@fnndsc/argus 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Settings-CKApE3sg.js → Settings-0BtPR8Wf.js} +1 -1
- package/dist/assets/{Texture-CFUfIEub.js → Texture-B-lj_eg9.js} +1 -1
- package/dist/assets/{addVolumesToViewports-CkTaWHv-.js → addVolumesToViewports-CGj99Yo7.js} +1 -1
- package/dist/assets/{cornerstoneEngine-CAd9z_EH.js → cornerstoneEngine-BIu8DPDK.js} +2 -2
- package/dist/assets/{index-DjJppD5u.js → index-BSxa_TT4.js} +1 -1
- package/dist/assets/{index-C9XrSjdk.js → index-BjMVTIAp.js} +1 -1
- package/dist/assets/{index-DSCJS0dw.js → index-BlbwwKJU.js} +1 -1
- package/dist/assets/{index-BFg_Vgc2.js → index-CLBcMXje.js} +1 -1
- package/dist/assets/{index-DfT-vEKx.js → index-D3RLyWos.js} +207 -207
- package/dist/assets/{index-Bk-4Cj4d.js → index-Dl6u9QLH.js} +1 -1
- package/dist/assets/{index-BwXaD9bz.js → index-eDvpvfGy.js} +1 -1
- package/dist/assets/{layoutWorker-S-M8lwVB.js → layoutWorker-CfJVM55D.js} +1 -1
- package/dist/assets/{niivueEngine-B8EopR_P.js → niivueEngine-DswitPEw.js} +2 -2
- package/dist/assets/{slabScene-BbagJ9Kt.js → slabScene-CjreQf7z.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{m as N,D as ne,k as ge,l as H5,o as Or,p as Yr,q as Pl,u as h0,v as Xo,w as j5,x as ue,y as K5,z as q5,A as X5,C as Y5,E as wt,F as oa,i as lt,G as Z5,H as Rl,j as rt,J as et,M as pe,P as Yt,I as Jg,K as Oe,L as Ye,N as gt,O as Zr,Q as qn,t as Ee,R as Tt,S as hn,T as Dc,V as me,U as Vl,W as Jn,X as J5,Y as uf,Z as Yo,_ as Q5,$ as Qg,a0 as Un,a1 as Zo,a2 as sa,a3 as e3,a4 as t3,a5 as ep,a6 as tp,a7 as n3,a8 as ri,B as Ze,a9 as r3,e as ln,aa as Pc,ab as a3,ac as qa,ad as i3,ae as Rc,af as o3,ag as s3,ah as La,ai as c3,aj as l3,ak as Vc,al as np,n as ff,am as u3,s as _a,an as f3,ao as Jo,ap as ao,aq as d3,ar as g3}from"./cornerstoneEngine-CAd9z_EH.js";import{i as p3,j as h3,C as mn,P as Li,k as m3,H as xn,F as rp,V as ap,l as mt,m as ip,I as op,a as El,r as je,n as De,S as L,o as ma,p as sp,q as Ce,s as Pn,u as K,W as Qo,v as v3,w as C3,b as ze,c as ai,B as No,x as m0,O as y3,y as x3,z as ut,D as Ml,U as va,E as Al,t as v0,G as df,J as cp,K as ee,N as Ll,X as S3,Y as w3,Z as lp,_ as Fs,$ as T3,a0 as I3,a1 as C0,a2 as Bs,M as Zt,a3 as Nn,a4 as ks,a5 as pr,a6 as b3,a7 as up,a8 as O3,a9 as gf,aa as es,ab as D3,ac as P3,ad as R3,ae as V3,R as E3,af as _l,ag as M3,ah as fp,ai as A3,A as Xn,T as _i,d as ii,aj as L3,ak as pf,al as _3,g as U3}from"./Texture-CFUfIEub.js";import Gs,{constants as io,log as Ws}from"./dcmjs.es-DfWkgqfk.js";var B;(function(t){t.ERROR_EVENT="CORNERSTONE_ERROR",t.CACHE_SIZE_EXCEEDED="CACHE_SIZE_EXCEEDED",t.IMAGE_LOAD_ERROR="IMAGE_LOAD_ERROR",t.CAMERA_MODIFIED="CORNERSTONE_CAMERA_MODIFIED",t.CAMERA_RESET="CORNERSTONE_CAMERA_RESET",t.VOI_MODIFIED="CORNERSTONE_VOI_MODIFIED",t.PRESET_MODIFIED="CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED",t.DISPLAY_AREA_MODIFIED="CORNERSTONE_DISPLAY_AREA_MODIFIED",t.ELEMENT_DISABLED="CORNERSTONE_ELEMENT_DISABLED",t.ELEMENT_ENABLED="CORNERSTONE_ELEMENT_ENABLED",t.IMAGE_RENDERED="CORNERSTONE_IMAGE_RENDERED",t.IMAGE_VOLUME_MODIFIED="CORNERSTONE_IMAGE_VOLUME_MODIFIED",t.IMAGE_VOLUME_LOADING_COMPLETED="CORNERSTONE_IMAGE_VOLUME_LOADING_COMPLETED",t.IMAGE_LOADED="CORNERSTONE_IMAGE_LOADED",t.IMAGE_RETRIEVAL_STAGE="CORNERSTONE_IMAGE_RETRIEVAL_STAGE",t.IMAGE_LOAD_FAILED="CORNERSTONE_IMAGE_LOAD_FAILED",t.VOLUME_VIEWPORT_NEW_VOLUME="CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME",t.VOLUME_LOADED="CORNERSTONE_VOLUME_LOADED",t.VOLUME_LOADED_FAILED="CORNERSTONE_VOLUME_LOADED_FAILED",t.IMAGE_CACHE_IMAGE_ADDED="CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED",t.IMAGE_CACHE_IMAGE_REMOVED="CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED",t.VOLUME_CACHE_VOLUME_ADDED="CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED",t.VOLUME_CACHE_VOLUME_REMOVED="CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED",t.STACK_NEW_IMAGE="CORNERSTONE_STACK_NEW_IMAGE",t.VOLUME_NEW_IMAGE="CORNERSTONE_VOLUME_NEW_IMAGE",t.PRE_STACK_NEW_IMAGE="CORNERSTONE_PRE_STACK_NEW_IMAGE",t.IMAGE_SPACING_CALIBRATED="CORNERSTONE_IMAGE_SPACING_CALIBRATED",t.VIEWPORT_NEW_IMAGE_SET="CORNERSTONE_VIEWPORT_NEW_IMAGE_SET",t.STACK_VIEWPORT_SCROLL="CORNERSTONE_STACK_VIEWPORT_SCROLL",t.STACK_SCROLL_OUT_OF_BOUNDS="STACK_SCROLL_OUT_OF_BOUNDS",t.GEOMETRY_CACHE_GEOMETRY_ADDED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED",t.GEOMETRY_CACHE_GEOMETRY_REMOVED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_REMOVED",t.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS="VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS",t.VOLUME_VIEWPORT_SCROLL="VOLUME_VIEWPORT_SCROLL",t.CLIPPING_PLANES_UPDATED="CORNERSTONE_CLIPPING_PLANES_UPDATED",t.WEB_WORKER_PROGRESS="CORNERSTONE_WEB_WORKER_PROGRESS",t.COLORMAP_MODIFIED="CORNERSTONE_COLORMAP_MODIFIED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED="DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED",t.DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED="DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED="DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED",t.DYNAMIC_VOLUME_TIME_POINT_LOADED="DYNAMIC_VOLUME_TIME_POINT_LOADED",t.GEOMETRY_LOADED="GEOMETRY_LOADED",t.GEOMETRY_LOAD_PROGRESS="GEOMETRY_LOAD_PROGRESS",t.GEOMETRY_LOADED_FAILED="GEOMETRY_LOADED_FAILED",t.ACTORS_CHANGED="CORNERSTONE_ACTORS_CHANGED",t.RENDER_BACKEND_CHANGED="CORNERSTONE_RENDER_BACKEND_CHANGED",t.WEBGL_CONTEXT_LOST="CORNERSTONE_WEBGL_CONTEXT_LOST",t.WEBGL_CONTEXT_RESTORED="CORNERSTONE_WEBGL_CONTEXT_RESTORED",t.RENDER_PATH_ERROR="CORNERSTONE_RENDER_PATH_ERROR",t.RENDERING_PIPELINE_CHANGED="CORNERSTONE_RENDERING_PIPELINE_CHANGED"})(B||(B={}));var ce;(function(t){t.Interaction="interaction",t.Thumbnail="thumbnail",t.Prefetch="prefetch",t.Compute="compute"})(ce||(ce={}));var z;(function(t){t.STACK="stack",t.ORTHOGRAPHIC="orthographic",t.PERSPECTIVE="perspective",t.VOLUME_3D="volume3d",t.VOLUME_3D_NEXT="volume3dNext",t.PLANAR_NEXT="planarNext",t.VIDEO="video",t.VIDEO_NEXT="videoNext",t.WHOLE_SLIDE="wholeSlide",t.WHOLE_SLIDE_NEXT="wholeSlideNext",t.ECG="ecg",t.ECG_NEXT="ecgNext"})(z||(z={}));const N3={STACK:z.STACK,ORTHOGRAPHIC:z.ORTHOGRAPHIC,PERSPECTIVE:z.PERSPECTIVE,VOLUME_3D:z.VOLUME_3D,VOLUME_3D_NEXT:z.VOLUME_3D_NEXT,PLANAR_NEXT:z.PLANAR_NEXT,VIDEO:z.VIDEO,VIDEO_NEXT:z.VIDEO_NEXT,WHOLE_SLIDE:z.WHOLE_SLIDE,WHOLE_SLIDE_NEXT:z.WHOLE_SLIDE_NEXT,ECG:z.ECG,ECG_NEXT:z.ECG_NEXT},ts=N3;function F3(t,e){if(Object.prototype.hasOwnProperty.call(ts,t))throw new Error(`Viewport type constant "${String(t)}" already exists`);ts[t]=e}var be;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t[t.FAST_LINEAR=2]="FAST_LINEAR"})(be||(be={}));const{BlendMode:ba}=p3;var Lt;(function(t){t[t.COMPOSITE=ba.COMPOSITE_BLEND]="COMPOSITE",t[t.MAXIMUM_INTENSITY_BLEND=ba.MAXIMUM_INTENSITY_BLEND]="MAXIMUM_INTENSITY_BLEND",t[t.MINIMUM_INTENSITY_BLEND=ba.MINIMUM_INTENSITY_BLEND]="MINIMUM_INTENSITY_BLEND",t[t.AVERAGE_INTENSITY_BLEND=ba.AVERAGE_INTENSITY_BLEND]="AVERAGE_INTENSITY_BLEND",t[t.LABELMAP_EDGE_PROJECTION_BLEND=ba.LABELMAP_EDGE_PROJECTION_BLEND]="LABELMAP_EDGE_PROJECTION_BLEND"})(Lt||(Lt={}));var X;(function(t){t.AXIAL="axial",t.CORONAL="coronal",t.SAGITTAL="sagittal",t.ACQUISITION="acquisition",t.AXIAL_REFORMAT="axial_reformat",t.CORONAL_REFORMAT="coronal_reformat",t.SAGITTAL_REFORMAT="sagittal_reformat",t.REFORMAT="reformat"})(X||(X={}));var _t;(function(t){t.CONTOUR="CONTOUR",t.SURFACE="SURFACE",t.MESH="MESH"})(_t||(_t={}));var Ec;(function(t){t.CLOSED_PLANAR="CLOSED_PLANAR",t.OPEN_PLANAR="OPEN_PLANAR"})(Ec||(Ec={}));const B3=Ec;var Pt;(function(t){t.PLY="PLY",t.STL="STL",t.OBJ="OBJ",t.VTP="VTP"})(Pt||(Pt={}));var We;(function(t){t.LINEAR="LINEAR",t.SAMPLED_SIGMOID="SIGMOID",t.LINEAR_EXACT="LINEAR_EXACT"})(We||(We={}));var Mc;(function(t){t.SUM="SUM",t.AVERAGE="AVERAGE",t.SUBTRACT="SUBTRACT"})(Mc||(Mc={}));const k3=Mc;class dp{constructor(e){this.fullDate=e}getTimeInSec(){const e=this.fullDate.substring(0,10),n=this.fullDate.substring(11,28),r=parseInt(e.substring(0,4),10),a=e.length>=7?parseInt(e.substring(5,7),10):void 0,i=e.length>=10?parseInt(e.substring(8,10),10):void 0;if(isNaN(r)||a!==void 0&&isNaN(a)||i!==void 0&&isNaN(i)||r>3e3||a&&(a<1||a>12)||i&&(i<1||i>31))throw new Error(`invalid date '${e}'`);const o=new Date(`${e}T00:00:00.000000Z`),s=parseInt(n.substring(0,2),10),c=n.length>=5?parseInt(n.substring(3,5),10):void 0,l=n.length>=8?parseInt(n.substring(6,8),10):void 0,u=n.substring(9,15),f=u?parseInt(u,10)*Math.pow(10,-u.length):void 0;if(isNaN(s)||c!==void 0&&isNaN(c)||l!==void 0&&isNaN(l)||f!==void 0&&isNaN(f)||s<0||s>23||c&&(c<0||c>59)||l&&(l<0||l>59)||f&&(f<0||f>999999))throw new Error(`invalid time '${n}'`);let d=o.getTime()/1e3;return d+=s*3600,c!==void 0&&(d+=c*60),l!==void 0&&(d+=l),f!==void 0&&(d+=f),d}getTimeInMicroSec(){return this.getTimeInSec()*1e6}}function ns(t,e){const n=`${e.hours||"00"}`.padStart(2,"0"),r=`${e.minutes||"00"}`.padStart(2,"0"),a=`${e.seconds||"00"}`.padStart(2,"0"),i=`${t.month}`.padStart(2,"0"),o=`${t.day}`.padStart(2,"0"),s=`${e.fractionalSeconds||"000000"}`.padEnd(6,"0"),c=`${t.year}-${i}-${o}`,l=`T${n}:${r}:${a}.${s}Z`,u=`${c}${l}`;return new dp(u)}function G3(t,e){switch(t){case 2:return e%4===0&&e%100||e%400===0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}function W3(t,e,n){return isNaN(n)?!1:e>0&&e<=12&&t>0&&t<=G3(e,n)}function rs(t){if(t==null||t.length!==8||typeof t!="string")throw new Error(`invalid DA '${t}'`);const e=parseInt(t.substring(0,4),10),n=parseInt(t.substring(4,6),10),r=parseInt(t.substring(6,8),10);if(W3(r,n,e)!==!0)throw new Error(`invalid DA '${t}'`);return{year:e,month:n,day:r}}function as(t){if(t==null||t.length<2||typeof t!="string")throw new Error(`invalid TM '${t}'`);const e=parseInt(t.substring(0,2),10),n=t.length>=4?parseInt(t.substring(2,4),10):void 0,r=t.length>=6?parseInt(t.substring(4,6),10):void 0,a=t.length>=8?t.substring(7,13):void 0,i=a?parseInt(a,10)*Math.pow(10,6-a.length):void 0;if(isNaN(e)||n!==void 0&&isNaN(n)||r!==void 0&&isNaN(r)||i!==void 0&&isNaN(i)||e<0||e>23||n&&(n<0||n>59)||r&&(r<0||r>59)||i&&(i<0||i>999999))throw new Error(`invalid TM '${t}'`);return{hours:e,minutes:n,seconds:r,fractionalSeconds:i}}function gp(t){if(t==null)throw new Error("dateTimeToFullDateInterface : dateTime not defined.");const e=rs(t.substring(0,8)),n=as(t.substring(8));return ns(e,n)}function z3(t){const{SeriesDate:e,SeriesTime:n,GEPrivatePostInjectionDateTime:r}=t[0],a=new Array(t.length),i=rs(e),o=as(n),s=ns(i,o);let c=new dp("3000-01-01T00:00:00.000000Z"),l=c.getTimeInSec();if(t.forEach(u=>{const{AcquisitionDate:f,AcquisitionTime:d}=u,g=rs(f),p=as(d),h=ns(g,p);c.getTimeInSec()>=l?c=h:c=h.getTimeInSec()<c.getTimeInSec()?h:c}),c.getTimeInSec()>=l)throw new Error("Earliest acquisition time or date could not be parsed.");return s.getTimeInSec()<=c.getTimeInSec()?a.fill(s):r?a.fill(gp(r)):a.fill(c)}function $3(t){const{PatientSex:e,PatientWeight:n,PatientSize:r}=t;let a;const i=n*n/(r*r*1e4);if(e==="F")a=1.07*n-148*i;else if(e==="M")a=1.1*n-120*i;else throw new Error(`PatientSex is an invalid value: ${e}`);return a*1e3}function H3(t){const{PatientWeight:e,PatientSize:n}=t;return Math.pow(e,.425)*Math.pow(n*100,.725)*71.84}function j3(t){const{RadiopharmaceuticalStartDateTime:e,RadiopharmaceuticalStartTime:n,SeriesDate:r}=t;let a,i;if(e)return gp(e);if(n&&r)return a=as(n),i=rs(r),ns(i,a);throw new Error(`Invalid input: ${t}`)}function K3(t){const{RadionuclideTotalDose:e,RadionuclideHalfLife:n,RadiopharmaceuticalStartDateTime:r,RadiopharmaceuticalStartTime:a,SeriesDate:i}=t[0];if(e==null)throw new Error("calculateDecayCorrection : RadionuclideTotalDose value not found.");if(n==null)throw new Error("calculateDecayCorrection : RadionuclideHalfLife value not found.");const o=z3(t),s=j3({RadiopharmaceuticalStartDateTime:r,RadiopharmaceuticalStartTime:a,SeriesDate:i});return t.map((c,l)=>{const f=o[l].getTimeInSec()-s.getTimeInSec();if(f<0)throw new Error("Decay time cannot be less than zero");return 1/(e*Math.pow(2,-f/n))})}const q3=(t,e)=>t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,r)=>n===e[r]);function X3(t){const{CorrectedImage:e,Units:n,PhilipsPETPrivateGroup:r,PatientWeight:a,PatientSex:i,PatientSize:o}=t[0];if(!e.includes("ATTN")||!e.includes("DECY"))throw new Error(`CorrectedImage must contain "ATTN" and "DECY": ${e}`);if(!t.every(g=>g.Units===n&&q3(g.CorrectedImage,e)&&g.PatientWeight===a&&g.PatientSex===i&&g.PatientSize===o&&g.RadionuclideHalfLife===t[0].RadionuclideHalfLife&&g.RadionuclideTotalDose===t[0].RadionuclideTotalDose&&g.DecayCorrection===t[0].DecayCorrection&&g.SeriesDate===t[0].SeriesDate&&g.SeriesTime===t[0].SeriesTime))throw new Error("The set of instances does not appear to come from one Series. Every instance must have identical values for series-level metadata properties");if(a==null)throw new Error("PatientWeight value is missing. It is not possible to calculate the SUV factors");let c=new Array(t.length);c=K3(t);let l=new Array(t.length);const u=a*1e3;if(n==="BQML")l=c.map(function(g){return g*u});else if(n==="CNTS"){const g=t.every(h=>{var m,v,C;return h.PhilipsPETPrivateGroup&&((m=h.PhilipsPETPrivateGroup)===null||m===void 0?void 0:m.SUVScaleFactor)!==null&&((v=h.PhilipsPETPrivateGroup)===null||v===void 0?void 0:v.SUVScaleFactor)!==void 0&&((C=h.PhilipsPETPrivateGroup)===null||C===void 0?void 0:C.SUVScaleFactor)!==0}),p=t.every(h=>{var m,v,C;return h.PhilipsPETPrivateGroup&&!((m=h.PhilipsPETPrivateGroup)!==null&&m!==void 0&&m.SUVScaleFactor)&&((v=h.PhilipsPETPrivateGroup)===null||v===void 0?void 0:v.ActivityConcentrationScaleFactor)!==void 0&&((C=h.PhilipsPETPrivateGroup)===null||C===void 0?void 0:C.ActivityConcentrationScaleFactor)!==0});if(g)l=t.map(h=>h.PhilipsPETPrivateGroup.SUVScaleFactor);else if(p)l=t.map((h,m)=>h.PhilipsPETPrivateGroup.ActivityConcentrationScaleFactor*c[m]*u);else throw new Error(`Units are in CNTS, but PhilipsPETPrivateGroup has invalid values: ${JSON.stringify(r)}`)}else if(n==="GML")l.fill(1);else throw new Error(`Units has an invalid value: ${n}`);let f;o==null?console.warn("PatientSize value is missing. It is not possible to calculate the SUV bsa factors"):f=H3({PatientWeight:a,PatientSize:o});let d;return o==null?console.warn("PatientSize value is missing. It is not possible to calculate the SUV lbm factors"):i==null?console.warn("PatientSex value is missing. It is not possible to calculate the SUV lbm factors"):d=$3({PatientWeight:a,PatientSex:i,PatientSize:o}),l.map(function(g,p){const h={suvbw:g};return f&&(h.suvbsa=c[p]*f),d&&(h.suvlbm=c[p]*d),h})}var un;(function(t){t.NOT_APPLICABLE="",t.ERMF="ERMF",t.USER="User",t.PROJECTION="Proj",t.REGION="Region",t.ERROR="Error",t.UNCALIBRATED="Uncalibrated",t.CALIBRATED="Calibrated",t.UNKNOWN="Unknown"})(un||(un={}));var q;(function(t){t.CALIBRATION="calibrationModule",t.CINE="cineModule",t.FRAME_OF_REFERENCE="frameOfReferenceModule",t.GENERAL_IMAGE="generalImageModule",t.GENERAL_SERIES="generalSeriesModule",t.GENERAL_STUDY="generalStudyModule",t.IMAGE_PIXEL="imagePixelModule",t.IMAGE_PLANE="imagePlaneModule",t.IMAGE_URL="imageUrlModule",t.MODALITY_LUT="modalityLutModule",t.MULTIFRAME="multiframeModule",t.NM_MULTIFRAME_GEOMETRY="nmMultiframeGeometryModule",t.OVERLAY_PLANE="overlayPlaneModule",t.PATIENT="patientModule",t.PATIENT_DEMOGRAPHIC="patientDemographicModule",t.PATIENT_STUDY="patientStudyModule",t.PET_IMAGE="petImageModule",t.PET_ISOTOPE="petIsotopeModule",t.PET_SERIES="petSeriesModule",t.SCALING="scalingModule",t.SOP_COMMON="sopCommonModule",t.ULTRASOUND_ENHANCED_REGION="ultrasoundEnhancedRegionModule",t.ECG="ecgModule",t.VOI_LUT="voiLutModule",t.TRANSFER_SYNTAX="transferSyntax",t.PLANE_ORIENTATION="PlaneOrientation",t.PLANE_POSITION="PlanePosition",t.PIXEL_MEASURES="PixelMeasures",t.XRAY_GEOMETRY="XrayGeometry",t.FRAME_PIXEL_DATA="FramePixelData",t.FRAME_MODULE="frameModule",t.URI_MODULE="uriModule",t.WADO_WEB_CLIENT="wadoWebClient",t.INSTANCE="instance",t.IMAGE_SOP_INSTANCE_REFERENCE="ImageSopInstanceReference",t.REFERENCED_SERIES_REFERENCE="ReferencedSeriesReference",t.PREDECESSOR_SEQUENCE="PredecessorSequence",t.STUDY_DATA="StudyData",t.SERIES_DATA="SeriesData",t.IMAGE_DATA="ImageData",t.RTSS_INSTANCE_DATA="RtssInstanceData",t.NEW_INSTANCE_DATA="NewInstanceData",t.RTSS_CONTOUR="metaRTSSContour",t.SEG_BIT="metaSegBitmap",t.SR_ANNOTATION="metaSrAnnotation",t.COMPRESSED_FRAME_DATA="compressedFrameData",t.BASE_IMAGE_ID="baseImageId",t.FRAME_IMAGE_IDS="frameImageIds",t.NATURALIZED="naturalized",t.DISPLAY_SET="displaySetModule"})(q||(q={}));const Y3="Add";function Ca(t){return`${t}${Y3}`}const ot={IMPLICIT_VR_LITTLE_ENDIAN:io.IMPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_LITTLE_ENDIAN:io.EXPLICIT_LITTLE_ENDIAN,DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN:io.DEFLATED_EXPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_BIG_ENDIAN:io.EXPLICIT_BIG_ENDIAN,MPEG2_MAIN_PROFILE_MAIN_LEVEL:"1.2.840.10008.1.2.4.100",MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.100.1",MPEG2_MAIN_PROFILE_HIGH_LEVEL:"1.2.840.10008.1.2.4.101",MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.101.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.102",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.102.1",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.103",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.103.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO:"1.2.840.10008.1.2.4.104",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.104.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO:"1.2.840.10008.1.2.4.105",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.105.1",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2:"1.2.840.10008.1.2.4.106",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE:"1.2.840.10008.1.2.4.106.1",HEVC_H265_MAIN_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.107",HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.108"},Jt=[],oi=new Map,Ul=new Map;function Z3(t,e=0){if(Jt.some(r=>r.provider===t))return;let n;for(n=0;n<Jt.length&&!(Jt[n].priority<=e);n++);Jt.splice(n,0,{priority:e,provider:t})}const J3=(t,e,n)=>n?.defaultValue;function Q3(t,e,n,r){const a={type:t,...r,provider:n};if(!e.find(o=>o.provider===n)){let o;const{priority:s=0}=r;for(o=0;o<e.length&&!(e[o].priority<=s);o++);e.splice(o,0,a)}let i=J3;for(let o=e.length-1;o>=0;o--){const s=e[o].provider;s&&(i=s.bind(null,i))}return i}function Re(t,e,n={priority:0,isDefault:!0}){if(!e)throw new Error(`addTypedProvider: cannot register undefined provider for type "${t}"`);let r=oi.get(t);if(r||(r=new Array,oi.set(t,r)),r.find(i=>i.provider===e))return;const a=Q3(t,r,e,n);if(!a)throw new Error(`newProvider is empty for ${t}`);Ul.set(t,a)}function si(t,e,n={priority:0,isDefault:!0}){Re(Ca(t),e,n)}function zs(t,e,n){const r=Ul.get(t);if(r)return r(e,null,n)}function e9(t){for(let e=0;e<Jt.length;e++)if(Jt[e].provider===t){Jt.splice(e,1);break}}function t9(){for(;Jt.length>0;)Jt.pop();oi.clear(),Ul.clear()}function Yn(t,e,n){if(e!==void 0)for(let r=0;r<Jt.length;r++){const a=Jt[r].provider(t,e,n);if(a!==void 0)return a}}function pp(t,e,n){return Yn(t,e,n)}function hp(t,e,n){return Yn(Ca(t),e,n)}function mp(t,e,n){return hp(t,e,n)}const is=(t,e)=>{const n=[t,Ca(t)];for(const r of n){const a=oi.get(r);if(a)for(const i of a)i?.clearQuery?.(e)}},Ua=t=>{const e=Array.from(new Set([t,Ca(t)]));for(const n of e){const r=oi.get(n);if(r)for(const a of r)a?.clear?.()}},vn=(t,...e)=>e.length===1?Yn(t,e[0]):e.map(n=>n&&Yn(t,n)).find(n=>n!==void 0);function n9(t,e,n=Yn){const r={};for(const a of e)try{const i=n(a,t);if(i){const o={};for(const s in i)if(s in i){const c=vp(s);o[c]=i[s]}Object.assign(r,o)}}catch(i){console.error(`Error retrieving ${a} data:`,i)}return r}const vp=t=>t.startsWith("sop")?`SOP${t.substring(3)}`:t.startsWith("voi")?`VOI${t.substring(3)}`:(t.endsWith("Id")&&(t=`${t.substring(0,t.length-2)}ID`),t.charAt(0).toUpperCase()+t.slice(1)),Nl=t=>t.startsWith("SOP")?`sop${t.substring(3)}`:t.startsWith("VOI")?`voi${t.substring(3)}`:(t.endsWith("ID")&&!t.endsWith("UID")&&(t=`${t.substring(0,t.length-2)}Id`),t.charAt(0).toLowerCase()+t.slice(1)),r9=Object.freeze(Object.defineProperty({__proto__:null,addAddProvider:si,addMetaData:hp,addProvider:Z3,addTyped:mp,addTypedProvider:Re,clear:Ua,clearQuery:is,get:vn,getMetaData:Yn,getNormalized:n9,getTyped:pp,metadataModuleProvider:zs,removeAllProviders:t9,removeProvider:e9,toLowerCamelTag:Nl,toUpperCamelTag:vp},Symbol.toStringTag,{value:"Module"}));function y0(t){return t instanceof ArrayBuffer?new Uint8Array(t):t}function Cp(t){if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return y0(t);if(!Array.isArray(t)||t.length===0)return;const e=t[0];if(e==null||!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))return;if(t.length===1)return y0(e);const n=t.filter(o=>o!=null&&(o instanceof ArrayBuffer||ArrayBuffer.isView(o)));if(n.length===0)return;const r=n.reduce((o,s)=>o+(s instanceof ArrayBuffer,s.byteLength),0),a=new Uint8Array(r);let i=0;for(const o of n){const s=y0(o);a.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),i),i+=s.byteLength}return a}function a9(t){return typeof t=="string"||typeof t=="number"||t instanceof String||t instanceof Number}function zr(t){if(t!==void 0){if(a9(t)){const e=Number(t);return Number.isFinite(e)?e:void 0}return Array.from(t,e=>{const n=Number(e);return Number.isFinite(n)?n:void 0})}}const yp=1e-5;function xp(t,e,n){return Math.abs(t-e)<=n}function i9(t,e,n=yp){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!xp(t[r],e[r],n))return!1;return!0}function hf(t){return typeof t=="number"}function mf(t){return t&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>0&&typeof t[0]=="number"}function ie(t,e,n=yp){return typeof t!=typeof e||t===null||e===null?!1:hf(t)&&hf(e)?xp(t,e,n):mf(t)&&mf(e)?i9(t,e,n):!1}const Sp=t=>typeof t=="number"?-t:t?.map?t.map(Sp):!t,Ac=t=>typeof t=="number"?Math.abs(t):t?.map?t.map(Ac):t,wp=(t,e,n=void 0)=>ie(t,Sp(e),n),Fo=(t,e,n=void 0)=>ie(Ac(t),Ac(e),n);function Tp(t){return Array.isArray(t)?Tp(t[0]):isFinite(t)&&!isNaN(t)}const Qn=$s("cs3d"),o9=Qn.getLogger("metadata"),s9=Qn.getLogger("core"),c9=Qn.getLogger("tools"),l9=Qn.getLogger("dicomImageLoader"),u9=Qn.getLogger("ai"),f9=Qn.getLogger("examples"),d9=Qn.getLogger("worker"),g9=Ws.getLogger("consistency.dicom"),p9=Ws.getLogger("consistency.image");function $s(t){const e=Ws.getLogger(t);return e.getLogger=(...n)=>$s(`${t}.${n.join(".")}`),e}function h9(...t){return $s(t.join("."))}const Ip=Object.freeze(Object.defineProperty({__proto__:null,aiLog:u9,coreLog:s9,cs3dLog:Qn,dicomConsistencyLog:g9,examplesLog:f9,getLogger:h9,getRootLogger:$s,imageConsistencyLog:p9,loaderLog:l9,log:Ws,metadataLog:o9,toolsLog:c9,workerLog:d9},Symbol.toStringTag,{value:"Module"})),bp=new Set([ot.MPEG2_MAIN_PROFILE_MAIN_LEVEL,ot.MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE,ot.MPEG2_MAIN_PROFILE_HIGH_LEVEL,ot.MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,ot.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1,ot.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE,ot.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2,ot.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE,ot.HEVC_H265_MAIN_PROFILE_LEVEL_5_1,ot.HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1]);function Fl(t){return t?(Array.isArray(t)?t:[t]).find(n=>bp.has(n)):!1}const vf=/^[a-zA-Z]+:/;function os(t){if(!t)return"";const e=t.match(vf);if(!e)return t;const n=t.substring(e[0].length);return vf.test(n)?n:t}const m9=new Set(["1.2.840.10008.5.1.4.1.1.1","1.2.840.10008.5.1.4.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.2","1.2.840.10008.5.1.4.1.1.1.2.1","1.2.840.10008.5.1.4.1.1.1.3","1.2.840.10008.5.1.4.1.1.1.3.1","1.2.840.10008.5.1.4.1.1.12.1","1.2.840.10008.5.1.4.1.1.12.1.1","1.2.840.10008.5.1.4.1.1.12.2","1.2.840.10008.5.1.4.1.1.12.2.1","1.2.840.10008.5.1.4.1.1.12.3"]);function Op(t){const{PixelSpacing:e,ImagerPixelSpacing:n,EstimatedRadiographicMagnificationFactor:r,DistanceSourceToDetector:a,DistanceSourceToEntrance:i,DistanceSourceToPatient:o=i}=t;if(r>1)return r;if(o<a)return a/o;if(n?.[0]>e?.[0])return!0}function Dp(t){const{PixelSpacing:e,ImagerPixelSpacing:n,PixelSpacingCalibrationType:r}=t,a=!0;if(e&&r==="GEOMETRY")return ie(e,n)&&console.warn("Calibration type is geometry, but pixel spacing and imager pixel spacing identical",e,n),{PixelSpacing:e,type:un.ERMF,isProjection:a};if(e&&r==="FIDUCIAL")return{PixelSpacing:e,type:un.CALIBRATED,isProjection:a};if(n){const i=Op(t);return i>1?{PixelSpacing:n.map(s=>s/i),type:un.ERMF,isProjection:a}:i===!0?{PixelSpacing:e,type:un.ERMF,isProjection:a}:(i&&console.error("Illegal ERMF value:",i),{PixelSpacing:e||n,type:un.PROJECTION,isProjection:a})}return{PixelSpacing:e,type:un.UNKNOWN,isProjection:a}}function Pp(t){const{PixelSpacing:e,SOPClassUID:n}=t;return m9.has(n)?Dp(t):{PixelSpacing:e,type:un.NOT_APPLICABLE,isProjection:!1}}const x0=new Map,Lc={add:(t,e)=>{const n=os(t);x0.set(n,e),is(q.IMAGE_PLANE,t)},get:(t,e)=>{if(t==="calibratedPixelSpacing"){const n=os(e);return x0.get(n)}},clear:()=>{x0.clear()}};function Bl(t,e,n=void 0,r=0){if(!t)return n;const a=t[e];if(a==null)return n;if(Array.isArray(a)){const i=a[r];return i??n}return r!==0?n:a}function Rp(t,e,n=void 0,r=0){const a=Bl(t,e,n,r);return a==null?n:String(a)}function lr(t,e,n=void 0,r=0){const a=Bl(t,e,n,r);if(a==null)return n;const i=Number(a);return Number.isFinite(i)?i:n}function Vp(t,e){const n=/\/frames\/\d+/,r=/([?&])frame=\d+/;if(n.test(t))return t.replace(n,`/frames/${e}`);if(r.test(t))return t.replace(r,(i,o)=>`${o}frame=${e}`);const a=t.includes("?")?"&":"?";return`${t}${a}frame=${e}`}function Ep(t){if(!t||t.length===0)return null;const e=t[0],n=vn("instance",e);if(!n)return null;const r=n.NumberOfFrames;if(!r||r<=1)return null;const a=n.TimeSlotVector;if(!a||!Array.isArray(a))return null;const i=n.SliceVector,o=n.NumberOfSlices;if(a.length!==r)return console.warn("TimeSlotVector length does not match NumberOfFrames:",a.length,"vs",r),null;if(i){if(!Array.isArray(i))return console.warn("SliceVector exists but is not an array. Expected length:",r),null;if(i.length!==r||i.some(d=>d===void 0))return console.warn("SliceVector exists but has invalid length or undefined entries. Expected length:",r,"Actual length:",i.length),null}const s=new Map;for(let d=0;d<r;d++){const g=a[d],p=i?.[d]??d;s.has(g)||s.set(g,[]),s.get(g).push({frameIndex:d,sliceIndex:p})}const l=Array.from(s.keys()).sort((d,g)=>d-g).map(d=>{const g=s.get(d);return g.sort((p,h)=>p.sliceIndex-h.sliceIndex),g.map(p=>Vp(e,p.frameIndex+1))}),u=o||l[0]?.length;return l.every(d=>d.length===u)||console.warn("Multiframe 4D split resulted in uneven time slot groups. Expected",u,"slices per time slot."),{imageIdGroups:l,splittingTag:"TimeSlotVector"}}function v9(t){if(!t||t.length===0||S0(t[0],"CardiacNumberOfImages")===void 0)return null;const n=new Map;for(const s of t){const c=vn("StackID",s),l=S0(s,"InStackPositionNumber"),u=S0(s,"TriggerTime");if(c===void 0||l===void 0||u===void 0)return null;const f=String(c);n.has(f)||n.set(f,new Map);const d=n.get(f);d.has(l)||d.set(l,[]),d.get(l).push({imageId:s,triggerTime:u})}const r=Array.from(n.keys()).sort((s,c)=>Number(s)-Number(c));if(r.length===0)return null;const a=[];let i;for(const s of r){const c=n.get(s),l=Array.from(c.keys()).sort((u,f)=>u-f);for(const u of l){const f=c.get(u);if(f.sort((d,g)=>d.triggerTime-g.triggerTime),i===void 0)i=f.length;else if(f.length!==i)return null}a.push({stackId:s,positions:l,framesByPosition:c})}if(!i)return null;const o=[];for(let s=0;s<i;s++){const c=[];for(const l of a)for(const u of l.positions){const f=l.framesByPosition.get(u);c.push(f[s].imageId)}o.push(c)}return{imageIdGroups:o,splittingTag:"CardiacTriggerTime"}}const C9=(t,e)=>t.reduce((n,r)=>((n[r[e]]=n[r[e]]||[]).push(r),n),{});function y9(t){const e=t.map(o=>{const{imagePositionPatient:s}=vn("imagePlaneModule",o)||{};return{imageId:o,imagePositionPatient:s}});if(!e.every(o=>o.imagePositionPatient))return null;const n=C9(e,"imagePositionPatient"),r=Object.keys(n),a=n[r[0]].length;return a===1||!r.every(o=>n[o].length===a)?null:n}function x9(t,e){const n={};let r=[];const a=Object.keys(t);for(let i=0;i<a.length;i++){const o=new Set,s=t[a[i]];for(let c=0;c<s.length;c++){const l=e(s[c].imageId)||0;if(n[l]=n[l]||[],n[l].push({imageId:s[c].imageId}),o.add(l),o.size-1<c)return}if(i==0)r=Array.from(o);else if(!I9(r,o))return}return n}function Nr(t,e){const n=vn(e,t);try{return parseFloat(n)}catch{return}}function S0(t,e){return zr(Nr(t,e))}function S9(t){const e=vn("20011003",t);try{const{InlineBinary:n}=e;if(n){const r=atob(n),a=new ArrayBuffer(r.length),i=new DataView(a);for(let o=0;o<r.length;o++)i.setUint8(o,r.charCodeAt(o));return new Float32Array(a)[0]}return parseFloat(e)}catch{return}}function w9(t){let e=vn("0019100c",t)||vn("0019100C",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n)),parseFloat(e)}catch{return}}function T9(t){let e=vn("00431039",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n).split("//")),parseFloat(e[0])%1e5}catch{return}}function I9(t,e){if(t.length!=e.size)return!1;for(let n=0;n<t.length;n++)if(!e.has(t[n]))return!1;return!0}function b9(t){const e=vn("petImageModule",t);return e?e.frameReferenceTime:0}function O9(t){const e=Ep(t);if(e)return e;const n=v9(t);if(n)return n;const r=y9(t);if(!r)return{imageIdGroups:[t],splittingTag:null};const a=["TemporalPositionIdentifier","DiffusionBValue","TriggerTime","EchoTime","EchoNumber","PhilipsPrivateBValue","SiemensPrivateBValue","GEPrivateBValue","PetFrameReferenceTime"],i=[o=>Nr(o,a[0]),o=>Nr(o,a[1]),o=>Nr(o,a[2]),o=>Nr(o,a[3]),o=>Nr(o,a[4]),S9,w9,T9,b9];for(let o=0;o<i.length;o++){const s=x9(r,i[o]);if(s)return{imageIdGroups:Object.keys(s).map(Number.parseFloat).sort((u,f)=>u-f).map(u=>s[u].map(f=>f.imageId)),splittingTag:a[o]}}return{imageIdGroups:[t],splittingTag:null}}const D9=["TransferSyntaxUID","AvailableTransferSyntaxUID"],P9=["FrameTime","RecommendedDisplayFrameRate"],R9=[["RadiopharmaceuticalInfo","00540016"]],V9=["RadiopharmaceuticalStartTime","RadiopharmaceuticalStopTime","RadionuclideTotalDose","RadionuclideHalfLife"],E9=["FrameReferenceTime","ActualFrameDuration"],M9=["CorrectedImage","Units","DecayCorrection"],A9=["PatientID","PatientName","PatientBirthDate","PatientBirthTime"],L9=["PatientAge","PatientSize","PatientSex","PatientWeight"],_9=["StudyInstanceUID","StudyDescription","StudyDate","StudyTime","AccessionNumber"],U9=["StudyInstanceUID","SeriesInstanceUID","Modality","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","AcquisitionDate","AcquisitionTime"],N9=["ClinicalTrialSponsorName","ClinicalTrialSiteID","ClinicalTrialSiteName","ClinicalTrialSubjectID"],F9=["SOPInstanceUID","SOPClassUID"],B9=["StudyInstanceUID","SeriesInstanceUID","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","Modality","SOPInstanceUID","SOPClassUID"],k9=["SOPInstanceUID","SOPClassUID","InstanceNumber","InstanceCreationDate","InstanceCreationTime","ContentTime","LossyImageCompression","LossyImageCompressionRatio","LossyImageCompressionMethod","FrameOfReferenceUID","NumberOfFrames","PixelSpacing"],G9=["ImagerPixelSpacing","ImageOrientationPatient","ImagePositionPatient","SpacingBetweenSlices","SliceThickness","SliceLocation"],W9=["SamplesPerPixel","PhotometricInterpretation","PlanarConfiguration","Rows","Columns","BitsAllocated","BitsStored","HighBit","PixelRepresentation",["SmallestPixelValue","00280106"],["LargestPixelValue","00280107"],"PixelPaddingValue","PixelPaddingRangeLimit","RedPaletteColorLookupTableDescriptor","GreenPaletteColorLookupTableDescriptor","BluePaletteColorLookupTableDescriptor","AlphaPaletteColorLookupTableDescriptor","RedPaletteColorLookupTableData","GreenPaletteColorLookupTableData","BluePaletteColorLookupTableData","AlphaPaletteColorLookupTableData","PaletteColorLookupTableUID","DistanceSourceToDetector","DistanceSourceToPatient","EstimatedRadiographicMagnificationFactor","DistanceSourceToEntrance","PixelSpacingCalibrationType","PixelSpacingCalibrationDescription","SequenceOfUltrasoundRegions"],z9=["WindowCenter","WindowWidth","VOILUTFunction","WindowCenterWidthExplanation"],$9=["RescaleIntercept","RescaleSlope","RescaleType"],H9=["SequenceOfUltrasoundRegions"],j9=["PhysicalDeltaX","PhysicalDeltaY","PhysicalUnitsXDirection","PhysicalUnitsYDirection","RegionLocationMinY0","RegionLocationMaxY1","RegionLocationMinX0","RegionLocationMaxX1","ReferencePixelX0","ReferencePixelY0",["ReferencePhysicalPixelValueY","0018602A"],["ReferencePhysicalPixelValueX","00186028"],"RegionSpatialFormat","RegionDataType","RegionFlags","TransducerFrequency"],K9=["ReferencedImageSequence","ReferencedSOPClassUID","ReferencedSOPInstanceUID","ReferencedFrameNumber","SharedFunctionalGroupsSequence","PerFrameFunctionalGroupsSequence","PlanePositionSequence","AnatomicRegionSequence","PlaneOrientationSequence","PixelMeasuresSequence","PixelValueTransformationSequence","ParametricMapFrameTypeSequence","RealWorldValueMappingSequence"],q9="usRegionChild",X9="clinicalTrialModule",Y9="RadiopharmaceuticalInfo",Z9=[[q.TRANSFER_SYNTAX,D9],[q.CINE,P9],[q.PET_ISOTOPE,R9],[Y9,V9],[q.PET_IMAGE,E9],[q.PET_SERIES,M9],[q.PATIENT,A9],[q.PATIENT_STUDY,L9],[q.GENERAL_STUDY,_9],[q.GENERAL_SERIES,U9],[X9,N9],[q.SOP_COMMON,F9],[q.ECG,B9],[q.GENERAL_IMAGE,k9],[q.IMAGE_PLANE,G9],[q.IMAGE_PIXEL,W9],[q.VOI_LUT,z9],[q.MODALITY_LUT,$9],[q.ULTRASOUND_ENHANCED_REGION,H9],[q9,j9],[null,K9]],Mp=Gs.data.DicomMetaDictionary.dictionary,J9=Gs.data.DicomMetaDictionary.nameMap;function Q9(t,...e){return{tag:t,groups:e,xTag:null,primaryGroup:null,name:null,lowerName:null,vr:null,vm:null}}function Ap(t){if(t==null)return null;if(typeof t=="number")return t;const e=parseInt(t,10);return String(e)===t?e:0}function Lp(t){return Mp[t.toUpperCase()]}const ci=new Map,Xa=new Map;function e4(t,e){if(t&&e.name&&t!==e.name)throw new Error(`Tag name provided and value don't match: ${t} !== ${e.name}`);e.name||=t,e.lowerName||=Nl(t);const{tag:n}=e;e.primaryGroup||=e.groups?.[0];const{groups:r}=e;if(Xa.set(t,e),n&&(e.xTag=`x${n.toLowerCase()}`,e.tag=n.toUpperCase(),Xa.set(e.xTag,e),Xa.set(e.tag,e),!e.vr)){const a=Mp[e.tag];a&&(e.vr=a.vr,e.vm=Ap(a.vm))}if(r?.length)for(const a of r){let i=ci.get(a);if(!i){i=[e],ci.set(a,i);return}const o=i.findIndex(s=>s.name===t);o===-1?i.push(e):i[o]=e}}function t4(t){const e=J9[t];if(e)return e.tag.substring(1,5)+e.tag.substring(6,10)}const _c=new Map;for(const[t,e]of Z9)for(const n of e){const r=typeof n=="string"?n:n[0],a=typeof n=="string"?void 0:n[1];let i=_c.get(r);i||(i={hex:a??t4(r),groups:[]},_c.set(r,i)),t!==null&&i.groups.push(t)}for(const[t,{hex:e,groups:n}]of _c){if(!e){console.warn(`Tags: keyword "${t}" not found in dcmjs nameMap`);continue}e4(t,Q9(e,...n))}class n4{constructor(e){this.metadata=e}syncIterator(e,n=this.metadata){for(const[r,a]of Object.entries(n)){if(r==="_vrMap"||a===void 0)continue;if(a===null){e.addTag(r,{length:0}),e.pop();continue}const i=a.vr,o=Xa.get(r),s=o?void 0:Lp(r),c=!a.Value&&(a.BulkDataURI??a.InlineBinary);if(!(!a.Value&&!c)){if(e.addTag(r,{vr:i,name:o?.name||s?.name,vm:o?.vm??s?.vm}),i==="SQ"){for(const l of a.Value)e.startObject(),this.syncIterator(e,l),e.pop();e.pop();continue}if(c){e.value({BulkDataURI:a.BulkDataURI,InlineBinary:a.InlineBinary}),e.pop();continue}a.vr==="CS"&&a.Value.length===1&&String(a.Value[0]).indexOf("\\")!==-1&&(a.Value=String(a.Value[0]).split("\\"));for(const l of a.Value)e.value(l);e.pop()}}}}function Uc(t){return t==null||typeof t!="object"||Array.isArray(t)||(Object.defineProperty(t,"length",{value:1,configurable:!0}),Object.defineProperty(t,0,{value:t,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(t,Symbol.iterator,{value:function*(){yield this},configurable:!0})),t}const{DicomMetadataListener:r4}=Gs.utilities;function a4(t,e,n){if(t&&t.vm!==void 0&&t.vm!==null)return t.vm===1;const r=n?.vm??e?.vm;if(r!=null){const a=Ap(r);if(a!==null)return a===1}return null}function i4(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?!0:Array.isArray(e)?t.every(n=>Array.isArray(n)&&n.every(r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r))):!1}const o4="name";class Hs{constructor(e){}static createMetadataListener(e){return new r4({},new Hs(e))}addTag(e,n,r){const a=Xa.get(n),i=a?void 0:Lp(n),o=r?.name||a?.[o4]||i?.name||n,s=a4(a,i,r);e(n,r),this.current.natural={name:o,singleVm:s,tag:n}}pop(e){const n=this,r=n.current?.natural,a=n.current?.parent;if(!r||!a?.dest)return e();const i=e(),o=a,s=o.dest[r.tag];if(s===void 0)return i;let c=s.Value??s;if(Array.isArray(c)&&c.length===1&&c[0]===void 0&&(c=[]),i4(c))return o.dest[r.name]=c,r.name!==r.tag&&delete o.dest[r.tag],i;if(r.singleVm===!0&&Array.isArray(c)&&c.length===1){const l=c[0];return typeof l=="object"&&l!==null&&!(l instanceof ArrayBuffer)&&!ArrayBuffer.isView(l)?o.dest[r.name]=Uc(l):o.dest[r.name]=l,r.name!==r.tag&&delete o.dest[r.tag],i}return r.singleVm===null&&Array.isArray(c)&&c.length===1&&typeof c[0]=="object"&&c[0]!==null&&!(c[0]instanceof ArrayBuffer)&&!ArrayBuffer.isView(c[0])?o.dest[r.name]=Uc(c[0]):o.dest[r.name]=c,r.name!==r.tag&&delete o.dest[r.tag],i}}const{metadataLog:_p}=Ip;function Up(t){return Array.isArray(t)&&t||typeof t=="string"&&t.split("\\")||t}const Np=(t,e,n,r)=>{if(!n)return t(e,n,r);const{ImageOrientationPatient:a,ImagePositionPatient:i}=n,{PixelSpacing:o,type:s}=Pp(n);let c,l,u,f,d=!1,g=!1,p=!1,h;o?([c,l]=o,Lc.get("calibratedPixelSpacing",e)||Lc.add(e,{rowPixelSpacing:parseFloat(o[0]),columnPixelSpacing:parseFloat(o[1]),type:s})):(c=l=1,d=!0),a?(h=zr(a)||[1,0,0,0,1,0],u=h.slice(0,3),f=h.slice(3,6)):(u=[1,0,0],f=[0,1,0],h=[1,0,0,0,1,0],d=!0,g=!0,p=!0);const m=zr(i)||[0,0,0];i||(d=!0);const v=zr(c)??null,C=zr(l)??null,y=v!==null&&C!==null?[v,C]:Array.isArray(o)?o.map(S=>Number(S)).filter(Number.isFinite):[],x={frameOfReferenceUID:n.FrameOfReferenceUID,rows:lr(n,"Rows",0),columns:lr(n,"Columns",0),imageOrientationPatient:h,rowCosines:u,columnCosines:f,imagePositionPatient:m,sliceLocation:lr(n,"SliceLocation",0),pixelSpacing:y,rowPixelSpacing:v,sliceThickness:lr(n,"SliceThickness"),spacingBetweenSlices:lr(n,"SpacingBetweenSlices"),columnPixelSpacing:C};return Object.defineProperty(x,"usingDefaultValues",{value:d}),Object.defineProperty(x,"isDefaultValueSetForRowCosine",{value:g}),Object.defineProperty(x,"isDefaultValueSetForColumnCosine",{value:p}),x};function s4(){Re(q.IMAGE_PLANE,Np)}const hr=q.FRAME_IMAGE_IDS,Hn=q.BASE_IMAGE_ID,c4=9e3,l4=8e3,u4=9e3;function f4(t,e){return e}function d4(t,e,n,r){return(t(e,n,r)??e).replace(/\/frames\/\d+(?=(\?|#|$))/i,"")}function g4(t,e,n,r){return(t(e,n,r)??e).replace(/([?&])frame=\d+(&?)/i,(i,o,s)=>o==="?"&&s?"?":"").replace(/\?$/,"").replace(/\?&/,"?").replace(/&&+/g,"&")}function p4(t){return!!Rp(t,"PhotometricInterpretation")}function h4(t,e){const n=t.includes("?")?"&":"?";return`${t}${n}frame=${e}`}function m4(t,e){const n=/\/instances\/[^/]+/i.exec(t);if(!n)return;const r=n.index+n[0].length;return`${t.slice(0,r)}/frames/${e}${t.slice(r)}`}function Fp(t,e){if(!e)return;if(!p4(e))return new Set([t]);const n=new Set,r=Math.floor(lr(e,"NumberOfFrames",1));if(!(!Number.isFinite(r)||r<1)){for(let a=1;a<=r;a++){const i=m4(t,a);if(i){n.add(i);continue}n.add(h4(t,a))}return n}}function v4(t,e,n,r){const a=zs(q.NATURALIZED,e,r);return Fp(e,a)||t(e,n,r)}function Nc(t,e,n,r){const a=pp(q.BASE_IMAGE_ID,e,r);return t(a,n,r)}function C4(){Re(Hn,f4,{priority:0}),Re(Hn,d4,{priority:c4}),Re(Hn,g4,{priority:l4}),Re(hr,v4,{priority:u4})}class Qe{static setCacheDataInternal(e,n,r){let a=this.mapCacheData.get(e);a||(a=new Map,this.mapCacheData.set(e,a)),a.set(n,r),this.clearRelatedDerivedCache(e,n)}static clearRelatedDerivedCache(e,n){const r=this.secondaryTypesByBaseType.get(e);if(!r?.size)return;const a=Yn(hr,n)??new Set([n]);for(const i of a)for(const o of r)this.mapCacheData.get(o)?.delete(i)}static registerSecondaryTypes(e,n){if(!n)return;const r=Array.isArray(n)?n:[n];for(const a of r){let i=this.secondaryTypesByBaseType.get(a);i||(i=new Set,this.secondaryTypesByBaseType.set(a,i)),i.add(e)}}static getCacheData(e,n){return this.mapCacheData.get(e)?.get(n)}static hasCacheData(e,n){return this.mapCacheData.get(e)?.has(n)===!0}static clearCacheData(){this.mapCacheData.clear(),this.secondaryTypesByBaseType.clear(),Ua(hr),Ua(Hn)}static clearTypedCacheData(e,n){const r=this.secondaryTypesByBaseType.get(e),a=this.mapCacheData.get(e);if(n){if(a?.delete(n),r?.size)for(const i of r)this.mapCacheData.get(i)?.delete(n);(e===q.NATURALIZED||r?.size)&&(is(hr,n),is(Hn,n));return}if(a?.clear(),r?.size)for(const i of r)this.mapCacheData.get(i)?.clear();(e===q.NATURALIZED||r?.size)&&(Ua(hr),Ua(Hn))}static fromAsyncLookup(e,n,r,a){if(a?.noCache!==!0&&a?.reCache!==!0){const o=this.getCacheData(e,n);if(o!==void 0)return o}const i=r();if(i!==void 0)return i instanceof Promise?i.then(o=>(o!==void 0&&!a?.noCache&&this.setCacheDataInternal(e,n,o),o)):(a?.noCache||this.setCacheDataInternal(e,n,i),i)}createTypeCacheProvider(e){return kl(e)}clearCacheData(){Qe.clearCacheData()}clearTypedCacheData(e,n){Qe.clearTypedCacheData(e,n)}getCacheData(e,n){return Qe.getCacheData(e,n)}hasCacheData(e,n){return Qe.hasCacheData(e,n)}fromAsyncLookup(e,n,r,a){return Qe.fromAsyncLookup(e,n,r,a)}}Qe.mapCacheData=new Map;Qe.secondaryTypesByBaseType=new Map;class Jr extends Qe{static setCacheData(e,n,r){this.setCacheDataInternal(e,n,r)}setCacheData(e,n,r){Jr.setCacheData(e,n,r)}}function kl(t){return(e,n,r,a)=>Qe.fromAsyncLookup(t,n,()=>e(n,r,a),a)}function Bp(t){const e=Ca(t);return(n,r,a,i)=>{const o=Qe.getCacheData(t,r);if(o!==void 0)return console.warn(`Metadata add skipped for "${t}" at query "${r}" because cache already has a value.`),o;const s=Qe.getCacheData(e,r);if(s!==void 0)return s;const c=n(r,a,i);if(c===void 0)return;if(!(c instanceof Promise))return Jr.setCacheData(t,r,c),c;const l=c.then(u=>(u!==void 0&&Jr.setCacheData(t,r,u),u)).finally(()=>{Qe.clearTypedCacheData(e,r)});return Jr.setCacheData(e,r,l),l}}function y4(){Qe.clearCacheData()}function li(t,e){Qe.clearTypedCacheData(t,e)}function On(t,e){const{secondaryOf:n,...r}=e??{};Qe.registerSecondaryTypes(t,n),Re(t,kl(t),{priority:5e4,clear:li.bind(null,t),clearQuery:li.bind(null,t),...r})}function Gl(t,e){const n=Ca(t),{secondaryOf:r,...a}={};On(t,{secondaryOf:r,...a}),Qe.registerSecondaryTypes(n,t),si(t,Bp(t),{priority:5e4,clear:li.bind(null,n),clearQuery:li.bind(null,n),...a})}function x4(){On(Hn),On(hr),Gl(q.NATURALIZED),On(q.INSTANCE,{secondaryOf:q.NATURALIZED}),On(q.URI_MODULE,{secondaryOf:q.NATURALIZED}),On(q.IMAGE_PLANE,{secondaryOf:q.NATURALIZED}),On(q.FRAME_MODULE,{secondaryOf:q.NATURALIZED}),On(q.GENERAL_IMAGE,{secondaryOf:q.NATURALIZED})}function Ui(t){return(e,n,r,a)=>(r||=zs(t,n,a?.[t]),e(n,r,a))}const ui=Ui(q.INSTANCE),Fc=Ui(q.NATURALIZED),ur={priority:5e3};function S4(){Re(q.INSTANCE,Ui(q.NATURALIZED),ur),Re(q.IMAGE_PLANE,ui,ur),Re(q.CALIBRATION,ui,ur),Re(q.COMPRESSED_FRAME_DATA,Fc,ur),Re(q.SCALING,Fc,ur)}const{AsyncDicomReader:w4}=Gs.async,Cf=6e4,T4=3e4;function I4(t){return t instanceof ArrayBuffer?t:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}async function b4(t){const e=typeof t=="function"?await t():t;if(!(e instanceof ArrayBuffer)&&!(e instanceof Uint8Array))throw new Error("part10 must resolve to ArrayBuffer or Uint8Array");return I4(e)}function kp(t){const e=new n4(t),n=Hs.createMetadataListener();return n.startObject(),e.syncIterator(n),n.pop()}async function Gp(t){const e=await b4(t),n=new w4,r=Hs.createMetadataListener();n.stream.addBuffer(e),n.stream.setComplete(),await n.readFile({listener:r});const a=n.dict,i=n.syntax;return i&&(a.TransferSyntaxUID=Array.isArray(i)?i[0]:i),a}function O4(t,e,n,r){const a=r?.dicomwebJson??r?.metadata;if(a&&typeof a=="object")return kp(a);const i=r?.part10Buffer??r?.part10;return i?Gp(i):t(e,n,r)}function D4(){Re(q.NATURALIZED,Nc,{priority:Cf}),si(q.NATURALIZED,Nc,{priority:Cf}),si(q.NATURALIZED,O4,{priority:T4})}const P4=_p.getLogger("tagModules"),Fr=new Map;function R4(){Fr.clear()}function Wp(t,e="instance"){if(!ci.has(t))throw new Error(`No module found: ${t}`);if(Fr.has(t))return Fr.get(t);e==="instance"?Re(t,ui,{priority:25e3}):e&&Re(t,Ui(e),{priority:25e3});const n=(r,a,i,o)=>{const s=ci.get(t),c=o?.destName||"lowerName";if(!i)return r(a,i,o);const l={};for(const u of s){let f=i[u.name];if(f!==void 0){if(Fr.has(u.name)){P4.debug("Getting nested module",u.name);const d=[];for(const g of f)g&&d.push(Fr.get(u.name)(null,a,g,o?.[u.name]));f=d.length===1?Uc(d[0]):d}l[u[c]]=f}}return l};return Fr.set(t,n),n}const zp={priority:-1e3};function V4(){for(const t of ci.keys()){const e=Wp(t);e&&Re(t,e,zp),Re(t,ui,ur)}}const $p=(t,e,n,r)=>zs(q.NATURALIZED,e,r)||t(e,n,r);function E4(){Re(q.INSTANCE,$p)}function Hp(t,e,n,r){if(!n)return t(e,n,r);if(!n.SequenceOfUltrasoundRegions?.length)return;const{SequenceOfUltrasoundRegions:a}=n,i=[];for(const o of a){const s={};i.push(s);for(const[c,l]of Object.entries(o))s[Nl(c)]=l}return{sequenceOfUltrasoundRegions:i}}function M4(){Re(q.CALIBRATION,Hp)}var Bc=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Na(){var t=new Bc(3);return Bc!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function oo(t,e,n){var r=new Bc(3);return r[0]=t,r[1]=e,r[2]=n,r}function yf(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function xf(t,e,n){var r=e[0],a=e[1],i=e[2],o=n[0],s=n[1],c=n[2];return t[0]=a*c-i*s,t[1]=i*o-r*c,t[2]=r*s-a*o,t}(function(){var t=Na();return function(e,n,r,a,i,o){var s,c;for(n||(n=3),r||(r=0),a?c=Math.min(a*n+r,e.length):c=e.length,s=r;s<c;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],i(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}})();const jp=(t,e)=>{const{PerFrameFunctionalGroupsSequence:n,SharedFunctionalGroupsSequence:r,NumberOfFrames:a,ImageType:i}=e;if(a<2)return e;e.ImageType=Up(i);const o=Number.parseInt(t||1),s=e.DetectorInformationSequence&&(!e.ImagePositionPatient||!e.ImageOrientationPatient);if(n&&r||s){!e.ImageOrientationPatient&&e.DetectorInformationSequence&&(e.ImageOrientationPatient=e.DetectorInformationSequence[0].ImageOrientationPatient);const c=e.ImagePositionPatient;let l;if(!e.ImagePositionPatient&&e.DetectorInformationSequence){let d=e.DetectorInformationSequence[0].ImagePositionPatient,g=e.ImageOrientationPatient;d=d?.map(h=>Number(h)),g=g?.map(h=>Number(h));const p=Number(e.SpacingBetweenSlices);if(g&&p){const h=oo(g[0],g[1],g[2]),m=oo(g[3],g[4],g[5]),v=xf(Na(),h,m),C=yf(Na(),d,v,p*(o-1));l=[C[0],C[1],C[2]]}}e._parentInstance||Object.defineProperty(e,"_parentInstance",{value:{...e}});const u=Fa(e._parentInstance,r?.[0],"_shared"),f=Fa(u,n?.[o-1],o);return l?f.ImagePositionPatient=l:!f.ImagePositionPatient&&c?f.ImagePositionPatient=c:f.ImagePositionPatient||(f.ImagePositionPatient=[0,0,o]),Object.defineProperty(f,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),f}if(e.GridFrameOffsetVector){e._parentInstance||Object.defineProperty(e,"_parentInstance",{value:{...e}});const c=Fa(e._parentInstance,r?.[0],"_shared"),l=Fa(c,n?.[o-1],o),u=l.ImagePositionPatient?.map(Number),f=l.ImageOrientationPatient?.map(Number),d=e.GridFrameOffsetVector,g=Number(d[0]),p=Number(d[o-1]);if(u&&f&&!Number.isNaN(p)){const h=ie(f[0],1)&&ie(f[1],0)&&ie(f[2],0)&&ie(f[3],0)&&ie(f[4],1)&&ie(f[5],0),m=ie(g,0);if(h&&ie(g,u[2]))l.ImagePositionPatient=[u[0],u[1],p];else if(m){const C=oo(f[0],f[1],f[2]),y=oo(f[3],f[4],f[5]),x=xf(Na(),C,y),S=yf(Na(),u,x,p);l.ImagePositionPatient=[S[0],S[1],S[2]]}}return Object.defineProperty(l,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),l}return e};function Fa(t,e,n){if(t[n])return t[n];const r=Object.create(t);return Object.defineProperty(t,n,{value:r,writable:!1,enumerable:!1}),e&&[...e?Object.values(e).filter(Boolean).map(i=>i[0]).filter(i=>typeof i=="object"):[]].forEach(i=>{i.SOPInstanceUID||Object.entries(i).forEach(([o,s])=>{r[o]=s})}),r}const Kp=(t,e,n,r)=>{if(!n)return t(e,n,r);if(!n.NumberOfFrames)return n;const a=Yn(q.URI_MODULE,e,r?.frameModule),{frameNumber:i=1}=a||{};return jp(i,n)};function A4(){Re(q.INSTANCE,Kp)}const qp=/(\/frames\/|[&?]frameNumber=|[&?]frame=)([^/&?]*)(.*)/i;function Xp(t){const e=t.match(qp);if(!e)return;const n=t.substring(0,e.index),r=e[2],a=parseFloat(r),i=e[3];return{baseImageId:n,frameNumber:a,framesString:r,remaining:i}}function Yp(t,e,n,r){return Xp(e)||t(e,n,r)}function L4(){Re(q.URI_MODULE,Yp)}function _4(t){if(t instanceof ArrayBuffer){const r=t.byteLength;return{view:r<=256?new Uint8Array(t):new Uint16Array(t),byteLength:r}}if(ArrayBuffer.isView(t)){const r=t;return{view:r,byteLength:r.byteLength}}if(Array.isArray(t)){const r=Cp(t);if(r)return{view:r,byteLength:r.byteLength}}if(t!=null&&typeof t=="object"&&"InlineBinary"in t&&typeof t.InlineBinary=="string"){const r=t.InlineBinary,a=atob(r),i=new Uint8Array(a.length);for(let o=0;o<a.length;o++)i[o]=a.charCodeAt(o);return{view:i,byteLength:i.byteLength}}const n=U4(t);throw new Error("Palette color lookup table data could not be normalized: expected ArrayBuffer, ArrayBufferView, or object with InlineBinary string. "+n)}function w0(t,e,n){e[0]||=65536;const r=e[0];e[2];const{view:a,byteLength:i}=_4(t);if(![r,r*2].includes(i)){const c=i===r?a.length:Math.floor(i/2);throw new Error(`Palette color lookup table length mismatch (${n}): descriptor has ${r} entries (expected byteLength ${r} or ${r*2}), but got ${i} bytes (${c} effective entries). This may indicate duplicated or concatenated buffer data from the natural filter.`)}return r===i?a instanceof Uint8Array?a:new Uint8Array(a):a instanceof Uint16Array?a:new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2)}function U4(t){if(t===null)return"Got null.";if(t===void 0)return"Got undefined.";if(typeof t!="object")return`Got primitive: ${typeof t}.`;const e=t,n=e.constructor!=null&&typeof e.constructor=="function"?e.constructor.name:"unknown",r=Object.keys(e),a={};for(const i of r){const o=e[i];o===null?a[i]="null":o===void 0?a[i]="undefined":typeof o=="string"?a[i]=o.length>80?`"${o.slice(0,80)}..." (len=${o.length})`:JSON.stringify(o):Array.isArray(o)?a[i]=`Array(${o.length})${o.length>0?` e.g. ${JSON.stringify(o[0])}`:""}`:o instanceof ArrayBuffer?a[i]=`ArrayBuffer(${o.byteLength})`:ArrayBuffer.isView(o)?a[i]=`${o.constructor?.name??"ArrayBufferView"}(${o.byteLength})`:a[i]=typeof o}return`Got object: constructor=${n}, keys=[${r.join(", ")}], preview=${JSON.stringify(a)}.`}function Zp(t,e,n,r){const a=t(e,n,r);if(!a)return a;const i={...a},{redPaletteColorLookupTableData:o,greenPaletteColorLookupTableData:s,bluePaletteColorLookupTableData:c,pixelPaddingValue:l,pixelPaddingRangeLimit:u,pixelRepresentation:f}=a;if(o!=null&&s!=null&&c!=null&&(i.redPaletteColorLookupTableData=w0(o,i.redPaletteColorLookupTableDescriptor,"red"),i.greenPaletteColorLookupTableData=w0(s,i.greenPaletteColorLookupTableDescriptor,"green"),i.bluePaletteColorLookupTableData=w0(c,i.bluePaletteColorLookupTableDescriptor,"blue")),f==1){l<0&&(i.pixelPaddingValue=l&65535),u<0&&(i.pixelPaddingValue=u&65535);const{smallestPixelValue:d,largestPixelValue:g}=i;d<0&&(i.smallestPixelValue=d&65535),g<0&&(i.largestPixelValue=g&65535)}return i}function N4(){Re(q.IMAGE_PIXEL,Zp)}function Jp(t,e,n,r){const a=t(e,n,r);if(a){const i=a.transferSyntaxUID||a.availableTransferSyntaxUID,o=Fl(i);return{...a,transferSyntaxUID:Array.isArray(i)?i[0]:i,isVideo:o}}}function F4(){Re(q.TRANSFER_SYNTAX,Jp)}async function B4(t,e){return mp(q.NATURALIZED,t,{part10Buffer:e})}function k4(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}function T0(t,e,n,r,a){const i=new Uint8Array(t);if(r===16&&a==="SS"){const o=[],c=2*e*n,l=Math.min(i.length,c);for(let u=0;u<e;u++){const f=new Int16Array(n);o.push(f);let d=0;for(let g=2*u;g<l;g+=2*e){const p=i[g+1],h=i[g],m=p&128;f[d++]=m?4294901760|p<<8|h:p<<8|h}}return o}return[]}function G4(t){const e=new Uint8Array(t),n=new TextEncoder().encode(`\r
|
|
1
|
+
import{m as N,D as ne,k as ge,l as H5,o as Or,p as Yr,q as Pl,u as h0,v as Xo,w as j5,x as ue,y as K5,z as q5,A as X5,C as Y5,E as wt,F as oa,i as lt,G as Z5,H as Rl,j as rt,J as et,M as pe,P as Yt,I as Jg,K as Oe,L as Ye,N as gt,O as Zr,Q as qn,t as Ee,R as Tt,S as hn,T as Dc,V as me,U as Vl,W as Jn,X as J5,Y as uf,Z as Yo,_ as Q5,$ as Qg,a0 as Un,a1 as Zo,a2 as sa,a3 as e3,a4 as t3,a5 as ep,a6 as tp,a7 as n3,a8 as ri,B as Ze,a9 as r3,e as ln,aa as Pc,ab as a3,ac as qa,ad as i3,ae as Rc,af as o3,ag as s3,ah as La,ai as c3,aj as l3,ak as Vc,al as np,n as ff,am as u3,s as _a,an as f3,ao as Jo,ap as ao,aq as d3,ar as g3}from"./cornerstoneEngine-BIu8DPDK.js";import{i as p3,j as h3,C as mn,P as Li,k as m3,H as xn,F as rp,V as ap,l as mt,m as ip,I as op,a as El,r as je,n as De,S as L,o as ma,p as sp,q as Ce,s as Pn,u as K,W as Qo,v as v3,w as C3,b as ze,c as ai,B as No,x as m0,O as y3,y as x3,z as ut,D as Ml,U as va,E as Al,t as v0,G as df,J as cp,K as ee,N as Ll,X as S3,Y as w3,Z as lp,_ as Fs,$ as T3,a0 as I3,a1 as C0,a2 as Bs,M as Zt,a3 as Nn,a4 as ks,a5 as pr,a6 as b3,a7 as up,a8 as O3,a9 as gf,aa as es,ab as D3,ac as P3,ad as R3,ae as V3,R as E3,af as _l,ag as M3,ah as fp,ai as A3,A as Xn,T as _i,d as ii,aj as L3,ak as pf,al as _3,g as U3}from"./Texture-B-lj_eg9.js";import Gs,{constants as io,log as Ws}from"./dcmjs.es-DfWkgqfk.js";var B;(function(t){t.ERROR_EVENT="CORNERSTONE_ERROR",t.CACHE_SIZE_EXCEEDED="CACHE_SIZE_EXCEEDED",t.IMAGE_LOAD_ERROR="IMAGE_LOAD_ERROR",t.CAMERA_MODIFIED="CORNERSTONE_CAMERA_MODIFIED",t.CAMERA_RESET="CORNERSTONE_CAMERA_RESET",t.VOI_MODIFIED="CORNERSTONE_VOI_MODIFIED",t.PRESET_MODIFIED="CORNERSTONE_VIEWPORT_RENDERING_PRESET_MODIFIED",t.DISPLAY_AREA_MODIFIED="CORNERSTONE_DISPLAY_AREA_MODIFIED",t.ELEMENT_DISABLED="CORNERSTONE_ELEMENT_DISABLED",t.ELEMENT_ENABLED="CORNERSTONE_ELEMENT_ENABLED",t.IMAGE_RENDERED="CORNERSTONE_IMAGE_RENDERED",t.IMAGE_VOLUME_MODIFIED="CORNERSTONE_IMAGE_VOLUME_MODIFIED",t.IMAGE_VOLUME_LOADING_COMPLETED="CORNERSTONE_IMAGE_VOLUME_LOADING_COMPLETED",t.IMAGE_LOADED="CORNERSTONE_IMAGE_LOADED",t.IMAGE_RETRIEVAL_STAGE="CORNERSTONE_IMAGE_RETRIEVAL_STAGE",t.IMAGE_LOAD_FAILED="CORNERSTONE_IMAGE_LOAD_FAILED",t.VOLUME_VIEWPORT_NEW_VOLUME="CORNERSTONE_VOLUME_VIEWPORT_NEW_VOLUME",t.VOLUME_LOADED="CORNERSTONE_VOLUME_LOADED",t.VOLUME_LOADED_FAILED="CORNERSTONE_VOLUME_LOADED_FAILED",t.IMAGE_CACHE_IMAGE_ADDED="CORNERSTONE_IMAGE_CACHE_IMAGE_ADDED",t.IMAGE_CACHE_IMAGE_REMOVED="CORNERSTONE_IMAGE_CACHE_IMAGE_REMOVED",t.VOLUME_CACHE_VOLUME_ADDED="CORNERSTONE_VOLUME_CACHE_VOLUME_ADDED",t.VOLUME_CACHE_VOLUME_REMOVED="CORNERSTONE_VOLUME_CACHE_VOLUME_REMOVED",t.STACK_NEW_IMAGE="CORNERSTONE_STACK_NEW_IMAGE",t.VOLUME_NEW_IMAGE="CORNERSTONE_VOLUME_NEW_IMAGE",t.PRE_STACK_NEW_IMAGE="CORNERSTONE_PRE_STACK_NEW_IMAGE",t.IMAGE_SPACING_CALIBRATED="CORNERSTONE_IMAGE_SPACING_CALIBRATED",t.VIEWPORT_NEW_IMAGE_SET="CORNERSTONE_VIEWPORT_NEW_IMAGE_SET",t.STACK_VIEWPORT_SCROLL="CORNERSTONE_STACK_VIEWPORT_SCROLL",t.STACK_SCROLL_OUT_OF_BOUNDS="STACK_SCROLL_OUT_OF_BOUNDS",t.GEOMETRY_CACHE_GEOMETRY_ADDED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_ADDED",t.GEOMETRY_CACHE_GEOMETRY_REMOVED="CORNERSTONE_GEOMETRY_CACHE_GEOMETRY_REMOVED",t.VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS="VOLUME_VIEWPORT_SCROLL_OUT_OF_BOUNDS",t.VOLUME_VIEWPORT_SCROLL="VOLUME_VIEWPORT_SCROLL",t.CLIPPING_PLANES_UPDATED="CORNERSTONE_CLIPPING_PLANES_UPDATED",t.WEB_WORKER_PROGRESS="CORNERSTONE_WEB_WORKER_PROGRESS",t.COLORMAP_MODIFIED="CORNERSTONE_COLORMAP_MODIFIED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED="DYNAMIC_VOLUME_DIMENSION_GROUP_CHANGED",t.DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED="DYNAMIC_VOLUME_TIME_POINT_INDEX_CHANGED",t.DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED="DYNAMIC_VOLUME_DIMENSION_GROUP_LOADED",t.DYNAMIC_VOLUME_TIME_POINT_LOADED="DYNAMIC_VOLUME_TIME_POINT_LOADED",t.GEOMETRY_LOADED="GEOMETRY_LOADED",t.GEOMETRY_LOAD_PROGRESS="GEOMETRY_LOAD_PROGRESS",t.GEOMETRY_LOADED_FAILED="GEOMETRY_LOADED_FAILED",t.ACTORS_CHANGED="CORNERSTONE_ACTORS_CHANGED",t.RENDER_BACKEND_CHANGED="CORNERSTONE_RENDER_BACKEND_CHANGED",t.WEBGL_CONTEXT_LOST="CORNERSTONE_WEBGL_CONTEXT_LOST",t.WEBGL_CONTEXT_RESTORED="CORNERSTONE_WEBGL_CONTEXT_RESTORED",t.RENDER_PATH_ERROR="CORNERSTONE_RENDER_PATH_ERROR",t.RENDERING_PIPELINE_CHANGED="CORNERSTONE_RENDERING_PIPELINE_CHANGED"})(B||(B={}));var ce;(function(t){t.Interaction="interaction",t.Thumbnail="thumbnail",t.Prefetch="prefetch",t.Compute="compute"})(ce||(ce={}));var z;(function(t){t.STACK="stack",t.ORTHOGRAPHIC="orthographic",t.PERSPECTIVE="perspective",t.VOLUME_3D="volume3d",t.VOLUME_3D_NEXT="volume3dNext",t.PLANAR_NEXT="planarNext",t.VIDEO="video",t.VIDEO_NEXT="videoNext",t.WHOLE_SLIDE="wholeSlide",t.WHOLE_SLIDE_NEXT="wholeSlideNext",t.ECG="ecg",t.ECG_NEXT="ecgNext"})(z||(z={}));const N3={STACK:z.STACK,ORTHOGRAPHIC:z.ORTHOGRAPHIC,PERSPECTIVE:z.PERSPECTIVE,VOLUME_3D:z.VOLUME_3D,VOLUME_3D_NEXT:z.VOLUME_3D_NEXT,PLANAR_NEXT:z.PLANAR_NEXT,VIDEO:z.VIDEO,VIDEO_NEXT:z.VIDEO_NEXT,WHOLE_SLIDE:z.WHOLE_SLIDE,WHOLE_SLIDE_NEXT:z.WHOLE_SLIDE_NEXT,ECG:z.ECG,ECG_NEXT:z.ECG_NEXT},ts=N3;function F3(t,e){if(Object.prototype.hasOwnProperty.call(ts,t))throw new Error(`Viewport type constant "${String(t)}" already exists`);ts[t]=e}var be;(function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR",t[t.FAST_LINEAR=2]="FAST_LINEAR"})(be||(be={}));const{BlendMode:ba}=p3;var Lt;(function(t){t[t.COMPOSITE=ba.COMPOSITE_BLEND]="COMPOSITE",t[t.MAXIMUM_INTENSITY_BLEND=ba.MAXIMUM_INTENSITY_BLEND]="MAXIMUM_INTENSITY_BLEND",t[t.MINIMUM_INTENSITY_BLEND=ba.MINIMUM_INTENSITY_BLEND]="MINIMUM_INTENSITY_BLEND",t[t.AVERAGE_INTENSITY_BLEND=ba.AVERAGE_INTENSITY_BLEND]="AVERAGE_INTENSITY_BLEND",t[t.LABELMAP_EDGE_PROJECTION_BLEND=ba.LABELMAP_EDGE_PROJECTION_BLEND]="LABELMAP_EDGE_PROJECTION_BLEND"})(Lt||(Lt={}));var X;(function(t){t.AXIAL="axial",t.CORONAL="coronal",t.SAGITTAL="sagittal",t.ACQUISITION="acquisition",t.AXIAL_REFORMAT="axial_reformat",t.CORONAL_REFORMAT="coronal_reformat",t.SAGITTAL_REFORMAT="sagittal_reformat",t.REFORMAT="reformat"})(X||(X={}));var _t;(function(t){t.CONTOUR="CONTOUR",t.SURFACE="SURFACE",t.MESH="MESH"})(_t||(_t={}));var Ec;(function(t){t.CLOSED_PLANAR="CLOSED_PLANAR",t.OPEN_PLANAR="OPEN_PLANAR"})(Ec||(Ec={}));const B3=Ec;var Pt;(function(t){t.PLY="PLY",t.STL="STL",t.OBJ="OBJ",t.VTP="VTP"})(Pt||(Pt={}));var We;(function(t){t.LINEAR="LINEAR",t.SAMPLED_SIGMOID="SIGMOID",t.LINEAR_EXACT="LINEAR_EXACT"})(We||(We={}));var Mc;(function(t){t.SUM="SUM",t.AVERAGE="AVERAGE",t.SUBTRACT="SUBTRACT"})(Mc||(Mc={}));const k3=Mc;class dp{constructor(e){this.fullDate=e}getTimeInSec(){const e=this.fullDate.substring(0,10),n=this.fullDate.substring(11,28),r=parseInt(e.substring(0,4),10),a=e.length>=7?parseInt(e.substring(5,7),10):void 0,i=e.length>=10?parseInt(e.substring(8,10),10):void 0;if(isNaN(r)||a!==void 0&&isNaN(a)||i!==void 0&&isNaN(i)||r>3e3||a&&(a<1||a>12)||i&&(i<1||i>31))throw new Error(`invalid date '${e}'`);const o=new Date(`${e}T00:00:00.000000Z`),s=parseInt(n.substring(0,2),10),c=n.length>=5?parseInt(n.substring(3,5),10):void 0,l=n.length>=8?parseInt(n.substring(6,8),10):void 0,u=n.substring(9,15),f=u?parseInt(u,10)*Math.pow(10,-u.length):void 0;if(isNaN(s)||c!==void 0&&isNaN(c)||l!==void 0&&isNaN(l)||f!==void 0&&isNaN(f)||s<0||s>23||c&&(c<0||c>59)||l&&(l<0||l>59)||f&&(f<0||f>999999))throw new Error(`invalid time '${n}'`);let d=o.getTime()/1e3;return d+=s*3600,c!==void 0&&(d+=c*60),l!==void 0&&(d+=l),f!==void 0&&(d+=f),d}getTimeInMicroSec(){return this.getTimeInSec()*1e6}}function ns(t,e){const n=`${e.hours||"00"}`.padStart(2,"0"),r=`${e.minutes||"00"}`.padStart(2,"0"),a=`${e.seconds||"00"}`.padStart(2,"0"),i=`${t.month}`.padStart(2,"0"),o=`${t.day}`.padStart(2,"0"),s=`${e.fractionalSeconds||"000000"}`.padEnd(6,"0"),c=`${t.year}-${i}-${o}`,l=`T${n}:${r}:${a}.${s}Z`,u=`${c}${l}`;return new dp(u)}function G3(t,e){switch(t){case 2:return e%4===0&&e%100||e%400===0?29:28;case 9:case 4:case 6:case 11:return 30;default:return 31}}function W3(t,e,n){return isNaN(n)?!1:e>0&&e<=12&&t>0&&t<=G3(e,n)}function rs(t){if(t==null||t.length!==8||typeof t!="string")throw new Error(`invalid DA '${t}'`);const e=parseInt(t.substring(0,4),10),n=parseInt(t.substring(4,6),10),r=parseInt(t.substring(6,8),10);if(W3(r,n,e)!==!0)throw new Error(`invalid DA '${t}'`);return{year:e,month:n,day:r}}function as(t){if(t==null||t.length<2||typeof t!="string")throw new Error(`invalid TM '${t}'`);const e=parseInt(t.substring(0,2),10),n=t.length>=4?parseInt(t.substring(2,4),10):void 0,r=t.length>=6?parseInt(t.substring(4,6),10):void 0,a=t.length>=8?t.substring(7,13):void 0,i=a?parseInt(a,10)*Math.pow(10,6-a.length):void 0;if(isNaN(e)||n!==void 0&&isNaN(n)||r!==void 0&&isNaN(r)||i!==void 0&&isNaN(i)||e<0||e>23||n&&(n<0||n>59)||r&&(r<0||r>59)||i&&(i<0||i>999999))throw new Error(`invalid TM '${t}'`);return{hours:e,minutes:n,seconds:r,fractionalSeconds:i}}function gp(t){if(t==null)throw new Error("dateTimeToFullDateInterface : dateTime not defined.");const e=rs(t.substring(0,8)),n=as(t.substring(8));return ns(e,n)}function z3(t){const{SeriesDate:e,SeriesTime:n,GEPrivatePostInjectionDateTime:r}=t[0],a=new Array(t.length),i=rs(e),o=as(n),s=ns(i,o);let c=new dp("3000-01-01T00:00:00.000000Z"),l=c.getTimeInSec();if(t.forEach(u=>{const{AcquisitionDate:f,AcquisitionTime:d}=u,g=rs(f),p=as(d),h=ns(g,p);c.getTimeInSec()>=l?c=h:c=h.getTimeInSec()<c.getTimeInSec()?h:c}),c.getTimeInSec()>=l)throw new Error("Earliest acquisition time or date could not be parsed.");return s.getTimeInSec()<=c.getTimeInSec()?a.fill(s):r?a.fill(gp(r)):a.fill(c)}function $3(t){const{PatientSex:e,PatientWeight:n,PatientSize:r}=t;let a;const i=n*n/(r*r*1e4);if(e==="F")a=1.07*n-148*i;else if(e==="M")a=1.1*n-120*i;else throw new Error(`PatientSex is an invalid value: ${e}`);return a*1e3}function H3(t){const{PatientWeight:e,PatientSize:n}=t;return Math.pow(e,.425)*Math.pow(n*100,.725)*71.84}function j3(t){const{RadiopharmaceuticalStartDateTime:e,RadiopharmaceuticalStartTime:n,SeriesDate:r}=t;let a,i;if(e)return gp(e);if(n&&r)return a=as(n),i=rs(r),ns(i,a);throw new Error(`Invalid input: ${t}`)}function K3(t){const{RadionuclideTotalDose:e,RadionuclideHalfLife:n,RadiopharmaceuticalStartDateTime:r,RadiopharmaceuticalStartTime:a,SeriesDate:i}=t[0];if(e==null)throw new Error("calculateDecayCorrection : RadionuclideTotalDose value not found.");if(n==null)throw new Error("calculateDecayCorrection : RadionuclideHalfLife value not found.");const o=z3(t),s=j3({RadiopharmaceuticalStartDateTime:r,RadiopharmaceuticalStartTime:a,SeriesDate:i});return t.map((c,l)=>{const f=o[l].getTimeInSec()-s.getTimeInSec();if(f<0)throw new Error("Decay time cannot be less than zero");return 1/(e*Math.pow(2,-f/n))})}const q3=(t,e)=>t===e||Array.isArray(t)&&Array.isArray(e)&&t.length===e.length&&t.every((n,r)=>n===e[r]);function X3(t){const{CorrectedImage:e,Units:n,PhilipsPETPrivateGroup:r,PatientWeight:a,PatientSex:i,PatientSize:o}=t[0];if(!e.includes("ATTN")||!e.includes("DECY"))throw new Error(`CorrectedImage must contain "ATTN" and "DECY": ${e}`);if(!t.every(g=>g.Units===n&&q3(g.CorrectedImage,e)&&g.PatientWeight===a&&g.PatientSex===i&&g.PatientSize===o&&g.RadionuclideHalfLife===t[0].RadionuclideHalfLife&&g.RadionuclideTotalDose===t[0].RadionuclideTotalDose&&g.DecayCorrection===t[0].DecayCorrection&&g.SeriesDate===t[0].SeriesDate&&g.SeriesTime===t[0].SeriesTime))throw new Error("The set of instances does not appear to come from one Series. Every instance must have identical values for series-level metadata properties");if(a==null)throw new Error("PatientWeight value is missing. It is not possible to calculate the SUV factors");let c=new Array(t.length);c=K3(t);let l=new Array(t.length);const u=a*1e3;if(n==="BQML")l=c.map(function(g){return g*u});else if(n==="CNTS"){const g=t.every(h=>{var m,v,C;return h.PhilipsPETPrivateGroup&&((m=h.PhilipsPETPrivateGroup)===null||m===void 0?void 0:m.SUVScaleFactor)!==null&&((v=h.PhilipsPETPrivateGroup)===null||v===void 0?void 0:v.SUVScaleFactor)!==void 0&&((C=h.PhilipsPETPrivateGroup)===null||C===void 0?void 0:C.SUVScaleFactor)!==0}),p=t.every(h=>{var m,v,C;return h.PhilipsPETPrivateGroup&&!((m=h.PhilipsPETPrivateGroup)!==null&&m!==void 0&&m.SUVScaleFactor)&&((v=h.PhilipsPETPrivateGroup)===null||v===void 0?void 0:v.ActivityConcentrationScaleFactor)!==void 0&&((C=h.PhilipsPETPrivateGroup)===null||C===void 0?void 0:C.ActivityConcentrationScaleFactor)!==0});if(g)l=t.map(h=>h.PhilipsPETPrivateGroup.SUVScaleFactor);else if(p)l=t.map((h,m)=>h.PhilipsPETPrivateGroup.ActivityConcentrationScaleFactor*c[m]*u);else throw new Error(`Units are in CNTS, but PhilipsPETPrivateGroup has invalid values: ${JSON.stringify(r)}`)}else if(n==="GML")l.fill(1);else throw new Error(`Units has an invalid value: ${n}`);let f;o==null?console.warn("PatientSize value is missing. It is not possible to calculate the SUV bsa factors"):f=H3({PatientWeight:a,PatientSize:o});let d;return o==null?console.warn("PatientSize value is missing. It is not possible to calculate the SUV lbm factors"):i==null?console.warn("PatientSex value is missing. It is not possible to calculate the SUV lbm factors"):d=$3({PatientWeight:a,PatientSex:i,PatientSize:o}),l.map(function(g,p){const h={suvbw:g};return f&&(h.suvbsa=c[p]*f),d&&(h.suvlbm=c[p]*d),h})}var un;(function(t){t.NOT_APPLICABLE="",t.ERMF="ERMF",t.USER="User",t.PROJECTION="Proj",t.REGION="Region",t.ERROR="Error",t.UNCALIBRATED="Uncalibrated",t.CALIBRATED="Calibrated",t.UNKNOWN="Unknown"})(un||(un={}));var q;(function(t){t.CALIBRATION="calibrationModule",t.CINE="cineModule",t.FRAME_OF_REFERENCE="frameOfReferenceModule",t.GENERAL_IMAGE="generalImageModule",t.GENERAL_SERIES="generalSeriesModule",t.GENERAL_STUDY="generalStudyModule",t.IMAGE_PIXEL="imagePixelModule",t.IMAGE_PLANE="imagePlaneModule",t.IMAGE_URL="imageUrlModule",t.MODALITY_LUT="modalityLutModule",t.MULTIFRAME="multiframeModule",t.NM_MULTIFRAME_GEOMETRY="nmMultiframeGeometryModule",t.OVERLAY_PLANE="overlayPlaneModule",t.PATIENT="patientModule",t.PATIENT_DEMOGRAPHIC="patientDemographicModule",t.PATIENT_STUDY="patientStudyModule",t.PET_IMAGE="petImageModule",t.PET_ISOTOPE="petIsotopeModule",t.PET_SERIES="petSeriesModule",t.SCALING="scalingModule",t.SOP_COMMON="sopCommonModule",t.ULTRASOUND_ENHANCED_REGION="ultrasoundEnhancedRegionModule",t.ECG="ecgModule",t.VOI_LUT="voiLutModule",t.TRANSFER_SYNTAX="transferSyntax",t.PLANE_ORIENTATION="PlaneOrientation",t.PLANE_POSITION="PlanePosition",t.PIXEL_MEASURES="PixelMeasures",t.XRAY_GEOMETRY="XrayGeometry",t.FRAME_PIXEL_DATA="FramePixelData",t.FRAME_MODULE="frameModule",t.URI_MODULE="uriModule",t.WADO_WEB_CLIENT="wadoWebClient",t.INSTANCE="instance",t.IMAGE_SOP_INSTANCE_REFERENCE="ImageSopInstanceReference",t.REFERENCED_SERIES_REFERENCE="ReferencedSeriesReference",t.PREDECESSOR_SEQUENCE="PredecessorSequence",t.STUDY_DATA="StudyData",t.SERIES_DATA="SeriesData",t.IMAGE_DATA="ImageData",t.RTSS_INSTANCE_DATA="RtssInstanceData",t.NEW_INSTANCE_DATA="NewInstanceData",t.RTSS_CONTOUR="metaRTSSContour",t.SEG_BIT="metaSegBitmap",t.SR_ANNOTATION="metaSrAnnotation",t.COMPRESSED_FRAME_DATA="compressedFrameData",t.BASE_IMAGE_ID="baseImageId",t.FRAME_IMAGE_IDS="frameImageIds",t.NATURALIZED="naturalized",t.DISPLAY_SET="displaySetModule"})(q||(q={}));const Y3="Add";function Ca(t){return`${t}${Y3}`}const ot={IMPLICIT_VR_LITTLE_ENDIAN:io.IMPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_LITTLE_ENDIAN:io.EXPLICIT_LITTLE_ENDIAN,DEFLATED_EXPLICIT_VR_LITTLE_ENDIAN:io.DEFLATED_EXPLICIT_LITTLE_ENDIAN,EXPLICIT_VR_BIG_ENDIAN:io.EXPLICIT_BIG_ENDIAN,MPEG2_MAIN_PROFILE_MAIN_LEVEL:"1.2.840.10008.1.2.4.100",MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.100.1",MPEG2_MAIN_PROFILE_HIGH_LEVEL:"1.2.840.10008.1.2.4.101",MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE:"1.2.840.10008.1.2.4.101.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.102",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.102.1",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1:"1.2.840.10008.1.2.4.103",MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE:"1.2.840.10008.1.2.4.103.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO:"1.2.840.10008.1.2.4.104",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.104.1",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO:"1.2.840.10008.1.2.4.105",MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE:"1.2.840.10008.1.2.4.105.1",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2:"1.2.840.10008.1.2.4.106",MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE:"1.2.840.10008.1.2.4.106.1",HEVC_H265_MAIN_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.107",HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1:"1.2.840.10008.1.2.4.108"},Jt=[],oi=new Map,Ul=new Map;function Z3(t,e=0){if(Jt.some(r=>r.provider===t))return;let n;for(n=0;n<Jt.length&&!(Jt[n].priority<=e);n++);Jt.splice(n,0,{priority:e,provider:t})}const J3=(t,e,n)=>n?.defaultValue;function Q3(t,e,n,r){const a={type:t,...r,provider:n};if(!e.find(o=>o.provider===n)){let o;const{priority:s=0}=r;for(o=0;o<e.length&&!(e[o].priority<=s);o++);e.splice(o,0,a)}let i=J3;for(let o=e.length-1;o>=0;o--){const s=e[o].provider;s&&(i=s.bind(null,i))}return i}function Re(t,e,n={priority:0,isDefault:!0}){if(!e)throw new Error(`addTypedProvider: cannot register undefined provider for type "${t}"`);let r=oi.get(t);if(r||(r=new Array,oi.set(t,r)),r.find(i=>i.provider===e))return;const a=Q3(t,r,e,n);if(!a)throw new Error(`newProvider is empty for ${t}`);Ul.set(t,a)}function si(t,e,n={priority:0,isDefault:!0}){Re(Ca(t),e,n)}function zs(t,e,n){const r=Ul.get(t);if(r)return r(e,null,n)}function e9(t){for(let e=0;e<Jt.length;e++)if(Jt[e].provider===t){Jt.splice(e,1);break}}function t9(){for(;Jt.length>0;)Jt.pop();oi.clear(),Ul.clear()}function Yn(t,e,n){if(e!==void 0)for(let r=0;r<Jt.length;r++){const a=Jt[r].provider(t,e,n);if(a!==void 0)return a}}function pp(t,e,n){return Yn(t,e,n)}function hp(t,e,n){return Yn(Ca(t),e,n)}function mp(t,e,n){return hp(t,e,n)}const is=(t,e)=>{const n=[t,Ca(t)];for(const r of n){const a=oi.get(r);if(a)for(const i of a)i?.clearQuery?.(e)}},Ua=t=>{const e=Array.from(new Set([t,Ca(t)]));for(const n of e){const r=oi.get(n);if(r)for(const a of r)a?.clear?.()}},vn=(t,...e)=>e.length===1?Yn(t,e[0]):e.map(n=>n&&Yn(t,n)).find(n=>n!==void 0);function n9(t,e,n=Yn){const r={};for(const a of e)try{const i=n(a,t);if(i){const o={};for(const s in i)if(s in i){const c=vp(s);o[c]=i[s]}Object.assign(r,o)}}catch(i){console.error(`Error retrieving ${a} data:`,i)}return r}const vp=t=>t.startsWith("sop")?`SOP${t.substring(3)}`:t.startsWith("voi")?`VOI${t.substring(3)}`:(t.endsWith("Id")&&(t=`${t.substring(0,t.length-2)}ID`),t.charAt(0).toUpperCase()+t.slice(1)),Nl=t=>t.startsWith("SOP")?`sop${t.substring(3)}`:t.startsWith("VOI")?`voi${t.substring(3)}`:(t.endsWith("ID")&&!t.endsWith("UID")&&(t=`${t.substring(0,t.length-2)}Id`),t.charAt(0).toLowerCase()+t.slice(1)),r9=Object.freeze(Object.defineProperty({__proto__:null,addAddProvider:si,addMetaData:hp,addProvider:Z3,addTyped:mp,addTypedProvider:Re,clear:Ua,clearQuery:is,get:vn,getMetaData:Yn,getNormalized:n9,getTyped:pp,metadataModuleProvider:zs,removeAllProviders:t9,removeProvider:e9,toLowerCamelTag:Nl,toUpperCamelTag:vp},Symbol.toStringTag,{value:"Module"}));function y0(t){return t instanceof ArrayBuffer?new Uint8Array(t):t}function Cp(t){if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return y0(t);if(!Array.isArray(t)||t.length===0)return;const e=t[0];if(e==null||!(e instanceof ArrayBuffer)&&!ArrayBuffer.isView(e))return;if(t.length===1)return y0(e);const n=t.filter(o=>o!=null&&(o instanceof ArrayBuffer||ArrayBuffer.isView(o)));if(n.length===0)return;const r=n.reduce((o,s)=>o+(s instanceof ArrayBuffer,s.byteLength),0),a=new Uint8Array(r);let i=0;for(const o of n){const s=y0(o);a.set(new Uint8Array(s.buffer,s.byteOffset,s.byteLength),i),i+=s.byteLength}return a}function a9(t){return typeof t=="string"||typeof t=="number"||t instanceof String||t instanceof Number}function zr(t){if(t!==void 0){if(a9(t)){const e=Number(t);return Number.isFinite(e)?e:void 0}return Array.from(t,e=>{const n=Number(e);return Number.isFinite(n)?n:void 0})}}const yp=1e-5;function xp(t,e,n){return Math.abs(t-e)<=n}function i9(t,e,n=yp){if(t.length!==e.length)return!1;for(let r=0;r<t.length;r++)if(!xp(t[r],e[r],n))return!1;return!0}function hf(t){return typeof t=="number"}function mf(t){return t&&typeof t=="object"&&"length"in t&&typeof t.length=="number"&&t.length>0&&typeof t[0]=="number"}function ie(t,e,n=yp){return typeof t!=typeof e||t===null||e===null?!1:hf(t)&&hf(e)?xp(t,e,n):mf(t)&&mf(e)?i9(t,e,n):!1}const Sp=t=>typeof t=="number"?-t:t?.map?t.map(Sp):!t,Ac=t=>typeof t=="number"?Math.abs(t):t?.map?t.map(Ac):t,wp=(t,e,n=void 0)=>ie(t,Sp(e),n),Fo=(t,e,n=void 0)=>ie(Ac(t),Ac(e),n);function Tp(t){return Array.isArray(t)?Tp(t[0]):isFinite(t)&&!isNaN(t)}const Qn=$s("cs3d"),o9=Qn.getLogger("metadata"),s9=Qn.getLogger("core"),c9=Qn.getLogger("tools"),l9=Qn.getLogger("dicomImageLoader"),u9=Qn.getLogger("ai"),f9=Qn.getLogger("examples"),d9=Qn.getLogger("worker"),g9=Ws.getLogger("consistency.dicom"),p9=Ws.getLogger("consistency.image");function $s(t){const e=Ws.getLogger(t);return e.getLogger=(...n)=>$s(`${t}.${n.join(".")}`),e}function h9(...t){return $s(t.join("."))}const Ip=Object.freeze(Object.defineProperty({__proto__:null,aiLog:u9,coreLog:s9,cs3dLog:Qn,dicomConsistencyLog:g9,examplesLog:f9,getLogger:h9,getRootLogger:$s,imageConsistencyLog:p9,loaderLog:l9,log:Ws,metadataLog:o9,toolsLog:c9,workerLog:d9},Symbol.toStringTag,{value:"Module"})),bp=new Set([ot.MPEG2_MAIN_PROFILE_MAIN_LEVEL,ot.MPEG2_MAIN_PROFILE_MAIN_LEVEL_FRAGMENTABLE,ot.MPEG2_MAIN_PROFILE_HIGH_LEVEL,ot.MPEG2_MAIN_PROFILE_HIGH_LEVEL_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,ot.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1,ot.MPEG4_AVC_H264_BD_COMPATIBLE_HIGH_PROFILE_LEVEL_4_1_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_2D_VIDEO_FRAGMENTABLE,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO,ot.MPEG4_AVC_H264_HIGH_PROFILE_LEVEL_4_2_FOR_3D_VIDEO_FRAGMENTABLE,ot.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2,ot.MPEG4_AVC_H264_STEREO_HIGH_PROFILE_LEVEL_4_2_FRAGMENTABLE,ot.HEVC_H265_MAIN_PROFILE_LEVEL_5_1,ot.HEVC_H265_MAIN_10_PROFILE_LEVEL_5_1]);function Fl(t){return t?(Array.isArray(t)?t:[t]).find(n=>bp.has(n)):!1}const vf=/^[a-zA-Z]+:/;function os(t){if(!t)return"";const e=t.match(vf);if(!e)return t;const n=t.substring(e[0].length);return vf.test(n)?n:t}const m9=new Set(["1.2.840.10008.5.1.4.1.1.1","1.2.840.10008.5.1.4.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.1.1","1.2.840.10008.5.1.4.1.1.1.2","1.2.840.10008.5.1.4.1.1.1.2.1","1.2.840.10008.5.1.4.1.1.1.3","1.2.840.10008.5.1.4.1.1.1.3.1","1.2.840.10008.5.1.4.1.1.12.1","1.2.840.10008.5.1.4.1.1.12.1.1","1.2.840.10008.5.1.4.1.1.12.2","1.2.840.10008.5.1.4.1.1.12.2.1","1.2.840.10008.5.1.4.1.1.12.3"]);function Op(t){const{PixelSpacing:e,ImagerPixelSpacing:n,EstimatedRadiographicMagnificationFactor:r,DistanceSourceToDetector:a,DistanceSourceToEntrance:i,DistanceSourceToPatient:o=i}=t;if(r>1)return r;if(o<a)return a/o;if(n?.[0]>e?.[0])return!0}function Dp(t){const{PixelSpacing:e,ImagerPixelSpacing:n,PixelSpacingCalibrationType:r}=t,a=!0;if(e&&r==="GEOMETRY")return ie(e,n)&&console.warn("Calibration type is geometry, but pixel spacing and imager pixel spacing identical",e,n),{PixelSpacing:e,type:un.ERMF,isProjection:a};if(e&&r==="FIDUCIAL")return{PixelSpacing:e,type:un.CALIBRATED,isProjection:a};if(n){const i=Op(t);return i>1?{PixelSpacing:n.map(s=>s/i),type:un.ERMF,isProjection:a}:i===!0?{PixelSpacing:e,type:un.ERMF,isProjection:a}:(i&&console.error("Illegal ERMF value:",i),{PixelSpacing:e||n,type:un.PROJECTION,isProjection:a})}return{PixelSpacing:e,type:un.UNKNOWN,isProjection:a}}function Pp(t){const{PixelSpacing:e,SOPClassUID:n}=t;return m9.has(n)?Dp(t):{PixelSpacing:e,type:un.NOT_APPLICABLE,isProjection:!1}}const x0=new Map,Lc={add:(t,e)=>{const n=os(t);x0.set(n,e),is(q.IMAGE_PLANE,t)},get:(t,e)=>{if(t==="calibratedPixelSpacing"){const n=os(e);return x0.get(n)}},clear:()=>{x0.clear()}};function Bl(t,e,n=void 0,r=0){if(!t)return n;const a=t[e];if(a==null)return n;if(Array.isArray(a)){const i=a[r];return i??n}return r!==0?n:a}function Rp(t,e,n=void 0,r=0){const a=Bl(t,e,n,r);return a==null?n:String(a)}function lr(t,e,n=void 0,r=0){const a=Bl(t,e,n,r);if(a==null)return n;const i=Number(a);return Number.isFinite(i)?i:n}function Vp(t,e){const n=/\/frames\/\d+/,r=/([?&])frame=\d+/;if(n.test(t))return t.replace(n,`/frames/${e}`);if(r.test(t))return t.replace(r,(i,o)=>`${o}frame=${e}`);const a=t.includes("?")?"&":"?";return`${t}${a}frame=${e}`}function Ep(t){if(!t||t.length===0)return null;const e=t[0],n=vn("instance",e);if(!n)return null;const r=n.NumberOfFrames;if(!r||r<=1)return null;const a=n.TimeSlotVector;if(!a||!Array.isArray(a))return null;const i=n.SliceVector,o=n.NumberOfSlices;if(a.length!==r)return console.warn("TimeSlotVector length does not match NumberOfFrames:",a.length,"vs",r),null;if(i){if(!Array.isArray(i))return console.warn("SliceVector exists but is not an array. Expected length:",r),null;if(i.length!==r||i.some(d=>d===void 0))return console.warn("SliceVector exists but has invalid length or undefined entries. Expected length:",r,"Actual length:",i.length),null}const s=new Map;for(let d=0;d<r;d++){const g=a[d],p=i?.[d]??d;s.has(g)||s.set(g,[]),s.get(g).push({frameIndex:d,sliceIndex:p})}const l=Array.from(s.keys()).sort((d,g)=>d-g).map(d=>{const g=s.get(d);return g.sort((p,h)=>p.sliceIndex-h.sliceIndex),g.map(p=>Vp(e,p.frameIndex+1))}),u=o||l[0]?.length;return l.every(d=>d.length===u)||console.warn("Multiframe 4D split resulted in uneven time slot groups. Expected",u,"slices per time slot."),{imageIdGroups:l,splittingTag:"TimeSlotVector"}}function v9(t){if(!t||t.length===0||S0(t[0],"CardiacNumberOfImages")===void 0)return null;const n=new Map;for(const s of t){const c=vn("StackID",s),l=S0(s,"InStackPositionNumber"),u=S0(s,"TriggerTime");if(c===void 0||l===void 0||u===void 0)return null;const f=String(c);n.has(f)||n.set(f,new Map);const d=n.get(f);d.has(l)||d.set(l,[]),d.get(l).push({imageId:s,triggerTime:u})}const r=Array.from(n.keys()).sort((s,c)=>Number(s)-Number(c));if(r.length===0)return null;const a=[];let i;for(const s of r){const c=n.get(s),l=Array.from(c.keys()).sort((u,f)=>u-f);for(const u of l){const f=c.get(u);if(f.sort((d,g)=>d.triggerTime-g.triggerTime),i===void 0)i=f.length;else if(f.length!==i)return null}a.push({stackId:s,positions:l,framesByPosition:c})}if(!i)return null;const o=[];for(let s=0;s<i;s++){const c=[];for(const l of a)for(const u of l.positions){const f=l.framesByPosition.get(u);c.push(f[s].imageId)}o.push(c)}return{imageIdGroups:o,splittingTag:"CardiacTriggerTime"}}const C9=(t,e)=>t.reduce((n,r)=>((n[r[e]]=n[r[e]]||[]).push(r),n),{});function y9(t){const e=t.map(o=>{const{imagePositionPatient:s}=vn("imagePlaneModule",o)||{};return{imageId:o,imagePositionPatient:s}});if(!e.every(o=>o.imagePositionPatient))return null;const n=C9(e,"imagePositionPatient"),r=Object.keys(n),a=n[r[0]].length;return a===1||!r.every(o=>n[o].length===a)?null:n}function x9(t,e){const n={};let r=[];const a=Object.keys(t);for(let i=0;i<a.length;i++){const o=new Set,s=t[a[i]];for(let c=0;c<s.length;c++){const l=e(s[c].imageId)||0;if(n[l]=n[l]||[],n[l].push({imageId:s[c].imageId}),o.add(l),o.size-1<c)return}if(i==0)r=Array.from(o);else if(!I9(r,o))return}return n}function Nr(t,e){const n=vn(e,t);try{return parseFloat(n)}catch{return}}function S0(t,e){return zr(Nr(t,e))}function S9(t){const e=vn("20011003",t);try{const{InlineBinary:n}=e;if(n){const r=atob(n),a=new ArrayBuffer(r.length),i=new DataView(a);for(let o=0;o<r.length;o++)i.setUint8(o,r.charCodeAt(o));return new Float32Array(a)[0]}return parseFloat(e)}catch{return}}function w9(t){let e=vn("0019100c",t)||vn("0019100C",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n)),parseFloat(e)}catch{return}}function T9(t){let e=vn("00431039",t);try{const{InlineBinary:n}=e;return n&&(e=atob(n).split("//")),parseFloat(e[0])%1e5}catch{return}}function I9(t,e){if(t.length!=e.size)return!1;for(let n=0;n<t.length;n++)if(!e.has(t[n]))return!1;return!0}function b9(t){const e=vn("petImageModule",t);return e?e.frameReferenceTime:0}function O9(t){const e=Ep(t);if(e)return e;const n=v9(t);if(n)return n;const r=y9(t);if(!r)return{imageIdGroups:[t],splittingTag:null};const a=["TemporalPositionIdentifier","DiffusionBValue","TriggerTime","EchoTime","EchoNumber","PhilipsPrivateBValue","SiemensPrivateBValue","GEPrivateBValue","PetFrameReferenceTime"],i=[o=>Nr(o,a[0]),o=>Nr(o,a[1]),o=>Nr(o,a[2]),o=>Nr(o,a[3]),o=>Nr(o,a[4]),S9,w9,T9,b9];for(let o=0;o<i.length;o++){const s=x9(r,i[o]);if(s)return{imageIdGroups:Object.keys(s).map(Number.parseFloat).sort((u,f)=>u-f).map(u=>s[u].map(f=>f.imageId)),splittingTag:a[o]}}return{imageIdGroups:[t],splittingTag:null}}const D9=["TransferSyntaxUID","AvailableTransferSyntaxUID"],P9=["FrameTime","RecommendedDisplayFrameRate"],R9=[["RadiopharmaceuticalInfo","00540016"]],V9=["RadiopharmaceuticalStartTime","RadiopharmaceuticalStopTime","RadionuclideTotalDose","RadionuclideHalfLife"],E9=["FrameReferenceTime","ActualFrameDuration"],M9=["CorrectedImage","Units","DecayCorrection"],A9=["PatientID","PatientName","PatientBirthDate","PatientBirthTime"],L9=["PatientAge","PatientSize","PatientSex","PatientWeight"],_9=["StudyInstanceUID","StudyDescription","StudyDate","StudyTime","AccessionNumber"],U9=["StudyInstanceUID","SeriesInstanceUID","Modality","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","AcquisitionDate","AcquisitionTime"],N9=["ClinicalTrialSponsorName","ClinicalTrialSiteID","ClinicalTrialSiteName","ClinicalTrialSubjectID"],F9=["SOPInstanceUID","SOPClassUID"],B9=["StudyInstanceUID","SeriesInstanceUID","SeriesDescription","SeriesNumber","SeriesDate","SeriesTime","Modality","SOPInstanceUID","SOPClassUID"],k9=["SOPInstanceUID","SOPClassUID","InstanceNumber","InstanceCreationDate","InstanceCreationTime","ContentTime","LossyImageCompression","LossyImageCompressionRatio","LossyImageCompressionMethod","FrameOfReferenceUID","NumberOfFrames","PixelSpacing"],G9=["ImagerPixelSpacing","ImageOrientationPatient","ImagePositionPatient","SpacingBetweenSlices","SliceThickness","SliceLocation"],W9=["SamplesPerPixel","PhotometricInterpretation","PlanarConfiguration","Rows","Columns","BitsAllocated","BitsStored","HighBit","PixelRepresentation",["SmallestPixelValue","00280106"],["LargestPixelValue","00280107"],"PixelPaddingValue","PixelPaddingRangeLimit","RedPaletteColorLookupTableDescriptor","GreenPaletteColorLookupTableDescriptor","BluePaletteColorLookupTableDescriptor","AlphaPaletteColorLookupTableDescriptor","RedPaletteColorLookupTableData","GreenPaletteColorLookupTableData","BluePaletteColorLookupTableData","AlphaPaletteColorLookupTableData","PaletteColorLookupTableUID","DistanceSourceToDetector","DistanceSourceToPatient","EstimatedRadiographicMagnificationFactor","DistanceSourceToEntrance","PixelSpacingCalibrationType","PixelSpacingCalibrationDescription","SequenceOfUltrasoundRegions"],z9=["WindowCenter","WindowWidth","VOILUTFunction","WindowCenterWidthExplanation"],$9=["RescaleIntercept","RescaleSlope","RescaleType"],H9=["SequenceOfUltrasoundRegions"],j9=["PhysicalDeltaX","PhysicalDeltaY","PhysicalUnitsXDirection","PhysicalUnitsYDirection","RegionLocationMinY0","RegionLocationMaxY1","RegionLocationMinX0","RegionLocationMaxX1","ReferencePixelX0","ReferencePixelY0",["ReferencePhysicalPixelValueY","0018602A"],["ReferencePhysicalPixelValueX","00186028"],"RegionSpatialFormat","RegionDataType","RegionFlags","TransducerFrequency"],K9=["ReferencedImageSequence","ReferencedSOPClassUID","ReferencedSOPInstanceUID","ReferencedFrameNumber","SharedFunctionalGroupsSequence","PerFrameFunctionalGroupsSequence","PlanePositionSequence","AnatomicRegionSequence","PlaneOrientationSequence","PixelMeasuresSequence","PixelValueTransformationSequence","ParametricMapFrameTypeSequence","RealWorldValueMappingSequence"],q9="usRegionChild",X9="clinicalTrialModule",Y9="RadiopharmaceuticalInfo",Z9=[[q.TRANSFER_SYNTAX,D9],[q.CINE,P9],[q.PET_ISOTOPE,R9],[Y9,V9],[q.PET_IMAGE,E9],[q.PET_SERIES,M9],[q.PATIENT,A9],[q.PATIENT_STUDY,L9],[q.GENERAL_STUDY,_9],[q.GENERAL_SERIES,U9],[X9,N9],[q.SOP_COMMON,F9],[q.ECG,B9],[q.GENERAL_IMAGE,k9],[q.IMAGE_PLANE,G9],[q.IMAGE_PIXEL,W9],[q.VOI_LUT,z9],[q.MODALITY_LUT,$9],[q.ULTRASOUND_ENHANCED_REGION,H9],[q9,j9],[null,K9]],Mp=Gs.data.DicomMetaDictionary.dictionary,J9=Gs.data.DicomMetaDictionary.nameMap;function Q9(t,...e){return{tag:t,groups:e,xTag:null,primaryGroup:null,name:null,lowerName:null,vr:null,vm:null}}function Ap(t){if(t==null)return null;if(typeof t=="number")return t;const e=parseInt(t,10);return String(e)===t?e:0}function Lp(t){return Mp[t.toUpperCase()]}const ci=new Map,Xa=new Map;function e4(t,e){if(t&&e.name&&t!==e.name)throw new Error(`Tag name provided and value don't match: ${t} !== ${e.name}`);e.name||=t,e.lowerName||=Nl(t);const{tag:n}=e;e.primaryGroup||=e.groups?.[0];const{groups:r}=e;if(Xa.set(t,e),n&&(e.xTag=`x${n.toLowerCase()}`,e.tag=n.toUpperCase(),Xa.set(e.xTag,e),Xa.set(e.tag,e),!e.vr)){const a=Mp[e.tag];a&&(e.vr=a.vr,e.vm=Ap(a.vm))}if(r?.length)for(const a of r){let i=ci.get(a);if(!i){i=[e],ci.set(a,i);return}const o=i.findIndex(s=>s.name===t);o===-1?i.push(e):i[o]=e}}function t4(t){const e=J9[t];if(e)return e.tag.substring(1,5)+e.tag.substring(6,10)}const _c=new Map;for(const[t,e]of Z9)for(const n of e){const r=typeof n=="string"?n:n[0],a=typeof n=="string"?void 0:n[1];let i=_c.get(r);i||(i={hex:a??t4(r),groups:[]},_c.set(r,i)),t!==null&&i.groups.push(t)}for(const[t,{hex:e,groups:n}]of _c){if(!e){console.warn(`Tags: keyword "${t}" not found in dcmjs nameMap`);continue}e4(t,Q9(e,...n))}class n4{constructor(e){this.metadata=e}syncIterator(e,n=this.metadata){for(const[r,a]of Object.entries(n)){if(r==="_vrMap"||a===void 0)continue;if(a===null){e.addTag(r,{length:0}),e.pop();continue}const i=a.vr,o=Xa.get(r),s=o?void 0:Lp(r),c=!a.Value&&(a.BulkDataURI??a.InlineBinary);if(!(!a.Value&&!c)){if(e.addTag(r,{vr:i,name:o?.name||s?.name,vm:o?.vm??s?.vm}),i==="SQ"){for(const l of a.Value)e.startObject(),this.syncIterator(e,l),e.pop();e.pop();continue}if(c){e.value({BulkDataURI:a.BulkDataURI,InlineBinary:a.InlineBinary}),e.pop();continue}a.vr==="CS"&&a.Value.length===1&&String(a.Value[0]).indexOf("\\")!==-1&&(a.Value=String(a.Value[0]).split("\\"));for(const l of a.Value)e.value(l);e.pop()}}}}function Uc(t){return t==null||typeof t!="object"||Array.isArray(t)||(Object.defineProperty(t,"length",{value:1,configurable:!0}),Object.defineProperty(t,0,{value:t,writable:!0,configurable:!0,enumerable:!1}),Object.defineProperty(t,Symbol.iterator,{value:function*(){yield this},configurable:!0})),t}const{DicomMetadataListener:r4}=Gs.utilities;function a4(t,e,n){if(t&&t.vm!==void 0&&t.vm!==null)return t.vm===1;const r=n?.vm??e?.vm;if(r!=null){const a=Ap(r);if(a!==null)return a===1}return null}function i4(t){if(!Array.isArray(t)||t.length===0)return!1;const e=t[0];return e instanceof ArrayBuffer||ArrayBuffer.isView(e)?!0:Array.isArray(e)?t.every(n=>Array.isArray(n)&&n.every(r=>r instanceof ArrayBuffer||ArrayBuffer.isView(r))):!1}const o4="name";class Hs{constructor(e){}static createMetadataListener(e){return new r4({},new Hs(e))}addTag(e,n,r){const a=Xa.get(n),i=a?void 0:Lp(n),o=r?.name||a?.[o4]||i?.name||n,s=a4(a,i,r);e(n,r),this.current.natural={name:o,singleVm:s,tag:n}}pop(e){const n=this,r=n.current?.natural,a=n.current?.parent;if(!r||!a?.dest)return e();const i=e(),o=a,s=o.dest[r.tag];if(s===void 0)return i;let c=s.Value??s;if(Array.isArray(c)&&c.length===1&&c[0]===void 0&&(c=[]),i4(c))return o.dest[r.name]=c,r.name!==r.tag&&delete o.dest[r.tag],i;if(r.singleVm===!0&&Array.isArray(c)&&c.length===1){const l=c[0];return typeof l=="object"&&l!==null&&!(l instanceof ArrayBuffer)&&!ArrayBuffer.isView(l)?o.dest[r.name]=Uc(l):o.dest[r.name]=l,r.name!==r.tag&&delete o.dest[r.tag],i}return r.singleVm===null&&Array.isArray(c)&&c.length===1&&typeof c[0]=="object"&&c[0]!==null&&!(c[0]instanceof ArrayBuffer)&&!ArrayBuffer.isView(c[0])?o.dest[r.name]=Uc(c[0]):o.dest[r.name]=c,r.name!==r.tag&&delete o.dest[r.tag],i}}const{metadataLog:_p}=Ip;function Up(t){return Array.isArray(t)&&t||typeof t=="string"&&t.split("\\")||t}const Np=(t,e,n,r)=>{if(!n)return t(e,n,r);const{ImageOrientationPatient:a,ImagePositionPatient:i}=n,{PixelSpacing:o,type:s}=Pp(n);let c,l,u,f,d=!1,g=!1,p=!1,h;o?([c,l]=o,Lc.get("calibratedPixelSpacing",e)||Lc.add(e,{rowPixelSpacing:parseFloat(o[0]),columnPixelSpacing:parseFloat(o[1]),type:s})):(c=l=1,d=!0),a?(h=zr(a)||[1,0,0,0,1,0],u=h.slice(0,3),f=h.slice(3,6)):(u=[1,0,0],f=[0,1,0],h=[1,0,0,0,1,0],d=!0,g=!0,p=!0);const m=zr(i)||[0,0,0];i||(d=!0);const v=zr(c)??null,C=zr(l)??null,y=v!==null&&C!==null?[v,C]:Array.isArray(o)?o.map(S=>Number(S)).filter(Number.isFinite):[],x={frameOfReferenceUID:n.FrameOfReferenceUID,rows:lr(n,"Rows",0),columns:lr(n,"Columns",0),imageOrientationPatient:h,rowCosines:u,columnCosines:f,imagePositionPatient:m,sliceLocation:lr(n,"SliceLocation",0),pixelSpacing:y,rowPixelSpacing:v,sliceThickness:lr(n,"SliceThickness"),spacingBetweenSlices:lr(n,"SpacingBetweenSlices"),columnPixelSpacing:C};return Object.defineProperty(x,"usingDefaultValues",{value:d}),Object.defineProperty(x,"isDefaultValueSetForRowCosine",{value:g}),Object.defineProperty(x,"isDefaultValueSetForColumnCosine",{value:p}),x};function s4(){Re(q.IMAGE_PLANE,Np)}const hr=q.FRAME_IMAGE_IDS,Hn=q.BASE_IMAGE_ID,c4=9e3,l4=8e3,u4=9e3;function f4(t,e){return e}function d4(t,e,n,r){return(t(e,n,r)??e).replace(/\/frames\/\d+(?=(\?|#|$))/i,"")}function g4(t,e,n,r){return(t(e,n,r)??e).replace(/([?&])frame=\d+(&?)/i,(i,o,s)=>o==="?"&&s?"?":"").replace(/\?$/,"").replace(/\?&/,"?").replace(/&&+/g,"&")}function p4(t){return!!Rp(t,"PhotometricInterpretation")}function h4(t,e){const n=t.includes("?")?"&":"?";return`${t}${n}frame=${e}`}function m4(t,e){const n=/\/instances\/[^/]+/i.exec(t);if(!n)return;const r=n.index+n[0].length;return`${t.slice(0,r)}/frames/${e}${t.slice(r)}`}function Fp(t,e){if(!e)return;if(!p4(e))return new Set([t]);const n=new Set,r=Math.floor(lr(e,"NumberOfFrames",1));if(!(!Number.isFinite(r)||r<1)){for(let a=1;a<=r;a++){const i=m4(t,a);if(i){n.add(i);continue}n.add(h4(t,a))}return n}}function v4(t,e,n,r){const a=zs(q.NATURALIZED,e,r);return Fp(e,a)||t(e,n,r)}function Nc(t,e,n,r){const a=pp(q.BASE_IMAGE_ID,e,r);return t(a,n,r)}function C4(){Re(Hn,f4,{priority:0}),Re(Hn,d4,{priority:c4}),Re(Hn,g4,{priority:l4}),Re(hr,v4,{priority:u4})}class Qe{static setCacheDataInternal(e,n,r){let a=this.mapCacheData.get(e);a||(a=new Map,this.mapCacheData.set(e,a)),a.set(n,r),this.clearRelatedDerivedCache(e,n)}static clearRelatedDerivedCache(e,n){const r=this.secondaryTypesByBaseType.get(e);if(!r?.size)return;const a=Yn(hr,n)??new Set([n]);for(const i of a)for(const o of r)this.mapCacheData.get(o)?.delete(i)}static registerSecondaryTypes(e,n){if(!n)return;const r=Array.isArray(n)?n:[n];for(const a of r){let i=this.secondaryTypesByBaseType.get(a);i||(i=new Set,this.secondaryTypesByBaseType.set(a,i)),i.add(e)}}static getCacheData(e,n){return this.mapCacheData.get(e)?.get(n)}static hasCacheData(e,n){return this.mapCacheData.get(e)?.has(n)===!0}static clearCacheData(){this.mapCacheData.clear(),this.secondaryTypesByBaseType.clear(),Ua(hr),Ua(Hn)}static clearTypedCacheData(e,n){const r=this.secondaryTypesByBaseType.get(e),a=this.mapCacheData.get(e);if(n){if(a?.delete(n),r?.size)for(const i of r)this.mapCacheData.get(i)?.delete(n);(e===q.NATURALIZED||r?.size)&&(is(hr,n),is(Hn,n));return}if(a?.clear(),r?.size)for(const i of r)this.mapCacheData.get(i)?.clear();(e===q.NATURALIZED||r?.size)&&(Ua(hr),Ua(Hn))}static fromAsyncLookup(e,n,r,a){if(a?.noCache!==!0&&a?.reCache!==!0){const o=this.getCacheData(e,n);if(o!==void 0)return o}const i=r();if(i!==void 0)return i instanceof Promise?i.then(o=>(o!==void 0&&!a?.noCache&&this.setCacheDataInternal(e,n,o),o)):(a?.noCache||this.setCacheDataInternal(e,n,i),i)}createTypeCacheProvider(e){return kl(e)}clearCacheData(){Qe.clearCacheData()}clearTypedCacheData(e,n){Qe.clearTypedCacheData(e,n)}getCacheData(e,n){return Qe.getCacheData(e,n)}hasCacheData(e,n){return Qe.hasCacheData(e,n)}fromAsyncLookup(e,n,r,a){return Qe.fromAsyncLookup(e,n,r,a)}}Qe.mapCacheData=new Map;Qe.secondaryTypesByBaseType=new Map;class Jr extends Qe{static setCacheData(e,n,r){this.setCacheDataInternal(e,n,r)}setCacheData(e,n,r){Jr.setCacheData(e,n,r)}}function kl(t){return(e,n,r,a)=>Qe.fromAsyncLookup(t,n,()=>e(n,r,a),a)}function Bp(t){const e=Ca(t);return(n,r,a,i)=>{const o=Qe.getCacheData(t,r);if(o!==void 0)return console.warn(`Metadata add skipped for "${t}" at query "${r}" because cache already has a value.`),o;const s=Qe.getCacheData(e,r);if(s!==void 0)return s;const c=n(r,a,i);if(c===void 0)return;if(!(c instanceof Promise))return Jr.setCacheData(t,r,c),c;const l=c.then(u=>(u!==void 0&&Jr.setCacheData(t,r,u),u)).finally(()=>{Qe.clearTypedCacheData(e,r)});return Jr.setCacheData(e,r,l),l}}function y4(){Qe.clearCacheData()}function li(t,e){Qe.clearTypedCacheData(t,e)}function On(t,e){const{secondaryOf:n,...r}=e??{};Qe.registerSecondaryTypes(t,n),Re(t,kl(t),{priority:5e4,clear:li.bind(null,t),clearQuery:li.bind(null,t),...r})}function Gl(t,e){const n=Ca(t),{secondaryOf:r,...a}={};On(t,{secondaryOf:r,...a}),Qe.registerSecondaryTypes(n,t),si(t,Bp(t),{priority:5e4,clear:li.bind(null,n),clearQuery:li.bind(null,n),...a})}function x4(){On(Hn),On(hr),Gl(q.NATURALIZED),On(q.INSTANCE,{secondaryOf:q.NATURALIZED}),On(q.URI_MODULE,{secondaryOf:q.NATURALIZED}),On(q.IMAGE_PLANE,{secondaryOf:q.NATURALIZED}),On(q.FRAME_MODULE,{secondaryOf:q.NATURALIZED}),On(q.GENERAL_IMAGE,{secondaryOf:q.NATURALIZED})}function Ui(t){return(e,n,r,a)=>(r||=zs(t,n,a?.[t]),e(n,r,a))}const ui=Ui(q.INSTANCE),Fc=Ui(q.NATURALIZED),ur={priority:5e3};function S4(){Re(q.INSTANCE,Ui(q.NATURALIZED),ur),Re(q.IMAGE_PLANE,ui,ur),Re(q.CALIBRATION,ui,ur),Re(q.COMPRESSED_FRAME_DATA,Fc,ur),Re(q.SCALING,Fc,ur)}const{AsyncDicomReader:w4}=Gs.async,Cf=6e4,T4=3e4;function I4(t){return t instanceof ArrayBuffer?t:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}async function b4(t){const e=typeof t=="function"?await t():t;if(!(e instanceof ArrayBuffer)&&!(e instanceof Uint8Array))throw new Error("part10 must resolve to ArrayBuffer or Uint8Array");return I4(e)}function kp(t){const e=new n4(t),n=Hs.createMetadataListener();return n.startObject(),e.syncIterator(n),n.pop()}async function Gp(t){const e=await b4(t),n=new w4,r=Hs.createMetadataListener();n.stream.addBuffer(e),n.stream.setComplete(),await n.readFile({listener:r});const a=n.dict,i=n.syntax;return i&&(a.TransferSyntaxUID=Array.isArray(i)?i[0]:i),a}function O4(t,e,n,r){const a=r?.dicomwebJson??r?.metadata;if(a&&typeof a=="object")return kp(a);const i=r?.part10Buffer??r?.part10;return i?Gp(i):t(e,n,r)}function D4(){Re(q.NATURALIZED,Nc,{priority:Cf}),si(q.NATURALIZED,Nc,{priority:Cf}),si(q.NATURALIZED,O4,{priority:T4})}const P4=_p.getLogger("tagModules"),Fr=new Map;function R4(){Fr.clear()}function Wp(t,e="instance"){if(!ci.has(t))throw new Error(`No module found: ${t}`);if(Fr.has(t))return Fr.get(t);e==="instance"?Re(t,ui,{priority:25e3}):e&&Re(t,Ui(e),{priority:25e3});const n=(r,a,i,o)=>{const s=ci.get(t),c=o?.destName||"lowerName";if(!i)return r(a,i,o);const l={};for(const u of s){let f=i[u.name];if(f!==void 0){if(Fr.has(u.name)){P4.debug("Getting nested module",u.name);const d=[];for(const g of f)g&&d.push(Fr.get(u.name)(null,a,g,o?.[u.name]));f=d.length===1?Uc(d[0]):d}l[u[c]]=f}}return l};return Fr.set(t,n),n}const zp={priority:-1e3};function V4(){for(const t of ci.keys()){const e=Wp(t);e&&Re(t,e,zp),Re(t,ui,ur)}}const $p=(t,e,n,r)=>zs(q.NATURALIZED,e,r)||t(e,n,r);function E4(){Re(q.INSTANCE,$p)}function Hp(t,e,n,r){if(!n)return t(e,n,r);if(!n.SequenceOfUltrasoundRegions?.length)return;const{SequenceOfUltrasoundRegions:a}=n,i=[];for(const o of a){const s={};i.push(s);for(const[c,l]of Object.entries(o))s[Nl(c)]=l}return{sequenceOfUltrasoundRegions:i}}function M4(){Re(q.CALIBRATION,Hp)}var Bc=typeof Float32Array<"u"?Float32Array:Array;Math.hypot||(Math.hypot=function(){for(var t=0,e=arguments.length;e--;)t+=arguments[e]*arguments[e];return Math.sqrt(t)});function Na(){var t=new Bc(3);return Bc!=Float32Array&&(t[0]=0,t[1]=0,t[2]=0),t}function oo(t,e,n){var r=new Bc(3);return r[0]=t,r[1]=e,r[2]=n,r}function yf(t,e,n,r){return t[0]=e[0]+n[0]*r,t[1]=e[1]+n[1]*r,t[2]=e[2]+n[2]*r,t}function xf(t,e,n){var r=e[0],a=e[1],i=e[2],o=n[0],s=n[1],c=n[2];return t[0]=a*c-i*s,t[1]=i*o-r*c,t[2]=r*s-a*o,t}(function(){var t=Na();return function(e,n,r,a,i,o){var s,c;for(n||(n=3),r||(r=0),a?c=Math.min(a*n+r,e.length):c=e.length,s=r;s<c;s+=n)t[0]=e[s],t[1]=e[s+1],t[2]=e[s+2],i(t,t,o),e[s]=t[0],e[s+1]=t[1],e[s+2]=t[2];return e}})();const jp=(t,e)=>{const{PerFrameFunctionalGroupsSequence:n,SharedFunctionalGroupsSequence:r,NumberOfFrames:a,ImageType:i}=e;if(a<2)return e;e.ImageType=Up(i);const o=Number.parseInt(t||1),s=e.DetectorInformationSequence&&(!e.ImagePositionPatient||!e.ImageOrientationPatient);if(n&&r||s){!e.ImageOrientationPatient&&e.DetectorInformationSequence&&(e.ImageOrientationPatient=e.DetectorInformationSequence[0].ImageOrientationPatient);const c=e.ImagePositionPatient;let l;if(!e.ImagePositionPatient&&e.DetectorInformationSequence){let d=e.DetectorInformationSequence[0].ImagePositionPatient,g=e.ImageOrientationPatient;d=d?.map(h=>Number(h)),g=g?.map(h=>Number(h));const p=Number(e.SpacingBetweenSlices);if(g&&p){const h=oo(g[0],g[1],g[2]),m=oo(g[3],g[4],g[5]),v=xf(Na(),h,m),C=yf(Na(),d,v,p*(o-1));l=[C[0],C[1],C[2]]}}e._parentInstance||Object.defineProperty(e,"_parentInstance",{value:{...e}});const u=Fa(e._parentInstance,r?.[0],"_shared"),f=Fa(u,n?.[o-1],o);return l?f.ImagePositionPatient=l:!f.ImagePositionPatient&&c?f.ImagePositionPatient=c:f.ImagePositionPatient||(f.ImagePositionPatient=[0,0,o]),Object.defineProperty(f,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),f}if(e.GridFrameOffsetVector){e._parentInstance||Object.defineProperty(e,"_parentInstance",{value:{...e}});const c=Fa(e._parentInstance,r?.[0],"_shared"),l=Fa(c,n?.[o-1],o),u=l.ImagePositionPatient?.map(Number),f=l.ImageOrientationPatient?.map(Number),d=e.GridFrameOffsetVector,g=Number(d[0]),p=Number(d[o-1]);if(u&&f&&!Number.isNaN(p)){const h=ie(f[0],1)&&ie(f[1],0)&&ie(f[2],0)&&ie(f[3],0)&&ie(f[4],1)&&ie(f[5],0),m=ie(g,0);if(h&&ie(g,u[2]))l.ImagePositionPatient=[u[0],u[1],p];else if(m){const C=oo(f[0],f[1],f[2]),y=oo(f[3],f[4],f[5]),x=xf(Na(),C,y),S=yf(Na(),u,x,p);l.ImagePositionPatient=[S[0],S[1],S[2]]}}return Object.defineProperty(l,"frameNumber",{value:o,writable:!0,enumerable:!0,configurable:!0}),l}return e};function Fa(t,e,n){if(t[n])return t[n];const r=Object.create(t);return Object.defineProperty(t,n,{value:r,writable:!1,enumerable:!1}),e&&[...e?Object.values(e).filter(Boolean).map(i=>i[0]).filter(i=>typeof i=="object"):[]].forEach(i=>{i.SOPInstanceUID||Object.entries(i).forEach(([o,s])=>{r[o]=s})}),r}const Kp=(t,e,n,r)=>{if(!n)return t(e,n,r);if(!n.NumberOfFrames)return n;const a=Yn(q.URI_MODULE,e,r?.frameModule),{frameNumber:i=1}=a||{};return jp(i,n)};function A4(){Re(q.INSTANCE,Kp)}const qp=/(\/frames\/|[&?]frameNumber=|[&?]frame=)([^/&?]*)(.*)/i;function Xp(t){const e=t.match(qp);if(!e)return;const n=t.substring(0,e.index),r=e[2],a=parseFloat(r),i=e[3];return{baseImageId:n,frameNumber:a,framesString:r,remaining:i}}function Yp(t,e,n,r){return Xp(e)||t(e,n,r)}function L4(){Re(q.URI_MODULE,Yp)}function _4(t){if(t instanceof ArrayBuffer){const r=t.byteLength;return{view:r<=256?new Uint8Array(t):new Uint16Array(t),byteLength:r}}if(ArrayBuffer.isView(t)){const r=t;return{view:r,byteLength:r.byteLength}}if(Array.isArray(t)){const r=Cp(t);if(r)return{view:r,byteLength:r.byteLength}}if(t!=null&&typeof t=="object"&&"InlineBinary"in t&&typeof t.InlineBinary=="string"){const r=t.InlineBinary,a=atob(r),i=new Uint8Array(a.length);for(let o=0;o<a.length;o++)i[o]=a.charCodeAt(o);return{view:i,byteLength:i.byteLength}}const n=U4(t);throw new Error("Palette color lookup table data could not be normalized: expected ArrayBuffer, ArrayBufferView, or object with InlineBinary string. "+n)}function w0(t,e,n){e[0]||=65536;const r=e[0];e[2];const{view:a,byteLength:i}=_4(t);if(![r,r*2].includes(i)){const c=i===r?a.length:Math.floor(i/2);throw new Error(`Palette color lookup table length mismatch (${n}): descriptor has ${r} entries (expected byteLength ${r} or ${r*2}), but got ${i} bytes (${c} effective entries). This may indicate duplicated or concatenated buffer data from the natural filter.`)}return r===i?a instanceof Uint8Array?a:new Uint8Array(a):a instanceof Uint16Array?a:new Uint16Array(a.buffer,a.byteOffset,a.byteLength/2)}function U4(t){if(t===null)return"Got null.";if(t===void 0)return"Got undefined.";if(typeof t!="object")return`Got primitive: ${typeof t}.`;const e=t,n=e.constructor!=null&&typeof e.constructor=="function"?e.constructor.name:"unknown",r=Object.keys(e),a={};for(const i of r){const o=e[i];o===null?a[i]="null":o===void 0?a[i]="undefined":typeof o=="string"?a[i]=o.length>80?`"${o.slice(0,80)}..." (len=${o.length})`:JSON.stringify(o):Array.isArray(o)?a[i]=`Array(${o.length})${o.length>0?` e.g. ${JSON.stringify(o[0])}`:""}`:o instanceof ArrayBuffer?a[i]=`ArrayBuffer(${o.byteLength})`:ArrayBuffer.isView(o)?a[i]=`${o.constructor?.name??"ArrayBufferView"}(${o.byteLength})`:a[i]=typeof o}return`Got object: constructor=${n}, keys=[${r.join(", ")}], preview=${JSON.stringify(a)}.`}function Zp(t,e,n,r){const a=t(e,n,r);if(!a)return a;const i={...a},{redPaletteColorLookupTableData:o,greenPaletteColorLookupTableData:s,bluePaletteColorLookupTableData:c,pixelPaddingValue:l,pixelPaddingRangeLimit:u,pixelRepresentation:f}=a;if(o!=null&&s!=null&&c!=null&&(i.redPaletteColorLookupTableData=w0(o,i.redPaletteColorLookupTableDescriptor,"red"),i.greenPaletteColorLookupTableData=w0(s,i.greenPaletteColorLookupTableDescriptor,"green"),i.bluePaletteColorLookupTableData=w0(c,i.bluePaletteColorLookupTableDescriptor,"blue")),f==1){l<0&&(i.pixelPaddingValue=l&65535),u<0&&(i.pixelPaddingValue=u&65535);const{smallestPixelValue:d,largestPixelValue:g}=i;d<0&&(i.smallestPixelValue=d&65535),g<0&&(i.largestPixelValue=g&65535)}return i}function N4(){Re(q.IMAGE_PIXEL,Zp)}function Jp(t,e,n,r){const a=t(e,n,r);if(a){const i=a.transferSyntaxUID||a.availableTransferSyntaxUID,o=Fl(i);return{...a,transferSyntaxUID:Array.isArray(i)?i[0]:i,isVideo:o}}}function F4(){Re(q.TRANSFER_SYNTAX,Jp)}async function B4(t,e){return mp(q.NATURALIZED,t,{part10Buffer:e})}function k4(t){const e=atob(t),n=new Uint8Array(e.length);for(let r=0;r<e.length;r++)n[r]=e.charCodeAt(r);return n}function T0(t,e,n,r,a){const i=new Uint8Array(t);if(r===16&&a==="SS"){const o=[],c=2*e*n,l=Math.min(i.length,c);for(let u=0;u<e;u++){const f=new Int16Array(n);o.push(f);let d=0;for(let g=2*u;g<l;g+=2*e){const p=i[g+1],h=i[g],m=p&128;f[d++]=m?4294901760|p<<8|h:p<<8|h}}return o}return[]}function G4(t){const e=new Uint8Array(t),n=new TextEncoder().encode(`\r
|
|
2
2
|
\r
|
|
3
3
|
`);let r=0;const a=1e3;let i=-1;for(let d=0;d<Math.min(e.length-n.length,r+a);d++){let g=!0;for(let p=0;p<n.length;p++)if(e[d+p]!==n[p]){g=!1;break}if(g){i=d;break}}if(i===-1)return[t];const s=new TextDecoder().decode(e.slice(0,i)).match(/boundary=([^\s;]+)/i),c=s?new TextEncoder().encode(`--${s[1].replace(/"/g,"").trim()}`):null;if(!c)return[t];const l=i+n.length,u=[];let f=e.indexOf(c[0],l);for(;f!==-1;){const d=e.indexOf(n[0],f);if(d===-1)break;const g=d+n.length,p=e.indexOf(c[0],g),h=p===-1?e.length:p-2;if(h>g&&u.push(t.slice(g,h)),p===-1)break;f=e.indexOf(c[0],p+c.length)}return u.length>0?u:[t]}function W4(t){const e=t.replace(/^wadors:/i,""),n=e.indexOf("/studies/");if(n===-1)return{};const r=e.substring(0,n),a=e.substring(n+9),i=a.indexOf("/"),o=i!==-1?a.substring(0,i):a;return{wadoRsRoot:r,studyUID:o}}function Bo(t){return t?Array.isArray(t)?t:typeof t.length=="number"?Array.from(t):[t]:[]}function Qp(t,e){const n=t.WaveformSequence,r=Bo(n);if(!r.length)return null;const a=r[0],i=a.NumberOfWaveformChannels??0,o=a.NumberOfWaveformSamples??0,s=a.SamplingFrequency??1,c=a.WaveformBitsAllocated??16,l=a.WaveformSampleInterpretation??"SS",u=a.MultiplexGroupLabel??"",d=Bo(a.ChannelDefinitionSequence).map(C=>({channelSourceSequence:{codeMeaning:Bo(C.ChannelSourceSequence)[0]?.CodeMeaning??""}}));let g=a.WaveformData??a.waveformData;g&&typeof g.length=="number"&&g.length>0&&(g=g[0]);const p=g??{},{wadoRsRoot:h=void 0,studyUID:m=void 0}=e?W4(e):{};return{numberOfWaveformChannels:i,numberOfWaveformSamples:o,samplingFrequency:s,waveformBitsAllocated:c,waveformSampleInterpretation:l,multiplexGroupLabel:u,channelDefinitionSequence:d,waveformData:{retrieveBulkData:async()=>{const C=p;if(C instanceof ArrayBuffer||typeof ArrayBuffer<"u"&&ArrayBuffer.isView&&ArrayBuffer.isView(C))return T0(C,i,o,c,l);if(p.Value)return p.Value;if(p.InlineBinary){const y=k4(p.InlineBinary);return T0(y,i,o,c,l)}if(typeof p.retrieveBulkData=="function")return p.retrieveBulkData();if(p.BulkDataURI){let y=p.BulkDataURI;y.indexOf(":")===-1&&h&&(y=m?`${h}/studies/${m}/${y}`:`${h}/${y}`);const x=await fetch(y),S=await x.arrayBuffer(),O=(x.headers.get("content-type")||"").includes("multipart")?G4(S)[0]:S;return T0(O,i,o,c,l)}throw console.warn("[ecgFromInstance] No waveform data source found. group keys:",Object.keys(a),"waveformData keys:",Object.keys(p)),new Error("[ecgFromInstance] No waveform data source found")}}}}const Sf=4e3,z4=(t,e,n,r)=>{const a=n;return a&&a.WaveformSequence?Qp(a,e)??t(e,n,r):t(e,n,r)},$4=65536,H4=32768,j4=(t,e,n,r)=>{const i=n?.WaveformSequence,o=Bo(i);if(!o.length)return t(e,n,r);const s=o[0],c=s.NumberOfWaveformSamples??0,u=1/((s.SamplingFrequency??1)||1);return{sequenceOfUltrasoundRegions:[{regionLocationMinX0:0,regionLocationMaxX1:c,regionLocationMinY0:0,regionLocationMaxY1:$4-1,referencePixelX0:0,referencePixelY0:H4,physicalDeltaX:u,physicalDeltaY:.001,physicalUnitsXDirection:4,physicalUnitsYDirection:-1,regionDataType:1}]}};function K4(){Re(q.ECG,z4,{priority:Sf}),Re(q.CALIBRATION,j4,{priority:Sf})}function I0(t){if(typeof t=="string")return t;if(t&&typeof t=="object"&&!Array.isArray(t)){const e=t,n=`${e?.hours??"00"}`.padStart(2,"0"),r=`${e?.minutes??"00"}`.padStart(2,"0"),a=`${e?.seconds??"00"}`.padStart(2,"0"),i=`${e?.fractionalSeconds??"000000"}`.padEnd(6,"0");return`${n}${r}${a}.${i}`}return t}function b0(t){if(typeof t=="string")return t;if(t&&typeof t=="object"&&!Array.isArray(t)&&"year"in t){const e=t,n=`${e.month}`.padStart(2,"0"),r=`${e.day}`.padStart(2,"0");return`${e.year}${n}${r}`}return t}function ko(t){if(typeof t=="number"&&!Number.isNaN(t))return t;if(typeof t=="string"){const e=Number(t);return Number.isNaN(e)?void 0:e}}function q4(t){const e=t.RadiopharmaceuticalInfo;if(e==null||typeof e!="object")return;const n=Array.isArray(e)?e[0]:e[0]??e;return n&&typeof n=="object"&&!Array.isArray(n)?n:void 0}function X4(t){if(t.Modality!=="PT")return null;const{SeriesDate:e,SeriesTime:n,AcquisitionDate:r,AcquisitionTime:a,PatientWeight:i,CorrectedImage:o,Units:s,DecayCorrection:c}=t,l=q4(t);if(!l)return null;const u=ko(l.RadionuclideTotalDose),f=ko(l.RadionuclideHalfLife),d=l.RadiopharmaceuticalStartDateTime,g=l.RadiopharmaceuticalStartTime,p=ko(i);if(e===void 0||n===void 0||p===void 0||r===void 0||a===void 0||o===void 0||s===void 0||c===void 0||u===void 0||f===void 0)return null;const m={CorrectedImage:typeof o=="string"?o.split("\\"):(Array.isArray(o),o),Units:s,RadionuclideHalfLife:f,RadionuclideTotalDose:u,DecayCorrection:c,PatientWeight:p,SeriesDate:b0(e),SeriesTime:I0(n),AcquisitionDate:b0(r),AcquisitionTime:I0(a)};return d!==void 0&&(m.RadiopharmaceuticalStartDateTime=b0(d)),g!==void 0&&(m.RadiopharmaceuticalStartTime=I0(g)),t.PatientSex!==void 0&&(m.PatientSex=t.PatientSex),t.PatientSize!==void 0&&(m.PatientSize=t.PatientSize),m}function Y4(t,e,n,r){if(n==null||typeof n!="object")return t(e,n,r);const a=n;if(a.Modality==="RTDOSE"){const i=ko(a.DoseGridScaling),{DoseSummation:o,DoseType:s,DoseUnit:c}=a;if(i!==void 0||o!==void 0||s!==void 0||c!==void 0)return{DoseGridScaling:i,DoseSummation:o,DoseType:s,DoseUnit:c}}if(a.Modality==="PT"){const i=X4(a);if(!i)return t(e,void 0,r);try{return X3([i])[0]??t(e,void 0,r)}catch{return t(e,void 0,r)}}return t(e,void 0,r)}function Z4(){Re(q.SCALING,Y4,{priority:0,isDefault:!0})}function J4(t,e,n,r){const a=r?.displaySet;return a||t(e,n,r)}function Q4(){Gl(q.DISPLAY_SET),si(q.DISPLAY_SET,J4,{priority:4e4})}const e8=Object.freeze(Object.defineProperty({__proto__:null,BASE_IMAGE_ID:Hn,CacheData:Qe,DATA_PRIORITY:ur,FRAME_IMAGE_IDS:hr,MODULE_PRIORITY:zp,WritableCacheData:Jr,addCacheForType:On,addDicomPart10Instance:B4,addWritableCacheForType:Gl,baseImageIdQueryFilter:Nc,buildEcgModuleFromInstance:Qp,calculateRadiographicPixelSpacing:Dp,calibratedPixelSpacingMetadataProvider:Lc,calibrationModuleProvider:Hp,clearCacheData:y4,clearTagModules:R4,clearTypedCacheData:li,combineFrameInstance:jp,combineFrameProvider:Kp,createCombinedValue:Fa,createTypeCacheProvider:kl,createTypeWritableCacheProvider:Bp,dataLookup:Ui,dicomSplit:Up,frameRangeExtractor:qp,generateFrameImageId:Vp,generateFrameImageIdsFromNaturalized:Fp,getERMF:Op,getImagePlaneCalibrated:Np,getNaturalizedField:Bl,getNaturalizedNumber:lr,getNaturalizedString:Rp,getPixelSpacingInformation:Pp,getSingleBufferFromArray:Cp,getUriModule:Xp,handleMultiframe4D:Ep,imageIdToURI:os,instanceLookup:ui,instanceOrigToInstanceProvider:$p,isEqual:ie,isEqualAbs:Fo,isEqualNegative:wp,isNumber:Tp,isVideoTransferSyntax:Fl,metadataLog:_p,naturalLookup:Fc,naturalizeDicomwebMetadata:kp,naturalizePart10Buffer:Gp,pixelDataUpdate:Zp,registerCacheProviders:x4,registerCalibrationModule:M4,registerCombineFrameProvider:A4,registerDataLookup:S4,registerDisplaySetProviders:Q4,registerEcgFromInstanceProvider:K4,registerImageIdProviders:C4,registerImagePlaneCalibrated:s4,registerInstanceFromListener:E4,registerNaturalizedHandlers:D4,registerPixelDataUpdate:N4,registerScalingFromInstanceProvider:Z4,registerTagModules:V4,registerTransferSyntaxProvider:F4,registerUriModule:L4,splitImageIdsBy4DTags:O9,tagModules:Wp,toFiniteNumber:zr,transferSyntaxProvider:Jp,uriModuleProvider:Yp,videoUIDs:bp},Symbol.toStringTag,{value:"Module"})),t8=un;var Ve;(function(t){t.NO_DATA="noData",t.LOADING="loading",t.PRE_RENDER="preRender",t.NEEDS_RENDER="needsRender",t.RESIZE="resize",t.RENDERED="rendered"})(Ve||(Ve={}));var vt;(function(t){t[t.FAR_REPLICATE=1]="FAR_REPLICATE",t[t.ADJACENT_REPLICATE=3]="ADJACENT_REPLICATE",t[t.SUBRESOLUTION=6]="SUBRESOLUTION",t[t.LOSSY=7]="LOSSY",t[t.FULL_RESOLUTION=8]="FULL_RESOLUTION"})(vt||(vt={}));var fi;(function(t){t.FRAME="f",t.SECOND="s"})(fi||(fi={}));const n8=Object.freeze(Object.defineProperty({__proto__:null,get SpeedUnit(){return fi}},Symbol.toStringTag,{value:"Module"})),J=q;var kc;(function(t){t.SUM="SUM",t.SUBTRACT="SUBTRACT",t.AVERAGE="AVERAGE"})(kc||(kc={}));var ss;(function(t){t.RLE="RLE",t.Volume="Volume"})(ss||(ss={}));var di;(function(t){t.Tiled="tiled",t.ContextPool="contextPool"})(di||(di={}));const r8={Auto:"auto",GPU:"gpu",CPU:"cpu"},St=r8;function a8(t,e){if(Object.prototype.hasOwnProperty.call(St,t))throw new Error(`Render backend constant "${String(t)}" already exists`);St[t]=e}const i8=Object.freeze(Object.defineProperty({__proto__:null,BlendModes:Lt,CalibrationTypes:t8,ContourType:B3,DynamicOperatorType:k3,Events:B,get GenerateImageType(){return kc},GeometryType:_t,ImageQualityStatus:vt,InterpolationType:be,MeshType:Pt,MetadataModules:J,OrientationAxis:X,RenderBackends:St,RenderingEngineModeEnum:di,RequestType:ce,VOILUTFunctionType:We,VideoEnums:n8,ViewportStatus:Ve,ViewportType:z,ViewportTypes:ts,VoxelManagerEnum:ss},Symbol.toStringTag,{value:"Module"})),gi={hotIron:{name:"Hot Iron",numOfColors:256,colors:[[0,0,0,255],[2,0,0,255],[4,0,0,255],[6,0,0,255],[8,0,0,255],[10,0,0,255],[12,0,0,255],[14,0,0,255],[16,0,0,255],[18,0,0,255],[20,0,0,255],[22,0,0,255],[24,0,0,255],[26,0,0,255],[28,0,0,255],[30,0,0,255],[32,0,0,255],[34,0,0,255],[36,0,0,255],[38,0,0,255],[40,0,0,255],[42,0,0,255],[44,0,0,255],[46,0,0,255],[48,0,0,255],[50,0,0,255],[52,0,0,255],[54,0,0,255],[56,0,0,255],[58,0,0,255],[60,0,0,255],[62,0,0,255],[64,0,0,255],[66,0,0,255],[68,0,0,255],[70,0,0,255],[72,0,0,255],[74,0,0,255],[76,0,0,255],[78,0,0,255],[80,0,0,255],[82,0,0,255],[84,0,0,255],[86,0,0,255],[88,0,0,255],[90,0,0,255],[92,0,0,255],[94,0,0,255],[96,0,0,255],[98,0,0,255],[100,0,0,255],[102,0,0,255],[104,0,0,255],[106,0,0,255],[108,0,0,255],[110,0,0,255],[112,0,0,255],[114,0,0,255],[116,0,0,255],[118,0,0,255],[120,0,0,255],[122,0,0,255],[124,0,0,255],[126,0,0,255],[128,0,0,255],[130,0,0,255],[132,0,0,255],[134,0,0,255],[136,0,0,255],[138,0,0,255],[140,0,0,255],[142,0,0,255],[144,0,0,255],[146,0,0,255],[148,0,0,255],[150,0,0,255],[152,0,0,255],[154,0,0,255],[156,0,0,255],[158,0,0,255],[160,0,0,255],[162,0,0,255],[164,0,0,255],[166,0,0,255],[168,0,0,255],[170,0,0,255],[172,0,0,255],[174,0,0,255],[176,0,0,255],[178,0,0,255],[180,0,0,255],[182,0,0,255],[184,0,0,255],[186,0,0,255],[188,0,0,255],[190,0,0,255],[192,0,0,255],[194,0,0,255],[196,0,0,255],[198,0,0,255],[200,0,0,255],[202,0,0,255],[204,0,0,255],[206,0,0,255],[208,0,0,255],[210,0,0,255],[212,0,0,255],[214,0,0,255],[216,0,0,255],[218,0,0,255],[220,0,0,255],[222,0,0,255],[224,0,0,255],[226,0,0,255],[228,0,0,255],[230,0,0,255],[232,0,0,255],[234,0,0,255],[236,0,0,255],[238,0,0,255],[240,0,0,255],[242,0,0,255],[244,0,0,255],[246,0,0,255],[248,0,0,255],[250,0,0,255],[252,0,0,255],[254,0,0,255],[255,0,0,255],[255,2,0,255],[255,4,0,255],[255,6,0,255],[255,8,0,255],[255,10,0,255],[255,12,0,255],[255,14,0,255],[255,16,0,255],[255,18,0,255],[255,20,0,255],[255,22,0,255],[255,24,0,255],[255,26,0,255],[255,28,0,255],[255,30,0,255],[255,32,0,255],[255,34,0,255],[255,36,0,255],[255,38,0,255],[255,40,0,255],[255,42,0,255],[255,44,0,255],[255,46,0,255],[255,48,0,255],[255,50,0,255],[255,52,0,255],[255,54,0,255],[255,56,0,255],[255,58,0,255],[255,60,0,255],[255,62,0,255],[255,64,0,255],[255,66,0,255],[255,68,0,255],[255,70,0,255],[255,72,0,255],[255,74,0,255],[255,76,0,255],[255,78,0,255],[255,80,0,255],[255,82,0,255],[255,84,0,255],[255,86,0,255],[255,88,0,255],[255,90,0,255],[255,92,0,255],[255,94,0,255],[255,96,0,255],[255,98,0,255],[255,100,0,255],[255,102,0,255],[255,104,0,255],[255,106,0,255],[255,108,0,255],[255,110,0,255],[255,112,0,255],[255,114,0,255],[255,116,0,255],[255,118,0,255],[255,120,0,255],[255,122,0,255],[255,124,0,255],[255,126,0,255],[255,128,4,255],[255,130,8,255],[255,132,12,255],[255,134,16,255],[255,136,20,255],[255,138,24,255],[255,140,28,255],[255,142,32,255],[255,144,36,255],[255,146,40,255],[255,148,44,255],[255,150,48,255],[255,152,52,255],[255,154,56,255],[255,156,60,255],[255,158,64,255],[255,160,68,255],[255,162,72,255],[255,164,76,255],[255,166,80,255],[255,168,84,255],[255,170,88,255],[255,172,92,255],[255,174,96,255],[255,176,100,255],[255,178,104,255],[255,180,108,255],[255,182,112,255],[255,184,116,255],[255,186,120,255],[255,188,124,255],[255,190,128,255],[255,192,132,255],[255,194,136,255],[255,196,140,255],[255,198,144,255],[255,200,148,255],[255,202,152,255],[255,204,156,255],[255,206,160,255],[255,208,164,255],[255,210,168,255],[255,212,172,255],[255,214,176,255],[255,216,180,255],[255,218,184,255],[255,220,188,255],[255,222,192,255],[255,224,196,255],[255,226,200,255],[255,228,204,255],[255,230,208,255],[255,232,212,255],[255,234,216,255],[255,236,220,255],[255,238,224,255],[255,240,228,255],[255,242,232,255],[255,244,236,255],[255,246,240,255],[255,248,244,255],[255,250,248,255],[255,252,252,255],[255,255,255,255]]},pet:{name:"PET",numColors:256,colors:[[0,0,0,255],[0,2,1,255],[0,4,3,255],[0,6,5,255],[0,8,7,255],[0,10,9,255],[0,12,11,255],[0,14,13,255],[0,16,15,255],[0,18,17,255],[0,20,19,255],[0,22,21,255],[0,24,23,255],[0,26,25,255],[0,28,27,255],[0,30,29,255],[0,32,31,255],[0,34,33,255],[0,36,35,255],[0,38,37,255],[0,40,39,255],[0,42,41,255],[0,44,43,255],[0,46,45,255],[0,48,47,255],[0,50,49,255],[0,52,51,255],[0,54,53,255],[0,56,55,255],[0,58,57,255],[0,60,59,255],[0,62,61,255],[0,65,63,255],[0,67,65,255],[0,69,67,255],[0,71,69,255],[0,73,71,255],[0,75,73,255],[0,77,75,255],[0,79,77,255],[0,81,79,255],[0,83,81,255],[0,85,83,255],[0,87,85,255],[0,89,87,255],[0,91,89,255],[0,93,91,255],[0,95,93,255],[0,97,95,255],[0,99,97,255],[0,101,99,255],[0,103,101,255],[0,105,103,255],[0,107,105,255],[0,109,107,255],[0,111,109,255],[0,113,111,255],[0,115,113,255],[0,117,115,255],[0,119,117,255],[0,121,119,255],[0,123,121,255],[0,125,123,255],[0,128,125,255],[1,126,127,255],[3,124,129,255],[5,122,131,255],[7,120,133,255],[9,118,135,255],[11,116,137,255],[13,114,139,255],[15,112,141,255],[17,110,143,255],[19,108,145,255],[21,106,147,255],[23,104,149,255],[25,102,151,255],[27,100,153,255],[29,98,155,255],[31,96,157,255],[33,94,159,255],[35,92,161,255],[37,90,163,255],[39,88,165,255],[41,86,167,255],[43,84,169,255],[45,82,171,255],[47,80,173,255],[49,78,175,255],[51,76,177,255],[53,74,179,255],[55,72,181,255],[57,70,183,255],[59,68,185,255],[61,66,187,255],[63,64,189,255],[65,63,191,255],[67,61,193,255],[69,59,195,255],[71,57,197,255],[73,55,199,255],[75,53,201,255],[77,51,203,255],[79,49,205,255],[81,47,207,255],[83,45,209,255],[85,43,211,255],[86,41,213,255],[88,39,215,255],[90,37,217,255],[92,35,219,255],[94,33,221,255],[96,31,223,255],[98,29,225,255],[100,27,227,255],[102,25,229,255],[104,23,231,255],[106,21,233,255],[108,19,235,255],[110,17,237,255],[112,15,239,255],[114,13,241,255],[116,11,243,255],[118,9,245,255],[120,7,247,255],[122,5,249,255],[124,3,251,255],[126,1,253,255],[128,0,255,255],[130,2,252,255],[132,4,248,255],[134,6,244,255],[136,8,240,255],[138,10,236,255],[140,12,232,255],[142,14,228,255],[144,16,224,255],[146,18,220,255],[148,20,216,255],[150,22,212,255],[152,24,208,255],[154,26,204,255],[156,28,200,255],[158,30,196,255],[160,32,192,255],[162,34,188,255],[164,36,184,255],[166,38,180,255],[168,40,176,255],[170,42,172,255],[171,44,168,255],[173,46,164,255],[175,48,160,255],[177,50,156,255],[179,52,152,255],[181,54,148,255],[183,56,144,255],[185,58,140,255],[187,60,136,255],[189,62,132,255],[191,64,128,255],[193,66,124,255],[195,68,120,255],[197,70,116,255],[199,72,112,255],[201,74,108,255],[203,76,104,255],[205,78,100,255],[207,80,96,255],[209,82,92,255],[211,84,88,255],[213,86,84,255],[215,88,80,255],[217,90,76,255],[219,92,72,255],[221,94,68,255],[223,96,64,255],[225,98,60,255],[227,100,56,255],[229,102,52,255],[231,104,48,255],[233,106,44,255],[235,108,40,255],[237,110,36,255],[239,112,32,255],[241,114,28,255],[243,116,24,255],[245,118,20,255],[247,120,16,255],[249,122,12,255],[251,124,8,255],[253,126,4,255],[255,128,0,255],[255,130,4,255],[255,132,8,255],[255,134,12,255],[255,136,16,255],[255,138,20,255],[255,140,24,255],[255,142,28,255],[255,144,32,255],[255,146,36,255],[255,148,40,255],[255,150,44,255],[255,152,48,255],[255,154,52,255],[255,156,56,255],[255,158,60,255],[255,160,64,255],[255,162,68,255],[255,164,72,255],[255,166,76,255],[255,168,80,255],[255,170,85,255],[255,172,89,255],[255,174,93,255],[255,176,97,255],[255,178,101,255],[255,180,105,255],[255,182,109,255],[255,184,113,255],[255,186,117,255],[255,188,121,255],[255,190,125,255],[255,192,129,255],[255,194,133,255],[255,196,137,255],[255,198,141,255],[255,200,145,255],[255,202,149,255],[255,204,153,255],[255,206,157,255],[255,208,161,255],[255,210,165,255],[255,212,170,255],[255,214,174,255],[255,216,178,255],[255,218,182,255],[255,220,186,255],[255,222,190,255],[255,224,194,255],[255,226,198,255],[255,228,202,255],[255,230,206,255],[255,232,210,255],[255,234,214,255],[255,236,218,255],[255,238,222,255],[255,240,226,255],[255,242,230,255],[255,244,234,255],[255,246,238,255],[255,248,242,255],[255,250,246,255],[255,252,250,255],[255,255,255,255]]},hotMetalBlue:{name:"Hot Metal Blue",numColors:256,colors:[[0,0,0,255],[0,0,2,255],[0,0,4,255],[0,0,6,255],[0,0,8,255],[0,0,10,255],[0,0,12,255],[0,0,14,255],[0,0,16,255],[0,0,17,255],[0,0,19,255],[0,0,21,255],[0,0,23,255],[0,0,25,255],[0,0,27,255],[0,0,29,255],[0,0,31,255],[0,0,33,255],[0,0,35,255],[0,0,37,255],[0,0,39,255],[0,0,41,255],[0,0,43,255],[0,0,45,255],[0,0,47,255],[0,0,49,255],[0,0,51,255],[0,0,53,255],[0,0,55,255],[0,0,57,255],[0,0,59,255],[0,0,61,255],[0,0,63,255],[0,0,65,255],[0,0,67,255],[0,0,69,255],[0,0,71,255],[0,0,73,255],[0,0,75,255],[0,0,77,255],[0,0,79,255],[0,0,81,255],[0,0,83,255],[0,0,84,255],[0,0,86,255],[0,0,88,255],[0,0,90,255],[0,0,92,255],[0,0,94,255],[0,0,96,255],[0,0,98,255],[0,0,100,255],[0,0,102,255],[0,0,104,255],[0,0,106,255],[0,0,108,255],[0,0,110,255],[0,0,112,255],[0,0,114,255],[0,0,116,255],[0,0,117,255],[0,0,119,255],[0,0,121,255],[0,0,123,255],[0,0,125,255],[0,0,127,255],[0,0,129,255],[0,0,131,255],[0,0,133,255],[0,0,135,255],[0,0,137,255],[0,0,139,255],[0,0,141,255],[0,0,143,255],[0,0,145,255],[0,0,147,255],[0,0,149,255],[0,0,151,255],[0,0,153,255],[0,0,155,255],[0,0,157,255],[0,0,159,255],[0,0,161,255],[0,0,163,255],[0,0,165,255],[0,0,167,255],[3,0,169,255],[6,0,171,255],[9,0,173,255],[12,0,175,255],[15,0,177,255],[18,0,179,255],[21,0,181,255],[24,0,183,255],[26,0,184,255],[29,0,186,255],[32,0,188,255],[35,0,190,255],[38,0,192,255],[41,0,194,255],[44,0,196,255],[47,0,198,255],[50,0,200,255],[52,0,197,255],[55,0,194,255],[57,0,191,255],[59,0,188,255],[62,0,185,255],[64,0,182,255],[66,0,179,255],[69,0,176,255],[71,0,174,255],[74,0,171,255],[76,0,168,255],[78,0,165,255],[81,0,162,255],[83,0,159,255],[85,0,156,255],[88,0,153,255],[90,0,150,255],[93,2,144,255],[96,4,138,255],[99,6,132,255],[102,8,126,255],[105,9,121,255],[108,11,115,255],[111,13,109,255],[114,15,103,255],[116,17,97,255],[119,19,91,255],[122,21,85,255],[125,23,79,255],[128,24,74,255],[131,26,68,255],[134,28,62,255],[137,30,56,255],[140,32,50,255],[143,34,47,255],[146,36,44,255],[149,38,41,255],[152,40,38,255],[155,41,35,255],[158,43,32,255],[161,45,29,255],[164,47,26,255],[166,49,24,255],[169,51,21,255],[172,53,18,255],[175,55,15,255],[178,56,12,255],[181,58,9,255],[184,60,6,255],[187,62,3,255],[190,64,0,255],[194,66,0,255],[198,68,0,255],[201,70,0,255],[205,72,0,255],[209,73,0,255],[213,75,0,255],[217,77,0,255],[221,79,0,255],[224,81,0,255],[228,83,0,255],[232,85,0,255],[236,87,0,255],[240,88,0,255],[244,90,0,255],[247,92,0,255],[251,94,0,255],[255,96,0,255],[255,98,3,255],[255,100,6,255],[255,102,9,255],[255,104,12,255],[255,105,15,255],[255,107,18,255],[255,109,21,255],[255,111,24,255],[255,113,26,255],[255,115,29,255],[255,117,32,255],[255,119,35,255],[255,120,38,255],[255,122,41,255],[255,124,44,255],[255,126,47,255],[255,128,50,255],[255,130,53,255],[255,132,56,255],[255,134,59,255],[255,136,62,255],[255,137,65,255],[255,139,68,255],[255,141,71,255],[255,143,74,255],[255,145,76,255],[255,147,79,255],[255,149,82,255],[255,151,85,255],[255,152,88,255],[255,154,91,255],[255,156,94,255],[255,158,97,255],[255,160,100,255],[255,162,103,255],[255,164,106,255],[255,166,109,255],[255,168,112,255],[255,169,115,255],[255,171,118,255],[255,173,121,255],[255,175,124,255],[255,177,126,255],[255,179,129,255],[255,181,132,255],[255,183,135,255],[255,184,138,255],[255,186,141,255],[255,188,144,255],[255,190,147,255],[255,192,150,255],[255,194,153,255],[255,196,156,255],[255,198,159,255],[255,200,162,255],[255,201,165,255],[255,203,168,255],[255,205,171,255],[255,207,174,255],[255,209,176,255],[255,211,179,255],[255,213,182,255],[255,215,185,255],[255,216,188,255],[255,218,191,255],[255,220,194,255],[255,222,197,255],[255,224,200,255],[255,226,203,255],[255,228,206,255],[255,229,210,255],[255,231,213,255],[255,233,216,255],[255,235,219,255],[255,237,223,255],[255,239,226,255],[255,240,229,255],[255,242,232,255],[255,244,236,255],[255,246,239,255],[255,248,242,255],[255,250,245,255],[255,251,249,255],[255,253,252,255],[255,255,255,255]]},pet20Step:{name:"PET 20 Step",numColors:256,colors:[[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[0,0,0,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[96,0,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,80,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[48,48,112,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[80,80,128,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[96,96,176,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[112,112,192,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[128,128,224,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,96,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[48,144,48,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[80,192,80,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[64,224,64,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[224,224,80,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,208,96,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,176,64,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[208,144,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[192,96,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[176,48,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,0,0,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255],[255,255,255,255]]},gray:{name:"Gray",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,1,1]]}},jet:{name:"Jet",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.35,0,0],[.66,1,1],[.89,1,1],[1,.5,.5]],green:[[0,0,0],[.125,0,0],[.375,1,1],[.64,1,1],[.91,0,0],[1,0,0]],blue:[[0,.5,.5],[.11,1,1],[.34,1,1],[.65,0,0],[1,0,0]]}},hsv:{name:"HSV",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[.15873,1,1],[.174603,.96875,.96875],[.333333,.03125,.03125],[.349206,0,0],[.666667,0,0],[.68254,.03125,.03125],[.84127,.96875,.96875],[.857143,1,1],[1,1,1]],green:[[0,0,0],[.15873,.9375,.9375],[.174603,1,1],[.507937,1,1],[.666667,.0625,.0625],[.68254,0,0],[1,0,0]],blue:[[0,0,0],[.333333,0,0],[.349206,.0625,.0625],[.507937,1,1],[.84127,1,1],[.857143,.9375,.9375],[1,.09375,.09375]]}},hot:{name:"Hot",numColors:256,gamma:1,segmentedData:{red:[[0,.0416,.0416],[.365079,1,1],[1,1,1]],green:[[0,0,0],[.365079,0,0],[.746032,1,1],[1,1,1]],blue:[[0,0,0],[.746032,0,0],[1,1,1]]}},cool:{name:"Cool",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,1,1],[1,0,0]],blue:[[0,1,1],[1,1,1]]}},spring:{name:"Spring",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,0,0]]}},summer:{name:"Summer",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,1,1]],green:[[0,.5,.5],[1,1,1]],blue:[[0,.4,.4],[1,.4,.4]]}},autumn:{name:"Autumn",numColors:256,gamma:1,segmentedData:{red:[[0,1,1],[1,1,1]],green:[[0,0,0],[1,1,1]],blue:[[0,0,0],[1,0,0]]}},winter:{name:"Winter",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[1,0,0]],green:[[0,0,0],[1,1,1]],blue:[[0,1,1],[1,.5,.5]]}},bone:{name:"Bone",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.746032,.652778,.652778],[1,1,1]],green:[[0,0,0],[.365079,.319444,.319444],[.746032,.777778,.777778],[1,1,1]],blue:[[0,0,0],[.365079,.444444,.444444],[1,1,1]]}},copper:{name:"Copper",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.809524,1,1],[1,1,1]],green:[[0,0,0],[1,.7812,.7812]],blue:[[0,0,0],[1,.4975,.4975]]}},spectral:{name:"Spectral",numColors:256,gamma:1,segmentedData:{red:[[0,0,0],[.05,.4667,.4667],[.1,.5333,.5333],[.15,0,0],[.2,0,0],[.25,0,0],[.3,0,0],[.35,0,0],[.4,0,0],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,.7333,.7333],[.7,.9333,.9333],[.75,1,1],[.8,1,1],[.85,1,1],[.9,.8667,.8667],[.95,.8,.8],[1,.8,.8]],green:[[0,0,0],[.05,0,0],[.1,0,0],[.15,0,0],[.2,0,0],[.25,.4667,.4667],[.3,.6,.6],[.35,.6667,.6667],[.4,.6667,.6667],[.45,.6,.6],[.5,.7333,.7333],[.55,.8667,.8667],[.6,1,1],[.65,1,1],[.7,.9333,.9333],[.75,.8,.8],[.8,.6,.6],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]],blue:[[0,0,0],[.05,.5333,.5333],[.1,.6,.6],[.15,.6667,.6667],[.2,.8667,.8667],[.25,.8667,.8667],[.3,.8667,.8667],[.35,.6667,.6667],[.4,.5333,.5333],[.45,0,0],[.5,0,0],[.55,0,0],[.6,0,0],[.65,0,0],[.7,0,0],[.75,0,0],[.8,0,0],[.85,0,0],[.9,0,0],[.95,0,0],[1,.8,.8]]}},coolwarm:{name:"CoolWarm",numColors:256,gamma:1,segmentedData:{red:[[0,.2298057,.2298057],[.03125,.26623388,.26623388],[.0625,.30386891,.30386891],[.09375,.342804478,.342804478],[.125,.38301334,.38301334],[.15625,.424369608,.424369608],[.1875,.46666708,.46666708],[.21875,.509635204,.509635204],[.25,.552953156,.552953156],[.28125,.596262162,.596262162],[.3125,.639176211,.639176211],[.34375,.681291281,.681291281],[.375,.722193294,.722193294],[.40625,.761464949,.761464949],[.4375,.798691636,.798691636],[.46875,.833466556,.833466556],[.5,.865395197,.865395197],[.53125,.897787179,.897787179],[.5625,.924127593,.924127593],[.59375,.944468518,.944468518],[.625,.958852946,.958852946],[.65625,.96732803,.96732803],[.6875,.969954137,.969954137],[.71875,.966811177,.966811177],[.75,.958003065,.958003065],[.78125,.943660866,.943660866],[.8125,.923944917,.923944917],[.84375,.89904617,.89904617],[.875,.869186849,.869186849],[.90625,.834620542,.834620542],[.9375,.795631745,.795631745],[.96875,.752534934,.752534934],[1,.705673158,.705673158]],green:[[0,.298717966,.298717966],[.03125,.353094838,.353094838],[.0625,.406535296,.406535296],[.09375,.458757618,.458757618],[.125,.50941904,.50941904],[.15625,.558148092,.558148092],[.1875,.604562568,.604562568],[.21875,.648280772,.648280772],[.25,.688929332,.688929332],[.28125,.726149107,.726149107],[.3125,.759599947,.759599947],[.34375,.788964712,.788964712],[.375,.813952739,.813952739],[.40625,.834302879,.834302879],[.4375,.849786142,.849786142],[.46875,.860207984,.860207984],[.5,.86541021,.86541021],[.53125,.848937047,.848937047],[.5625,.827384882,.827384882],[.59375,.800927443,.800927443],[.625,.769767752,.769767752],[.65625,.734132809,.734132809],[.6875,.694266682,.694266682],[.71875,.650421156,.650421156],[.75,.602842431,.602842431],[.78125,.551750968,.551750968],[.8125,.49730856,.49730856],[.84375,.439559467,.439559467],[.875,.378313092,.378313092],[.90625,.312874446,.312874446],[.9375,.24128379,.24128379],[.96875,.157246067,.157246067],[1,.01555616,.01555616]],blue:[[0,.753683153,.753683153],[.03125,.801466763,.801466763],[.0625,.84495867,.84495867],[.09375,.883725899,.883725899],[.125,.917387822,.917387822],[.15625,.945619588,.945619588],[.1875,.968154911,.968154911],[.21875,.98478814,.98478814],[.25,.995375608,.995375608],[.28125,.999836203,.999836203],[.3125,.998151185,.998151185],[.34375,.990363227,.990363227],[.375,.976574709,.976574709],[.40625,.956945269,.956945269],[.4375,.931688648,.931688648],[.46875,.901068838,.901068838],[.5,.865395561,.865395561],[.53125,.820880546,.820880546],[.5625,.774508472,.774508472],[.59375,.726736146,.726736146],[.625,.678007945,.678007945],[.65625,.628751763,.628751763],[.6875,.579375448,.579375448],[.71875,.530263762,.530263762],[.75,.481775914,.481775914],[.78125,.434243684,.434243684],[.8125,.387970225,.387970225],[.84375,.343229596,.343229596],[.875,.300267182,.300267182],[.90625,.259301199,.259301199],[.9375,.220525627,.220525627],[.96875,.184115123,.184115123],[1,.150232812,.150232812]]}},blues:{name:"Blues",numColors:256,gamma:1,segmentedData:{red:[[0,.9686274528503418,.9686274528503418],[.125,.8705882430076599,.8705882430076599],[.25,.7764706015586853,.7764706015586853],[.375,.6196078658103943,.6196078658103943],[.5,.41960784792900085,.41960784792900085],[.625,.25882354378700256,.25882354378700256],[.75,.12941177189350128,.12941177189350128],[.875,.0313725508749485,.0313725508749485],[1,.0313725508749485,.0313725508749485]],green:[[0,.9843137264251709,.9843137264251709],[.125,.9215686321258545,.9215686321258545],[.25,.8588235378265381,.8588235378265381],[.375,.7921568751335144,.7921568751335144],[.5,.6823529601097107,.6823529601097107],[.625,.572549045085907,.572549045085907],[.75,.4431372582912445,.4431372582912445],[.875,.3176470696926117,.3176470696926117],[1,.1882352977991104,.1882352977991104]],blue:[[0,1,1],[.125,.9686274528503418,.9686274528503418],[.25,.9372549057006836,.9372549057006836],[.375,.8823529481887817,.8823529481887817],[.5,.8392156958580017,.8392156958580017],[.625,.7764706015586853,.7764706015586853],[.75,.7098039388656616,.7098039388656616],[.875,.6117647290229797,.6117647290229797],[1,.41960784792900085,.41960784792900085]]}}},Se={MINIMUM_SLAB_THICKNESS:.05,MAXIMUM_RAY_DISTANCE:1e6};Object.freeze(Se);const Be=.001;function e1(t){const e=Object.getOwnPropertyNames(t);for(const n of e){const r=t[n];r&&typeof r=="object"&&e1(r)}return Object.freeze(t)}const o8={axial:{viewPlaneNormal:[0,0,-1],viewUp:[0,-1,0],viewRight:[1,0,0]},sagittal:{viewPlaneNormal:[1,0,0],viewUp:[0,0,1],viewRight:[0,1,0]},coronal:{viewPlaneNormal:[0,-1,0],viewUp:[0,0,1],viewRight:[1,0,0]}},Ct=e1(o8),Wl=[{name:"CT-AAA",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 143.556 0 166.222 0.686275 214.389 0.696078 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 143.556 0.615686 0.356863 0.184314 166.222 0.882353 0.603922 0.290196 214.389 1 1 1 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-AAA2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"16 -3024 0 129.542 0 145.244 0.166667 157.02 0.5 169.918 0.627451 395.575 0.8125 1578.73 0.8125 3071 0.8125",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"32 -3024 0 0 0 129.542 0.54902 0.25098 0.14902 145.244 0.6 0.627451 0.843137 157.02 0.890196 0.47451 0.6 169.918 0.992157 0.870588 0.392157 395.575 1 0.886275 0.658824 1578.73 1 0.829256 0.957922 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -16.4458 0 641.385 0.715686 3071 0.705882",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -16.4458 0.729412 0.254902 0.301961 641.385 0.905882 0.815686 0.552941 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Bones",gradientOpacity:"4 0 1 985.12 1",specularPower:"1",scalarOpacity:"8 -1000 0 152.19 0 278.93 0.190476 952 0.2",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -1000 0.3 0.3 1 -488 0.3 1 0.3 463.28 1 0 0 659.15 1 0.912535 0.0374849 953 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-Cardiac",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 -77.6875 0 94.9518 0.285714 179.052 0.553571 260.439 0.848214 3071 0.875",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 -77.6875 0.54902 0.25098 0.14902 94.9518 0.882353 0.603922 0.290196 179.052 1 0.937033 0.954531 260.439 0.615686 0 0 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac2",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"12 -3024 0 42.8964 0 163.488 0.428571 277.642 0.776786 1587 0.754902 3071 0.754902",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"24 -3024 0 0 0 42.8964 0.54902 0.25098 0.14902 163.488 0.917647 0.639216 0.0588235 277.642 1 0.878431 0.623529 1587 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cardiac3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -3024 0 -86.9767 0 45.3791 0.169643 139.919 0.589286 347.907 0.607143 1224.16 0.607143 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -3024 0 0 0 -86.9767 0 0.25098 1 45.3791 1 0 0 139.919 1 0.894893 0.894893 347.907 1 1 0.25098 1224.16 1 1 1 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Contrast-Enhanced",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 67.0106 0 251.105 0.446429 439.291 0.625 3071 0.616071",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 67.0106 0.54902 0.25098 0.14902 251.105 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Chest-Vessels",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -3024 0 -1278.35 0 22.8277 0.428571 439.291 0.625 3071 0.616071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"20 -3024 0 0 0 -1278.35 0.54902 0.25098 0.14902 22.8277 0.882353 0.603922 0.290196 439.291 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 136.47 0 159.215 0.258929 318.43 0.571429 478.693 0.776786 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 136.47 0 0 0 159.215 0.159804 0.159804 0.159804 318.43 0.764706 0.764706 0.764706 478.693 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-2",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 142.677 0 145.016 0.116071 192.174 0.5625 217.24 0.776786 384.347 0.830357 3661 0.830357",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 142.677 0 0 0 145.016 0.615686 0 0.0156863 192.174 0.909804 0.454902 0 217.24 0.972549 0.807843 0.611765 384.347 0.909804 0.909804 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Coronary-Arteries-3",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"14 -2048 0 128.643 0 129.982 0.0982143 173.636 0.669643 255.884 0.857143 584.878 0.866071 3661 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"28 -2048 0 0 0 128.643 0 0 0 129.982 0.615686 0 0.0156863 173.636 0.909804 0.454902 0 255.884 0.886275 0.886275 0.886275 584.878 0.968627 0.968627 0.968627 3661 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Cropped-Volume-Bone",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -451 0 -450 1 1050 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -451 0 0 0 -450 0.0556356 0.0556356 0.0556356 1050 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Fat",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"14 -1000 0 -100 0 -99 0.15 -60 0.15 -59 0 101.2 0 952 0",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"36 -1000 0.3 0.3 1 -497.5 0.3 1 0.3 -99 0 0 1 -76.946 0 1 0 -65.481 0.835431 0.888889 0.0165387 83.89 1 0 0 463.28 1 0 0 659.15 1 0.912535 0.0374849 2952 1 0.300267 0.299886",diffuse:"1",interpolation:"1"},{name:"CT-Liver-Vasculature",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 149.113 0 157.884 0.482143 339.96 0.660714 388.526 0.830357 1197.95 0.839286 3661 0.848214",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 149.113 0 0 0 157.884 0.501961 0.25098 0 339.96 0.695386 0.59603 0.36886 388.526 0.854902 0.85098 0.827451 1197.95 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Lung",gradientOpacity:"6 0 1 985.12 1 988 1",specularPower:"1",scalarOpacity:"12 -1000 0 -600 0 -599 0.15 -400 0.15 -399 0 2952 0",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -1000 0.3 0.3 1 -600 0 0 1 -530 0.134704 0.781726 0.0724558 -460 0.929244 1 0.109473 -400 0.888889 0.254949 0.0240258 2952 1 0.3 0.3",diffuse:"1",interpolation:"1"},{name:"CT-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0 -637.62 0 700 1 3071 1",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 0 0 0 -637.62 1 1 1 700 1 1 1 3071 1 1 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Muscle",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"10 -3024 0 -155.407 0 217.641 0.676471 419.736 0.833333 3071 0.803922",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"20 -3024 0 0 0 -155.407 0.54902 0.25098 0.14902 217.641 0.882353 0.603922 0.290196 419.736 1 0.937033 0.954531 3071 0.827451 0.658824 1",diffuse:"0.9",interpolation:"1"},{name:"CT-Pulmonary-Arteries",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"14 -2048 0 -568.625 0 -364.081 0.0714286 -244.813 0.401786 18.2775 0.607143 447.798 0.830357 3592.73 0.839286",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"28 -2048 0 0 0 -568.625 0 0 0 -364.081 0.396078 0.301961 0.180392 -244.813 0.611765 0.352941 0.0705882 18.2775 0.843137 0.0156863 0.156863 447.798 0.752941 0.752941 0.752941 3592.73 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Soft-Tissue",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"10 -2048 0 -167.01 0 -160 1 240 1 3661 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"20 -2048 0 0 0 -167.01 0 0 0 -160 0.0556356 0.0556356 0.0556356 240 1 1 1 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"CT-Air",gradientOpacity:"4 0 1 255 1",specularPower:"10",scalarOpacity:"8 -3024 0.705882 -900.0 0.715686 -500.0 0 3071 0",specular:"0.2",shade:"1",ambient:"0.1",colorTransfer:"16 -3024 1 1 1 -900.0 0.2 1.0 1.0 -500.0 0.3 0.3 1.0 3071 0 0 0 ",diffuse:"0.9",interpolation:"1"},{name:"MR-Angio",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 -2048 0 151.354 0 158.279 0.4375 190.112 0.580357 200.873 0.732143 3661 0.741071",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 -2048 0 0 0 151.354 0 0 0 158.279 0.74902 0.376471 0 190.112 1 0.866667 0.733333 200.873 0.937255 0.937255 0.937255 3661 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-Default",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"12 0 0 20 0 40 0.15 120 0.3 220 0.375 1024 0.5",specular:"0",shade:"1",ambient:"0.2",colorTransfer:"24 0 0 0 0 20 0.168627 0 0 40 0.403922 0.145098 0.0784314 120 0.780392 0.607843 0.380392 220 0.847059 0.835294 0.788235 1024 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-MIP",gradientOpacity:"4 0 1 255 1",specularPower:"1",scalarOpacity:"8 0 0 98.3725 0 416.637 1 2800 1",specular:"0",shade:"0",ambient:"0.2",colorTransfer:"16 0 1 1 1 98.3725 1 1 1 416.637 1 1 1 2800 1 1 1",diffuse:"1",interpolation:"1"},{name:"MR-T2-Brain",gradientOpacity:"4 0 1 160.25 1",specularPower:"40",scalarOpacity:"10 0 0 36.05 0 218.302 0.171429 412.406 1 641 1",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"16 0 0 0 0 98.7223 0.956863 0.839216 0.192157 412.406 0 0.592157 0.807843 641 1 1 1",diffuse:"0.6",interpolation:"1"},{name:"DTI-FA-Brain",gradientOpacity:"4 0 1 0.9950 1",specularPower:"40",scalarOpacity:"16 0 0 0 0 0.3501 0.0158 0.49379 0.7619 0.6419 1 0.9920 1 0.9950 0 0.9950 0",specular:"0.5",shade:"1",ambient:"0.3",colorTransfer:"28 0 1 0 0 0 1 0 0 0.24974 0.4941 1 0 0.49949 0 0.9882 1 0.7492 0.51764 0 1 0.9950 1 0 0 0.9950 1 0 0",diffuse:"0.9",interpolation:"1"}],s8={slicer3D:[160/255,164/255,217/255]},c8=Object.freeze(Object.defineProperty({__proto__:null,BACKGROUND_COLORS:s8,CPU_COLORMAPS:gi,EPSILON:Be,MPR_CAMERA_VALUES:Ct,RENDERING_DEFAULTS:Se,VIEWPORT_PRESETS:Wl},Symbol.toStringTag,{value:"Module"})),Oa={},Rt={get:t=>Oa[t],set:t=>{const e=t.id;Oa[e]=t},delete:t=>delete Oa[t],getAll:()=>{const e=Object.keys(Oa).map(n=>Oa[n]);return e.sort((n,r)=>n.id[0]==="_"&&r.id[0]!=="_"?1:n.id[0]!=="_"&&r.id[0]==="_"?-1:0),e}};function l8(t){return Rt.get(t)}function zl(){return Rt.getAll()}const cs=t=>t&&typeof t=="object"&&Object.prototype.toString.call(t)!=="[object RegExp]"&&Object.prototype.toString.call(t)!=="[object Date]",u8=t=>Array.isArray(t)?[]:{},pi=(t,e)=>e&&e.clone===!0&&cs(t)?js(u8(t),t,e):t,wf=(t,e,n)=>{const r=t.slice();return e.forEach(function(a,i){typeof r[i]>"u"?r[i]=pi(a,n):cs(a)?r[i]=js(t[i],a,n):t.indexOf(a)===-1&&(r[i]=pi(a,n))}),r},f8=(t,e,n)=>{const r={};return cs(t)&&Object.keys(t).forEach(function(a){r[a]=pi(t[a],n)}),Object.keys(e).forEach(function(a){!cs(e[a])||!t[a]?r[a]=pi(e[a],n):r[a]=js(t[a],e[a],n)}),r},js=(t={},e={},n=void 0)=>{const r=Array.isArray(e),i=(n||{arrayMerge:wf}).arrayMerge||wf;return r?Array.isArray(t)?i(t,e,n):pi(e,n):f8(t,e,n)};const t1=Symbol("Comlink.proxy"),d8=Symbol("Comlink.endpoint"),n1=Symbol("Comlink.releaseProxy"),O0=Symbol("Comlink.finalizer"),Go=Symbol("Comlink.thrown"),r1=t=>typeof t=="object"&&t!==null||typeof t=="function",g8={canHandle:t=>r1(t)&&t[t1],serialize(t){const{port1:e,port2:n}=new MessageChannel;return i1(t,e),[n,[n]]},deserialize(t){return t.start(),Gc(t)}},p8={canHandle:t=>r1(t)&&Go in t,serialize({value:t}){let e;return t instanceof Error?e={isError:!0,value:{message:t.message,name:t.name,stack:t.stack}}:e={isError:!1,value:t},[e,[]]},deserialize(t){throw t.isError?Object.assign(new Error(t.value.message),t.value):t.value}},a1=new Map([["proxy",g8],["throw",p8]]);function h8(t,e){for(const n of t)if(e===n||n==="*"||n instanceof RegExp&&n.test(e))return!0;return!1}function i1(t,e=globalThis,n=["*"]){e.addEventListener("message",function r(a){if(!a||!a.data)return;if(!h8(n,a.origin)){console.warn(`Invalid origin '${a.origin}' for comlink proxy`);return}const{id:i,type:o,path:s}=Object.assign({path:[]},a.data),c=(a.data.argumentList||[]).map(fr);let l;try{const u=s.slice(0,-1).reduce((d,g)=>d[g],t),f=s.reduce((d,g)=>d[g],t);switch(o){case"GET":l=f;break;case"SET":u[s.slice(-1)[0]]=fr(a.data.value),l=!0;break;case"APPLY":l=f.apply(u,c);break;case"CONSTRUCT":{const d=new f(...c);l=l1(d)}break;case"ENDPOINT":{const{port1:d,port2:g}=new MessageChannel;i1(t,g),l=x8(d,[d])}break;case"RELEASE":l=void 0;break;default:return}}catch(u){l={value:u,[Go]:0}}Promise.resolve(l).catch(u=>({value:u,[Go]:0})).then(u=>{const[f,d]=fs(u);e.postMessage(Object.assign(Object.assign({},f),{id:i}),d),o==="RELEASE"&&(e.removeEventListener("message",r),o1(e),O0 in t&&typeof t[O0]=="function"&&t[O0]())}).catch(u=>{const[f,d]=fs({value:new TypeError("Unserializable return value"),[Go]:0});e.postMessage(Object.assign(Object.assign({},f),{id:i}),d)})}),e.start&&e.start()}function m8(t){return t.constructor.name==="MessagePort"}function o1(t){m8(t)&&t.close()}function Gc(t,e){const n=new Map;return t.addEventListener("message",function(a){const{data:i}=a;if(!i||!i.id)return;const o=n.get(i.id);if(o)try{o(i)}finally{n.delete(i.id)}}),Wc(t,n,[],e)}function so(t){if(t)throw new Error("Proxy has been released and is not useable")}function s1(t){return Br(t,new Map,{type:"RELEASE"}).then(()=>{o1(t)})}const ls=new WeakMap,us="FinalizationRegistry"in globalThis&&new FinalizationRegistry(t=>{const e=(ls.get(t)||0)-1;ls.set(t,e),e===0&&s1(t)});function v8(t,e){const n=(ls.get(e)||0)+1;ls.set(e,n),us&&us.register(t,e,t)}function C8(t){us&&us.unregister(t)}function Wc(t,e,n=[],r=function(){}){let a=!1;const i=new Proxy(r,{get(o,s){if(so(a),s===n1)return()=>{C8(i),s1(t),e.clear(),a=!0};if(s==="then"){if(n.length===0)return{then:()=>i};const c=Br(t,e,{type:"GET",path:n.map(l=>l.toString())}).then(fr);return c.then.bind(c)}return Wc(t,e,[...n,s])},set(o,s,c){so(a);const[l,u]=fs(c);return Br(t,e,{type:"SET",path:[...n,s].map(f=>f.toString()),value:l},u).then(fr)},apply(o,s,c){so(a);const l=n[n.length-1];if(l===d8)return Br(t,e,{type:"ENDPOINT"}).then(fr);if(l==="bind")return Wc(t,e,n.slice(0,-1));const[u,f]=Tf(c);return Br(t,e,{type:"APPLY",path:n.map(d=>d.toString()),argumentList:u},f).then(fr)},construct(o,s){so(a);const[c,l]=Tf(s);return Br(t,e,{type:"CONSTRUCT",path:n.map(u=>u.toString()),argumentList:c},l).then(fr)}});return v8(i,t),i}function y8(t){return Array.prototype.concat.apply([],t)}function Tf(t){const e=t.map(fs);return[e.map(n=>n[0]),y8(e.map(n=>n[1]))]}const c1=new WeakMap;function x8(t,e){return c1.set(t,e),t}function l1(t){return Object.assign(t,{[t1]:!0})}function fs(t){for(const[e,n]of a1)if(n.canHandle(t)){const[r,a]=n.serialize(t);return[{type:"HANDLER",name:e,value:r},a]}return[{type:"RAW",value:t},c1.get(t)||[]]}function fr(t){switch(t.type){case"HANDLER":return a1.get(t.name).deserialize(t.value);case"RAW":return t.value}}function Br(t,e,n,r){return new Promise(a=>{const i=S8();e.set(i,a),t.start&&t.start(),t.postMessage(Object.assign({id:i},n),r)})}function S8(){return new Array(4).fill(0).map(()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16)).join("-")}function it(){return typeof crypto.randomUUID=="function"?crypto.randomUUID():("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^crypto.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}class $l{constructor(e){this.numRequests={[ce.Interaction]:0,[ce.Thumbnail]:0,[ce.Prefetch]:0,[ce.Compute]:0},this.id=e||it(),this.requestPool={[ce.Interaction]:{0:[]},[ce.Thumbnail]:{0:[]},[ce.Prefetch]:{0:[]},[ce.Compute]:{0:[]}},this.grabDelay=5,this.awake=!1,this.numRequests={[ce.Interaction]:0,[ce.Thumbnail]:0,[ce.Prefetch]:0,[ce.Compute]:0},this.maxNumRequests={[ce.Interaction]:6,[ce.Thumbnail]:6,[ce.Prefetch]:5,[ce.Compute]:1e3}}setMaxSimultaneousRequests(e,n){this.maxNumRequests[e]=n}getMaxSimultaneousRequests(e){return this.maxNumRequests[e]}destroy(){this.timeoutHandle&&window.clearTimeout(this.timeoutHandle)}addRequest(e,n,r,a=0){const i={requestFn:e,type:n,additionalDetails:r};this.requestPool[n][a]===void 0&&(this.requestPool[n][a]=[]),this.requestPool[n][a].push(i),this.startGrabbing()}filterRequests(e){Object.keys(this.requestPool).forEach(n=>{const r=this.requestPool[n];Object.keys(r).forEach(a=>{r[a]=r[a].filter(i=>e(i))})})}clearRequestStack(e){if(!this.requestPool[e])throw new Error(`No category for the type ${e} found`);this.requestPool[e]={0:[]}}sendRequests(e){const n=this.maxNumRequests[e]-this.numRequests[e];let r=0;for(let a=0;a<n;a++){const i=this.getNextRequest(e);if(i===null)return!1;if(i){this.numRequests[e]++,this.awake=!0;let o;try{o=i.requestFn()}catch(s){console.warn("sendRequest failed",s)}o?.finally?o.finally(()=>{this.numRequests[e]--,this.startAgain()}):(this.numRequests[e]--,r++)}}return r&&this.startAgain(),!0}getNextRequest(e){const n=this.getSortedPriorityGroups(e);for(const r of n)if(this.requestPool[e][r].length)return this.requestPool[e][r].shift();return null}startGrabbing(){const e=this.sendRequests(ce.Interaction),n=this.sendRequests(ce.Thumbnail),r=this.sendRequests(ce.Prefetch),a=this.sendRequests(ce.Compute);!e&&!n&&!r&&!a&&(this.awake=!1)}startAgain(){this.awake&&(this.grabDelay!==void 0?this.timeoutHandle||(this.timeoutHandle=window.setTimeout(()=>{this.timeoutHandle=null,this.startGrabbing()},this.grabDelay)):this.startGrabbing())}getSortedPriorityGroups(e){return Object.keys(this.requestPool[e]).map(Number).filter(r=>this.requestPool[e][r].length).sort((r,a)=>r-a)}getRequestPool(){return this.requestPool}}const{getRootLogger:w8,getLogger:T8,cs3dLog:I8,workerLog:u1,coreLog:Hl,toolsLog:f1,loaderLog:b8,aiLog:O8,examplesLog:D8,dicomConsistencyLog:P8,imageConsistencyLog:R8}=Ip,V8=f1.getLogger("growCut"),BE=Object.freeze(Object.defineProperty({__proto__:null,aiLog:O8,coreLog:Hl,cs3dLog:I8,dicomConsistencyLog:P8,examplesLog:D8,getLogger:T8,getRootLogger:w8,growCutLog:V8,imageConsistencyLog:R8,loaderLog:b8,toolsLog:f1,workerLog:u1},Symbol.toStringTag,{value:"Module"})),E8=u1.getLogger("registration");class d1{constructor(){this.workerRegistry={},this.workerPoolManager=new $l("webworker")}registerWorker(e,n,r={}){const{maxWorkerInstances:a=1,overwrite:i=!1,autoTerminateOnIdle:o={enabled:!1,idleTimeThreshold:3e3}}=r;if(this.workerRegistry[e]&&!i){E8.warn(`Worker type '${e}' is already registered...`);return}i&&this.workerRegistry[e]?.idleCheckIntervalId&&clearInterval(this.workerRegistry[e].idleCheckIntervalId);const s={workerFn:null,instances:[],loadCounters:[],lastActiveTime:[],nativeWorkers:[],autoTerminateOnIdle:o.enabled,idleCheckIntervalId:null,idleTimeThreshold:o.idleTimeThreshold};s.loadCounters=Array(a).fill(0),s.lastActiveTime=Array(a).fill(null);for(let c=0;c<a;c++){const l=n();s.instances.push(Gc(l)),s.nativeWorkers.push(l),s.workerFn=n}this.workerRegistry[e]=s}getNextWorkerAPI(e){const n=this.workerRegistry[e];if(!n)return console.error(`Worker type '${e}' is not registered.`),null;const r=n.instances.filter(o=>o!==null);let a=0,i=n.loadCounters[0]||0;for(let o=1;o<r.length;o++){const s=n.loadCounters[o]||0;s<i&&(a=o,i=s)}if(n.instances[a]===null){const o=n.workerFn();n.instances[a]=Gc(o),n.nativeWorkers[a]=o}return n.loadCounters[a]+=1,{api:n.instances[a],index:a}}executeTask(e,n,r={},{requestType:a=ce.Compute,priority:i=0,options:o={},callbacks:s=[]}={}){return new Promise((c,l)=>{const u=async()=>{const{api:f,index:d}=this.getNextWorkerAPI(e);if(!f){const g=new Error(`No available worker instance for '${e}'`);console.error(g),l(g);return}try{let g=[];s.length&&(g=s.map(m=>l1(m)));const p=this.workerRegistry[e];p.processing=!0;const h=await f[n](r,...g);p.processing=!1,p.lastActiveTime[d]=Date.now(),p.autoTerminateOnIdle&&!p.idleCheckIntervalId&&p.idleTimeThreshold&&(p.idleCheckIntervalId=setInterval(()=>{this.terminateIdleWorkers(e,p.idleTimeThreshold)},p.idleTimeThreshold)),c(h)}catch(g){console.error(`Error executing method '${n}' on worker '${e}':`,g),l(g)}finally{this.workerRegistry[e].loadCounters[d]--}};this.workerPoolManager.addRequest(u,a,o,i)})}terminateIdleWorkers(e,n){const r=this.workerRegistry[e];if(r.processing)return;const a=Date.now();r.instances.forEach((i,o)=>{const s=r.lastActiveTime[o],c=s!==null&&r.loadCounters[o]>0,l=a-s;!c&&l>n&&this.terminateWorkerInstance(e,o)})}terminate(e){const n=this.workerRegistry[e];if(!n){console.error(`Worker type '${e}' is not registered.`);return}n.instances.forEach((r,a)=>{this.terminateWorkerInstance(e,a)})}terminateWorkerInstance(e,n){const r=this.workerRegistry[e],a=r.instances[n];a!==null&&(a[n1](),r.nativeWorkers[n].terminate(),r.instances[n]=null,r.lastActiveTime[n]=null)}}const D0=4,M8=5,A8=1,If=[1,1];function L8(){try{const t=document.createElement("canvas");t.width=D0,t.height=D0;const e=t.getContext("webgl2");if(!e)return null;const n=`#version 300 es
|
|
4
4
|
void main() {
|