our-medical
Version:
medical image vue component
938 lines (937 loc) • 1.37 MB
JavaScript
import './style.css';
var mt = Object.defineProperty;
var Zt = (C, I, A) => I in C ? mt(C, I, { enumerable: !0, configurable: !0, writable: !0, value: A }) : C[I] = A;
var v = (C, I, A) => Zt(C, typeof I != "symbol" ? I + "" : I, A);
import { defineComponent as Ti, ref as xI, reactive as HC, computed as bC, onMounted as Qi, onBeforeUnmount as vl, createElementBlock as xC, openBlock as dC, Fragment as tl, createElementVNode as ut, createBlock as at, toDisplayString as nl, Teleport as wt, createCommentVNode as yt, normalizeStyle as bl, renderList as Vt, normalizeClass as Kt, nextTick as gA, watch as Ig, unref as gg, createVNode as HI, onUpdated as Wt, onActivated as Ht, onUnmounted as ht, getCurrentInstance as Xt } from "vue";
import * as WI from "@cornerstonejs/tools";
import { CrosshairsTool as nA, ZoomTool as _g, PanTool as qg, LengthTool as rA, AngleTool as DA, drawing as x, utilities as O, segmentation as CI, cursors as yI, Enums as P, BaseTool as CC, AnnotationTool as zl, annotation as N, ScaleOverlayTool as Lt, ToolGroupManager as $g, WindowLevelTool as pt, AnnotationDisplayTool as rt, TrackballRotateTool as gi, SynchronizerManager as VI, synchronizers as Dt, StackScrollMouseWheelTool as el, state as Yt, addTool as Rt } from "@cornerstonejs/tools";
import * as kI from "@cornerstonejs/core";
import { utilities as z, Enums as E, cache as iI, VolumeViewport as Ag, metaData as wg, getRenderingEngine as Lg, getEnabledElement as oI, eventTarget as nI, StackViewport as cl, EVENTS as eg, getConfiguration as El, triggerEvent as bI, getRenderingEngines as Ft, getEnabledElementByIds as Mt, RenderingEngine as Ni, ImageVolume as Pt, imageLoadPoolManager as Jt, volumeLoader as Ul, setVolumesForViewports as kt } from "@cornerstonejs/core";
import { merge as YA, clone as Ci, forIn as Ai, cloneDeep as Cg, isNumber as Sl, round as bg, isNil as pI, debounce as fl, flatten as Tt } from "lodash";
import Qt from "@kitware/vtk.js/Filters/General/ImageMarchingSquares";
import { vec2 as fI, vec3 as dI, quat as Gl, mat4 as oC, mat3 as ml } from "gl-matrix";
import { calculateSUVScalingFactors as Nt } from "@cornerstonejs/calculate-suv";
import tC from "@cornerstonejs/dicom-image-loader";
import { api as vt } from "dicomweb-client";
import xl from "@kitware/vtk.js/Imaging";
import Ol from "@kitware/vtk.js/Common/Core/DataArray";
import zt from "@kitware/vtk.js/Common/DataModel/ImageData";
import jl from "@kitware/vtk.js/Common/DataModel/PolyData";
import _l from "@kitware/vtk.js/Rendering/Core/Actor";
import ql from "@kitware/vtk.js/Rendering/Core/Mapper";
import "@kitware/vtk.js/Rendering/Core/Property";
import Jg from "@kitware/vtk.js/Common/Core/Math";
import Et from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps";
import { cornerstoneStreamingImageVolumeLoader as Ut } from "@cornerstonejs/streaming-image-volume-loader";
import ft from "dicom-parser";
import Zl from "@kitware/vtk.js/Interaction/Widgets/OrientationMarkerWidget";
import xt from "@kitware/vtk.js/IO/XML/XMLPolyDataReader";
import Ot from "@kitware/vtk.js/Common/Core/ImageHelper";
import jt from "@kitware/vtk.js/Filters/General/ImageCropFilter";
const _t = ["onClick"], qt = /* @__PURE__ */ Ti({
__name: "AxisSelect",
props: {
select: { type: String, required: !0 },
color: { type: String },
i18n: { type: String, required: !0 },
prefixMark: { type: String },
list: { type: Array, required: !0 },
onUpdateSelect: { type: Function }
},
emits: { "update:select": (C) => C || !0 },
setup(C, { emit: I }) {
const A = C, i = I, l = xI(), o = xI(), B = xI(!1), t = HC({ x: 0, y: 0 }), b = bC(() => ({ left: t.x + "px", top: t.y + "px" })), S = bC(() => {
for (const u of A.list)
if (u.key === A.select)
return u.text;
return A.i18n === "en" ? "Viewport" : "视口";
});
Qi(() => {
document.addEventListener("click", c);
}), vl(() => {
document.removeEventListener("click", c);
});
function c(u) {
var w;
u.target !== o.value && !((w = l.value) != null && w.contains(u.target)) && (B.value = !1);
}
async function G(u) {
B.value ? B.value = !1 : (B.value = !0, gA(() => {
const a = u.target.parentElement, { offsetHeight: V, offsetWidth: h } = a, { offsetX: H, offsetY: L } = u;
l.value.style.width = a.offsetWidth + "px";
const X = l.value.offsetWidth;
t.x = u.clientX - H + h - X - 5, t.y = u.clientY - L + V;
}));
}
function m(u) {
u.disabled || (i("update:select", u.key), A.onUpdateSelect && A.onUpdateSelect(u.key), B.value = !1);
}
return (u, w) => (dC(), xC(tl, null, [
ut("div", {
class: "title",
ref_key: "titleNode",
ref: o,
onClick: G
}, nl(`${C.prefixMark ? C.prefixMark + " - " : ""}${S.value}`), 513),
(dC(), at(wt, { to: "body" }, [
B.value ? (dC(), xC("ul", {
key: 0,
class: "list frosted-glass",
ref_key: "listNode",
ref: l,
style: bl(b.value),
onMouseleave: w[0] || (w[0] = (a) => B.value = !1)
}, [
(dC(!0), xC(tl, null, Vt(C.list, (a) => (dC(), xC("li", {
class: Kt([a.key === C.select ? "select" : "", a.disabled ? "disabled" : ""]),
key: a.key,
style: bl({ background: C.color && a.key === C.select ? C.color : void 0 }),
onClick: (V) => m(a)
}, nl(a.text), 15, _t))), 128))
], 36)) : yt("", !0)
]))
], 64));
}
}), vi = (C, I) => {
const A = C.__vccOpts || C;
for (const [i, l] of I)
A[i] = l;
return A;
}, $t = /* @__PURE__ */ vi(qt, [["__scopeId", "data-v-8f8e987b"]]);
var AI = /* @__PURE__ */ ((C) => (C.CONTOUR_DATA_MODIFIED = "contour_data_modified", C.VOI_MODIFIED_FROM_TOOL = "voi_modified_from_tool", C.ORIGIN_MODIFIED_FROM_DRAG = "origin_modified_from_drag", C.ORIGIN_DRAG_END = "origin_drag_end", C.SHOT_MODIFIED_FROM_DRAG = "shot_modified_from_drag", C.SHOT_REMOVED_FROM_DRAG = "shot_removed_from_drag", C.NEW_SHOT_FROM_DRAG = "new_shot_from_drag", C.CURR_SHOT_ID_MODIFIED = "current_shot_id_modified", C.CURR_FRAME_VERTICE_INFO_MODIFIED = "current_frame_vertice_infor_modified", C.FRAME_VERTICE_MOVED = "frame_vertice_moved", C.FRAME_MOVED = "frame_moved", C.FRAME_DRAG_END = "frame_drag_end", C.NAIL_MODIFIED_FROM_DRAG = "nail_modified_from_drag", C.NEW_NAIL_FROM_DRAG = "new_nail_from_drag", C.CURR_NAIL_MODIFIED = "current_nail_modified", C.IMAGE_CENTER_MODIFIED = "image_center_modified", C.IMAGE_CENTER_DRAG_END = "image_center_drag_end", C.IMGAE_CENTER_REMOVED_FROM_DRAG = "image_center_removed_from_drag", C.COUCH_MODIFIED_FROM_DRAG = "couch_modified_from_drag", C.COUCH_DRAG_END = "couch_drag_end", C.FIDUCIAL_MODIFIED_FROM_DRAG = "fiducial_modified_from_drag", C.FIDUCIAL_REMOVED_FROM_DRAG = "fiducial_removed_from_drag", C.NEW_FIDUCIAL_FROM_DRAG = "new_fiducial_from_drag", C.DOSE_PT_MODIFIED_FROM_DRAG = "dose_point_modified_from_drag", C.DOSE_PT_REMOVED_FROM_DRAG = "dose_point_removed_from_drag", C.DOSE_PT_UPDATE_DOSE = "dose_point_update_dose", C.NEW_DOSE_PT_FROM_DRAG = "new_dose_point_from_drag", C.VIEWPORT_VOLUMES_SETTED = "viewport_reference_volumes_setted", C.ACCESS_3D = "access_to_3d_display", C.Exit_3D = "exit_3d_display", C.DOSE_DRAWED = "dose_path_draw_end", C.VOLUME_TRANSFORM = "volume_transform", C))(AI || {}), fg = /* @__PURE__ */ ((C) => (C.C = "core", C.S = "south", C.N = "north", C))(fg || {}), lg = /* @__PURE__ */ ((C) => (C.Primary = "P", C.Secondary = "S", C.SideBySide = "P&S", C.Fusion = "P+S", C))(lg || {}), RA = /* @__PURE__ */ ((C) => (C.Horizontal = "horizontal", C.Vertical = "vertical", C))(RA || {}), D = /* @__PURE__ */ ((C) => (C.AdvanceBrush = "AdvanceBrush", C.ContourDelete = "ContourDelete", C.Draggable = "Draggable", C.DraggableDisplay = "DraggableDisplay", C.DoseDisplay = "DoseDisplay", C.ManualRegistration = "ManualRegistration", C.MeasuringScale = "MeasuringScale", C.OrientationMark = "OrientationMark", C.SimplePencil = "SimplePencil", C.SliceInfo = "SliceInfo", C.WWWC = "WWWC", C))(D || {}), ZI = /* @__PURE__ */ ((C) => (C.P = "primary", C.S = "secondary", C))(ZI || {}), cC = /* @__PURE__ */ ((C) => (C.A = "absolute", C.R = "relative", C))(cC || {}), zi = /* @__PURE__ */ ((C) => (C.F = "fill", C.L = "line", C))(zi || {});
const Ei = "#efefef", $l = "00080060", hg = "our-medial-rendering-engin " + z.uuidv4(), In = "0020000E", Id = "00080018", Ui = "segmentation", mg = "cornerstoneStreamingImageVolume", Tg = {
[E.OrientationAxis.AXIAL]: { en: "Axial", zh: "轴状位" },
[E.OrientationAxis.SAGITTAL]: { en: "Sagittal", zh: "矢状位" },
[E.OrientationAxis.CORONAL]: { en: "Coronal", zh: "冠状位" },
[E.ViewportType.VOLUME_3D]: { en: "3D", zh: "三 维" }
};
Object.freeze(Tg);
const bA = [
"DoseDisplay",
"DraggableDisplay",
"MeasuringScale",
"OrientationMark",
"SliceInfo"
/* SliceInfo */
];
Object.freeze(bA);
const zI = 4, fi = 0.2, xi = 0.4, Hg = {
fullIn: [
"M382 828H204c-4.4 0-8-3.6-8-8V665c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8v195c0 17.7 14.3 32 32 32h218c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8zM884 657h-48c-4.4 0-8 3.6-8 8v155c0 4.4-3.6 8-8 8H642c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8h218c17.7 0 32-14.3 32-32V665c0-4.4-3.6-8-8-8zM642 196h178c4.4 0 8 3.6 8 8v155c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V164c0-17.7-14.3-32-32-32H642c-4.4 0-8 3.6-8 8v48c0 4.4 3.6 8 8 8zM140 367h48c4.4 0 8-3.6 8-8V204c0-4.4 3.6-8 8-8h178c4.4 0 8-3.6 8-8v-48c0-4.4-3.6-8-8-8H164c-17.7 0-32 14.3-32 32v195c0 4.4 3.6 8 8 8z"
],
fullOut: [
"M358 657c17.7 0 32 14.3 32 32v195c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V729c0-4.4-3.6-8-8-8H140c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h218z m526 0c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H706c-4.4 0-8 3.6-8 8v155c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V689c0-17.7 14.3-32 32-32h218zM690 132c4.4 0 8 3.6 8 8v155c0 4.4 3.6 8 8 8h178c4.4 0 8 3.6 8 8v48c0 4.4-3.6 8-8 8H666c-17.7 0-32-14.3-32-32V140c0-4.4 3.6-8 8-8h48z m-308 0c4.4 0 8 3.6 8 8v195c0 17.7-14.3 32-32 32H140c-4.4 0-8-3.6-8-8v-48c0-4.4 3.6-8 8-8h178c4.4 0 8-3.6 8-8V140c0-4.4 3.6-8 8-8h48z"
],
pointer: [
"M836.54 429.526667l-498.833333-288-91.946667-53.086667c-10-5.78-18.553333-2.1-21.76-0.246667A21.333333 21.333333 0 0 0 213.333333 106.666667v682.666666a21.333333 21.333333 0 0 0 36.113334 15.386667l154.666666-148.586667 130.38 225.826667A53.333333 53.333333 0 0 0 607.333333 901.486667l129.333334-74.666667a53.333333 53.333333 0 0 0 19.526666-72.86L625.8 528.133333l206-59.64a21.333333 21.333333 0 0 0 4.733333-38.966666z"
],
reset: [
"M921.728 654.4a428.352 428.352 0 1 0-647.04 203.264c3.2 2.24 7.488 1.856 10.24-0.896l43.2-43.2a8 8 0 0 0-1.28-12.352 352.256 352.256 0 1 1 462.592-67.968l-70.4-69.76a8 8 0 0 0-13.632 4.608l-27.904 219.776a8 8 0 0 0 9.024 8.96l219.52-29.952a8 8 0 0 0 4.48-13.632l-67.008-66.368a431.36 431.36 0 0 0 78.208-132.48z"
],
[DA.toolName]: [
"M968 736.96h-315.84c11.52-202.56-82.24-304.96-153.28-352.64l132.8-147.84c20.8-23.04 18.88-58.24-4.16-079.04-23.04-20.8-58.56-18.88-79.04 4.16L14.4 755.52c-14.72 16.32-18.56 40-9.6 60.16 8.96 20.16 29.12 33.28 51.2 33.28h912c31.04 0 56-24.96 56-56s-24.96-56-56-56z m-544.32-269.12c45.76 25.92 127.68 96.64 116.16 269.12H181.76l241.92-269.12z"
],
[rA.toolName]: [
"M964.693333 300.8L725.333333 59.306667a42.666667 42.666667 0 0 0-30.293333-12.373334 42.666667 42.666667 0 0 0-29.866667 12.373334L59.306667 663.04a42.666667 42.666667 0 0 0 0 60.16l241.493333 241.493333a42.666667 42.666667 0 0 0 30.293333 12.373334 42.666667 42.666667 0 0 0 29.866667-12.373334l120.746667-120.746666 362.24-362.24 120.746666-120.746667a42.666667 42.666667 0 0 0 0-60.16z m-151.04 90.453333l-30.293333-30.293333a42.666667 42.666667 0 0 0-60.16 0 42.666667 42.666667 0 0 0 0 60.586667l30.293333 30.293333L692.906667 512l-90.453334-90.453333a42.666667 42.666667 0 0 0-60.16 60.16l90.453334 90.453333-60.586667 60.586667-29.866667-30.293334a42.666667 42.666667 0 1 0-60.586666 60.586667l30.293333 29.866667-60.16 60.586666-90.88-90.453333a42.666667 42.666667 0 0 0-60.16 0 42.666667 42.666667 0 0 0 0 60.16l90.453333 90.453333-60.16 60.586667-181.333333-181.333333L692.906667 149.76l181.333333 181.333333z"
],
[qg.toolName]: [
"M510.7 896.2c-15.3 0-28.7-11.3-31.4-26.6-0.7-4-0.6-7.9 0.1-11.7 1.7-43.3 0.6-444.5-0.6-710.7-0.1-17.5 14-31.7 31.5-31.8h0.1c17.4 0 31.6 14.1 31.7 31.5 0 0 0.8 179.3 1.3 358.7 0.2 89.7 0.3 179.4 0.2 246.8-0.3 141-0.3 141-30.2 143.7-0.9 0.1-1.8 0.1-2.7 0.1z",
"M510.7 896.2c-15.3 0-28.7-11.3-31.4-26.6-0.7-4-0.6-7.9 0.1-11.7 1.7-43.3 0.6-444.5-0.6-710.7-0.1-17.5 14-31.7 31.5-31.8h0.1c17.4 0 31.6 14.1 31.7 31.5 0 0 0.8 179.3 1.3 358.7 0.2 89.7 0.3 179.4 0.2 246.8-0.3 141-0.3 141-30.2 143.7-0.9 0.1-1.8 0.1-2.7 0.1z",
"M330.2 538.2h-65.5c-141-0.3-141-0.3-143.7-30.2-1.5-16.4 10.3-31.3 26.5-34.1 4-0.7 8-0.6 11.7 0.1 43.3 1.8 444.4 0.6 710.7-0.6h0.1c17.4 0 31.6 14.1 31.7 31.5 0.1 17.5-14 31.7-31.5 31.8 0 0-179.3 0.8-358.7 1.3-63 0.1-126 0.2-181.3 0.2zM614.8 250c-8.1 0-16.2-3.1-22.4-9.3L512 160.4l-80.4 80.4c-12.4 12.4-32.4 12.4-44.8 0-12.4-12.4-12.4-32.4 0-44.8L489.6 93.2c12.4-12.4 32.4-12.4 44.8 0L637.2 196c12.4 12.4 12.4 32.4 0 44.8-6.2 6.1-14.3 9.2-22.4 9.2zM512 920.5c-8.1 0-16.2-3.1-22.4-9.3L386.8 808.4c-12.4-12.4-12.4-32.4 0-44.8 12.4-12.4 32.4-12.4 44.8 0L512 844l80.4-80.4c12.4-12.4 32.4-12.4 44.8 0 12.4 12.4 12.4 32.4 0 44.8L534.4 911.2c-6.2 6.2-14.3 9.3-22.4 9.3z",
"M795.8 636.6c-8.1 0-16.2-3.1-22.4-9.3-12.4-12.4-12.4-32.4 0-44.8l80.4-80.4-80.4-80.4c-12.4-12.4-12.4-32.4 0-44.8 12.4-12.4 32.4-12.4 44.8 0L921 479.8c12.4 12.4 12.4 32.4 0 44.8L818.2 627.4c-6.2 6.1-14.3 9.2-22.4 9.2zM228.2 636.6c-8.1 0-16.2-3.1-22.4-9.3L103 524.6c-12.4-12.4-12.4-32.4 0-44.8L205.8 377c12.4-12.4 32.4-12.4 44.8 0 12.4 12.4 12.4 32.4 0 44.8l-80.4 80.4 80.4 80.4c12.4 12.4 12.4 32.4 0 44.8-6.2 6.1-14.3 9.2-22.4 9.2z"
],
WWWC: [
"M512 142.849636c49.823744 0 98.131965 9.747516 143.585504 28.972526 43.924636 18.579149 83.382979 45.184734 117.277915 79.080887 33.894936 33.894936 60.501738 73.353279 79.080887 117.277915 19.22501 45.452323 28.972526 93.76176 28.972526 143.585504s-9.747516 98.131965-28.972526 143.585504c-18.579149 43.924636-45.184734 83.382979-79.080887 117.277916-33.894936 33.894936-73.353279 60.501738-117.277915 79.080887-45.452323 19.22501-93.76176 28.972526-143.585504 28.972526s-98.131965-9.747516-143.585504-28.972526c-43.924636-18.579149-83.382979-45.184734-117.277915-79.080887-33.894936-33.894936-60.501738-73.353279-79.080887-117.277916-19.22501-45.452323-28.972526-93.76176-28.972526-143.585504s9.747516-98.131965 28.972526-143.585504c18.579149-43.924636 45.184734-83.382979 79.080887-117.277915s73.353279-60.501738 117.277915-79.080887c45.453539-19.223794 93.762976-28.972526 143.585504-28.972526m0-44.821057c-228.501035 0-413.736673 185.236855-413.736673 413.736673S283.500182 925.503142 512 925.503142s413.736673-185.236855 413.736673-413.736674S740.501035 98.028579 512 98.028579z",
"M488.542228 115.289247h44.821057v780.948238h-44.821057z",
"M661.647598 143.001675l31.693413 31.69463-166.01671 166.015493-31.692197-31.693413zM767.461782 217.801147l31.693414 31.693414L527.326734 521.323023l-31.693414-31.693413zM850.471354 319.054166l31.693413 31.693414-353.25318 353.25318-31.693414-31.693413zM891.520631 458.61733l31.692197 31.693414-401.358277 401.358277-31.693414-31.693414z"
],
[_g.toolName]: [
"M637 443H519V309c0-4.4-3.6-8-8-8h-60c-4.4 0-8 3.6-8 8v134H325c-4.4 0-8 3.6-8 8v60c0 4.4 3.6 8 8 8h118v134c0 4.4 3.6 8 8 8h60c4.4 0 8-3.6 8-8V519h118c4.4 0 8-3.6 8-8v-60c0-4.4-3.6-8-8-8z",
"M921 867L775 721c122.1-148.9 113.6-369.5-26-509-148-148.1-388.4-148.1-537 0-148.1 148.6-148.1 389 0 537 139.5 139.6 360.1 148.1 509 26l146 146c3.2 2.8 8.3 2.8 11 0l43-43c2.8-2.7 2.8-7.8 0-11zM696 696c-118.8 118.7-311.2 118.7-430 0-118.7-118.8-118.7-311.2 0-430 118.8-118.7 311.2-118.7 430 0 118.7 118.8 118.7 311.2 0 430z"
],
[nA.toolName]: [
"M62.016 474.016h900v76H62.016v-76zM474.016 62.016h76v900h-76V62.016z"
]
};
Object.freeze(Hg);
const sg = {
full: "viewport-container-full",
halfL: "viewport-container-half-left",
halfR: "viewport-container-half-right",
on: "viewport-container-on"
};
Object.freeze(sg);
const FA = [
[0, 1, 0, 0, 0, 0, 1, 0, -1, 0, 0, 0, null, 0, 0, 1],
//sagittal
[1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, null, 0, 1],
//coronal
[1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, null, 1]
//axial
], bi = {
SimplePencil: {
iconContent: `
<g xmlns="http://www.w3.org/2000/svg" transform="scale(0.04116214)">
<path style="fill: {{color}};" d="m 503.46668,777.41329 a 17.03253,17.03253 0 0 1 -12.15147,-5.08587 a 17.064088,17.064088 0 1 1 24.13227,24.13226 l -48.60587,48.60587 47.83787,48.52053 a 17.0496,17.0496 0 0 1 -12.15147,29.04747 z m -230.4,-145.92 H 102.40001 A 17.06667,17.06667 0 0 1 85.33335,614.42662 V 546.15996 H 17.06668 a 17.06667,17.06667 0 1 1 0,-34.13334 H 74.78615 L 1.80908,366.05542 a 17.06667,17.06667 0 0 1 0,-15.27466 L 172.39041,9.61809 a 16.896,16.896 0 0 1 10.82027,-8.99413 16.9472,16.9472 0 0 1 11.81013,1.00693 l 0.85334,0.42667 a 17.03253,17.03253 0 0 1 7.18506,7.50933 l 170.5984,341.17973 a 17.06667,17.06667 0 0 1 0,15.27467 l -72.97706,145.9712 h 57.71946 a 17.06667,17.06667 0 1 1 0,34.13333 h -68.26666 v 68.26667 a 17.06667,17.06667 0 0 1 -17.06667,17.1008 z m -153.6,-34.13333 h 136.53333 v -51.2 H 119.46668 Z m -6.51947,-85.33334 h 149.57227 l 76.8,-153.6 L 204.80001,89.38769 v 126.8224 c 8.78934,2.7648 16.5376,7.4752 23.15947,14.11413 a 58.5728,58.5728 0 0 1 17.80053,42.78614 c 0,16.57173 -6.2976,31.21493 -18.21013,42.3424 -10.30827,11.09333 -24.9344,17.39093 -41.5232,17.39093 a 58.5728,58.5728 0 0 1 -42.78613,-17.80053 c -11.24694,-11.22987 -16.9472,-25.344 -16.9472,-41.9328 0,-16.36694 5.56373,-30.6176 16.55466,-42.35947 8.46507,-7.95307 17.69814,-13.07307 27.81867,-15.5648 V 89.40476 L 36.14721,358.42662 Z m 73.07947,-264.53333 c -7.64587,0 -13.70453,2.33813 -19.06347,7.35573 -4.1984,4.5568 -6.53653,10.61547 -6.53653,18.24427 0,7.40693 2.2016,13.056 6.94613,17.78347 5.3248,5.3248 11.264,7.81653 18.65387,7.81653 7.2704,0 12.62933,-2.26987 17.39093,-7.38987 5.9392,-5.59786 8.20907,-10.9568 8.20907,-18.21013 a 24.91733,24.91733 0 0 0 -7.79947,-18.65387 c -4.31786,-4.31786 -9.59146,-6.53653 -16.55466,-6.94613 z"/>
</g>
`,
iconSize: 32,
viewBox: { x: 32, y: 32 },
mousePoint: { x: 8, y: 8 },
mousePointerGroupString: '<path stroke="{{color}}" d="M8 16L8 0"></path><path stroke="{{color}}" d="M16 8L0 8"></path>'
},
Fiducial: {
iconContent: `
<g xmlns="http://www.w3.org/2000/svg" transform="translate(0,0)">
<path style="fill:RED;fill-rule:evenodd;stroke-width:0.279359;fill-opacity:1" d="m 0,-4 a 4,4 0 0 1 -4,4 4,4 0 0 1 -4,-4 4,4 0 0 1 4,-4 4,4 0 0 1 4,4 z"/>
</g>
`,
iconSize: 32,
viewBox: { x: 16, y: 16 },
mousePoint: { x: 8, y: 8 },
mousePointerGroupString: ""
},
Nail: {
iconContent: "",
iconSize: 32,
viewBox: { x: 16, y: 16 },
mousePoint: { x: 8, y: 8 },
mousePointerGroupString: '<path stroke="{{color}}" d="M8 16L8 0"></path><path stroke="{{color}}" d="M16 8L0 8"></path>'
},
ContourDelete: {
iconContent: `
<g xmlns="http://www.w3.org/2000/svg" transform="scale(0.04116214)">
<path style="fill: {{color}};" d="m 503.46668,777.41329 a 17.03253,17.03253 0 0 1 -12.15147,-5.08587 l -47.6672,-48.34986 -47.58186,47.58186 a 17.064088,17.064088 0 1 1 -24.13227,-24.13226 l 47.58187,-47.58187 -48.34987,-47.6672 a 17.06667,17.06667 0 1 1 23.9616,-24.30293 l 48.52053,47.83786 48.60587,-48.60586 a 17.064088,17.064088 0 1 1 24.13227,24.13226 l -48.60587,48.60587 47.83787,48.52053 a 17.0496,17.0496 0 0 1 -12.15147,29.04747 z m -230.4,-145.92 H 102.40001 A 17.06667,17.06667 0 0 1 85.33335,614.42662 V 546.15996 H 17.06668 a 17.06667,17.06667 0 1 1 0,-34.13334 H 74.78615 L 1.80908,366.05542 a 17.06667,17.06667 0 0 1 0,-15.27466 L 172.39041,9.61809 a 16.896,16.896 0 0 1 10.82027,-8.99413 16.9472,16.9472 0 0 1 11.81013,1.00693 l 0.85334,0.42667 a 17.03253,17.03253 0 0 1 7.18506,7.50933 l 170.5984,341.17973 a 17.06667,17.06667 0 0 1 0,15.27467 l -72.97706,145.9712 h 57.71946 a 17.06667,17.06667 0 1 1 0,34.13333 h -68.26666 v 68.26667 a 17.06667,17.06667 0 0 1 -17.06667,17.1008 z m -153.6,-34.13333 h 136.53333 v -51.2 H 119.46668 Z m -6.51947,-85.33334 h 149.57227 l 76.8,-153.6 L 204.80001,89.38769 v 126.8224 c 8.78934,2.7648 16.5376,7.4752 23.15947,14.11413 a 58.5728,58.5728 0 0 1 17.80053,42.78614 c 0,16.57173 -6.2976,31.21493 -18.21013,42.3424 -10.30827,11.09333 -24.9344,17.39093 -41.5232,17.39093 a 58.5728,58.5728 0 0 1 -42.78613,-17.80053 c -11.24694,-11.22987 -16.9472,-25.344 -16.9472,-41.9328 0,-16.36694 5.56373,-30.6176 16.55466,-42.35947 8.46507,-7.95307 17.69814,-13.07307 27.81867,-15.5648 V 89.40476 L 36.14721,358.42662 Z m 73.07947,-264.53333 c -7.64587,0 -13.70453,2.33813 -19.06347,7.35573 -4.1984,4.5568 -6.53653,10.61547 -6.53653,18.24427 0,7.40693 2.2016,13.056 6.94613,17.78347 5.3248,5.3248 11.264,7.81653 18.65387,7.81653 7.2704,0 12.62933,-2.26987 17.39093,-7.38987 5.9392,-5.59786 8.20907,-10.9568 8.20907,-18.21013 a 24.91733,24.91733 0 0 0 -7.79947,-18.65387 c -4.31786,-4.31786 -9.59146,-6.53653 -16.55466,-6.94613 z"/>
</g>
`,
iconSize: 32,
viewBox: { x: 32, y: 32 },
mousePoint: { x: 8, y: 8 },
mousePointerGroupString: '<path stroke="{{color}}" d="M8 16L8 0"></path><path stroke="{{color}}" d="M16 8L0 8"></path>'
},
ContourDeleteDisabled: {
iconContent: `
<g xmlns="http://www.w3.org/2000/svg" transform="scale(0.04116214)">
<path style="fill: {{color}};" d="m 503.46668,777.41329 a 17.03253,17.03253 0 0 1 -12.15147,-5.08587 l -47.6672,-48.34986 -47.58186,47.58186 a 17.064088,17.064088 0 1 1 -24.13227,-24.13226 l 47.58187,-47.58187 -48.34987,-47.6672 a 17.06667,17.06667 0 1 1 23.9616,-24.30293 l 48.52053,47.83786 48.60587,-48.60586 a 17.064088,17.064088 0 1 1 24.13227,24.13226 l -48.60587,48.60587 47.83787,48.52053 a 17.0496,17.0496 0 0 1 -12.15147,29.04747 z m -230.4,-145.92 H 102.40001 A 17.06667,17.06667 0 0 1 85.33335,614.42662 V 546.15996 H 17.06668 a 17.06667,17.06667 0 1 1 0,-34.13334 H 74.78615 L 1.80908,366.05542 a 17.06667,17.06667 0 0 1 0,-15.27466 L 172.39041,9.61809 a 16.896,16.896 0 0 1 10.82027,-8.99413 16.9472,16.9472 0 0 1 11.81013,1.00693 l 0.85334,0.42667 a 17.03253,17.03253 0 0 1 7.18506,7.50933 l 170.5984,341.17973 a 17.06667,17.06667 0 0 1 0,15.27467 l -72.97706,145.9712 h 57.71946 a 17.06667,17.06667 0 1 1 0,34.13333 h -68.26666 v 68.26667 a 17.06667,17.06667 0 0 1 -17.06667,17.1008 z m -153.6,-34.13333 h 136.53333 v -51.2 H 119.46668 Z m -6.51947,-85.33334 h 149.57227 l 76.8,-153.6 L 204.80001,89.38769 v 126.8224 c 8.78934,2.7648 16.5376,7.4752 23.15947,14.11413 a 58.5728,58.5728 0 0 1 17.80053,42.78614 c 0,16.57173 -6.2976,31.21493 -18.21013,42.3424 -10.30827,11.09333 -24.9344,17.39093 -41.5232,17.39093 a 58.5728,58.5728 0 0 1 -42.78613,-17.80053 c -11.24694,-11.22987 -16.9472,-25.344 -16.9472,-41.9328 0,-16.36694 5.56373,-30.6176 16.55466,-42.35947 8.46507,-7.95307 17.69814,-13.07307 27.81867,-15.5648 V 89.40476 L 36.14721,358.42662 Z m 73.07947,-264.53333 c -7.64587,0 -13.70453,2.33813 -19.06347,7.35573 -4.1984,4.5568 -6.53653,10.61547 -6.53653,18.24427 0,7.40693 2.2016,13.056 6.94613,17.78347 5.3248,5.3248 11.264,7.81653 18.65387,7.81653 7.2704,0 12.62933,-2.26987 17.39093,-7.38987 5.9392,-5.59786 8.20907,-10.9568 8.20907,-18.21013 a 24.91733,24.91733 0 0 0 -7.79947,-18.65387 c -4.31786,-4.31786 -9.59146,-6.53653 -16.55466,-6.94613 z"/>
<line stroke="{{color}}" stroke-width="60" fill="none" x1="32" y1="727.93518" x2="489" y2="49.064789" stroke-linejoin="undefined" stroke-linecap="undefined"/>
<circle stroke-width="30" cy="728" cx="32" stroke="{{color}}" fill="none" r="15"/>
<circle stroke-width="30" cy="49" cx="489" stroke="{{color}}" fill="none" r="15"/>
</g>
`,
iconSize: 32,
viewBox: { x: 32, y: 32 },
mousePoint: { x: 8, y: 8 },
mousePointerGroupString: '<path stroke="{{color}}" d="M8 16L8 0"></path><path stroke="{{color}}" d="M16 8L0 8"></path>'
}
}, cm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
AXIS_AXES: FA,
AxisLayout: RA,
AxisNameI18n: Tg,
CUSTOM_CURSOR: bi,
DOSE_DISPLAY_TYPES: zi,
DOSE_LEGENDS: cC,
DOSE_OPACITY_IN_3D: xi,
Events: AI,
FRAME_PT_R: zI,
Grid: fg,
HeaderIconPaths: Hg,
Layout: lg,
MODALITY: $l,
RENDERING_ENGINE_ID: hg,
SEGMENTATION_PREFIX: Ui,
SERIES_INSTANCE_UID: In,
SOP_INSTANCE_UID: Id,
STREAMING_LOADER_NAME: mg,
TEXT_WHITE_IN_VIEWPORT: Ei,
TOOL_GROUP_TYPE: ZI,
ToolsName: D,
ToolsOrder: bA,
VOLUME_OPACITY_IN_3D: fi,
ViewportContainerGridAreaClassName: sg
}, Symbol.toStringTag, { value: "Module" }));
function j(C) {
const [I, A] = C.split("|");
return { medicalComponentId: I, seriesType: A };
}
function k(...C) {
return C.length ? C.join("|") : "";
}
function eI(C) {
return C.split("|");
}
function MI(C) {
const I = C.getDefaultActor();
return I == null ? void 0 : I.uid.startsWith(mg);
}
const SC = /* @__PURE__ */ new Map();
function gd(C) {
const { medicalComponentId: I, seriesType: A } = j(C);
let i = SC.get(I);
i || (i = { primary: null, secondary: null }, SC.set(I, i));
const l = {
[E.OrientationAxis.AXIAL]: xI(),
[E.OrientationAxis.SAGITTAL]: xI(),
[E.OrientationAxis.CORONAL]: xI()
};
return Reflect.set(i, A, l), l;
}
function gn(C) {
const { medicalComponentId: I, seriesType: A } = j(C), i = SC.get(I);
return i ? Reflect.get(i, A) : null;
}
function Cn(C) {
const I = SC.get(C);
return I || null;
}
function Cd(C) {
const { medicalComponentId: I, seriesType: A } = j(C), i = SC.get(I);
i && Reflect.set(i, A, null);
}
const eA = /* @__PURE__ */ new Map();
function Ad(C) {
const { medicalComponentId: I, seriesType: A } = j(C);
let i = eA.get(I);
i || (i = { primary: null, secondary: null }, eA.set(I, i));
const l = HC({
core: E.OrientationAxis.AXIAL,
south: E.OrientationAxis.SAGITTAL,
north: E.OrientationAxis.CORONAL
});
return Reflect.set(i, A, l), l;
}
function An(C) {
const { medicalComponentId: I, seriesType: A } = j(C), i = eA.get(I);
return i ? Reflect.get(i, A) : null;
}
function Oi(C) {
const I = eA.get(C);
return I || null;
}
const cA = /* @__PURE__ */ new Map();
function id(C) {
const { medicalComponentId: I, seriesType: A } = j(C);
let i = cA.get(I);
i || (i = { primary: null, secondary: null }, cA.set(I, i));
const l = HC({ core: !1, south: !1, north: !1 });
return Reflect.set(i, A, l), l;
}
function sn(C) {
const { medicalComponentId: I, seriesType: A } = j(C), i = cA.get(I);
return i ? Reflect.get(i, A) : null;
}
function sd(C) {
const I = cA.get(C);
return I || null;
}
const ei = /* @__PURE__ */ new Map();
function ld(C, I) {
const { medicalComponentId: A, seriesType: i } = j(C);
let l = ei.get(A);
return l || (l = { primary: null, secondary: null }, ei.set(A, l)), Reflect.set(l, i, I), I;
}
function IC(C) {
const { medicalComponentId: I, seriesType: A } = j(C), i = hC(I);
return i && A ? i[A] : null;
}
function hC(C) {
const I = ei.get(C);
return I && (I.primary || I.secondary) ? I : null;
}
const ci = /* @__PURE__ */ new Map();
function ji(C) {
let I = ci.get(C);
return I || (I = HC({ componentId: null, initOrientation: null, visible: !1 }), ci.set(C, I)), I;
}
function XC(C) {
const { medicalComponentId: I } = j(C);
return ci.get(I);
}
const dd = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
deleteAxisElementRef: Cd,
get3DViewState: XC,
getAxisElementRef: gn,
getAxisFullScreen: sn,
getAxisOrientation: An,
getAxixViewportIds: IC,
getComponentAxisElementRef: Cn,
getComponentAxisFullScreen: sd,
getComponentAxisOrientation: Oi,
getComponentViewportIds: hC,
init3DViewState: ji,
initAxisElementRef: gd,
initAxisFullScreen: id,
initAxisOrientation: Ad,
setAxisViewportIds: ld
}, Symbol.toStringTag, { value: "Module" })), od = {};
function ln(C, I) {
if (dn(I))
Reflect.set(od, C, I);
else
throw TypeError("Input parameter type error.");
}
function Bd(C) {
return Reflect.get(od, C);
}
function dn(C) {
return Array.isArray(C) ? !(isNaN(C[0].hu) || isNaN(C[0].ed)) : !1;
}
const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
__proto__: null,
getElectronDensity: Bd,
setElectronDensity: ln
}, Symbol.toStringTag, { value: "Module" }));
function Bn(C) {
return C && C.__esModule && Object.prototype.hasOwnProperty.call(C, "default") ? C.default : C;
}
var MA = {}, td = { exports: {} };
(function(C) {
(function() {
var I = {};
I.version = "6.4.2.2", I.use_lines = !0, I.use_xyz = !1;
var A = !1;
C.exports ? (C.exports = I, A = !0) : typeof document < "u" ? window.ClipperLib = I : self.ClipperLib = I;
var i;
if (A) {
var l = "chrome";
i = "Netscape";
} else {
var l = navigator.userAgent.toString().toLowerCase();
i = navigator.appName;
}
var o = {};
l.indexOf("chrome") != -1 && l.indexOf("chromium") == -1 ? o.chrome = 1 : o.chrome = 0, l.indexOf("chromium") != -1 ? o.chromium = 1 : o.chromium = 0, l.indexOf("safari") != -1 && l.indexOf("chrome") == -1 && l.indexOf("chromium") == -1 ? o.safari = 1 : o.safari = 0, l.indexOf("firefox") != -1 ? o.firefox = 1 : o.firefox = 0, l.indexOf("firefox/17") != -1 ? o.firefox17 = 1 : o.firefox17 = 0, l.indexOf("firefox/15") != -1 ? o.firefox15 = 1 : o.firefox15 = 0, l.indexOf("firefox/3") != -1 ? o.firefox3 = 1 : o.firefox3 = 0, l.indexOf("opera") != -1 ? o.opera = 1 : o.opera = 0, l.indexOf("msie 10") != -1 ? o.msie10 = 1 : o.msie10 = 0, l.indexOf("msie 9") != -1 ? o.msie9 = 1 : o.msie9 = 0, l.indexOf("msie 8") != -1 ? o.msie8 = 1 : o.msie8 = 0, l.indexOf("msie 7") != -1 ? o.msie7 = 1 : o.msie7 = 0, l.indexOf("msie ") != -1 ? o.msie = 1 : o.msie = 0, I.biginteger_used = null;
var B;
function t(g, s, d) {
I.biginteger_used = 1, g != null && (typeof g == "number" && typeof s > "u" ? this.fromInt(g) : typeof g == "number" ? this.fromNumber(g, s, d) : s == null && typeof g != "string" ? this.fromString(g, 256) : this.fromString(g, s));
}
function b() {
return new t(null, void 0, void 0);
}
function S(g, s, d, n, e, Z) {
for (; --Z >= 0; ) {
var y = s * this[g++] + d[n] + e;
e = Math.floor(y / 67108864), d[n++] = y & 67108863;
}
return e;
}
function c(g, s, d, n, e, Z) {
for (var y = s & 32767, K = s >> 15; --Z >= 0; ) {
var W = this[g] & 32767, p = this[g++] >> 15, J = K * W + p * y;
W = y * W + ((J & 32767) << 15) + d[n] + (e & 1073741823), e = (W >>> 30) + (J >>> 15) + K * p + (e >>> 30), d[n++] = W & 1073741823;
}
return e;
}
function G(g, s, d, n, e, Z) {
for (var y = s & 16383, K = s >> 14; --Z >= 0; ) {
var W = this[g] & 16383, p = this[g++] >> 14, J = K * W + p * y;
W = y * W + ((J & 16383) << 14) + d[n] + e, e = (W >> 28) + (J >> 14) + K * p, d[n++] = W & 268435455;
}
return e;
}
i == "Microsoft Internet Explorer" ? (t.prototype.am = c, B = 30) : i != "Netscape" ? (t.prototype.am = S, B = 26) : (t.prototype.am = G, B = 28), t.prototype.DB = B, t.prototype.DM = (1 << B) - 1, t.prototype.DV = 1 << B;
var m = 52;
t.prototype.FV = Math.pow(2, m), t.prototype.F1 = m - B, t.prototype.F2 = 2 * B - m;
var u = "0123456789abcdefghijklmnopqrstuvwxyz", w = new Array(), a, V;
for (a = 48, V = 0; V <= 9; ++V) w[a++] = V;
for (a = 97, V = 10; V < 36; ++V) w[a++] = V;
for (a = 65, V = 10; V < 36; ++V) w[a++] = V;
function h(g) {
return u.charAt(g);
}
function H(g, s) {
var d = w[g.charCodeAt(s)];
return d ?? -1;
}
function L(g) {
for (var s = this.t - 1; s >= 0; --s) g[s] = this[s];
g.t = this.t, g.s = this.s;
}
function X(g) {
this.t = 1, this.s = g < 0 ? -1 : 0, g > 0 ? this[0] = g : g < -1 ? this[0] = g + this.DV : this.t = 0;
}
function Y(g) {
var s = b();
return s.fromInt(g), s;
}
function r(g, s) {
var d;
if (s == 16) d = 4;
else if (s == 8) d = 3;
else if (s == 256) d = 8;
else if (s == 2) d = 1;
else if (s == 32) d = 5;
else if (s == 4) d = 2;
else {
this.fromRadix(g, s);
return;
}
this.t = 0, this.s = 0;
for (var n = g.length, e = !1, Z = 0; --n >= 0; ) {
var y = d == 8 ? g[n] & 255 : H(g, n);
if (y < 0) {
g.charAt(n) == "-" && (e = !0);
continue;
}
e = !1, Z == 0 ? this[this.t++] = y : Z + d > this.DB ? (this[this.t - 1] |= (y & (1 << this.DB - Z) - 1) << Z, this[this.t++] = y >> this.DB - Z) : this[this.t - 1] |= y << Z, Z += d, Z >= this.DB && (Z -= this.DB);
}
d == 8 && g[0] & 128 && (this.s = -1, Z > 0 && (this[this.t - 1] |= (1 << this.DB - Z) - 1 << Z)), this.clamp(), e && t.ZERO.subTo(this, this);
}
function R() {
for (var g = this.s & this.DM; this.t > 0 && this[this.t - 1] == g; ) --this.t;
}
function T(g) {
if (this.s < 0) return "-" + this.negate().toString(g);
var s;
if (g == 16) s = 4;
else if (g == 8) s = 3;
else if (g == 2) s = 1;
else if (g == 32) s = 5;
else if (g == 4) s = 2;
else return this.toRadix(g);
var d = (1 << s) - 1, n, e = !1, Z = "", y = this.t, K = this.DB - y * this.DB % s;
if (y-- > 0)
for (K < this.DB && (n = this[y] >> K) > 0 && (e = !0, Z = h(n)); y >= 0; )
K < s ? (n = (this[y] & (1 << K) - 1) << s - K, n |= this[--y] >> (K += this.DB - s)) : (n = this[y] >> (K -= s) & d, K <= 0 && (K += this.DB, --y)), n > 0 && (e = !0), e && (Z += h(n));
return e ? Z : "0";
}
function f() {
var g = b();
return t.ZERO.subTo(this, g), g;
}
function U() {
return this.s < 0 ? this.negate() : this;
}
function _(g) {
var s = this.s - g.s;
if (s != 0) return s;
var d = this.t;
if (s = d - g.t, s != 0) return this.s < 0 ? -s : s;
for (; --d >= 0; )
if ((s = this[d] - g[d]) != 0) return s;
return 0;
}
function II(g) {
var s = 1, d;
return (d = g >>> 16) != 0 && (g = d, s += 16), (d = g >> 8) != 0 && (g = d, s += 8), (d = g >> 4) != 0 && (g = d, s += 4), (d = g >> 2) != 0 && (g = d, s += 2), (d = g >> 1) != 0 && (g = d, s += 1), s;
}
function gI() {
return this.t <= 0 ? 0 : this.DB * (this.t - 1) + II(this[this.t - 1] ^ this.s & this.DM);
}
function BI(g, s) {
var d;
for (d = this.t - 1; d >= 0; --d) s[d + g] = this[d];
for (d = g - 1; d >= 0; --d) s[d] = 0;
s.t = this.t + g, s.s = this.s;
}
function uI(g, s) {
for (var d = g; d < this.t; ++d) s[d - g] = this[d];
s.t = Math.max(this.t - g, 0), s.s = this.s;
}
function KI(g, s) {
var d = g % this.DB, n = this.DB - d, e = (1 << n) - 1, Z = Math.floor(g / this.DB), y = this.s << d & this.DM, K;
for (K = this.t - 1; K >= 0; --K)
s[K + Z + 1] = this[K] >> n | y, y = (this[K] & e) << d;
for (K = Z - 1; K >= 0; --K) s[K] = 0;
s[Z] = y, s.t = this.t + Z + 1, s.s = this.s, s.clamp();
}
function tg(g, s) {
s.s = this.s;
var d = Math.floor(g / this.DB);
if (d >= this.t) {
s.t = 0;
return;
}
var n = g % this.DB, e = this.DB - n, Z = (1 << n) - 1;
s[0] = this[d] >> n;
for (var y = d + 1; y < this.t; ++y)
s[y - d - 1] |= (this[y] & Z) << e, s[y - d] = this[y] >> n;
n > 0 && (s[this.t - d - 1] |= (this.s & Z) << e), s.t = this.t - d, s.clamp();
}
function PI(g, s) {
for (var d = 0, n = 0, e = Math.min(g.t, this.t); d < e; )
n += this[d] - g[d], s[d++] = n & this.DM, n >>= this.DB;
if (g.t < this.t) {
for (n -= g.s; d < this.t; )
n += this[d], s[d++] = n & this.DM, n >>= this.DB;
n += this.s;
} else {
for (n += this.s; d < g.t; )
n -= g[d], s[d++] = n & this.DM, n >>= this.DB;
n -= g.s;
}
s.s = n < 0 ? -1 : 0, n < -1 ? s[d++] = this.DV + n : n > 0 && (s[d++] = n), s.t = d, s.clamp();
}
function il(g, s) {
var d = this.abs(), n = g.abs(), e = d.t;
for (s.t = e + n.t; --e >= 0; ) s[e] = 0;
for (e = 0; e < n.t; ++e) s[e + d.t] = d.am(0, n[e], s, e, 0, d.t);
s.s = 0, s.clamp(), this.s != g.s && t.ZERO.subTo(s, s);
}
function vC(g) {
for (var s = this.abs(), d = g.t = 2 * s.t; --d >= 0; ) g[d] = 0;
for (d = 0; d < s.t - 1; ++d) {
var n = s.am(d, s[d], g, 2 * d, 0, 1);
(g[d + s.t] += s.am(d + 1, 2 * s[d], g, 2 * d + 1, n, s.t - d - 1)) >= s.DV && (g[d + s.t] -= s.DV, g[d + s.t + 1] = 1);
}
g.t > 0 && (g[g.t - 1] += s.am(d, s[d], g, 2 * d, 0, 1)), g.s = 0, g.clamp();
}
function qA(g, s, d) {
var n = g.abs();
if (!(n.t <= 0)) {
var e = this.abs();
if (e.t < n.t) {
s != null && s.fromInt(0), d != null && this.copyTo(d);
return;
}
d == null && (d = b());
var Z = b(), y = this.s, K = g.s, W = this.DB - II(n[n.t - 1]);
W > 0 ? (n.lShiftTo(W, Z), e.lShiftTo(W, d)) : (n.copyTo(Z), e.copyTo(d));
var p = Z.t, J = Z[p - 1];
if (J != 0) {
var F = J * (1 << this.F1) + (p > 1 ? Z[p - 2] >> this.F2 : 0), Q = this.FV / F, q = (1 << this.F1) / F, lI = 1 << this.F2, tI = d.t, wI = tI - p, JI = s ?? b();
for (Z.dlShiftTo(wI, JI), d.compareTo(JI) >= 0 && (d[d.t++] = 1, d.subTo(JI, d)), t.ONE.dlShiftTo(p, JI), JI.subTo(Z, Z); Z.t < p; ) Z[Z.t++] = 0;
for (; --wI >= 0; ) {
var ig = d[--tI] == J ? this.DM : Math.floor(d[tI] * Q + (d[tI - 1] + lI) * q);
if ((d[tI] += Z.am(0, ig, d, wI, 0, p)) < ig)
for (Z.dlShiftTo(wI, JI), d.subTo(JI, d); d[tI] < --ig; ) d.subTo(JI, d);
}
s != null && (d.drShiftTo(p, s), y != K && t.ZERO.subTo(s, s)), d.t = p, d.clamp(), W > 0 && d.rShiftTo(W, d), y < 0 && t.ZERO.subTo(d, d);
}
}
}
function $A(g) {
var s = b();
return this.abs().divRemTo(g, null, s), this.s < 0 && s.compareTo(t.ZERO) > 0 && g.subTo(s, s), s;
}
function ng(g) {
this.m = g;
}
function zC(g) {
return g.s < 0 || g.compareTo(this.m) >= 0 ? g.mod(this.m) : g;
}
function EC(g) {
return g;
}
function sl(g) {
g.divRemTo(this.m, null, g);
}
function UC(g, s, d) {
g.multiplyTo(s, d), this.reduce(d);
}
function fC(g, s) {
g.squareTo(s), this.reduce(s);
}
ng.prototype.convert = zC, ng.prototype.revert = EC, ng.prototype.reduce = sl, ng.prototype.mulTo = UC, ng.prototype.sqrTo = fC;
function UI() {
if (this.t < 1) return 0;
var g = this[0];
if (!(g & 1)) return 0;
var s = g & 3;
return s = s * (2 - (g & 15) * s) & 15, s = s * (2 - (g & 255) * s) & 255, s = s * (2 - ((g & 65535) * s & 65535)) & 65535, s = s * (2 - g * s % this.DV) % this.DV, s > 0 ? this.DV - s : -s;
}
function Vg(g) {
this.m = g, this.mp = g.invDigit(), this.mpl = this.mp & 32767, this.mph = this.mp >> 15, this.um = (1 << g.DB - 15) - 1, this.mt2 = 2 * g.t;
}
function $0(g) {
var s = b();
return g.abs().dlShiftTo(this.m.t, s), s.divRemTo(this.m, null, s), g.s < 0 && s.compareTo(t.ZERO) > 0 && this.m.subTo(s, s), s;
}
function IB(g) {
var s = b();
return g.copyTo(s), this.reduce(s), s;
}
function gB(g) {
for (; g.t <= this.mt2; )
g[g.t++] = 0;
for (var s = 0; s < this.m.t; ++s) {
var d = g[s] & 32767, n = d * this.mpl + ((d * this.mph + (g[s] >> 15) * this.mpl & this.um) << 15) & g.DM;
for (d = s + this.m.t, g[d] += this.m.am(0, n, g, s, 0, this.m.t); g[d] >= g.DV; )
g[d] -= g.DV, g[++d]++;
}
g.clamp(), g.drShiftTo(this.m.t, g), g.compareTo(this.m) >= 0 && g.subTo(this.m, g);
}
function CB(g, s) {
g.squareTo(s), this.reduce(s);
}
function AB(g, s, d) {
g.multiplyTo(s, d), this.reduce(d);
}
Vg.prototype.convert = $0, Vg.prototype.revert = IB, Vg.prototype.reduce = gB, Vg.prototype.mulTo = AB, Vg.prototype.sqrTo = CB;
function iB() {
return (this.t > 0 ? this[0] & 1 : this.s) == 0;
}
function sB(g, s) {
if (g > 4294967295 || g < 1) return t.ONE;
var d = b(), n = b(), e = s.convert(this), Z = II(g) - 1;
for (e.copyTo(d); --Z >= 0; )
if (s.sqrTo(d, n), (g & 1 << Z) > 0) s.mulTo(n, e, d);
else {
var y = d;
d = n, n = y;
}
return s.revert(d);
}
function lB(g, s) {
var d;
return g < 256 || s.isEven() ? d = new ng(s) : d = new Vg(s), this.exp(g, d);
}
t.prototype.copyTo = L, t.prototype.fromInt = X, t.prototype.fromString = r, t.prototype.clamp = R, t.prototype.dlShiftTo = BI, t.prototype.drShiftTo = uI, t.prototype.lShiftTo = KI, t.prototype.rShiftTo = tg, t.prototype.subTo = PI, t.prototype.multiplyTo = il, t.prototype.squareTo = vC, t.prototype.divRemTo = qA, t.prototype.invDigit = UI, t.prototype.isEven = iB, t.prototype.exp = sB, t.prototype.toString = T, t.prototype.negate = f, t.prototype.abs = U, t.prototype.compareTo = _, t.prototype.bitLength = gI, t.prototype.mod = $A, t.prototype.modPowInt = lB, t.ZERO = Y(0), t.ONE = Y(1);
function dB() {
var g = b();
return this.copyTo(g), g;
}
function oB() {
if (this.s < 0) {
if (this.t == 1) return this[0] - this.DV;
if (this.t == 0) return -1;
} else {
if (this.t == 1) return this[0];
if (this.t == 0) return 0;
}
return (this[1] & (1 << 32 - this.DB) - 1) << this.DB | this[0];
}
function BB() {
return this.t == 0 ? this.s : this[0] << 24 >> 24;
}
function tB() {
return this.t == 0 ? this.s : this[0] << 16 >> 16;
}
function nB(g) {
return Math.floor(Math.LN2 * this.DB / Math.log(g));
}
function bB() {
return this.s < 0 ? -1 : this.t <= 0 || this.t == 1 && this[0] <= 0 ? 0 : 1;
}
function eB(g) {
if (g == null && (g = 10), this.signum() == 0 || g < 2 || g > 36) return "0";
var s = this.chunkSize(g), d = Math.pow(g, s), n = Y(d), e = b(), Z = b(), y = "";
for (this.divRemTo(n, e, Z); e.signum() > 0; )
y = (d + Z.intValue()).toString(g).substr(1) + y, e.divRemTo(n, e, Z);
return Z.intValue().toString(g) + y;
}
function cB(g, s) {
this.fromInt(0), s == null && (s = 10);
for (var d = this.chunkSize(s), n = Math.pow(s, d), e = !1, Z = 0, y = 0, K = 0; K < g.length; ++K) {
var W = H(g, K);
if (W < 0) {
g.charAt(K) == "-" && this.signum() == 0 && (e = !0);
continue;
}
y = s * y + W, ++Z >= d && (this.dMultiply(n), this.dAddOffset(y, 0), Z = 0, y = 0);
}
Z > 0 && (this.dMultiply(Math.pow(s, Z)), this.dAddOffset(y, 0)), e && t.ZERO.subTo(this, this);
}
function SB(g, s, d) {
if (typeof s == "number")
if (g < 2) this.fromInt(1);
else
for (this.fromNumber(g, d), this.testBit(g - 1) || this.bitwiseTo(t.ONE.shiftLeft(g - 1), Ii, this), this.isEven() && this.dAddOffset(1, 0); !this.isProbablePrime(s); )
this.dAddOffset(2, 0), this.bitLength() > g && this.subTo(t.ONE.shiftLeft(g - 1), this);
else {
var n = new Array(), e = g & 7;
n.length = (g >> 3) + 1, s.nextBytes(n), e > 0 ? n[0] &= (1 << e) - 1 : n[0] = 0, this.fromString(n, 256);
}
}
function GB() {
var g = this.t, s = new Array();
s[0] = this.s;
var d = this.DB - g * this.DB % 8, n, e = 0;
if (g-- > 0)
for (d < this.DB && (n = this[g] >> d) != (this.s & this.DM) >> d && (s[e++] = n | this.s << this.DB - d); g >= 0; )
d < 8 ? (n = (this[g] & (1 << d) - 1) << 8 - d, n |= this[--g] >> (d += this.DB - 8)) : (n = this[g] >> (d -= 8) & 255, d <= 0 && (d += this.DB, --g)), n & 128 && (n |= -256), e == 0 && (this.s & 128) != (n & 128) && ++e, (e > 0 || n != this.s) && (s[e++] = n);
return s;
}
function mB(g) {
return this.compareTo(g) == 0;
}
function ZB(g) {
return this.compareTo(g) < 0 ? this : g;
}
function uB(g) {
return this.compareTo(g) > 0 ? this : g;
}
function aB(g, s, d) {
var n, e, Z = Math.min(g.t, this.t);
for (n = 0; n < Z; ++n) d[n] = s(this[n], g[n]);
if (g.t < this.t) {
for (e = g.s & this.DM, n = Z; n < this.t; ++n) d[n] = s(this[n], e);
d.t = this.t;
} else {
for (e = this.s & this.DM, n = Z; n < g.t; ++n) d[n] = s(e, g[n]);
d.t = g.t;
}
d.s = s(this.s, g.s), d.clamp();
}
function wB(g, s) {
return g & s;
}
function yB(g) {
var s = b();
return this.bitwiseTo(g, wB, s), s;
}
function Ii(g, s) {
return g | s;
}
function VB(g) {
var s = b();
return this.bitwiseTo(g, Ii, s), s;
}
function ll(g, s) {
return g ^ s;
}
function KB(g) {
var s = b();
return this.bitwiseTo(g, ll, s), s;
}
function dl(g, s) {
return g & ~s;
}
function WB(g) {
var s = b();
return this.bitwiseTo(g, dl, s), s;
}
function HB() {
for (var g = b(), s = 0; s < this.t; ++s) g[s] = this.DM & ~this[s];
return g.t = this.t, g.s = ~this.s, g;
}
function hB(g) {
var s = b();
return g < 0 ? this.rShiftTo(-g, s) : this.lShiftTo(g, s), s;
}
function XB(g) {
var s = b();
return g < 0 ? this.lShiftTo(-g, s) : this.rShiftTo(g, s), s;
}
function LB(g) {
if (g == 0) return -1;
var s = 0;
return g & 65535 || (g >>= 16, s += 16), g & 255 || (g >>= 8, s += 8), g & 15 || (g >>= 4, s += 4), g & 3 || (g >>= 2, s += 2), g & 1 || ++s, s;
}
function pB() {
for (var g = 0; g < this.t; ++g)
if (this[g] != 0) return g * this.DB + LB(this[g]);
return this.s < 0 ? this.t * this.DB : -1;
}
function rB(g) {
for (var s = 0; g != 0; )
g &= g - 1, ++s;
return s;
}
function DB() {
for (var g = 0, s = this.s & this.DM, d = 0; d < this.t; ++d) g += rB(this[d] ^ s);
return g;
}
function YB(g) {
var s = Math.floor(g / this.DB);
return s >= this.t ? this.s != 0 : (this[s] & 1 << g % this.DB) != 0;
}
function RB(g, s) {
var d = t.ONE.shiftLeft(g);
return this.bitwiseTo(d, s, d), d;
}
function FB(g) {
return this.changeBit(g, Ii);
}
function MB(g) {
return this.changeBit(g, dl);
}
function PB(g) {
return this.changeBit(g, ll);
}
function JB(g, s) {
for (var d = 0, n = 0, e = Math.min(g.t, this.t); d < e; )
n += this[d] + g[d], s[d++] = n & this.DM, n >>= this.DB;
if (g.t < this.t) {
for (n += g.s; d < this.t; )
n += this[d], s[d++] = n & this.DM, n >>= this.DB;
n += this.s;
} else {
for (n += this.s; d < g.t; )
n += g[d], s[d++] = n & this.DM, n >>= this.DB;
n += g.s;
}
s.s = n < 0 ? -1 : 0, n > 0 ? s[d++] = n : n < -1 && (s[d++] = this.DV + n), s.t = d, s.clamp();
}
function kB(g) {
var s = b();
return this.addTo(g, s), s;
}
function TB(g) {
var s = b();
return this.subTo(g, s), s;
}
function QB(g) {
var s = b();
return this.multiplyTo(g, s), s;
}
function NB() {
var g = b();
return this.squareTo(g), g;
}
function vB(g) {
var s = b();
return this.divRemTo(g, s, null), s;
}
function zB(g) {
var s = b();
return this.divRemTo(g, null, s), s;
}
function EB(g) {
var s = b(), d = b();
return this.divRemTo(g, s, d), new Array(s, d);
}
function UB(g) {
this[this.t] = this.am(0, g - 1, this, 0, 0, this.t), ++this.t, this.clamp();
}
function fB(g, s) {
if (g != 0) {
for (; this.t <= s; ) this[this.t++] = 0;
for (this[s] += g; this[s] >= this.DV; )
this[s] -= this.DV, ++s >= this.t && (this[this.t++] = 0), ++this[s];
}
}
function lC() {
}
function ol(g) {
return g;
}
function xB(g, s, d) {
g.multiplyTo(s, d);
}
function OB(g, s) {
g.squareTo(s);
}
lC.prototype.convert = ol, lC.prototype.revert = ol, lC.prototype.mulTo = xB, lC.prototype.sqrTo = OB;
function jB(g) {
return this.exp(g, new lC());
}
function _B(g, s, d) {
var n = Math.min(this.t + g.t, s);
for (d.s = 0, d.t = n; n > 0; ) d[--n] = 0;
var e;
for (e = d.t - this.t; n < e; ++n) d[n + this.t] = this.am(0, g[n], d, n, 0, this.t);
for (e = Math.min(g.t, s); n < e; ++n) this.am(0, g[n], d, n, 0, s - n);
d.clamp();
}
function qB(g, s, d) {
--s;
var n = d.t = this.t + g.t - s;
for (d.s = 0; --n >= 0; ) d[n] = 0;
for (n = Math.max(s - this.t, 0); n < g.t; ++n)
d[this.t + n - s] = this.am(s - n, g[n], d, 0, 0, this.t + n - s);
d.clamp(), d.drShiftTo(1, d);
}
function Fg(g) {
this.r2 = b(), this.q3 = b(), t.ONE.dlShiftTo(2 * g.t, this.r2), this.mu = this.r2.divide(g), this.m = g;
}
function $B(g) {
if (g.s < 0 || g.t > 2 * this.m.t) return g.mod(this.m);
if (g.compareTo(this.m) < 0) return g;
var s = b();
return g.copyTo(s), this.reduce(s), s;
}
function It(g) {
return g;
}