From 4b31861be090539d4d32a7252b312c016b3390d8 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 12 Jul 2026 09:09:49 -0500 Subject: [PATCH 1/5] feat(training): add GR00T policy support --- lelab/train.py | 40 ++++++++++++++++++++++++++++++++++++++++ lelab/utils/system.py | 3 +++ 2 files changed, 43 insertions(+) diff --git a/lelab/train.py b/lelab/train.py index bfdc0226..871f3491 100644 --- a/lelab/train.py +++ b/lelab/train.py @@ -18,6 +18,7 @@ lives in app/jobs.py. """ +import json import re from typing import TYPE_CHECKING @@ -35,6 +36,7 @@ class TrainingRequest(BaseModel): dataset_revision: str | None = None dataset_root: str | None = None dataset_episodes: list[int] | None = None + dataset_image_transforms_enable: bool = False # Policy configuration policy_type: str = "act" @@ -49,6 +51,7 @@ class TrainingRequest(BaseModel): log_freq: int = 250 save_freq: int = 1000 env_eval_freq: int = 0 + eval_steps: int = 0 save_checkpoint: bool = True # Output configuration @@ -79,6 +82,17 @@ class TrainingRequest(BaseModel): policy_push_to_hub: bool = False policy_repo_id: str | None = None + # GR00T-specific policy options (only emitted when policy_type == "groot"; + # these flags don't exist on other policy configs, so draccus would reject + # them). All optional — unset fields fall back to the groot config defaults. + policy_base_model_path: str | None = None + policy_embodiment_tag: str | None = None + policy_chunk_size: int | None = None + policy_n_action_steps: int | None = None + policy_use_relative_actions: bool | None = None + policy_relative_exclude_joints: list[str] | None = None + policy_use_bf16: bool | None = None + # Optimizer optimizer_type: str | None = "adam" optimizer_lr: float | None = None @@ -118,6 +132,8 @@ def build_training_command( cmd.extend(["--dataset.root", request.dataset_root]) if request.dataset_episodes: cmd.extend(["--dataset.episodes"] + [str(ep) for ep in request.dataset_episodes]) + if request.dataset_image_transforms_enable: + cmd.extend(["--dataset.image_transforms.enable", "true"]) # Policy cmd.extend(["--policy.type", request.policy_type]) @@ -143,10 +159,34 @@ def build_training_command( if request.policy_push_to_hub and request.policy_repo_id: cmd.extend(["--policy.repo_id", request.policy_repo_id]) + # GR00T-specific policy flags. These options only exist on the groot config, + # so emit them only for --policy.type=groot; sending them to another policy + # would make draccus abort the run. Each is skipped when unset so the groot + # config's own defaults apply. + if request.policy_type == "groot": + if request.policy_base_model_path: + cmd.extend(["--policy.base_model_path", request.policy_base_model_path]) + if request.policy_embodiment_tag: + cmd.extend(["--policy.embodiment_tag", request.policy_embodiment_tag]) + if request.policy_chunk_size is not None: + cmd.extend(["--policy.chunk_size", str(request.policy_chunk_size)]) + if request.policy_n_action_steps is not None: + cmd.extend(["--policy.n_action_steps", str(request.policy_n_action_steps)]) + if request.policy_use_relative_actions is not None: + cmd.extend( + ["--policy.use_relative_actions", "true" if request.policy_use_relative_actions else "false"] + ) + if request.policy_relative_exclude_joints is not None: + # draccus parses list values from a single JSON token, e.g. '["gripper"]'. + cmd.extend(["--policy.relative_exclude_joints", json.dumps(request.policy_relative_exclude_joints)]) + if request.policy_use_bf16 is not None: + cmd.extend(["--policy.use_bf16", "true" if request.policy_use_bf16 else "false"]) + # Logging / checkpointing cmd.extend(["--log_freq", str(request.log_freq)]) cmd.extend(["--save_freq", str(request.save_freq)]) cmd.extend(["--env_eval_freq", str(request.env_eval_freq)]) + cmd.extend(["--eval_steps", str(request.eval_steps)]) cmd.extend(["--save_checkpoint", "true" if request.save_checkpoint else "false"]) # Output. On HF Cloud the pod, not this host, runs the trainer: an absolute host diff --git a/lelab/utils/system.py b/lelab/utils/system.py index 128a0431..a4029303 100644 --- a/lelab/utils/system.py +++ b/lelab/utils/system.py @@ -200,6 +200,9 @@ def handle_install_wandb_extra_status() -> dict[str, Any]: "pi0": ("transformers", "lerobot[pi]"), "pi0_fast": ("transformers", "lerobot[pi]"), "diffusion": ("diffusers", "lerobot[diffusion]"), + # groot pulls in peft (LoRA), diffusers, timm, dm-tree and decord; peft is a + # reliable, cross-platform stand-in for "the lerobot[groot] extra is present". + "groot": ("peft", "lerobot[groot]"), } # One install manager per install target (lerobot[smolvla] / lerobot[pi] / …), From 9106347a4091500d02d87d531882eb84e97abec1 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 12 Jul 2026 09:09:49 -0500 Subject: [PATCH 2/5] feat(frontend): add GR00T training configuration --- ...{index-Da-rRmcX.css => index-C5KQGL1C.css} | 2 +- frontend/dist/assets/index-CuYRVmdE.js | 3956 ----------------- frontend/dist/assets/index-Vh3JnQ1R.js | 3956 +++++++++++++++++ frontend/dist/index.html | 40 +- .../components/training/ConfigurationTab.tsx | 2 + .../training/config/EssentialsCard.tsx | 1 + .../components/training/config/GrootCard.tsx | 176 + frontend/src/components/training/types.ts | 11 + frontend/src/lib/jobsApi.ts | 11 + frontend/src/pages/Training.tsx | 15 + 10 files changed, 4193 insertions(+), 3977 deletions(-) rename frontend/dist/assets/{index-Da-rRmcX.css => index-C5KQGL1C.css} (94%) delete mode 100644 frontend/dist/assets/index-CuYRVmdE.js create mode 100644 frontend/dist/assets/index-Vh3JnQ1R.js create mode 100644 frontend/src/components/training/config/GrootCard.tsx diff --git a/frontend/dist/assets/index-Da-rRmcX.css b/frontend/dist/assets/index-C5KQGL1C.css similarity index 94% rename from frontend/dist/assets/index-Da-rRmcX.css rename to frontend/dist/assets/index-C5KQGL1C.css index be9077f5..cb4dbd7e 100644 --- a/frontend/dist/assets/index-Da-rRmcX.css +++ b/frontend/dist/assets/index-C5KQGL1C.css @@ -1 +1 @@ -*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} +*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-96{width:24rem}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/frontend/dist/assets/index-CuYRVmdE.js b/frontend/dist/assets/index-CuYRVmdE.js deleted file mode 100644 index 3c9d8a43..00000000 --- a/frontend/dist/assets/index-CuYRVmdE.js +++ /dev/null @@ -1,3956 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` -`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ie(e):``}function se(e){switch(e.tag){case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ce(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function L(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fe(e){e._valueTracker||=L(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function R(e,t){var n=t.checked;return ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function he(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function z(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ge(e,t){z(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ve(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ae={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ae).forEach(function(e){je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ae[t]=Ae[e]})});function Me(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ae.hasOwnProperty(e)&&Ae[e]?(``+t).trim():t+`px`}function Ne(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Me(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Pe=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fe(e,t){if(t){if(Pe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ie(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Le=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,Ve=null;function He(e){if(e=zi(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),ze(e.stateNode,e.type,t))}}function Ue(e){Be?Ve?Ve.push(e):Ve=[e]:Be=e}function We(){if(Be){var e=Be,t=Ve;if(Ve=Be=null,He(e),t)for(e=0;e>>=0,e===0?32:31-(Dt(e)/Ot|0)|0}var At=64,jt=4194304;function Mt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Mt(a))):r=Mt(s)}else o=n&~i,o===0?a!==0&&(r=Mt(a)):r=Mt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function B(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Fr(e){var t=Nr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mr(n.ownerDocument.documentElement,n)){if(r!==null&&Pr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=jr(n,a);var o=jr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,U=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||U==null||U!==me(r)||(r=U,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function Ki(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var qi={},Ji=Wi(qi),Yi=Wi(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qi(e){return e=e.childContextTypes,e!=null}function $i(){Gi(Yi),Gi(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));Ki(Ji,t),Ki(Yi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return ne({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qi,Xi=Ji.current,Ki(Ji,e),Ki(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,Gi(Yi),Gi(Ji),Ki(Ji,e)):Gi(Yi),Ki(Yi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=Vt;try{var n=ia;for(Vt=1;e>=o,i-=o,_a=1<<32-Et(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ta&&ya(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ta&&ya(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ta&&ya(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ta&&ya(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&za(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=La(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=iu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ru(i.type,i.key,i.props,null,e.mode,o),o.ref=La(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=su(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ye(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Ra(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=ou(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Va=Ba(!0),Ha=Ba(!1),Ua=Wi(null),Wa=null,Ga=null,Ka=null;function qa(){Ka=Ga=Wa=null}function Ja(e){var t=Ua.current;Gi(Ua),e._currentValue=t}function Ya(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xa(e,t){Wa=e,Ka=Ga=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Za(e){var t=e._currentValue;if(Ka!==e)if(e={context:e,memoizedValue:t,next:null},Ga===null){if(Wa===null)throw Error(r(308));Ga=e,Wa.dependencies={lanes:0,firstContext:e}}else Ga=Ga.next=e;return t}var Qa=null;function $a(e){Qa===null?Qa=[e]:Qa.push(e)}function eo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,$a(t)):(n.next=i.next,i.next=n),t.interleaved=n,to(e,r)}function to(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ao(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,to(e,n)}return i=r.interleaved,i===null?(t.next=t,$a(r)):(t.next=i.next,i.next=t),r.interleaved=t,to(e,n)}function so(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}function co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lo(e,t,n,r){var i=e.updateQueue;no=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=ne({},d,f);break a;case 2:no=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);tl|=o,e.lanes=o,e.memoizedState=d}}function uo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{Vt=n,Eo.transition=r}}function fs(){return Bo().memoizedState}function ps(e,t,n){var r=bl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e))gs(t,n);else if(n=eo(e,t,n,r),n!==null){var i=yl();xl(n,e,r,i),_s(n,t,r)}}function ms(e,t,n){var r=bl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))gs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o)){var c=t.interleaved;c===null?(i.next=i,$a(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=eo(e,t,i,r),n!==null&&(i=yl(),xl(n,e,r,i),_s(n,t,r))}}function hs(e){var t=e.alternate;return e===Oo||t!==null&&t===Oo}function gs(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _s(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var vs={readContext:Za,useCallback:Fo,useContext:Fo,useEffect:Fo,useImperativeHandle:Fo,useInsertionEffect:Fo,useLayoutEffect:Fo,useMemo:Fo,useReducer:Fo,useRef:Fo,useState:Fo,useDebugValue:Fo,useDeferredValue:Fo,useTransition:Fo,useMutableSource:Fo,useSyncExternalStore:Fo,useId:Fo,unstable_isNewReconciler:!1},ys={readContext:Za,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:Za,useEffect:ns,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),es(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){return es(4,2,e,t)},useMemo:function(e,t){var n=zo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ps.bind(null,Oo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:Zo,useDebugValue:cs,useDeferredValue:function(e){return zo().memoizedState=e},useTransition:function(){var e=Zo(!1),t=e[0];return e=ds.bind(null,e[1]),zo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Oo,a=zo();if(Ta){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Jc===null)throw Error(r(349));Do&30||Ko(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Jo.bind(null,i,o,e),[e]),i.flags|=2048,Qo(9,qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=zo(),t=Jc.identifierPrefix;if(Ta){var n=va,r=_a;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=No++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ie(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;osl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=So(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ta)return fc(t),null}else 2*gt()-s.renderingStartTime>sl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=gt(),t.sibling=null,n=xo.current,Ki(xo,i?n&1|2:n&1),t);case 22:case 23:return jl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Zc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Sa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vo(),Gi(Yi),Gi(Ji),wo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bo(t),null;case 13:if(Gi(xo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(xo),null;case 4:return vo(),null;case 10:return Ja(t.type._context),null;case 22:case 23:return jl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Gl(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Gl(e,t,n)}}var bc=!1;function xc(e,t){if(bi=mn,e=Nr(),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},mn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ss(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Gl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var Ac=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount==`function`)try{wt.onCommitFiberUnmount(Ct,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=Ac,i=jc;Ac=null,Mc(e,t,n),Ac=r,jc=i,Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ac.removeChild(n.stateNode));break;case 18:Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),fn(e)):Oi(Ac,n.stateNode));break;case 4:r=Ac,i=jc,Ac=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),Ac=r,jc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Gl(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Mc(e,t,n),gc=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Yl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=gt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10e?16:e,pl===null)var i=!1;else{if(e=pl,pl=null,ml=0,qc&6)throw Error(r(331));var a=qc;for(qc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lgt()-ol?Ml(e,0):rl|=n),Sl(e,t)}function ql(e,t){t===0&&(e.mode&1?(t=jt,jt<<=1,!(jt&130023424)&&(jt=4194304)):t=1);var n=yl();e=to(e,t),e!==null&&(zt(e,t,n),Sl(e,n))}function Jl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ql(e,n)}function Yl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),ql(e,n)}var Xl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Ta&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Xa(t,n),a=Lo(null,t,i,e,a,n);var o=Ro();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ro(t),a.updater=ws,t.stateNode=a,a._reactInternals=t,Os(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,Ta&&o&&xa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=tu(i),e=Ss(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,Ss(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,io(e,t),lo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=ks(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=ks(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(wa=ki(t.stateNode.containerInfo.firstChild),Ca=t,Ta=!0,Ea=null,n=Ha(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Pa(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return yo(t),e===null&&Aa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Aa(t),null;case 13:return Qs(e,t,n);case 4:return _o(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Va(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ua,i._currentValue),i._currentValue=s,o!==null)if(Or(o.value,s)){if(o.children===a.children&&!Yi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ao(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ya(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ya(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Xa(t,n),a=Za(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=Ss(i,t.pendingProps),a=Ss(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),ac(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Xa(t,n),Es(t,i,a),Os(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Zl(e,t){return ft(e,t)}function Ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $l(e,t,n,r){return new Ql(e,t,n,r)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tu(e){if(typeof e==`function`)return+!!eu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function nu(e,t){var n=e.alternate;return n===null?(n=$l(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ru(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)eu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return iu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=$l(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=$l(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=$l(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return au(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=$l(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function iu(e,t,n,r){return e=$l(7,e,r,t),e.lanes=n,e}function au(e,t,n,r){return e=$l(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function ou(e,t,n){return e=$l(6,e,null,t),e.lanes=n,e}function su(e,t,n){return t=$l(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lu(e,t,n,r,i,a,o,s,c){return e=new cu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=$l(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ro(a),e}function uu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d()),v=l(h()),y=g();function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function j(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=x.Pop,c=null,l=u();l??(l=0,o.replaceState(b({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=x.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=x.Push;let r=O(h.location,e,t);n&&n(r,e),l=u()+1;let d=D(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=x.Replace;let r=O(h.location,e,t);n&&n(r,e),l=u();let i=D(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:k(e);return n=n.replace(/ $/,`%20`),w(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var M;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(M||={});function N(e,t,n){return n===void 0&&(n=`/`),P(e,t,n,!1)}function P(e,t,n,r){let i=pe((typeof t==`string`?A(t):t).pathname||`/`,n);if(i==null)return null;let a=F(e);ee(a);let o=null,s=fe(i);for(let e=0;o==null&&e{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(w(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=xe([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),F(e.children,t,c,s)),!(e.path==null&&!e.index)&&t.push({path:s,score:ce(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of I(e.path))i(e,t,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ee(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var te=/^:[\w-]+$/,ne=3,re=2,ie=1,ae=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=re),n.filter(e=>!se(e)).reduce((e,t)=>e+(te.test(t)?ne:t===``?ie:ae),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return i&&!c?e[r]=void 0:e[r]=(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function L(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "`+e+`" will be treated as if it were `+(`"`+e.replace(/\*$/,`/*`)+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+(`please change the route path to "`+e.replace(/\*$/,`/*`)+`".`));let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function pe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var me=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R=e=>me.test(e);function he(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;if(n)if(R(n))a=n;else{if(n.includes(`//`)){let e=n;n=be(n),T(!1,`Pathnames cannot have embedded double slashes - normalizing `+(e+` -> `+n))}a=n.startsWith(`/`)?z(n.substring(1),`/`):z(n,t)}else a=t;return{pathname:a,search:Ce(r),hash:we(i)}}function z(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in and the router will parse it for you.`}function _e(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ve(e,t){let n=_e(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function ye(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=A(e):(i=b({},e),w(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/\/\/+/g,`/`),xe=e=>be(e.join(`/`)),Se=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ce=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,we=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Ee=[`post`,`put`,`patch`,`delete`];new Set(Ee);var De=[`get`,...Ee];new Set(De);function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),_.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=ye(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:xe([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}function Be(){let{matches:e}=_.useContext(Ne),t=e[e.length-1];return t?t.params:{}}function Ve(e,t){return He(e,t)}function He(e,t,n,r){!Fe()&&w(!1);let{navigator:i}=_.useContext(je),{matches:a}=_.useContext(Ne),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=Ie(),u;if(t){let e=typeof t==`string`?A(t):t;!(c===`/`||e.pathname?.startsWith(c))&&w(!1),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=N(e,{pathname:f}),m=qe(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:xe([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:xe([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&m?_.createElement(Me.Provider,{value:{location:Oe({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:x.Pop}},m):m}function Ue(){let e=et(),t=Te(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return _.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var We=_.createElement(Ue,null),Ge=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:_.createElement(Ne.Provider,{value:this.props.routeContext},_.createElement(Pe.Provider,{value:this.state.error,children:this.props.component}))}};function Ke(e){let{routeContext:t,match:n,children:r}=e,i=_.useContext(ke);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),_.createElement(Ne.Provider,{value:t},r)}function qe(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&w(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||We,s&&(c<0&&i===0?(rt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?_.createElement(r.route.Component,null):r.route.element?r.route.element:e,_.createElement(Ke,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?_.createElement(Ge,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var Je=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(Je||{}),Ye=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(Ye||{});function Xe(e){let t=_.useContext(ke);return!t&&w(!1),t}function Ze(e){let t=_.useContext(Ae);return!t&&w(!1),t}function Qe(e){let t=_.useContext(Ne);return!t&&w(!1),t}function $e(e){let t=Qe(e),n=t.matches[t.matches.length-1];return!n.route.id&&w(!1),n.route.id}function et(){let e=_.useContext(Pe),t=Ze(Ye.UseRouteError),n=$e(Ye.UseRouteError);return e===void 0?t.errors?.[n]:e}function tt(){let{router:e}=Xe(Je.UseNavigateStable),t=$e(Ye.UseNavigateStable),n=_.useRef(!1);return Le(()=>{n.current=!0}),_.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,Oe({fromRouteId:t},i)))},[e,t])}var nt={};function rt(e,t,n){!t&&!nt[e]&&(nt[e]=!0)}var it=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function at(e,t){e?.v7_startTransition===void 0&&it(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&it(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&it(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&it(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&it(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&it(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function ot(e){w(!1)}function st(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=x.Pop,navigator:a,static:o=!1,future:s}=e;Fe()&&w(!1);let c=t.replace(/^\/*/,`/`),l=_.useMemo(()=>({basename:c,navigator:a,static:o,future:Oe({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=A(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=_.useMemo(()=>{let e=pe(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:_.createElement(je.Provider,{value:l},_.createElement(Me.Provider,{children:n,value:h}))}function ct(e){let{children:t,location:n}=e;return Ve(ut(t),n)}var lt=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(lt||{});new Promise(()=>{}),_.Component;function ut(e,t){t===void 0&&(t=[]);let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,ut(e.props.children,i));return}e.type!==ot&&w(!1),!(!e.props.index||!e.props.children)&&w(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ut(e.props.children,i)),n.push(a)}),n}var dt=`6`;try{window.__reactRouterVersion=dt}catch{}var ft=_.startTransition;function pt(e){let{basename:t,children:n,future:r,window:i}=e,a=_.useRef();a.current??=C({window:i,v5Compat:!0});let o=a.current,[s,c]=_.useState({action:o.action,location:o.location}),{v7_startTransition:l}=r||{},u=_.useCallback(e=>{l&&ft?ft(()=>c(e)):c(e)},[c,l]);return _.useLayoutEffect(()=>o.listen(u),[o,u]),_.useEffect(()=>at(r),[r]),_.createElement(st,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}typeof window<`u`&&window.document!==void 0&&window.document.createElement;var mt;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(mt||={});var ht;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(ht||={});var gt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_t=new class extends gt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},vt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt=new class{#e=vt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function bt(e){setTimeout(e,0)}var xt=typeof window>`u`||`Deno`in globalThis;function St(){}function Ct(e,t){return typeof e==`function`?e(t):e}function wt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Tt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e==`function`?e(t):e}function Dt(e,t){return typeof e==`function`?e(t):e}function Ot(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==At(o,t.options))return!1}else if(!Mt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function kt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jt(t.options.mutationKey)!==jt(a))return!1}else if(!Mt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function At(e,t){return(t?.queryKeyHashFn||jt)(e)}function jt(e){return JSON.stringify(e,(e,t)=>It(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Mt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Mt(e[n],t[n])):!1}var Nt=Object.prototype.hasOwnProperty;function Pt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ft(e)&&Ft(t);if(!r&&!(It(e)&&It(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{yt.setTimeout(t,e)})}function zt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Pt(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vt=Symbol();function Ht(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Vt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Wt=(()=>{let e=()=>xt;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Kt=bt;function qt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Kt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Jt=qt(),Yt=new class extends gt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xt(e){return Math.min(1e3*2**e,3e4)}function Zt(e){return(e??`online`)===`online`?Yt.isOnline():!0}var Qt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $t(e){let t=!1,n=0,r,i=Gt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_t.isFocused()&&(e.networkMode===`always`||Yt.isOnline())&&e.canRun(),u=()=>Zt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wt.isServer()?0:3),o=e.retryDelay??Xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var en=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wt(this.gcTime)&&(this.#e=yt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(yt.clearTimeout(this.#e),this.#e=void 0)}};function tn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ut(e,()=>t.signal,()=>n=!0)},u=Ht(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Bt:B;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rn:nn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:nn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function nn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var an=class extends en{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=cn(this.options);e.data!==void 0&&(this.setState(sn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=zt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Dt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Et(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Tt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ht(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?tn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=$t({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...on(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...sn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Jt.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function on(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function sn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function cn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ln=class extends en{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||un(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$t({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Jt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function un(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var dn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ln({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=fn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kt(t,e))}findAll(e={}){return this.getAll().filter(t=>kt(e,t))}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Jt.batch(()=>Promise.all(e.map(e=>e.continue().catch(St))))}};function fn(e){return e.options.scope?.id}var pn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??At(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Jt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ot(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ot(e,t)):t}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new pn,this.#t=e.mutationCache||new dn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Yt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Jt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Jt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Jt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Jt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(St).catch(St)}invalidateQueries(e,t={}){return Jt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Jt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(St)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(St)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Yt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(jt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Mt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=At(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Vt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},hn=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=hn()}))(),gn=_.createContext(void 0),_n=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(gn.Provider,{value:e,children:t})),vn=(0,_.createContext)({theme:`system`,setTheme:()=>null});function yn({children:e,defaultTheme:t=`system`,storageKey:n=`vite-ui-theme`,...r}){let[i,a]=(0,_.useState)(()=>localStorage.getItem(n)||t);(0,_.useEffect)(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),i===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(i)},[i]);let o=(0,_.useCallback)(e=>{localStorage.setItem(n,e),a(e)},[n]),s=(0,_.useMemo)(()=>({theme:i,setTheme:o}),[i,o]);return(0,V.jsx)(vn.Provider,{...r,value:s,children:e})}var bn=e=>{switch(e){case`success`:return Cn;case`info`:return Tn;case`warning`:return wn;case`error`:return En;default:return null}},xn=Array(12).fill(0),Sn=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},xn.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Cn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),wn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Tn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),En=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Dn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),On=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},kn=1,An=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:kn++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Mn(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||kn++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},jn=(e,t)=>{let n=t?.id||kn++;return An.addToast({title:e,...t,id:n}),n},Mn=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Nn=Object.assign(jn,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:()=>An.toasts,getToasts:()=>An.getActiveToasts()});function Pn(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Pn(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Fn(e){return e.label!==void 0}var In=3,Ln=`32px`,Rn=`16px`,zn=4e3,Bn=356,Vn=14,Hn=20,Un=200;function Wn(...e){return e.filter(Boolean).join(` `)}function Gn(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kn=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,loadingIcon:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`,pauseWhenPageIsHidden:O}=e,[k,A]=_.useState(null),[j,M]=_.useState(null),[N,P]=_.useState(!1),[F,I]=_.useState(!1),[ee,te]=_.useState(!1),[ne,re]=_.useState(!1),[ie,ae]=_.useState(!1),[oe,se]=_.useState(0),[ce,le]=_.useState(0),ue=_.useRef(n.duration||b||zn),de=_.useRef(null),L=_.useRef(null),fe=c===0,pe=c+1<=o,me=n.type,R=n.dismissible!==!1,he=n.className||``,z=n.descriptionClassName||``,ge=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=_.useMemo(()=>n.duration||b||zn,[n.duration,b]),ye=_.useRef(0),be=_.useRef(0),xe=_.useRef(0),Se=_.useRef(null),[Ce,we]=x.split(`-`),Te=_.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=On(),De=n.invert||t,Oe=me===`loading`;be.current=_.useMemo(()=>ge*S+Te,[ge,Te]),_.useEffect(()=>{ue.current=ve},[ve]),_.useEffect(()=>{P(!0)},[]),_.useEffect(()=>{let e=L.current;if(e){let t=e.getBoundingClientRect().height;return le(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!N)return;let e=L.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,le(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id]);let ke=_.useCallback(()=>{I(!0),se(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Un)},[n,d,a,be]);_.useEffect(()=>{if(n.promise&&me===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||O&&Ee?(()=>{if(xe.current{var e;(e=n.onAutoClose)==null||e.call(n,n),ke()},ue.current)),()=>clearTimeout(e)},[u,i,n,me,O,Ee,ke]),_.useEffect(()=>{n.delete&&ke()},[ke,n.delete]);function Ae(){return E!=null&&E.loading?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},E.loading):C?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},C):_.createElement(Sn,{className:Wn(T?.loader,n?.classNames?.loader),visible:me===`loading`})}return _.createElement(`li`,{tabIndex:0,ref:L,className:Wn(v,he,T?.toast,n?.classNames?.toast,T?.default,T?.[me],n?.classNames?.[me]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":ie,"data-removed":F,"data-visible":pe,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":fe,"data-swiping":ee,"data-dismissible":R,"data-type":me,"data-invert":De,"data-swipe-out":ne,"data-swipe-direction":j,"data-expanded":!!(u||w&&N),style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?oe:be.current}px`,"--initial-height":w?`auto`:`${ce}px`,...m,...n.style},onDragEnd:()=>{te(!1),A(null),Se.current=null},onPointerDown:e=>{Oe||!R||(de.current=new Date,se(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e;if(ne||!R)return;Se.current=null;let t=Number(L.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),r=Number(L.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),i=new Date().getTime()-de.current?.getTime(),a=k===`x`?t:r,o=Math.abs(a)/i;if(Math.abs(a)>=Hn||o>.11){se(be.current),(e=n.onDismiss)==null||e.call(n,n),M(k===`x`?t>0?`right`:`left`:r>0?`down`:`up`),ke(),re(!0),ae(!1);return}te(!1),A(null)},onPointerMove:t=>{var n,r;if(!Se.current||!R||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??Gn(x);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0};k===`y`?(o.includes(`top`)||o.includes(`bottom`))&&(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)&&(s.y=i):k===`x`&&(o.includes(`left`)||o.includes(`right`))&&(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)&&(s.x=a),(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ae(!0),(n=L.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=L.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx?_.createElement(`button`,{"aria-label":D,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!R?()=>{}:()=>{var e;ke(),(e=n.onDismiss)==null||e.call(n,n)},className:Wn(T?.closeButton,n?.classNames?.closeButton)},E?.close??Dn):null,n.jsx||(0,_.isValidElement)(n.title)?n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title:_.createElement(_.Fragment,null,me||n.icon||n.promise?_.createElement(`div`,{"data-icon":``,className:Wn(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:n.icon||E?.[me]||bn(me)):null,_.createElement(`div`,{"data-content":``,className:Wn(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Wn(T?.title,n?.classNames?.title)},typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Wn(y,z,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),(0,_.isValidElement)(n.cancel)?n.cancel:n.cancel&&Fn(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{var t,r;Fn(n.cancel)&&R&&((r=(t=n.cancel).onClick)==null||r.call(t,e),ke())},className:Wn(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,(0,_.isValidElement)(n.action)?n.action:n.action&&Fn(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{var t,r;Fn(n.action)&&((r=(t=n.action).onClick)==null||r.call(t,e),!e.defaultPrevented&&ke())},className:Wn(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null))};function qn(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Jn(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Rn:Ln;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}(0,_.forwardRef)(function(e,t){let{invert:n,position:r=`bottom-right`,hotkey:i=[`altKey`,`KeyT`],expand:a,closeButton:o,className:s,offset:c,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:p,visibleToasts:m=In,toastOptions:h,dir:g=qn(),gap:y=Vn,loadingIcon:b,icons:x,containerAriaLabel:S=`Notifications`,pauseWhenPageIsHidden:C}=e,[w,T]=_.useState([]),E=_.useMemo(()=>Array.from(new Set([r].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,r]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=_.useRef(null),I=i.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ee=_.useRef(null),te=_.useRef(!1),ne=_.useCallback(e=>{T(t=>{var n;return(n=t.find(t=>t.id===e.id))!=null&&n.delete||An.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return _.useEffect(()=>An.subscribe(e=>{if(e.dismiss){T(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));return}setTimeout(()=>{v.flushSync(()=>{T(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),_.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),_.useEffect(()=>{w.length<=1&&A(!1)},[w]),_.useEffect(()=>{let e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(A(!0),(t=F.current)==null||t.focus()),e.code===`Escape`&&(document.activeElement===F.current||(n=F.current)!=null&&n.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),_.useEffect(()=>{if(F.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,te.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,r)=>{let[i,u]=t.split(`-`);return w.length?_.createElement(`ol`,{key:t,dir:g===`auto`?qn():g,tabIndex:-1,ref:F,className:s,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":i,"data-lifted":k&&w.length>1&&!a,"data-x-position":u,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Bn}px`,"--gap":`${y}px`,...p,...Jn(c,l)},onBlur:e=>{te.current&&!e.currentTarget.contains(e.relatedTarget)&&(te.current=!1,ee.current&&=(ee.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te.current||(te.current=!0,ee.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},w.filter(e=>!e.position&&r===0||e.position===t).map((r,i)=>_.createElement(Kn,{key:r.id,icons:x,index:i,toast:r,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:n,visibleToasts:m,closeButton:h?.closeButton??o,interacting:j,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:ne,toasts:w.filter(e=>e.position==r.position),heights:D.filter(e=>e.position==r.position),setHeights:O,expandByDefault:a,gap:y,loadingIcon:b,expanded:k,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections}))):null}))});function Yn(e){if(!(e instanceof DataTransfer))throw Error(`Data must be of type "DataTransfer"`);let t={};function n(e){let r=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.file==`function`&&`fullPath`in e,i=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.createReader==`function`;if(r(e)&&e.isFile)return new Promise(n=>{e.file(r=>{t[e.fullPath]=r,n()})});if(i(e)&&!e.isFile){let t=e.createReader();return new Promise(e=>{let r=[];function i(){t.readEntries(t=>{t.length===0?Promise.all(r).then(()=>e()):(t.forEach(e=>{r.push(n(e))}),i())})}i()})}return Promise.resolve()}return new Promise(r=>{let i=e.items&&Array.from(e.items),a=Array.from(e.files);if(i&&i.length&&`webkitGetAsEntry`in i[0]){let e=[];for(let t=0;tr(t))}else a.filter(e=>e.size!==0).forEach(e=>t[`/`+e.name]=e),r(t)})}function Xn(e){return e.replace(/\\/g,`/`).split(/\//g).reduce((e,t)=>(t===`..`?e.pop():t!==`.`&&e.push(t),e),[]).join(`/`)}var Zn={current:``};function Qn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{e.target&&e.target.result?t(e.target.result):n(Error(`Failed to read Urdf file content`))},r.onerror=()=>n(Error(`Error reading Urdf file`)),r.readAsText(e)})}async function $n(e,t){Zn.current=``;let n=await Yn(e),r=Object.keys(n).map(e=>Xn(e)),i=r.filter(e=>/urdf$/i.test(e)),a={};i.forEach(e=>{a[e]=URL.createObjectURL(n[e])});let o=``;if(i.length>0){let e=i[0].match(/^(\/[^/]+\/)/);e&&e[1]&&(o=e[1])}let s=o;return t.setUrlModifierFunc(e=>{s&&(Zn.current=s);let t=Xn(e).split(`/`).pop()||``,i=r.find(e=>e.endsWith(t));if(!i&&t.includes(`.`)){let e=`.`+t.split(`.`).pop();i=r.find(t=>t.endsWith(e))}if(i!=null){let e=i.split(`.`).pop()?.toLowerCase()||``,t=new Blob([n[i]],{type:er(e)}),r=URL.createObjectURL(t)+`#.`+e;return setTimeout(()=>URL.revokeObjectURL(r),5e3),r}return console.warn(`No matching file found for: ${e}`),e}),{files:n,availableModels:i,blobUrls:a}}function er(e){switch(e.toLowerCase()){case`stl`:return`model/stl`;case`obj`:return`model/obj`;case`gltf`:case`glb`:return`model/gltf+json`;case`dae`:return`model/vnd.collada+xml`;case`urdf`:return`application/xml`;default:return`application/octet-stream`}}var tr=(0,_.createContext)(void 0),nr=({children:e})=>{let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!d||p)return;let e=!1;return(async()=>{try{let t=await fetch(`/so-101-urdf/urdf/so101_new_calib.urdf`);if(!t.ok)throw Error(`Failed to fetch default Urdf: ${t.statusText}`);let n=await t.text();e||m(n)}catch(t){e||console.error(`Error loading default Urdf content:`,t)}})(),()=>{e=!0}},[d,p]);let v=(0,_.useRef)([]),y=(0,_.useCallback)(()=>{f(!0),m(null),g(null),Nn.info(`Switched to default model`,{description:`The default ARM100 robot model is now displayed.`})},[]),b=(0,_.useCallback)(e=>(v.current.push(e),()=>{v.current=v.current.filter(t=>t!==e)}),[]),x=(0,_.useCallback)(e=>{n(e)},[]),S=(0,_.useCallback)(e=>{e.hasUrdf?f(!1):y(),v.current.forEach(t=>t(e))},[y]),C=(0,_.useCallback)(async e=>{if(!t)return;let n=Object.values(r).filter(t=>t===e.blobUrl).map(e=>{let t=Object.keys(r).find(t=>r[t]===e);return t?{path:t,url:e}:null}).filter(e=>e!==null);if(n.length===0){console.error(`❌ Could not find file for selected Urdf model`);return}let i=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{let t=n[0]?.path;if(!t||!r[t])throw Error(`File not found in records`);let a=await(await fetch(e.blobUrl)).blob();m(await Qn(new File([a],t.split(`/`).pop()||`model.urdf`,{type:`application/xml`}))),Nn.dismiss(i),f(!1);let o=e.name||e.path.split(`/`).pop()||`Unknown`;Nn.success(`Urdf model loaded successfully`,{description:`Model: ${o}`,duration:3e3}),S({hasUrdf:!0,modelName:o})}catch(e){console.error(`❌ Error processing selected Urdf:`,e),Nn.dismiss(i),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3})}},[r,t,S]),w=(0,_.useCallback)(e=>{if(!t){console.error(`❌ No Urdf processor available`);return}c(!1);let n=e.name||e.path.split(`/`).pop()?.replace(/\.urdf$/i,``)||`Unknown`;t.loadUrdf(e.blobUrl),f(!1),Nn.info(`Loading model: ${n}`,{description:`Preparing 3D visualization`,duration:2e3}),S({hasUrdf:!0,modelName:n}),C(e)},[t,S,C]),T=(0,_.useCallback)(async(e,n)=>{Object.values(r).forEach(URL.revokeObjectURL),i({}),o([]),u([]);try{if(n.length>0&&t){let r={};if(n.forEach(t=>{e[t]&&(r[t]=URL.createObjectURL(e[t]))}),i(r),o(n),u(n.map(e=>{let t=(e.split(`/`).pop()||``).replace(/\.urdf$/i,``);return{path:e,blobUrl:r[e],name:t}})),n.length===1){let i=(n[0].split(`/`).pop()||``).replace(/\.urdf$/i,``),a=r[n[0]];if(a)if(t.loadUrdf(a),f(!1),e[n[0]]){let t=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{m(await Qn(e[n[0]])),Nn.dismiss(t),Nn.success(`Urdf model loaded successfully`,{description:`Model: ${i}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}catch(e){console.error(`Error loading Urdf:`,e),Nn.dismiss(t),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}}else console.error(`Could not find file for Urdf model:`,n[0]),S({hasUrdf:!0,modelName:i});else console.warn(`No blob URL found for ${n[0]}, using path directly`),t.loadUrdf(n[0]),f(!1),S({hasUrdf:!0,modelName:i})}else c(!0),S({hasUrdf:!0,modelName:`Multiple models available`})}else S({hasUrdf:!1}),y(),Nn.error(`No Urdf file found`,{description:`Please upload a folder containing a .urdf file.`,duration:3e3})}catch(e){console.error(`Error processing Urdf files:`,e),Nn.error(`Error processing files`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),y()}},[S,r,t,y]),E=(0,_.useRef)(r);E.current=r,(0,_.useEffect)(()=>()=>{Object.values(E.current).forEach(URL.revokeObjectURL)},[]);let D=(0,_.useMemo)(()=>({urdfProcessor:t,registerUrdfProcessor:x,onUrdfDetected:b,processUrdfFiles:T,urdfBlobUrls:r,alternativeUrdfModels:a,isSelectionModalOpen:s,setIsSelectionModalOpen:c,urdfModelOptions:l,selectUrdfModel:w,isDefaultModel:d,setIsDefaultModel:f,resetToDefaultModel:y,urdfContent:p,currentAnimationConfig:h,setCurrentAnimationConfig:g}),[t,x,b,T,r,a,s,l,w,d,y,p,h]);return(0,V.jsx)(tr.Provider,{value:D,children:e})},rr=()=>{let e=(0,_.useContext)(tr);if(e===void 0)throw Error(`useUrdf must be used within a UrdfProvider`);return e},ir=(0,_.createContext)(void 0),ar=({children:e})=>{let[t,n]=(0,_.useState)(!1),{urdfProcessor:r,processUrdfFiles:i}=rr(),a=e=>{e.preventDefault(),e.stopPropagation()},o=e=>{e.preventDefault(),e.stopPropagation(),n(!0)},s=e=>{e.preventDefault(),e.stopPropagation(),(!e.relatedTarget||!e.relatedTarget.closest(`html`))&&n(!1)},c=(0,_.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),n(!1),!(!e.dataTransfer||!r))try{let{availableModels:t,files:n}=await $n(e.dataTransfer,r);await i(n,t)}catch(e){console.error(`Error in handleDrop:`,e)}},[r,i]);(0,_.useEffect)(()=>(document.addEventListener(`dragover`,a),document.addEventListener(`dragenter`,o),document.addEventListener(`dragleave`,s),document.addEventListener(`drop`,c),()=>{document.removeEventListener(`dragover`,a),document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragleave`,s),document.removeEventListener(`drop`,c)}),[c]);let l=(0,_.useMemo)(()=>({isDragging:t,setIsDragging:n,handleDrop:c}),[t,c]);return(0,V.jsxs)(ir.Provider,{value:l,children:[e,t&&(0,V.jsx)(`div`,{className:`fixed inset-0 bg-primary/10 pointer-events-none z-50 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-background p-8 rounded-lg shadow-lg text-center`,children:[(0,V.jsx)(`div`,{className:`text-3xl font-bold mb-4`,children:`Drop Urdf Files Here`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Release to upload your robot model`})]})})]})},or=1,sr=1e6,cr=0;function lr(){return cr=(cr+1)%(2**53-1),cr.toString()}var ur=new Map,dr=e=>{if(ur.has(e))return;let t=setTimeout(()=>{ur.delete(e),hr({type:`REMOVE_TOAST`,toastId:e})},sr);ur.set(e,t)},fr=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,or)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?dr(n):e.toasts.forEach(e=>{dr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},pr=[],mr={toasts:[]};function hr(e){mr=fr(mr,e),pr.forEach(e=>{e(mr)})}function gr({...e}){let t=lr(),n=e=>hr({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>hr({type:`DISMISS_TOAST`,toastId:t});return hr({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function _r(){let[e,t]=_.useState(mr);return _.useEffect(()=>(pr.push(t),()=>{let e=pr.indexOf(t);e>-1&&pr.splice(e,1)}),[e]),{...e,toast:gr,dismiss:e=>hr({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function vr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function yr(...e){return t=>{let n=!1,r=e.map(e=>{let r=vr(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=_.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Sr(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cr(i,...t)]}function Cr(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function wr(e){let t=Tr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Dr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=kr(n),i=Or(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Er=Symbol(`radix.slottable`);function Dr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Er}function Or(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function kr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ar(e){let t=e+`CollectionProvider`,[n,r]=Sr(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=wr(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,V.jsx)(c,{ref:br(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=wr(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=br(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}function jr(e){let t=Mr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Pr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ir(n),i=Fr(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nr=Symbol(`radix.slottable`);function Pr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Nr}function Fr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ir(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jr(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lr(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}function Rr(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...e)=>t.current?.(...e),[])}function zr(e,t=globalThis?.document){let n=Rr(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Br=`DismissableLayer`,Vr=`dismissableLayer.update`,Hr=`dismissableLayer.pointerDownOutside`,Ur=`dismissableLayer.focusOutside`,Wr,Gr=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kr=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=_.useContext(Gr),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=_.useState({}),m=br(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Yr(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Xr(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zr(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wr=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zr(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wr)}},[u,f,n,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zr())},[u,l]),_.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vr,e),()=>document.removeEventListener(Vr,e)},[]),(0,V.jsx)(U.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,C.onFocusCapture),onBlurCapture:H(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,S.onPointerDownCapture)})});Kr.displayName=Br;var qr=`DismissableLayerBranch`,Jr=_.forwardRef((e,t)=>{let n=_.useContext(Gr),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(U.div,{...e,ref:i})});Jr.displayName=qr;function Yr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qr(Hr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qr(Ur,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zr(){let e=new CustomEvent(Vr);document.dispatchEvent(e)}function Qr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var $r=Kr,ei=Jr,ti=globalThis?.document?_.useLayoutEffect:()=>{},ni=`Portal`,ri=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);ti(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?v.createPortal((0,V.jsx)(U.div,{...r,ref:t}),o):null});ri.displayName=ni;function ii(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var ai=e=>{let{present:t,children:n}=e,r=oi(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=br(r.ref,ci(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};ai.displayName=`Presence`;function oi(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=ii(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=si(r.current);a.current=o===`mounted`?e:`none`},[o]),ti(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=si(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ti(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=si(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=si(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function si(e){return e?.animationName||`none`}function ci(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var li=_.useInsertionEffect||ti;function ui({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=di({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=fi(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function di({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return li(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function fi(e){return typeof e==`function`}var pi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),mi=`VisuallyHidden`,hi=_.forwardRef((e,t)=>(0,V.jsx)(U.span,{...e,ref:t,style:{...pi,...e.style}}));hi.displayName=mi;var gi=hi,_i=`ToastProvider`,[vi,yi,bi]=Ar(`Toast`),[xi,Si]=Sr(`Toast`,[bi]),[Ci,wi]=xi(_i),Ti=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=_.useState(null),[l,u]=_.useState(0),d=_.useRef(!1),f=_.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${_i}\`. Expected non-empty \`string\`.`),(0,V.jsx)(vi.Provider,{scope:t,children:(0,V.jsx)(Ci,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:_.useCallback(()=>u(e=>e+1),[]),onToastRemove:_.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};Ti.displayName=_i;var Ei=`ToastViewport`,Di=[`F8`],Oi=`toast.viewportPause`,ki=`toast.viewportResume`,Ai=_.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=Di,label:i=`Notifications ({hotkey})`,...a}=e,o=wi(Ei,n),s=yi(n),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=br(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;_.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),_.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Oi);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ki);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=_.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...ra(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return _.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);ia(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,V.jsxs)(ei,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,V.jsx)(Mi,{ref:l,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`forwards`}))}}),(0,V.jsx)(vi.Slot,{scope:n,children:(0,V.jsx)(U.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,V.jsx)(Mi,{ref:u,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`backwards`}))}})]})});Ai.displayName=Ei;var ji=`ToastFocusProxy`,Mi=_.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=wi(ji,n);return(0,V.jsx)(hi,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Mi.displayName=ji;var Ni=`Toast`,Pi=`toast.swipeStart`,Fi=`toast.swipeMove`,Ii=`toast.swipeCancel`,Li=`toast.swipeEnd`,Ri=_.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ui({prop:r,defaultProp:i??!0,onChange:a,caller:Ni});return(0,V.jsx)(ai,{present:n||s,children:(0,V.jsx)(Vi,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Rr(e.onPause),onResume:Rr(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ri.displayName=Ni;var[zi,Bi]=xi(Ni,{onClose(){}}),Vi=_.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=wi(Ni,n),[g,y]=_.useState(null),b=br(t,e=>y(e)),x=_.useRef(null),S=_.useRef(null),C=i||h.duration,w=_.useRef(0),T=_.useRef(C),E=_.useRef(0),{onToastAdd:D,onToastRemove:O}=h,k=Rr(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),A=_.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(k,e))},[k]);_.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{A(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(Oi,n),e.addEventListener(ki,t),()=>{e.removeEventListener(Oi,n),e.removeEventListener(ki,t)}}},[h.viewport,C,c,l,A]),_.useEffect(()=>{a&&!h.isClosePausedRef.current&&A(C)},[a,C,h.isClosePausedRef,A]),_.useEffect(()=>(D(),()=>O()),[D,O]);let j=_.useMemo(()=>g?Qi(g):null,[g]);return h.viewport?(0,V.jsxs)(V.Fragment,{children:[j&&(0,V.jsx)(Hi,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:j}),(0,V.jsx)(zi,{scope:n,onClose:k,children:v.createPortal((0,V.jsx)(vi.ItemSlot,{scope:n,children:(0,V.jsx)($r,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||k(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,V.jsx)(U.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(S.current=l,$i(Fi,d,f,{discrete:!1})):ea(l,h.swipeDirection,c)?(S.current=l,$i(Pi,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};ea(t,h.swipeDirection,h.swipeThreshold)?$i(Li,p,r,{discrete:!0}):$i(Ii,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Hi=e=>{let{__scopeToast:t,children:n,...r}=e,i=wi(Ni,t),[a,o]=_.useState(!1),[s,c]=_.useState(!1);return ta(()=>o(!0)),_.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,V.jsx)(ri,{asChild:!0,children:(0,V.jsx)(hi,{...r,children:a&&(0,V.jsxs)(V.Fragment,{children:[i.label,` `,n]})})})},Ui=`ToastTitle`,Wi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Wi.displayName=Ui;var Gi=`ToastDescription`,Ki=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Ki.displayName=Gi;var qi=`ToastAction`,Ji=_.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,V.jsx)(Zi,{altText:n,asChild:!0,children:(0,V.jsx)(Xi,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${qi}\`. Expected non-empty \`string\`.`),null)});Ji.displayName=qi;var Yi=`ToastClose`,Xi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Bi(Yi,n);return(0,V.jsx)(Zi,{asChild:!0,children:(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Xi.displayName=Yi;var Zi=_.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,V.jsx)(U.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Qi(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),na(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Qi(e))}}),t}function $i(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var ea=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ta(e=()=>{}){let t=Rr(e);ti(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function na(e){return e.nodeType===e.ELEMENT_NODE}function ra(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ia(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var aa=Ti,oa=Ai,sa=Ri,ca=Wi,la=Ki,ua=Ji,da=Xi;function fa(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,ha=pa,ga=(e,t)=>n=>{if(t?.variants==null)return ha(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ma(t)||ma(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ha(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},_a=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),va=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ya={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ba=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...ya,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:va(`lucide`,i),...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xa=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(ba,{ref:i,iconNode:t,className:va(`lucide-${_a(e)}`,n),...r}));return n.displayName=`${e}`,n},Sa=xa(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ca=xa(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),wa=xa(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ta=xa(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Ea=xa(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Da=xa(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Oa=xa(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ka=xa(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aa=xa(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ja=xa(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ma=xa(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Na=xa(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pa=xa(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Fa=xa(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ia=xa(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),La=xa(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Ra=xa(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=xa(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ba=xa(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Va=xa(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ha=xa(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ua=xa(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wa=xa(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ga=xa(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=xa(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),qa=xa(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ja=xa(`Lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ya=xa(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Xa=xa(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Za=xa(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Qa=xa(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=xa(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=xa(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),to=xa(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),no=xa(`ShieldQuestion`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ro=xa(`SkipForward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]),io=xa(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ao=xa(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),oo=xa(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),so=xa(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),co=xa(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),lo=xa(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),uo=xa(`VideoOff`,[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),fo=xa(`Volume2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),po=xa(`VolumeX`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),mo=xa(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ho=`-`,go=e=>{let t=bo(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(ho);return n[0]===``&&n.length!==1&&n.shift(),_o(n,t)||yo(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},_o=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?_o(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(ho);return t.validators.find(({validator:e})=>e(a))?.classGroupId},vo=/^\[(.+)\]$/,yo=e=>{if(vo.test(e)){let t=vo.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},bo=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wo(Object.entries(e.classGroups),n).forEach(([e,n])=>{xo(n,r,e,t)}),r},xo=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:So(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Co(e)){xo(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{xo(i,So(t,e),n,r)})})},So=(e,t)=>{let n=e;return t.split(ho).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Co=e=>e.isThemeGetter,wo=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,To=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Eo=`!`,Do=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;ls?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Oo=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},ko=e=>({cache:To(e.cacheSize),parseClassName:Do(e),...go(e)}),Ao=/\s+/,jo=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Ao),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Oo(c).join(`:`),h=l?m+Eo:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Mo(){let e=0,t,n,r=``;for(;e{if(typeof e==`string`)return e;let t,n=``;for(let r=0;rt(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=jo(e,n);return i(e,a),a}return function(){return a(Mo.apply(null,arguments))}}var Fo=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lo=/^\d+\/\d+$/,Ro=new Set([`px`,`full`,`screen`]),zo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ho=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wo=e=>Ko(e)||Ro.has(e)||Lo.test(e),Go=e=>as(e,`length`,os),Ko=e=>!!e&&!Number.isNaN(Number(e)),qo=e=>as(e,`number`,Ko),Jo=e=>!!e&&Number.isInteger(Number(e)),Yo=e=>e.endsWith(`%`)&&Ko(e.slice(0,-1)),Xo=e=>Io.test(e),Zo=e=>zo.test(e),Qo=new Set([`length`,`size`,`percentage`]),$o=e=>as(e,Qo,ss),es=e=>as(e,`position`,ss),ts=new Set([`image`,`url`]),ns=e=>as(e,ts,ls),rs=e=>as(e,``,cs),is=()=>!0,as=(e,t,n)=>{let r=Io.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},os=e=>Bo.test(e)&&!Vo.test(e),ss=()=>!1,cs=e=>Ho.test(e),ls=e=>Uo.test(e),us=Po(()=>{let e=Fo(`colors`),t=Fo(`spacing`),n=Fo(`blur`),r=Fo(`brightness`),i=Fo(`borderColor`),a=Fo(`borderRadius`),o=Fo(`borderSpacing`),s=Fo(`borderWidth`),c=Fo(`contrast`),l=Fo(`grayscale`),u=Fo(`hueRotate`),d=Fo(`invert`),f=Fo(`gap`),p=Fo(`gradientColorStops`),m=Fo(`gradientColorStopPositions`),h=Fo(`inset`),g=Fo(`margin`),_=Fo(`opacity`),v=Fo(`padding`),y=Fo(`saturate`),b=Fo(`scale`),x=Fo(`sepia`),S=Fo(`skew`),C=Fo(`space`),w=Fo(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,Xo,t],O=()=>[Xo,t],k=()=>[``,Wo,Go],A=()=>[`auto`,Ko,Xo],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,Xo],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],ee=()=>[Ko,Xo];return{cacheSize:500,separator:`:`,theme:{colors:[is],spacing:[Wo,Go],blur:[`none`,``,Zo,Xo],brightness:ee(),borderColor:[e],borderRadius:[`none`,``,`full`,Zo,Xo],borderSpacing:O(),borderWidth:k(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Yo,Go],inset:D(),margin:D(),opacity:ee(),padding:O(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,Xo]}],container:[`container`],columns:[{columns:[Zo]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),Xo]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Jo,Xo]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,Xo]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Jo,Xo]}],"grid-cols":[{"grid-cols":[is]}],"col-start-end":[{col:[`auto`,{span:[`full`,Jo,Xo]},Xo]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[is]}],"row-start-end":[{row:[`auto`,{span:[Jo,Xo]},Xo]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,Xo]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,Xo]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,Xo,t]}],"min-w":[{"min-w":[Xo,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[Xo,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Zo]},Zo]}],h:[{h:[Xo,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[Xo,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Zo,Go]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,qo]}],"font-family":[{font:[is]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,Xo]}],"line-clamp":[{"line-clamp":[`none`,Ko,qo]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Wo,Xo]}],"list-image":[{"list-image":[`none`,Xo]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,Xo]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Wo,Go]}],"underline-offset":[{"underline-offset":[`auto`,Wo,Xo]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Xo]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Xo]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),es]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,$o]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ns]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Wo,Xo]}],"outline-w":[{outline:[Wo,Go]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Wo,Go]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Zo,rs]}],"shadow-color":[{shadow:[is]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Zo,Xo]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,Xo]}],duration:[{duration:ee()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,Xo]}],delay:[{delay:ee()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,Xo]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Jo,Xo]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,Xo]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Xo]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Xo]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Wo,Go,qo]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function W(...e){return us(pa(e))}var ds=aa,fs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oa,{ref:n,className:W(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));fs.displayName=oa.displayName;var ps=ga(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),ms=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(sa,{ref:r,className:W(ps({variant:t}),e),...n}));ms.displayName=sa.displayName;var hs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ua,{ref:n,className:W(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));hs.displayName=ua.displayName;var gs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(da,{ref:n,className:W(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,V.jsx)(mo,{className:`h-4 w-4`})}));gs.displayName=da.displayName;var _s=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ca,{ref:n,className:W(`text-sm font-semibold`,e),...t}));_s.displayName=ca.displayName;var vs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(la,{ref:n,className:W(`text-sm opacity-90`,e),...t}));vs.displayName=la.displayName;function ys(){let{toasts:e}=_r();return(0,V.jsxs)(ds,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,V.jsxs)(ms,{...i,children:[(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,V.jsx)(_s,{children:t}),n&&(0,V.jsx)(vs,{children:n})]}),r,(0,V.jsx)(gs,{})]},e)}),(0,V.jsx)(fs,{})]})}var bs=Symbol.for(`react.lazy`),xs=_.use;function Ss(e){return typeof e==`object`&&!!e&&`then`in e}function Cs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===bs&&`_payload`in e&&Ss(e._payload)}function ws(e){let t=Es(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e;Cs(r)&&typeof xs==`function`&&(r=xs(r._payload));let a=_.Children.toArray(r),o=a.find(Os);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ts=ws(`Slot`);function Es(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(Cs(n)&&typeof xs==`function`&&(n=xs(n._payload)),_.isValidElement(n)){let e=As(n),i=ks(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ds=Symbol(`radix.slottable`);function Os(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ds}function ks(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function As(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var js=ga(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),G=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,V.jsx)(r?Ts:`button`,{className:W(js({variant:t,size:n,className:e})),ref:a,...i}));G.displayName=`Button`;var Ms=(0,_.createContext)(void 0),Ns=`lelab.apiBaseUrl`,Ps=`http://localhost:8000`,Fs=e=>e.replace(/^http(s?):/,`ws$1:`),Is=()=>{if(typeof window>`u`)return Ps;let e=new URLSearchParams(window.location.search).get(`api`);if(e)try{new URL(e);let t=e.replace(/\/$/,``);return window.localStorage.setItem(Ns,t),t}catch{console.warn("Invalid `api` query param, ignoring:",e)}return window.localStorage.getItem(Ns)||Ps},Ls=({children:e})=>{let[t]=(0,_.useState)(Is),n=Fs(t),r=(0,_.useCallback)(async(e,t={})=>fetch(e,{...t,headers:{"Content-Type":`application/json`,...t.headers}}),[]),i=(0,_.useMemo)(()=>({baseUrl:t,wsBaseUrl:n,fetchWithHeaders:r}),[t,n,r]);return(0,V.jsx)(Ms.Provider,{value:i,children:e})},Rs=()=>{let e=(0,_.useContext)(Ms);if(e===void 0)throw Error(`useApi must be used within an ApiProvider`);return e},zs=(0,_.createContext)(void 0),Bs=({children:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)({status:`loading`}),a=(0,_.useCallback)(async()=>{i({status:`loading`});try{let e=await(await n(`${t}/hf-auth-status`)).json();e.authenticated?i({status:`authenticated`,username:e.username,orgs:e.orgs??[]}):i({status:`unauthenticated`,loginCommand:e.login_command??`hf auth login`})}catch(e){console.warn(`HF auth status fetch failed:`,e),i({status:`unauthenticated`,loginCommand:`hf auth login`})}},[t,n]);(0,_.useEffect)(()=>{a()},[a]);let o=(0,_.useMemo)(()=>({auth:r,refetch:a}),[r,a]);return(0,V.jsx)(zs.Provider,{value:o,children:e})},Vs=()=>{let e=(0,_.useContext)(zs);if(e===void 0)throw Error(`useHfAuth must be used within an HfAuthProvider`);return e},Hs=_.useId||(()=>void 0),Us=0;function Ws(e){let[t,n]=_.useState(Hs());return ti(()=>{e||n(e=>e??String(Us++))},[e]),e||(t?`radix-${t}`:``)}var Gs=`focusScope.autoFocusOnMount`,Ks=`focusScope.autoFocusOnUnmount`,qs={bubbles:!1,cancelable:!0},Js=`FocusScope`,Ys=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Rr(i),u=Rr(a),d=_.useRef(null),f=br(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:nc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||nc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nc(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){rc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Gs,qs);s.addEventListener(Gs,l),s.dispatchEvent(t),t.defaultPrevented||(Xs(oc(Qs(s)),{select:!0}),document.activeElement===e&&nc(s))}return()=>{s.removeEventListener(Gs,l),setTimeout(()=>{let t=new CustomEvent(Ks,qs);s.addEventListener(Ks,u),s.dispatchEvent(t),t.defaultPrevented||nc(e??document.body,{select:!0}),s.removeEventListener(Ks,u),rc.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Zs(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&nc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&nc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(U.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ys.displayName=Js;function Xs(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nc(r,{select:t}),document.activeElement!==n)return}function Zs(e){let t=Qs(e);return[$s(t,e),$s(t.reverse(),e)]}function Qs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $s(e,t){for(let n of e)if(!ec(n,{upTo:t}))return n}function ec(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function tc(e){return e instanceof HTMLInputElement&&`select`in e}function nc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tc(e)&&t&&e.select()}}var rc=ic();function ic(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ac(e,t),e.unshift(t)},remove(t){e=ac(e,t),e[0]?.resume()}}}function ac(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oc(e){return e.filter(e=>e.tagName!==`A`)}var sc=0;function cc(){_.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??lc()),document.body.insertAdjacentElement(`beforeend`,e[1]??lc()),sc++,()=>{sc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),sc--}},[])}function lc(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var uc=function(){return uc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Lc;var t=zc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Vc=Ic(),Hc=`data-scroll-locked`,Uc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` - .${hc} { - overflow: hidden ${r}; - padding-right: ${s}px ${r}; - } - body[${Hc}] { - overflow: hidden ${r}; - overscroll-behavior: contain; - ${[t&&`position: relative ${r};`,n===`margin`&&` - padding-left: ${i}px; - padding-top: ${a}px; - padding-right: ${o}px; - margin-left:0; - margin-top:0; - margin-right: ${s}px ${r}; - `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} - } - - .${pc} { - right: ${s}px ${r}; - } - - .${mc} { - margin-right: ${s}px ${r}; - } - - .${pc} .${pc} { - right: 0 ${r}; - } - - .${mc} .${mc} { - margin-right: 0 ${r}; - } - - body[${Hc}] { - ${gc}: ${s}px; - } -`},Wc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Gc=function(){_.useEffect(function(){return document.body.setAttribute(Hc,(Wc()+1).toString()),function(){var e=Wc()-1;e<=0?document.body.removeAttribute(Hc):document.body.setAttribute(Hc,e.toString())}},[])},Kc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Gc();var a=_.useMemo(function(){return Bc(i)},[i]);return _.createElement(Vc,{styles:Uc(a,!t,i,n?``:`!important`)})},qc=!1;if(typeof window<`u`)try{var Jc=Object.defineProperty({},"passive",{get:function(){return qc=!0,!0}});window.addEventListener(`test`,Jc,Jc),window.removeEventListener(`test`,Jc,Jc)}catch{qc=!1}var Yc=qc?{passive:!1}:!1,Xc=function(e){return e.tagName===`TEXTAREA`},Zc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xc(e)&&n[t]===`visible`)},Qc=function(e){return Zc(e,`overflowY`)},$c=function(e){return Zc(e,`overflowX`)},el=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rl(e,r)){var i=il(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rl=function(e,t){return e===`v`?Qc(t):$c(t)},il=function(e,t){return e===`v`?tl(t):nl(t)},al=function(e,t){return e===`h`&&t===`rtl`?-1:1},ol=function(e,t,n,r,i){var a=al(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=il(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cl=function(e){return[e.deltaX,e.deltaY]},ll=function(e){return e&&`current`in e?e.current:e},ul=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dl=function(e){return` - .block-interactivity-${e} {pointer-events: none;} - .allow-interactivity-${e} {pointer-events: all;} -`},fl=0,pl=[];function ml(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(fl++)[0],a=_.useState(Ic)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fc([e.lockRef.current],(e.shards||[]).map(ll),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=el(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=el(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ol(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!pl.length||pl[pl.length-1]!==a)){var r=`deltaY`in n?cl(n):sl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ul(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ll).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=sl(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,cl(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,sl(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return pl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yc),document.addEventListener(`touchmove`,c,Yc),document.addEventListener(`touchstart`,u,Yc),function(){pl=pl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yc),document.removeEventListener(`touchmove`,c,Yc),document.removeEventListener(`touchstart`,u,Yc)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:dl(i)}):null,p?_.createElement(Kc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gl=Tc(Ec,ml),_l=_.forwardRef(function(e,t){return _.createElement(Oc,uc({},e,{ref:t,sideCar:gl}))});_l.classNames=Oc.classNames;var vl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},yl=new WeakMap,bl=new WeakMap,xl={},Sl=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},wl=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cl(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Tl=function(e,t,n,r){var i=wl(t,Array.isArray(e)?e:[e]);xl[n]||(xl[n]=new WeakMap);var a=xl[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(yl.get(e)||0)+1,l=(a.get(e)||0)+1;yl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bl.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sl++,function(){o.forEach(function(e){var t=yl.get(e)-1,i=a.get(e)-1;yl.set(e,t),a.set(e,i),t||(bl.has(e)||e.removeAttribute(r),bl.delete(e)),i||e.removeAttribute(n)}),Sl--,Sl||(yl=new WeakMap,yl=new WeakMap,bl=new WeakMap,xl={})}},El=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Tl(r,i,n,`aria-hidden`)):function(){return null}};function Dl(e){let t=Ol(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Al);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ol(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ml(n),i=jl(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kl=Symbol(`radix.slottable`);function Al(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kl}function jl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ml(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Nl=`Dialog`,[Pl,Fl]=Sr(Nl),[Il,Ll]=Pl(Nl),Rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:Nl});return(0,V.jsx)(Il,{scope:t,triggerRef:s,contentRef:c,contentId:Ws(),titleId:Ws(),descriptionId:Ws(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Rl.displayName=Nl;var zl=`DialogTrigger`,Bl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(zl,n),a=br(t,i.triggerRef);return(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ou(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Bl.displayName=zl;var Vl=`DialogPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ll(Vl,t);return(0,V.jsx)(Hl,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:e})}))})};Wl.displayName=Vl;var Gl=`DialogOverlay`,Kl=_.forwardRef((e,t)=>{let n=Ul(Gl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Gl,e.__scopeDialog);return a.modal?(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(Jl,{...i,ref:t})}):null});Kl.displayName=Gl;var ql=Dl(`DialogOverlay.RemoveScroll`),Jl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(Gl,n);return(0,V.jsx)(_l,{as:ql,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(U.div,{"data-state":ou(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Yl=`DialogContent`,Xl=_.forwardRef((e,t)=>{let n=Ul(Yl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Yl,e.__scopeDialog);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(Zl,{...i,ref:t}):(0,V.jsx)(Ql,{...i,ref:t})})});Xl.displayName=Yl;var Zl=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(null),i=br(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)($l,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Ql=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)($l,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$l=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ll(Yl,n),c=_.useRef(null),l=br(t,c);return cc(),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ou(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(uu,{titleId:s.titleId}),(0,V.jsx)(fu,{contentRef:c,descriptionId:s.descriptionId})]})]})}),eu=`DialogTitle`,tu=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(eu,n);return(0,V.jsx)(U.h2,{id:i.titleId,...r,ref:t})});tu.displayName=eu;var nu=`DialogDescription`,ru=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(nu,n);return(0,V.jsx)(U.p,{id:i.descriptionId,...r,ref:t})});ru.displayName=nu;var iu=`DialogClose`,au=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(iu,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});au.displayName=iu;function ou(e){return e?`open`:`closed`}var su=`DialogTitleWarning`,[cu,lu]=xr(su,{contentName:Yl,titleName:eu,docsSlug:`dialog`}),uu=({titleId:e})=>{let t=lu(su),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},du=`DialogDescriptionWarning`,fu=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lu(du).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},pu=Rl,mu=Bl,hu=Wl,gu=Kl,_u=Xl,vu=tu,yu=ru,bu=au,xu=pu,Su=hu,Cu=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gu,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Cu.displayName=gu.displayName;var wu=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,V.jsxs)(Su,{children:[(0,V.jsx)(Cu,{}),(0,V.jsxs)(_u,{ref:i,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,V.jsxs)(bu,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,V.jsx)(mo,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));wu.displayName=_u.displayName;var Tu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Tu.displayName=`DialogHeader`;var Eu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Eu.displayName=`DialogFooter`;var Du=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vu,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Du.displayName=vu.displayName;var Ou=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yu,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Ou.displayName=yu.displayName;var ku=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Vs(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,V.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,V.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,V.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,V.jsx)(Ea,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,V.jsx)(Qa,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},Au=()=>{let{auth:e}=Vs(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,V.jsx)(qa,{className:`w-3 h-3 animate-spin`}),(0,V.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:e.username})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`HF not configured`})]}),(0,V.jsx)(ku,{open:t,onOpenChange:n})]})},eee=()=>(0,V.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,V.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,V.jsx)(Au,{})]})}),ju=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:Ka},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:wa},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,V.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,V.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],Mu=()=>(0,V.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,V.jsxs)(`span`,{children:[`Powered by`,` `,(0,V.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,V.jsx)(`nav`,{className:`flex items-center gap-4`,children:ju.map(({href:e,label:t,Icon:n})=>(0,V.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,V.jsx)(n,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:t})]},t))})]})}),Nu=[`top`,`right`,`bottom`,`left`],Pu=Math.min,Fu=Math.max,Iu=Math.round,Lu=Math.floor,Ru=e=>({x:e,y:e}),zu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Bu(e,t,n){return Fu(e,Pu(t,n))}function Vu(e,t){return typeof e==`function`?e(t):e}function Hu(e){return e.split(`-`)[0]}function Uu(e){return e.split(`-`)[1]}function Wu(e){return e===`x`?`y`:`x`}function Gu(e){return e===`y`?`height`:`width`}function Ku(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function qu(e){return Wu(Ku(e))}function Ju(e,t,n){n===void 0&&(n=!1);let r=Uu(e),i=qu(e),a=Gu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=rd(o)),[o,rd(o)]}function Yu(e){let t=rd(e);return[Xu(e),t,Xu(t)]}function Xu(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Zu=[`left`,`right`],Qu=[`right`,`left`],$u=[`top`,`bottom`],ed=[`bottom`,`top`];function td(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Qu:Zu:t?Zu:Qu;case`left`:case`right`:return t?$u:ed;default:return[]}}function nd(e,t,n,r){let i=Uu(e),a=td(Hu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Xu)))),a}function rd(e){let t=Hu(e);return zu[t]+e.slice(t.length)}function id(e){return{top:0,right:0,bottom:0,left:0,...e}}function ad(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:id(e)}function od(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function sd(e,t,n){let{reference:r,floating:i}=e,a=Ku(t),o=qu(t),s=Gu(o),c=Hu(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Uu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function cd(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Vu(t,e),p=ad(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=od(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=od(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ld=50,ud=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:cd},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=sd(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Vu(e,t)||{};if(l==null)return{};let d=ad(u),f={x:n,y:r},p=qu(i),m=Gu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Pu(d[_],T),D=Pu(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Bu(O,A,k),M=!c.arrow&&Uu(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ku(t))||T.every(e=>Ku(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ku(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function pd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function md(e){return Nu.some(t=>e[t]>=0)}var hd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Vu(e,t);switch(i){case`referenceHidden`:{let e=pd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:md(e)}}}case`escaped`:{let e=pd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:md(e)}}}default:return{}}}}},gd=new Set([`left`,`top`]);async function tee(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hu(n),s=Uu(n),c=Ku(n)===`y`,l=gd.has(o)?-1:1,u=a&&c?-1:1,d=Vu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nee=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tee(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ree=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Vu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ku(Hu(i)),p=Wu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Bu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Bu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},iee=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Vu(e,t),u={x:n,y:r},d=Ku(i),f=Wu(d),p=u[f],m=u[d],h=Vu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=gd.has(Hu(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},aee=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Vu(e,t),u=await o.detectOverflow(t,l),d=Hu(i),f=Uu(i),p=Ku(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Pu(h-u[g],v),x=Pu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Fu(u.left,0),t=Fu(u.right,0),n=Fu(u.top,0),r=Fu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Fu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Fu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function _d(){return typeof window<`u`}function vd(e){return xd(e)?(e.nodeName||``).toLowerCase():`#document`}function yd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bd(e){return((xd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xd(e){return _d()?e instanceof Node||e instanceof yd(e).Node:!1}function Sd(e){return _d()?e instanceof Element||e instanceof yd(e).Element:!1}function Cd(e){return _d()?e instanceof HTMLElement||e instanceof yd(e).HTMLElement:!1}function wd(e){return!_d()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof yd(e).ShadowRoot}function Td(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Id(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ed(e){return/^(table|td|th)$/.test(vd(e))}function Dd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Od=/transform|translate|scale|rotate|perspective|filter/,kd=/paint|layout|strict|content/,Ad=e=>!!e&&e!==`none`,jd;function Md(e){let t=Sd(e)?Id(e):e;return Ad(t.transform)||Ad(t.translate)||Ad(t.scale)||Ad(t.rotate)||Ad(t.perspective)||!Pd()&&(Ad(t.backdropFilter)||Ad(t.filter))||Od.test(t.willChange||``)||kd.test(t.contain||``)}function Nd(e){let t=Rd(e);for(;Cd(t)&&!Fd(t);){if(Md(t))return t;if(Dd(t))return null;t=Rd(t)}return null}function Pd(){return jd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),jd}function Fd(e){return/^(html|body|#document)$/.test(vd(e))}function Id(e){return yd(e).getComputedStyle(e)}function Ld(e){return Sd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rd(e){if(vd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||wd(e)&&e.host||bd(e);return wd(t)?t.host:t}function zd(e){let t=Rd(e);return Fd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cd(t)&&Td(t)?t:zd(t)}function Bd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=zd(e),i=r===e.ownerDocument?.body,a=yd(r);if(i){let e=Vd(a);return t.concat(a,a.visualViewport||[],Td(r)?r:[],e&&n?Bd(e):[])}else return t.concat(r,Bd(r,[],n))}function Vd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hd(e){let t=Id(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Cd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Iu(n)!==a||Iu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ud(e){return Sd(e)?e:e.contextElement}function Wd(e){let t=Ud(e);if(!Cd(t))return Ru(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Hd(t),o=(a?Iu(n.width):n.width)/r,s=(a?Iu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Gd=Ru(0);function Kd(e){let t=yd(e);return!Pd()||!t.visualViewport?Gd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yd(e)?!1:t}function Jd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ud(e),o=Ru(1);t&&(r?Sd(r)&&(o=Wd(r)):o=Wd(e));let s=qd(a,n,r)?Kd(a):Ru(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=yd(a),t=r&&Sd(r)?yd(r):r,n=e,i=Vd(n);for(;i&&r&&t!==n;){let e=Wd(i),t=i.getBoundingClientRect(),r=Id(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=yd(i),i=Vd(n)}}return od({width:u,height:d,x:c,y:l})}function Yd(e,t){let n=Ld(e).scrollLeft;return t?t.left+n:Jd(bd(e)).left+n}function Xd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Yd(e,n),y:n.top+t.scrollTop}}function Zd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=bd(r),s=t?Dd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ru(1),u=Ru(0),d=Cd(r);if((d||!d&&!a)&&((vd(r)!==`body`||Td(o))&&(c=Ld(r)),d)){let e=Jd(r);l=Wd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Xd(o,c):Ru(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Qd(e){return Array.from(e.getClientRects())}function $d(e){let t=bd(e),n=Ld(e),r=e.ownerDocument.body,i=Fu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Fu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Yd(e),s=-n.scrollTop;return Id(r).direction===`rtl`&&(o+=Fu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ef=25;function tf(e,t){let n=yd(e),r=bd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Pd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Yd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ef&&(a-=o)}else l<=ef&&(a+=l);return{width:a,height:o,x:s,y:c}}function nf(e,t){let n=Jd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Cd(e)?Wd(e):Ru(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function rf(e,t,n){let r;if(t===`viewport`)r=tf(e,n);else if(t===`document`)r=$d(bd(e));else if(Sd(t))r=nf(t,n);else{let n=Kd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return od(r)}function af(e,t){let n=Rd(e);return n===t||!Sd(n)||Fd(n)?!1:Id(n).position===`fixed`||af(n,t)}function oee(e,t){let n=t.get(e);if(n)return n;let r=Bd(e,[],!1).filter(e=>Sd(e)&&vd(e)!==`body`),i=null,a=Id(e).position===`fixed`,o=a?Rd(e):e;for(;Sd(o)&&!Fd(o);){let t=Id(o),n=Md(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Td(o)&&!n&&af(e,o))?r=r.filter(e=>e!==o):i=t,o=Rd(o)}return t.set(e,r),r}function see(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dd(t)?[]:oee(t,this._c):[].concat(n),r],o=rf(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!lf(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function df(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ud(e),u=i||a?[...l?Bd(l):[],...t?Bd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?uf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Jd(e):null;c&&g();function g(){let t=Jd(e);h&&!lf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ff=nee,pf=ree,mf=fd,hf=aee,gf=hd,_f=dd,vf=iee,yf=(e,t,n)=>{let r=new Map,i={platform:fee,...n},a={...i.platform,_c:r};return ud(e,t,{...i,platform:a})},bf=typeof document<`u`?_.useLayoutEffect:function(){};function xf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!xf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Sf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cf(e,t){let n=Sf(e);return Math.round(t*n)/n}function wf(e){let t=_.useRef(e);return bf(()=>{t.current=e}),t}function Tf(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);xf(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=wf(c),k=wf(i),A=wf(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),yf(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!xf(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);bf(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);bf(()=>(M.current=!0,()=>{M.current=!1}),[]),bf(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Cf(P.floating,u.x),r=Cf(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Sf(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ef=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:_f({element:r.current,padding:i}).fn(n):r?_f({element:r,padding:i}).fn(n):{}}}},Df=(e,t)=>{let n=ff(e);return{name:n.name,fn:n.fn,options:[e,t]}},Of=(e,t)=>{let n=pf(e);return{name:n.name,fn:n.fn,options:[e,t]}},kf=(e,t)=>({fn:vf(e).fn,options:[e,t]}),Af=(e,t)=>{let n=mf(e);return{name:n.name,fn:n.fn,options:[e,t]}},jf=(e,t)=>{let n=hf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mf=(e,t)=>{let n=gf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nf=(e,t)=>{let n=Ef(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pf=`Arrow`,Ff=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(U.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Ff.displayName=Pf;var If=Ff;function Lf(e){let[t,n]=_.useState(void 0);return ti(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Rf=`Popper`,[zf,Bf]=Sr(Rf),[Vf,Hf]=zf(Rf),Uf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,V.jsx)(Vf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Uf.displayName=Rf;var Wf=`PopperAnchor`,Gf=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Hf(Wf,n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(U.div,{...i,ref:s})});Gf.displayName=Wf;var Kf=`PopperContent`,[qf,Jf]=zf(Kf),Yf=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Hf(Kf,n),[v,y]=_.useState(null),b=br(t,e=>y(e)),[x,S]=_.useState(null),C=Lf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter($f),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Tf({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>df(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Df({mainAxis:i+T,alignmentAxis:o}),c&&Of({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?kf():void 0,...A}),c&&Af({...A}),jf({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Nf({element:x,padding:s}),ep({arrowWidth:w,arrowHeight:T}),f&&Mf({strategy:`referenceHidden`,...A})]}),[I,ee]=tp(N),te=Rr(m);ti(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=_.useState();return ti(()=>{v&&oe(window.getComputedStyle(v).zIndex)},[v]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(qf,{scope:n,placedSide:I,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,V.jsx)(U.div,{"data-side":I,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Yf.displayName=Kf;var Xf=`PopperArrow`,Zf={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Qf=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Jf(Xf,n),a=Zf[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(If,{...r,ref:t,style:{...r.style,display:`block`}})})});Qf.displayName=Xf;function $f(e){return e!==null}var ep=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function tp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var np=Uf,rp=Gf,ip=Yf,ap=Qf,op=Symbol(`radix.slottable`);function sp(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=op,t}var[cp,pee]=Sr(`Tooltip`,[Bf]),lp=Bf(),up=`TooltipProvider`,dp=700,fp=`tooltip.open`,[pp,mp]=cp(up),hp=e=>{let{__scopeTooltip:t,delayDuration:n=dp,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(pp,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hp.displayName=up;var gp=`Tooltip`,[_p,vp]=cp(gp),yp=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mp(gp,e.__scopeTooltip),l=lp(t),[u,d]=_.useState(null),f=Ws(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=ui({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fp))):c.onClose(),a?.(e)},caller:gp}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(np,{...l,children:(0,V.jsx)(_p,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};yp.displayName=gp;var bp=`TooltipTrigger`,xp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vp(bp,n),a=mp(bp,n),o=lp(n),s=br(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(rp,{asChild:!0,...o,children:(0,V.jsx)(U.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});xp.displayName=bp;var Sp=`TooltipPortal`,[Cp,wp]=cp(Sp,{forceMount:void 0}),Tp=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vp(Sp,t);return(0,V.jsx)(Cp,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};Tp.displayName=Sp;var Ep=`TooltipContent`,Dp=_.forwardRef((e,t)=>{let n=wp(Ep,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vp(Ep,e.__scopeTooltip);return(0,V.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(Mp,{side:i,...a,ref:t}):(0,V.jsx)(Op,{side:i,...a,ref:t})})}),Op=_.forwardRef((e,t)=>{let n=vp(Ep,e.__scopeTooltip),r=mp(Ep,e.__scopeTooltip),i=_.useRef(null),a=br(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ip(r,Fp(r,n.getBoundingClientRect())),a=Lp(t.getBoundingClientRect());s(zp([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rp(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(Mp,{...e,ref:a})}),[kp,Ap]=cp(gp,{isInside:!1}),jp=sp(`TooltipContent`),Mp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vp(Ep,n),l=lp(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(fp,u),()=>document.removeEventListener(fp,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(ip,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(jp,{children:r}),(0,V.jsx)(kp,{scope:n,isInside:!0,children:(0,V.jsx)(gi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dp.displayName=Ep;var Np=`TooltipArrow`,Pp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lp(n);return Ap(Np,n).isInside?null:(0,V.jsx)(ap,{...i,...r,ref:t})});Pp.displayName=Np;function Fp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ip(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zp(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Bp(t)}function Bp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vp=yp,Hp=xp,Up=Dp,Wp=Vp,Gp=Hp,Kp=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(Up,{ref:r,sideOffset:t,className:W(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kp.displayName=Up.displayName;function qp(e){let t=Jp(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Xp);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Jp(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Qp(n),i=Zp(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yp=Symbol(`radix.slottable`);function Xp(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Yp}function Zp(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qp(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $p=`Popover`,[em,mee]=Sr($p,[Bf]),tm=Bf(),[nm,rm]=em($p),im=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tm(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:$p});return(0,V.jsx)(np,{...s,children:(0,V.jsx)(nm,{scope:t,contentId:Ws(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};im.displayName=$p;var am=`PopoverAnchor`,om=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(am,n),a=tm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(rp,{...a,...r,ref:t})});om.displayName=am;var sm=`PopoverTrigger`,cm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(sm,n),a=tm(n),o=br(t,i.triggerRef),s=(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Cm(i.open),...r,ref:o,onClick:H(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(rp,{asChild:!0,...a,children:s})});cm.displayName=sm;var lm=`PopoverPortal`,[um,dm]=em(lm,{forceMount:void 0}),fm=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=rm(lm,t);return(0,V.jsx)(um,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};fm.displayName=lm;var pm=`PopoverContent`,mm=_.forwardRef((e,t)=>{let n=dm(pm,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=rm(pm,e.__scopePopover);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(gm,{...i,ref:t}):(0,V.jsx)(_m,{...i,ref:t})})});mm.displayName=pm;var hm=qp(`PopoverContent.RemoveScroll`),gm=_.forwardRef((e,t)=>{let n=rm(pm,e.__scopePopover),r=_.useRef(null),i=br(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(_l,{as:hm,allowPinchZoom:!0,children:(0,V.jsx)(vm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),_m=_.forwardRef((e,t)=>{let n=rm(pm,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)(vm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),vm=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=rm(pm,n),p=tm(n);return cc(),(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(ip,{"data-state":Cm(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ym=`PopoverClose`,bm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(ym,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});bm.displayName=ym;var xm=`PopoverArrow`,Sm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tm(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});Sm.displayName=xm;function Cm(e){return e?`open`:`closed`}var wm=im,Tm=cm,Em=fm,Dm=mm,Om=wm,km=Tm,Am=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,V.jsx)(Em,{children:(0,V.jsx)(Dm,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Am.displayName=Dm.displayName;var jm=1,Mm=.9,Nm=.8,Pm=.17,Fm=.1,Im=.999,Lm=.9999,Rm=.99,zm=/[\\\/_+.#"@\[\(\{&]/,Bm=/[\\\/_+.#"@\[\(\{&]/g,Vm=/[\s-]/,Hm=/[\s-]/g;function Um(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?jm:Rm;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Um(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=jm:zm.test(e.charAt(l-1))?(d*=Nm,p=e.slice(i,l-1).match(Bm),p&&i>0&&(d*=Im**+p.length)):Vm.test(e.charAt(l-1))?(d*=Mm,m=e.slice(i,l-1).match(Hm),m&&i>0&&(d*=Im**+m.length)):(d*=Pm,i>0&&(d*=Im**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Lm)),(dd&&(d=f*Fm)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Wm(e){return e.toLowerCase().replace(Hm,` `)}function Gm(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Um(e,t,Wm(e),Wm(t),0,0,{})}var Km=`[cmdk-group=""]`,qm=`[cmdk-group-items=""]`,Jm=`[cmdk-group-heading=""]`,Ym=`[cmdk-item=""]`,Xm=`${Ym}:not([aria-disabled="true"])`,Zm=`cmdk-item-select`,Qm=`data-value`,$m=(e,t,n)=>Gm(e,t,n),eh=_.createContext(void 0),th=()=>_.useContext(eh),nh=_.createContext(void 0),rh=()=>_.useContext(nh),ih=_.createContext(void 0),ah=_.forwardRef((e,t)=>{let n=lh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=lh(()=>new Set),i=lh(()=>new Map),a=lh(()=>new Map),o=lh(()=>new Set),s=sh(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Ws(),b=Ws(),x=Ws(),S=_.useRef(null),C=Tee();ch(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),ch(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??$m;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qm);t?t.appendChild(e.parentElement===t?e:e.closest(`${qm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Km}[${Qm}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Qm);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Km)?.querySelector(Jm))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Ym}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Xm)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Qm))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Qm))}function F(e){let t=j()?.closest(Km),n;for(;t&&!n;)t=e>0?Cee(t,Km):wee(t,Km),n=t?.querySelector(Xm);n?w.setState(`value`,n.getAttribute(Qm)):P(e)}let I=()=>N(M().length-1),ee=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},te=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(U.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Zm);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Dee},c),fh(e,e=>_.createElement(nh.Provider,{value:w},_.createElement(eh.Provider,{value:T},e))))}),hee=_.forwardRef((e,t)=>{let n=Ws(),r=_.useRef(null),i=_.useContext(ih),a=th(),o=sh(e),s=o.current?.forceMount??i?.forceMount;ch(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=dh(n,r,[e.value,e.children,r],e.keywords),l=rh(),u=uh(e=>e.value&&e.value===c.current),d=uh(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Zm,f),()=>t.removeEventListener(Zm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(U.div,{ref:yr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),gee=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ws(),s=_.useRef(null),c=_.useRef(null),l=Ws(),u=th(),d=uh(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);ch(()=>u.group(o),[]),dh(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(U.div,{ref:yr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),fh(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(ih.Provider,{value:f},e))))}),_ee=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=uh(e=>!e.search);return!n&&!a?null:_.createElement(U.div,{ref:yr(i,t),...r,"cmdk-separator":``,role:`separator`})}),vee=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=rh(),o=uh(e=>e.search),s=uh(e=>e.selectedItemId),c=th();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(U.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),yee=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=uh(e=>e.selectedItemId),c=th();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(U.div,{ref:yr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},fh(e,e=>_.createElement(`div`,{ref:yr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),bee=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(pu,{open:n,onOpenChange:r},_.createElement(hu,{container:o},_.createElement(gu,{"cmdk-overlay":``,className:i}),_.createElement(_u,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(ah,{ref:t,...s}))))}),xee=_.forwardRef((e,t)=>uh(e=>e.filtered.count===0)?_.createElement(U.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),See=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(U.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},fh(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),oh=Object.assign(ah,{List:yee,Item:hee,Input:vee,Group:gee,Separator:_ee,Dialog:bee,Empty:xee,Loading:See});function Cee(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function wee(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function sh(e){let t=_.useRef(e);return ch(()=>{t.current=e}),t}var ch=typeof window>`u`?_.useEffect:_.useLayoutEffect;function lh(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function uh(e){let t=rh(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function dh(e,t,n,r=[]){let i=_.useRef(),a=th();return ch(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Qm,s),i.current=s}),i}var Tee=()=>{let[e,t]=_.useState(),n=lh(()=>new Map);return ch(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Eee(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function fh({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(Eee(t),{ref:t.ref},n(t.props.children)):n(t)}var Dee={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},ph=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh,{ref:n,className:W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));ph.displayName=oh.displayName;var mh=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,V.jsx)(eo,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,V.jsx)(oh.Input,{ref:n,className:W(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));mh.displayName=oh.Input.displayName;var hh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.List,{ref:n,className:W(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));hh.displayName=oh.List.displayName;var gh=_.forwardRef((e,t)=>(0,V.jsx)(oh.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));gh.displayName=oh.Empty.displayName;var _h=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Group,{ref:n,className:W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));_h.displayName=oh.Group.displayName;var Oee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Separator,{ref:n,className:W(`-mx-1 h-px bg-border`,e),...t}));Oee.displayName=oh.Separator.displayName;var vh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Item,{ref:n,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));vh.displayName=oh.Item.displayName;var kee=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});kee.displayName=`CommandShortcut`;var yh=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,V.jsxs)(Om,{open:a,onOpenChange:o,children:[(0,V.jsx)(km,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,V.jsx)(`span`,{className:W(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(Am,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,V.jsxs)(ph,{className:`bg-gray-800`,children:[(0,V.jsx)(mh,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,V.jsxs)(hh,{children:[t.length===0&&(0,V.jsx)(gh,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,V.jsx)(_h,{heading:`Existing`,children:t.map(t=>(0,V.jsxs)(vh,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),p]})]})})]})},bh=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,V.jsx)(yh,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,V.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,children:(0,V.jsx)(to,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Configure (calibrate)`})]}),(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Delete robot config`})]})]})]}),e&&(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsx)(G,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,V.jsx)(Kp,{children:`Configure the robot first.`})]}),e&&(0,V.jsx)(xu,{open:l,onOpenChange:u,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{children:`Delete robot config?`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,V.jsxs)(Eu,{className:`flex gap-2 justify-end`,children:[(0,V.jsx)(G,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,V.jsx)(G,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},xh=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=Re(),{baseUrl:c,fetchWithHeaders:l}=Rs(),{toast:u}=_r();return(0,V.jsx)(bh,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},Sh=_.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:W(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Sh.displayName=`Input`;var Ch=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,V.jsx)(Sh,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:W(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});Ch.displayName=`NumberInput`;var wh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Th=`Label`,Eh=_.forwardRef((e,t)=>(0,V.jsx)(wh.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Eh.displayName=Th;var Dh=Eh,Oh=ga(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),kh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Dh,{ref:n,className:W(Oh(),e),...t}));kh.displayName=Dh.displayName;function Ah(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jh=`Checkbox`,[Mh,Aee]=Sr(jh),[Nh,Ph]=Mh(jh);function Fh(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:i??!1,onChange:c,caller:jh}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Wh(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,V.jsx)(Nh,{scope:t,...x,children:Uh(d)?d(x):r})}var Ih=`CheckboxTrigger`,Lh=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Ph(Ih,e),h=br(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(U.button,{type:`button`,role:`checkbox`,"aria-checked":Wh(c)?`mixed`:c,"aria-required":l,"data-state":Gh(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>Wh(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Lh.displayName=Ih;var Rh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(Fh,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Lh,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Hh,{__scopeCheckbox:n})]})})});Rh.displayName=jh;var zh=`CheckboxIndicator`,Bh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ph(zh,n);return(0,V.jsx)(ai,{present:r||Wh(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{"data-state":Gh(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Bh.displayName=zh;var Vh=`CheckboxBubbleInput`,Hh=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Ph(Vh,e),m=br(n,p),h=Ah(a),g=Lf(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Wh(a),n.call(e,Wh(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(Wh(a)?!1:a);return(0,V.jsx)(U.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Hh.displayName=Vh;function Uh(e){return typeof e==`function`}function Wh(e){return e===`indeterminate`}function Gh(e){return Wh(e)?`indeterminate`:e?`checked`:`unchecked`}var Kh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Rh,{ref:n,className:W(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,V.jsx)(Bh,{className:W(`flex items-center justify-center text-current`),children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}));Kh.displayName=Rh.displayName;var qh=`Collapsible`,[Jh,jee]=Sr(qh),[Yh,Xh]=Jh(qh),Zh=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ui({prop:r,defaultProp:i??!1,onChange:o,caller:qh});return(0,V.jsx)(Yh,{scope:n,disabled:a,contentId:Ws(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,V.jsx)(U.div,{"data-state":rg(c),"data-disabled":a?``:void 0,...s,ref:t})})});Zh.displayName=qh;var Qh=`CollapsibleTrigger`,$h=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Xh(Qh,n);return(0,V.jsx)(U.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":rg(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});$h.displayName=Qh;var eg=`CollapsibleContent`,tg=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Xh(eg,e.__scopeCollapsible);return(0,V.jsx)(ai,{present:n||i.open,children:({present:e})=>(0,V.jsx)(ng,{...r,ref:t,present:e})})});tg.displayName=eg;var ng=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Xh(eg,n),[s,c]=_.useState(r),l=_.useRef(null),u=br(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),ti(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,V.jsx)(U.div,{"data-state":rg(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function rg(e){return e?`open`:`closed`}var ig=Zh,ag=$h,og=tg,sg=ga(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),cg=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(`div`,{ref:r,role:`alert`,className:W(sg({variant:t}),e),...n}));cg.displayName=`Alert`;var lg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h5`,{ref:n,className:W(`mb-1 font-medium leading-none tracking-tight`,e),...t}));lg.displayName=`AlertTitle`;var ug=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`text-sm [&_p]:leading-relaxed`,e),...t}));ug.displayName=`AlertDescription`;function dg(e,[t,n]){return Math.min(n,Math.max(t,e))}var fg=_.createContext(void 0);function pg(e){let t=_.useContext(fg);return e||t||`ltr`}function Mee(e){let t=Nee(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Fee);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Nee(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Lee(n),i=Iee(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pee=Symbol(`radix.slottable`);function Fee(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Pee}function Iee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Lee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hg=[` `,`Enter`],gg=`Select`,[_g,vg,yg]=Ar(gg),[bg,Ree]=Sr(gg,[yg,Bf]),xg=Bf(),[Sg,Cg]=bg(gg),[wg,Tg]=bg(gg),Eg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=xg(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=pg(l),[w,T]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:gg}),[E,D]=ui({prop:o,defaultProp:s,onChange:c,caller:gg}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,V.jsx)(np,{...h,children:(0,V.jsxs)(Sg,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ws(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,V.jsx)(_g.Provider,{scope:t,children:(0,V.jsx)(wg,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,V.jsxs)(x_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,V.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Eg.displayName=gg;var Dg=`SelectTrigger`,Og=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xg(n),o=Cg(Dg,n),s=o.disabled||r,c=br(t,o.onTriggerChange),l=vg(n),u=_.useRef(`touch`),[d,f,p]=C_(e=>{let t=l().filter(e=>!e.disabled),n=w_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,V.jsx)(rp,{asChild:!0,...a,children:(0,V.jsx)(U.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":S_(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&mg.includes(e.key)&&(m(),e.preventDefault())})})})});Og.displayName=Dg;var kg=`SelectValue`,Ag=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Cg(kg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=br(t,c.onValueNodeChange);return ti(()=>{l(u)},[l,u]),(0,V.jsx)(U.span,{...s,ref:d,style:{pointerEvents:`none`},children:S_(c.value)?(0,V.jsx)(V.Fragment,{children:o}):a})});Ag.displayName=kg;var jg=`SelectIcon`,Mg=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(U.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Mg.displayName=jg;var Ng=`SelectPortal`,Pg=e=>(0,V.jsx)(ri,{asChild:!0,...e});Pg.displayName=Ng;var Fg=`SelectContent`,Ig=_.forwardRef((e,t)=>{let n=Cg(Fg,e.__scopeSelect),[r,i]=_.useState();if(ti(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,V.jsx)(Rg,{scope:e.__scopeSelect,children:(0,V.jsx)(_g.Slot,{scope:e.__scopeSelect,children:(0,V.jsx)(`div`,{children:e.children})})}),t):null}return(0,V.jsx)(Hg,{...e,ref:t})});Ig.displayName=Fg;var Lg=10,[Rg,zg]=bg(Fg),Bg=`SelectContentImpl`,Vg=Mee(`SelectContent.RemoveScroll`),Hg=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=Cg(Fg,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=br(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=vg(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return El(b)},[b]),cc();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ee,te]=C_(e=>{let t=k().filter(e=>!e.disabled),n=w_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ne=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),re=_.useCallback(()=>b?.focus(),[b]),ie=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ae=r===`popper`?Kg:Wg,oe=ae===Kg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,V.jsx)(Rg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ne,selectedItem:T,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:ee,children:(0,V.jsx)(_l,{as:Vg,allowPinchZoom:!0,children:(0,V.jsx)(Ys,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,V.jsx)(ae,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...oe,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:H(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Hg.displayName=Bg;var Ug=`SelectItemAlignedPosition`,Wg=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Cg(Fg,n),o=zg(Fg,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=br(t,e=>u(e)),f=vg(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Lg,d=dg(a,[Lg,Math.max(Lg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Lg,d=dg(a,[Lg,Math.max(Lg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Lg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Lg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Lg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);ti(()=>b(),[b]);let[x,S]=_.useState();return ti(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,V.jsx)(qg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(U.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Wg.displayName=Ug;var Gg=`SelectPopperPosition`,Kg=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Lg,...a}=e,o=xg(n);return(0,V.jsx)(ip,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Kg.displayName=Gg;var[qg,Jg]=bg(Fg,{}),Yg=`SelectViewport`,Xg=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zg(Yg,n),o=Jg(Yg,n),s=br(t,a.onViewportChange),c=_.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(_g.Slot,{scope:n,children:(0,V.jsx)(U.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Lg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Xg.displayName=Yg;var Zg=`SelectGroup`,[Qg,$g]=bg(Zg),e_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ws();return(0,V.jsx)(Qg,{scope:n,id:i,children:(0,V.jsx)(U.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});e_.displayName=Zg;var t_=`SelectLabel`,n_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$g(t_,n);return(0,V.jsx)(U.div,{id:i.id,...r,ref:t})});n_.displayName=t_;var r_=`SelectItem`,[i_,a_]=bg(r_),o_=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Cg(r_,n),c=zg(r_,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=br(t,e=>c.itemRefCallback?.(e,r,i)),h=Ws(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,V.jsx)(i_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(_g.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(U.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(hg.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});o_.displayName=r_;var s_=`SelectItemText`,c_=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Cg(s_,n),s=zg(s_,n),c=a_(s_,n),l=Tg(s_,n),[u,d]=_.useState(null),f=br(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return ti(()=>(h(m),()=>g(m)),[h,g,m]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(U.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});c_.displayName=s_;var l_=`SelectItemIndicator`,u_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return a_(l_,n).isSelected?(0,V.jsx)(U.span,{"aria-hidden":!0,...r,ref:t}):null});u_.displayName=l_;var d_=`SelectScrollUpButton`,f_=_.forwardRef((e,t)=>{let n=zg(d_,e.__scopeSelect),r=Jg(d_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(h_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});f_.displayName=d_;var p_=`SelectScrollDownButton`,m_=_.forwardRef((e,t)=>{let n=zg(p_,e.__scopeSelect),r=Jg(p_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(h_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});m_.displayName=p_;var h_=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zg(`SelectScrollButton`,n),o=_.useRef(null),s=vg(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),ti(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(U.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),g_=`SelectSeparator`,__=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,V.jsx)(U.div,{"aria-hidden":!0,...r,ref:t})});__.displayName=g_;var v_=`SelectArrow`,y_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xg(n),a=Cg(v_,n),o=zg(v_,n);return a.open&&o.position===`popper`?(0,V.jsx)(ap,{...i,...r,ref:t}):null});y_.displayName=v_;var b_=`SelectBubbleInput`,x_=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=br(r,i),o=Ah(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,V.jsx)(U.select,{...n,style:{...pi,...n.style},ref:a,defaultValue:t})});x_.displayName=b_;function S_(e){return e===``||e===void 0}function C_(e){let t=Rr(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function w_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=T_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function T_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var E_=Eg,D_=Og,O_=Ag,k_=Mg,A_=Pg,j_=Ig,M_=Xg,N_=n_,P_=o_,F_=c_,I_=u_,L_=f_,R_=m_,z_=__,B_=E_,V_=O_,H_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(D_,{ref:r,className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,V.jsx)(k_,{asChild:!0,children:(0,V.jsx)(Da,{className:`h-4 w-4 text-slate-400`})})]}));H_.displayName=D_.displayName;var U_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(L_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(ka,{className:`h-4 w-4`})}));U_.displayName=L_.displayName;var W_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(R_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(Da,{className:`h-4 w-4`})}));W_.displayName=R_.displayName;var G_=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(A_,{children:(0,V.jsxs)(j_,{ref:i,className:W(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,V.jsx)(U_,{}),(0,V.jsx)(M_,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,V.jsx)(W_,{})]})}));G_.displayName=j_.displayName;var zee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(N_,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));zee.displayName=N_.displayName;var K_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(P_,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(I_,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),(0,V.jsx)(F_,{children:t})]}));K_.displayName=P_.displayName;var Bee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(z_,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));Bee.displayName=z_.displayName;var q_=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function J_({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=q_(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>q_(e.label)===r)||i.find(e=>q_(e.label).startsWith(r))||i.find(e=>q_(e.label).includes(r)||r.includes(q_(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}function Y_(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null;return i(!1),(async()=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch{i(!0)}})(),()=>{r=!0,a&&a.getTracks().forEach(e=>e.stop())}},[e,t]),{videoRef:n,hasError:r}}var X_=`__auto__`,Z_=`__default__`,Vee=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],Hee=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],Q_=({cameras:e,onCamerasChange:t,releaseStreamsRef:n})=>{let{toast:r}=_r(),{cameras:i,isLoading:a,refresh:o}=J_(),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(i.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=i.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[i]);let d=()=>{if(!s||!l.trim()){r({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(s),a=i.find(e=>e.index===n);if(!a){r({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===a.index||a.deviceId&&e.device_id===a.deviceId)){r({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:l.trim(),type:`opencv`,camera_index:a.index,device_id:a.deviceId,width:640,height:480,fps:30};t([...e,o]),c(``),u(``),r({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},f=n=>{t(e.filter(e=>e.id!==n)),r({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},p=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[m,h]=(0,_.useState)(!1),g=(0,_.useCallback)(()=>{h(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=g)},[n,g]),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Camera Configuration`}),(0,V.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,V.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>o(),disabled:a,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,V.jsx)(Qa,{className:`w-3.5 h-3.5 ${a?`animate-spin`:``}`})})]}),(0,V.jsxs)(B_,{value:s,onValueChange:c,disabled:a,children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,V.jsx)(V_,{placeholder:a?`Loading cameras...`:`Select camera`})}),(0,V.jsx)(G_,{className:`bg-gray-800 border-gray-700`,children:i.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,V.jsx)(K_,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,V.jsx)(Sh,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,V.jsxs)(G,{onClick:d,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!s||!l.trim(),children:[(0,V.jsx)(Za,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,V.jsx)(Uee,{camera:e,paused:m,onRemove:()=>f(e.id),onUpdate:t=>p(e.id,t)},e.id))})]}),e.length===0&&(0,V.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,V.jsx)(Ta,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,V.jsx)(`p`,{children:`No cameras configured. Add a camera to get started.`})]})]})},Uee=({camera:e,paused:t,onRemove:n,onUpdate:r})=>{let{videoRef:i,hasError:a}=Y_(e.device_id,t);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!a?(0,V.jsx)(`video`,{ref:i,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,V.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),(0,V.jsx)(G,{onClick:n,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,V.jsx)(mo,{className:`w-4 h-4`})})]}),(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,V.jsxs)(og,{className:`pt-2 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(Ch,{value:e.width,onChange:e=>{e!==void 0&&r({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,V.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,V.jsx)(Ch,{value:e.height,onChange:e=>{e!==void 0&&r({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,V.jsx)(Ch,{value:e.fps??30,onChange:e=>{e!==void 0&&r({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,V.jsxs)(B_,{value:e.fourcc??X_,onValueChange:e=>r({fourcc:e===X_?void 0:e}),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(K_,{value:X_,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),Vee.map(e=>(0,V.jsx)(K_,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,V.jsxs)(B_,{value:e.backend??Z_,onValueChange:e=>r({backend:e===Z_?void 0:e}),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(K_,{value:Z_,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),Hee.map(e=>(0,V.jsx)(K_,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,V.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},Wee=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Vs(),b=!!n&&n.is_clean;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,V.jsx)(Sh,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,V.jsx)(`code`,{children:`.`}),` `,(0,V.jsx)(`code`,{children:`_`}),` `,(0,V.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,V.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,V.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,V.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,V.jsx)(Sh,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,V.jsx)(Ch,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,V.jsx)(Ch,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,V.jsx)(Ch,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(Q_,{cameras:h,onCamerasChange:g,releaseStreamsRef:v})}),(0,V.jsxs)(ig,{className:`space-y-4 group`,children:[(0,V.jsxs)(ag,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,V.jsx)(`span`,{children:`Advanced Parameters`}),(0,V.jsx)(Da,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,V.jsx)(og,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(Kh,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(kh,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsx)(G,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Gee=/^[\w.\-]+\/[\w.\-]+$/,Kee=/^[A-Za-z0-9._-]+$/,qee=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=Gee.test(u),p=Kee.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,V.jsxs)(vh,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,V.jsxs)(Om,{open:o,onOpenChange:s,children:[(0,V.jsx)(km,{asChild:!0,children:a}),(0,V.jsx)(Am,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,V.jsxs)(ph,{className:`bg-gray-800`,children:[(0,V.jsx)(mh,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,V.jsxs)(hh,{children:[e.length===0&&!m&&!h&&(0,V.jsx)(gh,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,V.jsx)(_h,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,V.jsx)(_h,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,V.jsx)(_h,{heading:`Custom repo`,children:(0,V.jsxs)(vh,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ha,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),v]})]})})]})},Jee=(e,t)=>{let{wsBaseUrl:n}=Rs(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},$_=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function ev(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new $_(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function tv(e,t,n=10,r){return(await ev(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function nv(e,t,n,r){return ev(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function rv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function iv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function av(e,t,n,r){return(await ev(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function ov(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await ev(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof $_&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function sv(e,t,n,r){return ev(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function cv(e,t,n){return ev(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function lv(e,t,n){await ev(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var uv={authenticated:!1,username:null,flavors:[]};async function dv(e,t,n){try{return await ev(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof $_)return uv;throw e}}var fv={authenticated:!1,jobs:[],models:[]};async function pv(e,t,n){try{return await ev(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof $_)return fv;throw e}}var mv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));mv.displayName=`Card`;var hv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex flex-col space-y-1.5 p-6`,e),...t}));hv.displayName=`CardHeader`;var gv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h3`,{ref:n,className:W(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));gv.displayName=`CardTitle`;var _v=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`p`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));_v.displayName=`CardDescription`;var vv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`p-6 pt-0`,e),...t}));vv.displayName=`CardContent`;var yv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex items-center p-6 pt-0`,e),...t}));yv.displayName=`CardFooter`;async function bv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function xv(e,t,n,r,i){return ev(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var Sv=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,V.jsxs)(B_,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,V.jsx)(H_,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(V_,{placeholder:i})}),(0,V.jsx)(G_,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,V.jsx)(K_,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function Cv(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var wv={running:{label:`Running`,color:`text-green-400`,Icon:qa},done:{label:`Done`,color:`text-slate-400`,Icon:Na},failed:{label:`Failed`,color:`text-red-400`,Icon:Fa},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:co}},Tv=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=Re(),{baseUrl:a,fetchWithHeaders:o}=Rs(),s=wv[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${Cv(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${Cv(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return bv(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,V.jsx)(mv,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,V.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,V.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})}):(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,V.jsx)(ao,{className:`w-3.5 h-3.5`}):(0,V.jsx)(mo,{className:`w-3.5 h-3.5`})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,V.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,V.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sv,{checkpoints:g,selectedStep:y,onChange:b}),(0,V.jsx)(G,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,V.jsx)(Xa,{className:`w-4 h-4`})})]}):null]})})};function Ev(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Dv={RUNNING:{label:`Running`,color:`text-green-400`,Icon:qa,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:La},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:La},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:Na},FAILED:{label:`Failed`,color:`text-red-400`,Icon:Fa},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:co},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:co}},Ov=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=Dv[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:Pa},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,V.jsx)(mv,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,V.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,Ev(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,V.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function kv(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Av=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,V.jsx)(mv,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,V.jsx)(lo,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,V.jsx)(Ja,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,V.jsx)(`span`,{className:`truncate`,children:n})]}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,kv(e.last_modified)]})]})]})})};async function jv(e,t,n){return ev(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function Mv(e,t){return ev(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Nv(e,t,n){return ev(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var Pv=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=Y_(e,t);return t||r||!e?(0,V.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},Fv=30,Iv=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=Rs(),{toast:s}=_r(),c=Re(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=J_({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return bv(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),xv(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:Fv})}try{await jv(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(Xa,{className:`w-4 h-4 text-white`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`No checkpoints available for this job yet.`})]}):(0,V.jsx)(Sv,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,V.jsx)(Sh,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,V.jsx)(Ch,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,V.jsxs)(cg,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-200`,children:e}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,V.jsxs)(B_,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,V.jsx)(V_,{placeholder:`Select a camera`})}),(0,V.jsx)(G_,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,V.jsxs)(K_,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,V.jsx)(Pv,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsxs)(G,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Lv=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=Rs(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,V.jsx)(Ou,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,V.jsx)(Sh,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,V.jsx)(Sh,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,V.jsxs)(cg,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:d})]}):null,(0,V.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,V.jsxs)(G,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await sv(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}):(0,V.jsx)(Ba,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Rv=`lelab.selectedRobot`,zv=()=>{try{let e=localStorage.getItem(Rv);return e&&typeof e==`string`?e:null}catch{return null}},Bv=e=>{try{e?localStorage.setItem(Rv,e):localStorage.removeItem(Rv)}catch{}},Vv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),r=Ie(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>zv()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{Bv(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Hv=10,Uv=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Wv=e=>e.state===`running`||e.checkpoint_count>0,Gv=e=>Uv.has((e.status?.stage??``).toUpperCase()),Kv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Vv(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([tv(e,t,Hv),pv(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),Jee(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await cv(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await lv(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),I=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),ee=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),te=(0,_.useMemo)(()=>M.filter(e=>!ee.has(e.id)),[M,ee]),ne=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),re=(0,_.useMemo)(()=>N.filter(e=>!ne.has(e.repo_id)),[N,ne]),ie=(0,_.useMemo)(()=>P.filter(Wv),[P]),ae=(0,_.useMemo)(()=>P.filter(e=>!Wv(e)),[P]),oe=(0,_.useMemo)(()=>F.filter(Wv),[F]),se=(0,_.useMemo)(()=>F.filter(e=>!Wv(e)),[F]),ce=(0,_.useMemo)(()=>te.filter(Gv),[te]),le=(0,_.useMemo)(()=>te.filter(e=>!Gv(e)),[te]),ue=ae.length+se.length+le.length;return(0,V.jsxs)(`section`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(eo,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,V.jsx)(Sh,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,V.jsx)(Ba,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})})]})]}),d?(0,V.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ie.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:ie.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ie.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),I.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,I.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:I.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,oe.length+ce.length+re.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:!l&&F.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):oe.length===0&&ce.length===0&&re.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,V.jsx)(Ov,{job:e},e.id)),re.map(e=>(0,V.jsx)(Av,{model:e},e.repo_id))]})})]}),ue>0?(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,ue,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[ae.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),se.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,V.jsx)(Ov,{job:e},e.id))]})})]}):null,x?(0,V.jsx)(Iv,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,V.jsx)(Lv,{open:y,onOpenChange:b,onImported:T})]})},qv=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,Jv=`http://localhost:8000/`,Yv=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,V.jsx)(xu,{open:e,onOpenChange:n?t:()=>void 0,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,V.jsxs)(Tu,{className:`text-center sm:text-center min-w-0`,children:[(0,V.jsxs)(Du,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,V.jsx)(oo,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,V.jsx)(Ou,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(qv),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,V.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,V.jsx)(`code`,{className:`text-green-400`,children:qv})}),(0,V.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ea,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ra,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,V.jsx)(G,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,V.jsxs)(`a`,{href:Jv,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})};async function Xv(e,t,n){return ev(e,t,`/datasets`,{signal:n,action:`List datasets`})}var Zv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),Xv(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},Qv=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),$v=Qv(),ey=()=>{let[e,t]=(0,_.useState)($v),{auth:n}=Vs(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Vv(),{datasets:u,loading:d}=Zv(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=Re(),{toast:j}=_r();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,V.jsx)(eee,{}),(0,V.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,V.jsx)(xh,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,V.jsx)(qee,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/upload`,{state:{datasetInfo:{dataset_repo_id:e.repo_id,source:e.source}}});return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,V.jsx)(G,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,V.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,V.jsx)(Kv,{})}),(0,V.jsx)(Mu,{}),(0,V.jsx)(Yv,{open:e,onOpenChange:t,dismissible:!$v}),(0,V.jsx)(Wee,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},ty={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ny={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ry=`attached`,iy=1e3,ay=1001,oy=1002,sy=1003,cy=1004,ly=1005,uy=1006,dy=1007,fy=1008,py=1009,my=1010,hy=1011,gy=1012,_y=1013,vy=1014,yy=1015,by=1016,xy=1017,Sy=1018,Cy=1020,wy=35902,Ty=1021,Ey=1022,Dy=1023,Oy=1026,ky=1027,Ay=1028,jy=1029,My=1030,Ny=1031,Py=1033,Fy=33776,Iy=33777,Ly=33778,Ry=33779,zy=35840,By=35841,Vy=35842,Hy=35843,Uy=36196,Wy=37492,Gy=37496,Ky=37808,qy=37809,Jy=37810,Yy=37811,Xy=37812,Zy=37813,Qy=37814,$y=37815,eb=37816,tb=37817,nb=37818,rb=37819,ib=37820,ab=37821,ob=36492,sb=36494,cb=36495,lb=36283,ub=36284,db=36285,fb=36286,pb=2300,mb=2301,hb=2302,gb=2400,_b=2401,vb=2402,yb=2500,bb=3200,xb=3201,Sb=`srgb`,Cb=`srgb-linear`,wb=`linear`,Tb=`srgb`,Eb=7680,Db=35044,Ob=2e3,kb=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Ab[e>>16&255]+Ab[e>>24&255]+`-`+Ab[t&255]+Ab[t>>8&255]+`-`+Ab[t>>16&15|64]+Ab[t>>24&255]+`-`+Ab[n&63|128]+Ab[n>>8&255]+`-`+Ab[n>>16&255]+Ab[n>>24&255]+Ab[r&255]+Ab[r>>8&255]+Ab[r>>16&255]+Ab[r>>24&255]).toLowerCase()}function Fb(e,t,n){return Math.max(t,Math.min(n,e))}function Ib(e,t){return(e%t+t)%t}function Lb(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Rb(e,t,n){return e===t?0:(n-e)/(t-e)}function zb(e,t,n){return(1-n)*e+n*t}function Bb(e,t,n,r){return zb(e,t,1-Math.exp(-n*r))}function Vb(e,t=1){return t-Math.abs(Ib(e,t*2)-t)}function Hb(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Ub(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Wb(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Gb(e,t){return e+Math.random()*(t-e)}function Kb(e){return e*(.5-Math.random())}function qb(e){e!==void 0&&(jb=e);let t=jb+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Jb(e){return e*Mb}function Yb(e){return e*Nb}function Xb(e){return(e&e-1)==0&&e!==0}function Zb(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Qb(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function $b(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function ex(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function tx(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var nx={DEG2RAD:Mb,RAD2DEG:Nb,generateUUID:Pb,clamp:Fb,euclideanModulo:Ib,mapLinear:Lb,inverseLerp:Rb,lerp:zb,damp:Bb,pingpong:Vb,smoothstep:Hb,smootherstep:Ub,randInt:Wb,randFloat:Gb,randFloatSpread:Kb,seededRandom:qb,degToRad:Jb,radToDeg:Yb,isPowerOfTwo:Xb,ceilPowerOfTwo:Zb,floorPowerOfTwo:Qb,setQuaternionFromProperEuler:$b,normalize:tx,denormalize:ex},rx=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Fb(this.x,e.x,t.x),this.y=Fb(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Fb(this.x,e,t),this.y=Fb(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Fb(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Fb(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ix=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Fb(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},q=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ox.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ox.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Fb(this.x,e.x,t.x),this.y=Fb(this.y,e.y,t.y),this.z=Fb(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Fb(this.x,e,t),this.y=Fb(this.y,e,t),this.z=Fb(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Fb(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ax.copy(this).projectOnVector(e),this.sub(ax)}reflect(e){return this.sub(ax.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Fb(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},ax=new q,ox=new ix,sx=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(cx.makeScale(e,t)),this}rotate(e){return this.premultiply(cx.makeRotation(-e)),this}translate(e,t){return this.premultiply(cx.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},cx=new sx;function lx(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function ux(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function dx(){let e=ux(`canvas`);return e.style.display=`block`,e}var fx={};function px(e){e in fx||(fx[e]=!0,console.warn(e))}function mx(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function hx(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function gx(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var _x=new sx().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),vx=new sx().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function yx(){let e={enabled:!0,workingColorSpace:Cb,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=xx(e.r),e.g=xx(e.g),e.b=xx(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Sx(e.r),e.g=Sx(e.g),e.b=Sx(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?wb:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return px(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return px(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Cb]:{primaries:t,whitePoint:r,transfer:wb,toXYZ:_x,fromXYZ:vx,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Sb},outputColorSpaceConfig:{drawingBufferColorSpace:Sb}},[Sb]:{primaries:t,whitePoint:r,transfer:Tb,toXYZ:_x,fromXYZ:vx,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Sb}}}),e}var bx=yx();function xx(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Sx(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var Cx,wx=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cx===void 0&&(Cx=ux(`canvas`)),Cx.width=e.width,Cx.height=e.height;let t=Cx.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Cx}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=ux(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(kx).x}get height(){return this.source.getSize(kx).y}get depth(){return this.source.getSize(kx).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case iy:e.x-=Math.floor(e.x);break;case ay:e.x=e.x<0?0:1;break;case oy:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case iy:e.y-=Math.floor(e.y);break;case ay:e.y=e.y<0?0:1;break;case oy:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ax.DEFAULT_IMAGE=null,Ax.DEFAULT_MAPPING=300,Ax.DEFAULT_ANISOTROPY=1;var jx=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Rx),Rx.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Kx),qx.subVectors(this.max,Kx),Bx.subVectors(e.a,Kx),Vx.subVectors(e.b,Kx),Hx.subVectors(e.c,Kx),Ux.subVectors(Vx,Bx),Wx.subVectors(Hx,Vx),Gx.subVectors(Bx,Hx);let t=[0,-Ux.z,Ux.y,0,-Wx.z,Wx.y,0,-Gx.z,Gx.y,Ux.z,0,-Ux.x,Wx.z,0,-Wx.x,Gx.z,0,-Gx.x,-Ux.y,Ux.x,0,-Wx.y,Wx.x,0,-Gx.y,Gx.x,0];return!Xx(t,Bx,Vx,Hx,qx)||(t=[1,0,0,0,1,0,0,0,1],!Xx(t,Bx,Vx,Hx,qx))?!1:(Jx.crossVectors(Ux,Wx),t=[Jx.x,Jx.y,Jx.z],Xx(t,Bx,Vx,Hx,qx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Rx).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Rx).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Lx[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Lx[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Lx[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Lx[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Lx[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Lx[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Lx[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Lx[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Lx),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Lx=[new q,new q,new q,new q,new q,new q,new q,new q],Rx=new q,zx=new Ix,Bx=new q,Vx=new q,Hx=new q,Ux=new q,Wx=new q,Gx=new q,Kx=new q,qx=new q,Jx=new q,Yx=new q;function Xx(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Yx.fromArray(e,a);let o=i.x*Math.abs(Yx.x)+i.y*Math.abs(Yx.y)+i.z*Math.abs(Yx.z),s=t.dot(Yx),c=n.dot(Yx),l=r.dot(Yx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Zx=new Ix,Qx=new q,$x=new q,eS=class{constructor(e=new q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Zx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Qx.subVectors(e,this.center);let t=Qx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Qx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):($x.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qx.copy(e.center).add($x)),this.expandByPoint(Qx.copy(e.center).sub($x))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},tS=new q,nS=new q,rS=new q,iS=new q,aS=new q,oS=new q,sS=new q,cS=class{constructor(e=new q,t=new q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,tS)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=tS.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tS.copy(this.origin).addScaledVector(this.direction,t),tS.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){nS.copy(e).add(t).multiplyScalar(.5),rS.copy(t).sub(e).normalize(),iS.copy(this.origin).sub(nS);let i=e.distanceTo(t)*.5,a=-this.direction.dot(rS),o=iS.dot(this.direction),s=-iS.dot(rS),c=iS.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(nS).addScaledVector(rS,d),f}intersectSphere(e,t){tS.subVectors(e.center,this.origin);let n=tS.dot(this.direction),r=tS.dot(tS)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,tS)!==null}intersectTriangle(e,t,n,r,i){aS.subVectors(t,e),oS.subVectors(n,e),sS.crossVectors(aS,oS);let a=this.direction.dot(sS),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;iS.subVectors(this.origin,e);let s=o*this.direction.dot(oS.crossVectors(iS,oS));if(s<0)return null;let c=o*this.direction.dot(aS.cross(iS));if(c<0||s+c>a)return null;let l=-o*iS.dot(sS);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},J=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/lS.setFromMatrixColumn(e,0).length(),i=1/lS.setFromMatrixColumn(e,1).length(),a=1/lS.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dS,e,fS)}lookAt(e,t,n){let r=this.elements;return hS.subVectors(e,t),hS.lengthSq()===0&&(hS.z=1),hS.normalize(),pS.crossVectors(n,hS),pS.lengthSq()===0&&(Math.abs(n.z)===1?hS.x+=1e-4:hS.z+=1e-4,hS.normalize(),pS.crossVectors(n,hS)),pS.normalize(),mS.crossVectors(hS,pS),r[0]=pS.x,r[4]=mS.x,r[8]=hS.x,r[1]=pS.y,r[5]=mS.y,r[9]=hS.y,r[2]=pS.z,r[6]=mS.z,r[10]=hS.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=lS.set(r[0],r[1],r[2]).length(),a=lS.set(r[4],r[5],r[6]).length(),o=lS.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],uS.copy(this);let s=1/i,c=1/a,l=1/o;return uS.elements[0]*=s,uS.elements[1]*=s,uS.elements[2]*=s,uS.elements[4]*=c,uS.elements[5]*=c,uS.elements[6]*=c,uS.elements[8]*=l,uS.elements[9]*=l,uS.elements[10]*=l,t.setFromRotationMatrix(uS),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=Ob){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=Ob){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},lS=new q,uS=new J,dS=new q(0,0,0),fS=new q(1,1,1),pS=new q,mS=new q,hS=new q,gS=new J,_S=new ix,vS=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(Fb(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-Fb(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(Fb(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-Fb(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(Fb(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-Fb(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return gS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(gS,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _S.setFromEuler(this),this.setFromQuaternion(_S,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};vS.DEFAULT_ORDER=`XYZ`;var yS=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){IS.subVectors(r,t),LS.subVectors(n,t),RS.subVectors(e,t);let a=IS.dot(IS),o=IS.dot(LS),s=IS.dot(RS),c=LS.dot(LS),l=LS.dot(RS),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,zS)===null?!1:zS.x>=0&&zS.y>=0&&zS.x+zS.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,zS)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,zS.x),s.addScaledVector(a,zS.y),s.addScaledVector(o,zS.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return KS.setScalar(0),qS.setScalar(0),JS.setScalar(0),KS.fromBufferAttribute(e,t),qS.fromBufferAttribute(e,n),JS.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(KS,i.x),a.addScaledVector(qS,i.y),a.addScaledVector(JS,i.z),a}static isFrontFacing(e,t,n,r){return IS.subVectors(n,t),LS.subVectors(e,t),IS.cross(LS).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return IS.subVectors(this.c,this.b),LS.subVectors(this.a,this.b),IS.cross(LS).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;BS.subVectors(r,n),VS.subVectors(i,n),US.subVectors(e,n);let s=BS.dot(US),c=VS.dot(US);if(s<=0&&c<=0)return t.copy(n);WS.subVectors(e,r);let l=BS.dot(WS),u=VS.dot(WS);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(BS,a);GS.subVectors(e,i);let f=BS.dot(GS),p=VS.dot(GS);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(VS,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return HS.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(HS,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(BS,a).addScaledVector(VS,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},XS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ZS={h:0,s:0,l:0},QS={h:0,s:0,l:0};function $S(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Y=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Sb){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bx.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=bx.workingColorSpace){return this.r=e,this.g=t,this.b=n,bx.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=bx.workingColorSpace){if(e=Ib(e,1),t=Fb(t,0,1),n=Fb(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=$S(i,r,e+1/3),this.g=$S(i,r,e),this.b=$S(i,r,e-1/3)}return bx.colorSpaceToWorking(this,r),this}setStyle(e,t=Sb){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Sb){let n=XS[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=xx(e.r),this.g=xx(e.g),this.b=xx(e.b),this}copyLinearToSRGB(e){return this.r=Sx(e.r),this.g=Sx(e.g),this.b=Sx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Sb){return bx.workingToColorSpace(eC.copy(this),e),Math.round(Fb(eC.r*255,0,255))*65536+Math.round(Fb(eC.g*255,0,255))*256+Math.round(Fb(eC.b*255,0,255))}getHexString(e=Sb){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bx.workingColorSpace){bx.workingToColorSpace(eC.copy(this),t);let n=eC.r,r=eC.g,i=eC.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},rC=class extends nC{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},iC=new q,aC=new rx,oC=0,sC=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:oC++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Db,this.updateRanges=[],this.gpuType=yy,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ix);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(yC.copy(i).invert(),bC.copy(e.ray).applyMatrix4(yC),!(n.boundingBox!==null&&bC.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bC)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:kC.clone(),object:e}}function MC(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,CC),e.getVertexPosition(c,wC),e.getVertexPosition(l,TC);let u=jC(e,t,n,r,CC,wC,TC,OC);if(u){let e=new q;YS.getBarycoord(OC,CC,wC,TC,e),i&&(u.uv=YS.getInterpolatedAttribute(i,s,c,l,e,new rx)),a&&(u.uv1=YS.getInterpolatedAttribute(a,s,c,l,e,new rx)),o&&(u.normal=YS.getInterpolatedAttribute(o,s,c,l,e,new q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new q,materialIndex:0};YS.getNormal(CC,wC,TC,t.normal),u.face=t,u.barycoord=e}return u}var NC=class e extends vC{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new uC(c,3)),this.setAttribute(`normal`,new uC(l,3)),this.setAttribute(`uv`,new uC(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new q;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},HC=class extends FS{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new J,this.projectionMatrix=new J,this.projectionMatrixInverse=new J,this.coordinateSystem=Ob}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},UC=new q,WC=new rx,GC=new rx,KC=class extends HC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Nb*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Mb*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Nb*2*Math.atan(Math.tan(Mb*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){UC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(UC.x,UC.y).multiplyScalar(-e/UC.z),UC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(UC.x,UC.y).multiplyScalar(-e/UC.z)}getViewSize(e,t){return this.getViewBounds(e,WC,GC),t.subVectors(GC,WC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Mb*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},qC=-90,JC=1,YC=class extends FS{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new KC(qC,JC,e,t);r.layers=this.layers,this.add(r);let i=new KC(qC,JC,e,t);i.layers=this.layers,this.add(i);let a=new KC(qC,JC,e,t);a.layers=this.layers,this.add(a);let o=new KC(qC,JC,e,t);o.layers=this.layers,this.add(o);let s=new KC(qC,JC,e,t);s.layers=this.layers,this.add(s);let c=new KC(qC,JC,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},XC=class extends Ax{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},ZC=class extends Nx{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new XC(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},r=new NC(5,5,5),i=new VC({name:`CubemapFromEquirect`,uniforms:PC(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new AC(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=uy),new YC(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},QC=class extends FS{constructor(){super(),this.isGroup=!0,this.type=`Group`}},$C={type:`move`},ew=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new QC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new QC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new QC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent($C)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new QC;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},tw=class extends FS{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new vS,this.environmentIntensity=1,this.environmentRotation=new vS,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},nw=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=Db,this.updateRanges=[],this.version=0,this.uuid=Pb()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||$ee.getNormalMatrix(e),r=this.coplanarPoint(Ew).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Ow=new eS,kw=new q,Aw=class{constructor(e=new Dw,t=new Dw,n=new Dw,r=new Dw,i=new Dw,a=new Dw){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ob){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ow.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ow.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ow)}intersectsSprite(e){return Ow.center.set(0,0,0),Ow.radius=.7071067811865476,Ow.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ow)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,kw.y=r.normal.y>0?e.max.y:e.min.y,kw.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(kw)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},jw=class extends nC{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Y(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Mw=new q,Nw=new q,Pw=new J,Fw=new cS,Iw=new eS,Lw=new q,Rw=new q,zw=class extends FS{constructor(e=new vC,t=new jw){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Lw.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Lw);if(!(ct.far))return{distance:c,point:Rw.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Vw=new q,Hw=new q,Uw=class extends zw{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Zw=class extends Ax{constructor(e,t,n=vy,r,i,a,o=sy,s=sy,c,l=Oy,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ex(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},tte=class e extends vC{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new uC(u,3)),this.setAttribute(`normal`,new uC(d,3)),this.setAttribute(`uv`,new uC(f,2));function _(){let a=new q,_=new q,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new rx,m=new q,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},tT=class extends nC{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new Y(16777215),this.specular=new Y(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new rx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},ite=class extends nC{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new rx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},ate=class extends nC{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=bb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},ote=class extends nC{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function nT(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function ste(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cte(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function rT(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function iT(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var aT=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&ste(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===hb,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};lT.prototype.ValueTypeName=``,lT.prototype.TimeBufferType=Float32Array,lT.prototype.ValueBufferType=Float32Array,lT.prototype.DefaultInterpolation=mb;var uT=class extends lT{constructor(e,t,n){super(e,t,n)}};uT.prototype.ValueTypeName=`bool`,uT.prototype.ValueBufferType=Array,uT.prototype.DefaultInterpolation=pb,uT.prototype.InterpolantFactoryMethodLinear=void 0,uT.prototype.InterpolantFactoryMethodSmooth=void 0;var dT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};dT.prototype.ValueTypeName=`color`;var fT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};fT.prototype.ValueTypeName=`number`;var pT=class extends aT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)ix.slerpFlat(i,0,a,c-o,a,c,s);return i}},mT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new pT(this.times,this.values,this.getValueSize(),e)}};mT.prototype.ValueTypeName=`quaternion`,mT.prototype.InterpolantFactoryMethodSmooth=void 0;var hT=class extends lT{constructor(e,t,n){super(e,t,n)}};hT.prototype.ValueTypeName=`string`,hT.prototype.ValueBufferType=Array,hT.prototype.DefaultInterpolation=pb,hT.prototype.InterpolantFactoryMethodLinear=void 0,hT.prototype.InterpolantFactoryMethodSmooth=void 0;var gT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};gT.prototype.ValueTypeName=`vector`;var _T=class{constructor(e=``,t=-1,n=[],r=yb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Pb(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(yT(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(lT.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];iT(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(wT[e]!==void 0){wT[e].push({onLoad:t,onProgress:n,onError:r});return}wT[e]=[],wT[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=wT[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new TT(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{bT.add(e,t);let n=wT[e];delete wT[e];for(let e=0,r=n.length;e{let n=wT[e];if(n===void 0)throw this.manager.itemError(e),t;delete wT[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},DT=class extends CT{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=bT.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=ux(`img`);function s(){l(),bT.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},OT=class extends CT{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new gw,o=new ET(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?ay:n.wrapS,a.wrapT=n.wrapT===void 0?ay:n.wrapT,a.magFilter=n.magFilter===void 0?uy:n.magFilter,a.minFilter=n.minFilter===void 0?uy:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=fy),n.mipmapCount===1&&(a.minFilter=uy),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},kT=class extends CT{constructor(e){super(e)}load(e,t,n,r){let i=new Ax,a=new DT(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},AT=class extends FS{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Y(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},jT=class extends AT{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Y(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},MT=new J,NT=new q,PT=new q,FT=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new rx(512,512),this.mapType=py,this.map=null,this.mapPass=null,this.matrix=new J,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Aw,this._frameExtents=new rx(1,1),this._viewportCount=1,this._viewports=[new jx(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;NT.setFromMatrixPosition(e.matrixWorld),t.position.copy(NT),PT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(PT),t.updateMatrixWorld(),MT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(MT),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(MT)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},IT=class extends FT{constructor(){super(new KC(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Nb*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},LT=class extends AT{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.target=new FS,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new IT}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},RT=new J,zT=new q,BT=new q,VT=class extends FT{constructor(){super(new KC(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new rx(4,2),this._viewportCount=6,this._viewports=[new jx(2,1,1,1),new jx(0,1,1,1),new jx(3,1,1,1),new jx(1,1,1,1),new jx(3,0,1,1),new jx(1,0,1,1)],this._cubeDirections=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],this._cubeUps=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),zT.setFromMatrixPosition(e.matrixWorld),n.position.copy(zT),BT.copy(n.position),BT.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(BT),n.updateMatrixWorld(),r.makeTranslation(-zT.x,-zT.y,-zT.z),RT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(RT)}},HT=class extends AT{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new VT}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},UT=class extends HC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},WT=class extends FT{constructor(){super(new UT(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},GT=class extends AT{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.target=new FS,this.shadow=new WT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},KT=class extends AT{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},qT=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},JT=new WeakMap,YT=class extends CT{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=bT.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(JT.has(a)===!0)r&&r(JT.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return bT.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),JT.set(s,t),bT.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});bT.add(e,s),i.manager.itemStart(e)}},XT=class extends KC{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},ZT=`\\[\\]\\.:\\/`,QT=RegExp(`[\\[\\]\\.:\\/]`,`g`),$T=`[^\\[\\]\\.:\\/]`,eE=`[^`+ZT.replace(`\\.`,``)+`]`,tE=`((?:WC+[\\/:])*)`.replace(`WC`,$T),nE=`(WCOD+)?`.replace(`WCOD`,eE),rE=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,$T),iE=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,$T),aE=RegExp(`^`+tE+nE+rE+iE+`$`),oE=[`material`,`materials`,`bones`,`map`],sE=class{constructor(e,t,n){let r=n||cE.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cE=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(QT,``)}static parseTrackName(e){let t=aE.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);oE.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e 0 - vec4 plane; - #ifdef ALPHA_TO_COVERAGE - float distanceToPlane, distanceGradient; - float clipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - if ( clipOpacity == 0.0 ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - float unionClipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - } - #pragma unroll_loop_end - clipOpacity *= 1.0 - unionClipOpacity; - #endif - diffuseColor.a *= clipOpacity; - if ( diffuseColor.a == 0.0 ) discard; - #else - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif - #endif -#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - varying vec3 vColor; -#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif -#ifdef USE_BATCHING_COLOR - vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); - vColor.xyz *= batchingColor.xyz; -#endif`,common:`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; -#ifdef USE_TANGENT - vec3 transformedTangent = objectTangent; -#endif -#ifdef USE_BATCHING - mat3 bm = mat3( batchingMatrix ); - transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); - transformedNormal = bm * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = bm * transformedTangent; - #endif -#endif -#ifdef USE_INSTANCING - mat3 im = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); - transformedNormal = im * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = im * transformedTangent; - #endif -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE - emissiveColor = sRGBTransferEOTF( emissiveColor ); - #endif - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferEOTF( in vec4 value ) { - return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); -} -vec4 sRGBTransferOETF( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,envmap_fragment:`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - uniform mat3 envMapRotation; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,envmap_vertex:`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,fog_vertex:`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,fog_pars_vertex:`#ifdef USE_FOG - varying float vFogDepth; -#endif`,fog_fragment:`#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,fog_pars_fragment:`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,lights_lambert_fragment:`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,lights_toon_fragment:`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_DISPERSION - material.dispersion = dispersion; -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - if( material.anisotropy == 0.0 ) { - anisotropyV = vec2( 1.0, 0.0 ); - } else { - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - } - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - float dispersion; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecularDirect = vec3( 0.0 ); -vec3 clearcoatSpecularIndirect = vec3( 0.0 ); -vec3 sheenSpecularDirect = vec3( 0.0 ); -vec3 sheenSpecularIndirect = vec3(0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,lights_fragment_begin:` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal = vec3( 0.0 ); -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF - varying float vFragDepth; - varying float vIsPerspective; -#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,map_fragment:`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,map_pars_fragment:`#ifdef USE_MAP - uniform sampler2D map; -#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH - float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; - } -#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS - #ifndef USE_INSTANCING_MORPH - uniform float morphTargetBaseInfluence; - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - #endif - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } -#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,normal_vertex:`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,opaque_fragment:`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; -const float Inv255 = 1. / 255.; -const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); -const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); -const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); -const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); -vec4 packDepthToRGBA( const in float v ) { - if( v <= 0.0 ) - return vec4( 0., 0., 0., 0. ); - if( v >= 1.0 ) - return vec4( 1., 1., 1., 1. ); - float vuf; - float af = modf( v * PackFactors.a, vuf ); - float bf = modf( vuf * ShiftRight8, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); -} -vec3 packDepthToRGB( const in float v ) { - if( v <= 0.0 ) - return vec3( 0., 0., 0. ); - if( v >= 1.0 ) - return vec3( 1., 1., 1. ); - float vuf; - float bf = modf( v * PackFactors.b, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec3( vuf * Inv255, gf * PackUpscale, bf ); -} -vec2 packDepthToRG( const in float v ) { - if( v <= 0.0 ) - return vec2( 0., 0. ); - if( v >= 1.0 ) - return vec2( 1., 1. ); - float vuf; - float gf = modf( v * 256., vuf ); - return vec2( vuf * Inv255, gf ); -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors4 ); -} -float unpackRGBToDepth( const in vec3 v ) { - return dot( v, UnpackFactors3 ); -} -float unpackRGToDepth( const in vec2 v ) { - return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; -} -vec4 pack2HalfToRGBA( const in vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( const in vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_BATCHING - mvPosition = batchingMatrix * mvPosition; -#endif -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,dithering_pars_fragment:`#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - float shadow = 1.0; - vec3 lightToPosition = shadowCoord.xyz; - - float lightToPositionLength = length( lightToPosition ); - if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { - float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - shadow = ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } -#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,shadowmask_pars_fragment:`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,skinbase_vertex:`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - mat4 getBoneMatrix( const in float i ) { - int size = textureSize( boneTexture, 0 ).x; - int j = int( i ) * 4; - int x = j % size; - int y = j / size; - vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); - vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); - vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); - vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); - return mat4( v1, v2, v3, v4 ); - } -#endif`,skinning_vertex:`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,skinnormal_vertex:`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,specularmap_fragment:`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,tonemapping_pars_fragment:`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 CineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( - vec3( 1.6605, - 0.1246, - 0.0182 ), - vec3( - 0.5876, 1.1329, - 0.1006 ), - vec3( - 0.0728, - 0.0083, 1.1187 ) -); -const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( - vec3( 0.6274, 0.0691, 0.0164 ), - vec3( 0.3293, 0.9195, 0.0880 ), - vec3( 0.0433, 0.0113, 0.8956 ) -); -vec3 agxDefaultContrastApprox( vec3 x ) { - vec3 x2 = x * x; - vec3 x4 = x2 * x2; - return + 15.5 * x4 * x2 - - 40.14 * x4 * x - + 31.96 * x4 - - 6.868 * x2 * x - + 0.4298 * x2 - + 0.1191 * x - - 0.00232; -} -vec3 AgXToneMapping( vec3 color ) { - const mat3 AgXInsetMatrix = mat3( - vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), - vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), - vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) - ); - const mat3 AgXOutsetMatrix = mat3( - vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), - vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), - vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) - ); - const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; - color *= toneMappingExposure; - color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; - color = AgXInsetMatrix * color; - color = max( color, 1e-10 ); color = log2( color ); - color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); - color = clamp( color, 0.0, 1.0 ); - color = agxDefaultContrastApprox( color ); - color = AgXOutsetMatrix * color; - color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); - color = LINEAR_REC2020_TO_LINEAR_SRGB * color; - color = clamp( color, 0.0, 1.0 ); - return color; -} -vec3 NeutralToneMapping( vec3 color ) { - const float StartCompression = 0.8 - 0.04; - const float Desaturation = 0.15; - color *= toneMappingExposure; - float x = min( color.r, min( color.g, color.b ) ); - float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; - color -= offset; - float peak = max( color.r, max( color.g, color.b ) ); - if ( peak < StartCompression ) return color; - float d = 1. - StartCompression; - float newPeak = 1. - d * d / ( peak + d - StartCompression ); - color *= newPeak / peak; - float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); - return mix( color, vec3( newPeak ), g ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec4 transmittedLight; - vec3 transmittance; - #ifdef USE_DISPERSION - float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; - vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); - for ( int i = 0; i < 3; i ++ ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); - transmittedLight[ i ] = transmissionSample[ i ]; - transmittedLight.a += transmissionSample.a; - transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; - } - transmittedLight.a /= 3.0; - #else - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - #endif - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_BATCHING - worldPosition = batchingMatrix * worldPosition; - #endif - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`,background_vert:`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,background_frag:`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,backgroundCube_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -uniform mat3 backgroundRotation; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,cube_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,cube_frag:`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,depth_vert:`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,depth_frag:`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #elif DEPTH_PACKING == 3202 - gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); - #elif DEPTH_PACKING == 3203 - gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); - #endif -}`,distanceRGBA_vert:`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,distanceRGBA_frag:`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,equirect_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,equirect_frag:`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,linedashed_vert:`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,linedashed_frag:`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,meshbasic_vert:`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,meshbasic_frag:`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,meshlambert_vert:`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,meshlambert_frag:`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,meshmatcap_vert:`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,meshmatcap_frag:`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,meshnormal_vert:`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,meshnormal_frag:`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,meshphong_vert:`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,meshphong_frag:`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,meshphysical_vert:`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,meshphysical_frag:`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_DISPERSION - uniform float dispersion; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,meshtoon_vert:`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,meshtoon_frag:`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,points_vert:`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,points_frag:`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,shadow_vert:`#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,shadow_frag:`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,sprite_vert:`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix[ 3 ]; - vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,sprite_frag:`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`},X={common:{diffuse:{value:new Y(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new sx},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new sx}},envmap:{envMap:{value:null},envMapRotation:{value:new sx},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new sx}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new sx}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new sx},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new sx},normalScale:{value:new rx(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new sx},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new sx}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new sx}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new sx}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Y(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Y(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0},uvTransform:{value:new sx}},sprite:{diffuse:{value:new Y(16777215)},opacity:{value:1},center:{value:new rx(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new sx},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0}}},bE={basic:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.fog]),vertexShader:yE.meshbasic_vert,fragmentShader:yE.meshbasic_frag},lambert:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.fog,X.lights,{emissive:{value:new Y(0)}}]),vertexShader:yE.meshlambert_vert,fragmentShader:yE.meshlambert_frag},phong:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.fog,X.lights,{emissive:{value:new Y(0)},specular:{value:new Y(1118481)},shininess:{value:30}}]),vertexShader:yE.meshphong_vert,fragmentShader:yE.meshphong_frag},standard:{uniforms:FC([X.common,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.roughnessmap,X.metalnessmap,X.fog,X.lights,{emissive:{value:new Y(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yE.meshphysical_vert,fragmentShader:yE.meshphysical_frag},toon:{uniforms:FC([X.common,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.gradientmap,X.fog,X.lights,{emissive:{value:new Y(0)}}]),vertexShader:yE.meshtoon_vert,fragmentShader:yE.meshtoon_frag},matcap:{uniforms:FC([X.common,X.bumpmap,X.normalmap,X.displacementmap,X.fog,{matcap:{value:null}}]),vertexShader:yE.meshmatcap_vert,fragmentShader:yE.meshmatcap_frag},points:{uniforms:FC([X.points,X.fog]),vertexShader:yE.points_vert,fragmentShader:yE.points_frag},dashed:{uniforms:FC([X.common,X.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yE.linedashed_vert,fragmentShader:yE.linedashed_frag},depth:{uniforms:FC([X.common,X.displacementmap]),vertexShader:yE.depth_vert,fragmentShader:yE.depth_frag},normal:{uniforms:FC([X.common,X.bumpmap,X.normalmap,X.displacementmap,{opacity:{value:1}}]),vertexShader:yE.meshnormal_vert,fragmentShader:yE.meshnormal_frag},sprite:{uniforms:FC([X.sprite,X.fog]),vertexShader:yE.sprite_vert,fragmentShader:yE.sprite_frag},background:{uniforms:{uvTransform:{value:new sx},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yE.background_vert,fragmentShader:yE.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new sx}},vertexShader:yE.backgroundCube_vert,fragmentShader:yE.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yE.cube_vert,fragmentShader:yE.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yE.equirect_vert,fragmentShader:yE.equirect_frag},distanceRGBA:{uniforms:FC([X.common,X.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yE.distanceRGBA_vert,fragmentShader:yE.distanceRGBA_frag},shadow:{uniforms:FC([X.lights,X.fog,{color:{value:new Y(0)},opacity:{value:1}}]),vertexShader:yE.shadow_vert,fragmentShader:yE.shadow_frag}};bE.physical={uniforms:FC([bE.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new sx},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new sx},clearcoatNormalScale:{value:new rx(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new sx},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new sx},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new sx},sheen:{value:0},sheenColor:{value:new Y(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new sx},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new sx},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new sx},transmissionSamplerSize:{value:new rx},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new sx},attenuationDistance:{value:0},attenuationColor:{value:new Y(0)},specularColor:{value:new Y(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new sx},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new sx},anisotropyVector:{value:new rx},anisotropyMap:{value:null},anisotropyMapTransform:{value:new sx}}]),vertexShader:yE.meshphysical_vert,fragmentShader:yE.meshphysical_frag};var xE={r:0,b:0,g:0},SE=new vS,lte=new J;function ute(e,t,n,r,i,a,o){let s=new Y(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new AC(new NC(1,1,1),new VC({name:`BackgroundCubeMaterial`,uniforms:PC(bE.backgroundCube.uniforms),vertexShader:bE.backgroundCube.vertexShader,fragmentShader:bE.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),SE.copy(n.backgroundRotation),SE.x*=-1,SE.y*=-1,SE.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(SE.y*=-1,SE.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(lte.makeRotationFromEuler(SE)),u.material.toneMapped=bx.getTransfer(r.colorSpace)!==Tb,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new AC(new Qw(2,2),new VC({name:`BackgroundMaterial`,uniforms:PC(bE.background.uniforms),vertexShader:bE.background.vertexShader,fragmentShader:bE.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=bx.getTransfer(r.colorSpace)!==Tb,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(xE,LC(e)),r.buffers.color.setClear(xE.r,xE.g,xE.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function dte(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function TE(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Dw,s=new sx,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new ZC(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var DE=4,OE=[.125,.215,.35,.446,.526,.582],kE=20,AE=new UT,jE=new Y,ME=null,NE=0,PE=0,FE=!1,IE=(1+Math.sqrt(5))/2,LE=1/IE,RE=[new q(-IE,LE,0),new q(IE,LE,0),new q(-LE,0,IE),new q(LE,0,IE),new q(0,IE,-LE),new q(0,IE,LE),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)],zE=new q,BE=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=zE}=i;ME=this._renderer.getRenderTarget(),NE=this._renderer.getActiveCubeFace(),PE=this._renderer.getActiveMipmapLevel(),FE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=KE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=GE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=KE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=GE());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new AC(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;UE(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,AE)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;tkE&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${kE}`);let h=[],g=0;for(let e=0;e_-DE?r-_+DE:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,AE)}};function VE(e){let t=[],n=[],r=[],i=e,a=e-DE+1+OE.length;for(let o=0;oe-DE?s=OE[o-e+DE-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new vC;h.setAttribute(`position`,new sC(f,3)),h.setAttribute(`uv`,new sC(p,2)),h.setAttribute(`faceIndex`,new sC(m,1)),t.push(h),i>DE&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function HE(e,t,n){let r=new Nx(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function UE(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function WE(e,t,n){let r=new Float32Array(kE),i=new q(0,1,0);return new VC({name:`SphericalGaussianBlur`,defines:{n:kE,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:qE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function GE(){return new VC({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:qE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function KE(){return new VC({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function qE(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function JE(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new BE(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new BE(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function YE(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&px(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function XE(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new Px(h,p,m,u);g.type=yy,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=oD[i];if(a===void 0&&(a=new Float32Array(i),oD[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function fD(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` -`)}var fO=new sx;function pO(e){bx._getMatrix(fO,bx.workingColorSpace,e);let t=`mat3( ${fO.elements.map(e=>e.toFixed(4))} )`;switch(bx.getTransfer(e)){case wb:return[t,`LinearTransferOETF`];case Tb:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function mO(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` - -`+i+` - -`+dO(e.getShaderSource(t),r)}else return i}function hO(e,t){let n=pO(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` -`)}function gO(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var _O=new q;function vO(){return bx.getLuminanceCoefficients(_O),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${_O.x.toFixed(4)}, ${_O.y.toFixed(4)}, ${_O.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` -`)}function yO(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(SO).join(` -`)}function bO(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` -`)}function xO(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function EO(e){return e.replace(TO,OO)}var DO=new Map;function OO(e,t){let n=yE[t];if(n===void 0){let e=DO.get(t);if(e!==void 0)n=yE[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return EO(n)}var kO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function AO(e){return e.replace(kO,jO)}function jO(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` -`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(SO).join(` -`),_.length>0&&(_+=` -`)):(g=[MO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` -`].filter(SO).join(` -`),_=[MO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:yE.tonemapping_pars_fragment,n.toneMapping===0?``:gO(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,yE.colorspace_pars_fragment,hO(`linearToOutputTexel`,n.outputColorSpace),vO(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` -`].filter(SO).join(` -`)),o=EO(o),o=CO(o,n),o=wO(o,n),s=EO(s),s=CO(s,n),s=wO(s,n),o=AO(o),s=AO(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es -`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` -`)+` -`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` -`)+` -`+_);let y=v+g+o,b=v+_+s,x=cO(i,i.VERTEX_SHADER,y),S=cO(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=mO(i,x,`vertex`),r=mO(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` - -Material Name: `+t.name+` -Material Type: `+t.type+` - -Program Info Log: `+n+` -`+e+` -`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new sO(i,h),T=xO(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,lO)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=uO++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var zO=0,BO=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new VO(e),t.set(e,n)),n}},VO=class{constructor(e){this.id=zO++,this.code=e,this.usedTimes=0}};function HO(e,t,n,r,i,a,o){let s=new yS,c=new BO,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=bE[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,I=!!a.matcap,ee=!!x,te=!!a.aoMap,ne=!!a.lightMap,re=!!a.bumpMap,ie=!!a.normalMap,ae=!!a.displacementMap,oe=!!a.emissiveMap,se=!!a.metalnessMap,ce=!!a.roughnessMap,le=a.anisotropy>0,ue=a.clearcoat>0,de=a.dispersion>0,L=a.iridescence>0,fe=a.sheen>0,pe=a.transmission>0,me=le&&!!a.anisotropyMap,R=ue&&!!a.clearcoatMap,he=ue&&!!a.clearcoatNormalMap,z=ue&&!!a.clearcoatRoughnessMap,ge=L&&!!a.iridescenceMap,_e=L&&!!a.iridescenceThicknessMap,ve=fe&&!!a.sheenColorMap,ye=fe&&!!a.sheenRoughnessMap,be=!!a.specularMap,xe=!!a.specularColorMap,Se=!!a.specularIntensityMap,Ce=pe&&!!a.transmissionMap,we=pe&&!!a.thicknessMap,Te=!!a.gradientMap,Ee=!!a.alphaMap,De=a.alphaTest>0,Oe=!!a.alphaHash,ke=!!a.extensions,Ae=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ae=e.toneMapping);let je={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Cb,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:ie,displacementMap:f&&ae,emissiveMap:oe,normalMapObjectSpace:ie&&a.normalMapType===1,normalMapTangentSpace:ie&&a.normalMapType===0,metalnessMap:se,roughnessMap:ce,anisotropy:le,anisotropyMap:me,clearcoat:ue,clearcoatMap:R,clearcoatNormalMap:he,clearcoatRoughnessMap:z,dispersion:de,iridescence:L,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:fe,sheenColorMap:ve,sheenRoughnessMap:ye,specularMap:be,specularColorMap:xe,specularIntensityMap:Se,transmission:pe,transmissionMap:Ce,thicknessMap:we,gradientMap:Te,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:Ee,alphaTest:De,alphaHash:Oe,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:te&&h(a.aoMap.channel),lightMapUv:ne&&h(a.lightMap.channel),bumpMapUv:re&&h(a.bumpMap.channel),normalMapUv:ie&&h(a.normalMap.channel),displacementMapUv:ae&&h(a.displacementMap.channel),emissiveMapUv:oe&&h(a.emissiveMap.channel),metalnessMapUv:se&&h(a.metalnessMap.channel),roughnessMapUv:ce&&h(a.roughnessMap.channel),anisotropyMapUv:me&&h(a.anisotropyMap.channel),clearcoatMapUv:R&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:he&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:z&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ve&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:ye&&h(a.sheenRoughnessMap.channel),specularMapUv:be&&h(a.specularMap.channel),specularColorMapUv:xe&&h(a.specularColorMap.channel),specularIntensityMapUv:Se&&h(a.specularIntensityMap.channel),transmissionMapUv:Ce&&h(a.transmissionMap.channel),thicknessMapUv:we&&h(a.thicknessMap.channel),alphaMapUv:Ee&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ie||le),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||Ee),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ae,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&bx.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:oe&&a.emissiveMap.isVideoTexture===!0&&bx.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ke&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(ke&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return je.vertexUv1s=l.has(1),je.vertexUv2s=l.has(2),je.vertexUv3s=l.has(3),l.clear(),je}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=bE[t];n=RC.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||WO),r.length>1&&r.sort(t||GO),i.length>1&&i.sort(t||GO)}function u(){for(let n=t,r=e.length;n=r.length?(i=new KO,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function JO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new q,color:new Y};break;case`SpotLight`:n={position:new q,direction:new q,color:new Y,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new q,color:new Y,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new q,skyColor:new Y,groundColor:new Y};break;case`RectAreaLight`:n={color:new Y,position:new q,halfWidth:new q,halfHeight:new q};break}return e[t.id]=n,n}}}function YO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var XO=0;function ZO(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function QO(e){let t=new JO,n=YO(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new q);let i=new q,a=new J,o=new J;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(ZO);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=X.LTC_FLOAT_1,r.rectAreaLTC2=X.LTC_FLOAT_2):(r.rectAreaLTC1=X.LTC_HALF_1,r.rectAreaLTC2=X.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=XO++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new $O(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var tk=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,nk=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function rk(e,t,n){let r=new Aw,i=new rx,a=new rx,o=new jx,s=new ate({depthPacking:xb}),c=new ote,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new VC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new rx},radius:{value:4}},vertexShader:tk,fragmentShader:nk}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new vC;m.setAttribute(`position`,new sC(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new AC(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:sy,magFilter:sy};d.map!==null&&d.map.dispose(),d.map=new Nx(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,I={},ee=e.getParameter(e.SCISSOR_BOX),te=e.getParameter(e.VIEWPORT),ne=new jx().fromArray(ee),re=new jx().fromArray(te);function ie(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new rx,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):ux(`canvas`)}function h(e,t,n){let r=1,i=ve(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?wb:bx.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&ge(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{ae(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[iy]:e.REPEAT,[ay]:e.CLAMP_TO_EDGE,[oy]:e.MIRRORED_REPEAT},I={[sy]:e.NEAREST,[cy]:e.NEAREST_MIPMAP_NEAREST,[ly]:e.NEAREST_MIPMAP_LINEAR,[uy]:e.LINEAR,[dy]:e.LINEAR_MIPMAP_NEAREST,[fy]:e.LINEAR_MIPMAP_LINEAR},ee={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function te(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,I[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,I[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ee[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ne(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function re(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ie(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=hE(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=hE(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ve(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ve(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,he(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function ce(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=he(n);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?le(i.__webglFramebuffer[0],t):le(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),ce(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),ce(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function de(t,n,i){let a=r.get(t);n!==void 0&&se(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&ue(t)}function L(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ge(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function _e(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(bx.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ve(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=de,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=R,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=se,this.useMultisampledRTT=z}function sk(e,t){function n(n,r=``){let i,a=bx.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var ck=` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`,lk=` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`,uk=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new Ax,i=e.properties.get(r);i.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new VC({vertexShader:ck,fragmentShader:lk,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new AC(new Qw(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},dk=class extends kb{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new uk,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new rx,x=null,S=new KC;S.viewport=new jx;let C=new KC;C.viewport=new jx;let w=[S,C],T=new XT,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new q,M=new q;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,fk.copy(o),fk.x*=-1,fk.y*=-1,fk.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(fk.y*=-1,fk.z*=-1),e.envMapRotation.value.setFromMatrix4(pk.makeRotationFromEuler(fk)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function fte(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var pte=class{constructor(e={}){let{canvas:t=dx(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=Sb;let x=0,S=0,C=null,w=-1,T=null,E=new jx,D=new jx,O=null,k=new Y(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,I=new jx(0,0,j,M),ee=new jx(0,0,j,M),te=!1,ne=new Aw,re=!1,ie=!1,ae=new J,oe=new J,se=new q,ce=new jx,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ue=!1;function de(){return C===null?N:1}let L=n;function fe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Le,!1),t.addEventListener(`webglcontextrestored`,Re,!1),t.addEventListener(`webglcontextcreationerror`,ze,!1),L===null){let t=`webgl2`;if(L=fe(t,e),L===null)throw fe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let pe,me,R,he,z,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe;function Fe(){pe=new YE(L),pe.init(),Me=new sk(L,pe),me=new wE(L,pe,e,Me),R=new ak(L,pe),me.reverseDepthBuffer&&d&&R.buffers.depth.setReversed(!0),he=new QE(L),z=new UO,ge=new ok(L,pe,R,z,me,Me,he),_e=new EE(y),ve=new JE(y),ye=new vE(L),Ne=new dte(L,ye),be=new XE(L,ye,he,Ne),xe=new eD(L,be,ye,he),ke=new $E(L,me,ge),Ee=new TE(z),Se=new HO(y,_e,ve,pe,me,Ne,Ee),Ce=new mk(y,z),we=new qO,Te=new ek(pe),Oe=new ute(y,_e,ve,R,xe,f,s),De=new rk(y,xe,me),Pe=new fte(L,he,me,R),Ae=new CE(L,pe,he),je=new ZE(L,pe,he),he.programs=Se.programs,y.capabilities=me,y.extensions=pe,y.properties=z,y.renderLists=we,y.shadowMap=De,y.state=R,y.info=he}Fe();let Ie=new dk(y,L);this.xr=Ie,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Ie.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),R.viewport(E.copy(I).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(ee)},this.setScissor=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),R.scissor(D.copy(ee).multiplyScalar(N).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(e){R.setScissorTest(te=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=Oe.getClearColor(),r=Oe.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,L.clearBufferuiv(L.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,L.clearBufferiv(L.COLOR,0,m))}else r|=L.COLOR_BUFFER_BIT}t&&(r|=L.DEPTH_BUFFER_BIT),n&&(r|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Le,!1),t.removeEventListener(`webglcontextrestored`,Re,!1),t.removeEventListener(`webglcontextcreationerror`,ze,!1),Oe.dispose(),we.dispose(),Te.dispose(),z.dispose(),_e.dispose(),ve.dispose(),xe.dispose(),Ne.dispose(),Pe.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener(`sessionstart`,Ke),Ie.removeEventListener(`sessionend`,qe),Je.stop()};function Le(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function Re(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=he.autoReset,t=De.enabled,n=De.autoUpdate,r=De.needsUpdate,i=De.type;Fe(),he.autoReset=e,De.enabled=t,De.autoUpdate=n,De.needsUpdate=r,De.type=i}function ze(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Be(e){let t=e.target;t.removeEventListener(`dispose`,Be),Ve(t)}function Ve(e){He(e),z.remove(e)}function He(e){let t=z.get(e).programs;t!==void 0&&(t.forEach(function(e){Se.releaseProgram(e)}),e.isShaderMaterial&&Se.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=le);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=rt(e,t,n,r,i);R.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=be.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ne.setup(i,r,s,n,c);let h,g=Ae;if(c!==null&&(h=ye.get(c),g=je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(R.setLineWidth(r.wireframeLinewidth*de()),g.setMode(L.LINES)):g.setMode(L.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),R.setLineWidth(e*de()),i.isLineSegments?g.setMode(L.LINES):i.isLineLoop?g.setMode(L.LINE_LOOP):g.setMode(L.LINE_STRIP)}else i.isPoints?g.setMode(L.POINTS):i.isSprite&&g.setMode(L.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)px(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(pe.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?ye.get(c).bytesPerElement:1,o=z.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){z.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}pe.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let We=null;function Ge(e){We&&We(e)}function Ke(){Je.stop()}function qe(){Je.start()}let Je=new _E;Je.setAnimationLoop(Ge),typeof self<`u`&&Je.setContext(self),this.setAnimationLoop=function(e){We=e,Ie.setAnimationLoop(e),e===null?Je.stop():Je.start()},Ie.addEventListener(`sessionstart`,Ke),Ie.addEventListener(`sessionend`,qe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(t),t=Ie.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Te.get(e,v.length),g.init(t),v.push(g),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ne.setFromProjectionMatrix(oe),ie=this.localClippingEnabled,re=Ee.init(this.clippingPlanes,ie),h=we.get(e,_.length),h.init(),_.push(h),Ie.enabled===!0&&Ie.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Ye(e,t,-1/0,y.sortObjects)}Ye(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),ue=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ue&&Oe.addToRenderList(h,e),this.info.render.frame++,re===!0&&Ee.beginShadows();let n=g.state.shadowsArray;De.render(n,e,t),re===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Ze(r,i,e,t),ue&&Oe.render(e),Xe(h,e,t);C!==null&&S===0&&(ge.updateMultisampleRenderTarget(C),ge.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Ne.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],re===!0&&Ee.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Ye(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ne.intersectsSprite(e)){r&&ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);let t=xe.update(e),i=e.material;i.visible&&h.push(e,t,i,n,ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ne.intersectsObject(e))){let t=xe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ce.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ce.copy(e.boundingSphere.center)),ce.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&Qe(i,t,n),a.length>0&&Qe(a,t,n),o.length>0&&Qe(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function Ze(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new Nx(1,1,{generateMipmaps:!0,type:pe.has(`EXT_color_buffer_half_float`)||pe.has(`EXT_color_buffer_float`)?by:py,minFilter:fy,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bx.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),ue&&Oe.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),re===!0&&Ee.setGlobalState(y.clippingPlanes,r),Qe(e,n,r),ge.updateMultisampleRenderTarget(a),ge.updateRenderTargetMipmap(a),pe.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=z.get(r),b=g.state.lights;if(re===!0&&(ie===!0||e!==T)){let t=e===T&&r.id===w;Ee.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ee.numPlanes||v.numIntersection!==Ee.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=et(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(R.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){R.buffers.depth.getReversed()?(ae.copy(e.projectionMatrix),hx(ae),gx(ae),k.setValue(L,`projectionMatrix`,ae)):k.setValue(L,`projectionMatrix`,e.projectionMatrix),k.setValue(L,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(L,se.setFromMatrixPosition(e.matrixWorld)),me.logarithmicDepthBuffer&&k.setValue(L,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(L,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(L,i,`bindMatrix`),k.setOptional(L,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(L,`boneTexture`,e.boneTexture,ge))}i.isBatchedMesh&&(k.setOptional(L,i,`batchingTexture`),k.setValue(L,`batchingTexture`,i._matricesTexture,ge),k.setOptional(L,i,`batchingIdTexture`),k.setValue(L,`batchingIdTexture`,i._indirectTexture,ge),k.setOptional(L,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(L,`batchingColorTexture`,i._colorsTexture,ge));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&ke.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(L,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(L,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&it(A,O),a&&r.fog===!0&&Ce.refreshFogUniforms(A,a),Ce.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),sO.upload(L,tt(v),A,ge)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(sO.upload(L,tt(v),A,ge),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(L,`center`,i.center),k.setValue(L,`modelViewMatrix`,i.modelViewMatrix),k.setValue(L,`normalMatrix`,i.normalMatrix),k.setValue(L,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&ge.useMultisampledRTT(e)===!1?z.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(I).multiplyScalar(N).floor(),D.copy(ee).multiplyScalar(N).floor(),O=te;if(n!==0&&(i=ot),R.bindFramebuffer(L.FRAMEBUFFER,i)&&r&&R.drawBuffers(e,i),R.viewport(E),R.scissor(D),R.setScissorTest(O),a){let r=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=z.get(e.texture),i=t;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){R.bindFramebuffer(L.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!me.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!me.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(c),Me.convert(l),a))}finally{let e=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(L.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.bufferData(L.PIXEL_PACK_BUFFER,a.byteLength,L.STREAM_READ),e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(l),Me.convert(u),0);let f=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,f);let p=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await mx(L,p,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,a),L.deleteBuffer(d),L.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;ge.setTexture2D(e,0),L.copyTexSubImage2D(L.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let st=L.createFramebuffer(),ct=L.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(px(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Me.convert(t.format),_=Me.convert(t.type),v;t.isData3DTexture?(ge.setTexture3D(t,0),v=L.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ge.setTexture2DArray(t,0),v=L.TEXTURE_2D_ARRAY):(ge.setTexture2D(t,0),v=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,t.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,t.unpackAlignment);let y=L.getParameter(L.UNPACK_ROW_LENGTH),b=L.getParameter(L.UNPACK_IMAGE_HEIGHT),x=L.getParameter(L.UNPACK_SKIP_PIXELS),S=L.getParameter(L.UNPACK_SKIP_ROWS),C=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,h.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,h.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,l),L.pixelStorei(L.UNPACK_SKIP_ROWS,u),L.pixelStorei(L.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=z.get(e),r=z.get(t),h=z.get(n.__renderTarget),g=z.get(r.__renderTarget);R.bindFramebuffer(L.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(L.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=xk),r<-Math.PI?r+=xk:r>Math.PI&&(r-=xk),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(bk.setFromSpherical(this._spherical),bk.applyQuaternion(this._quatInverse),t.copy(this.target).add(bk),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=bk.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new q(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new q(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=bk.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(vk.origin.copy(this.object.position),vk.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(vk.direction))Ck||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ck||this._lastTargetPosition.distanceToSquared(this.target)>Ck?(this.dispatchEvent(hk),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?xk/60/60*this.autoRotateSpeed:xk/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){bk.setFromMatrixColumn(t,0),bk.multiplyScalar(-e),this._panOffset.add(bk)}_panUp(e,t){this.screenSpacePanning===!0?bk.setFromMatrixColumn(t,1):(bk.setFromMatrixColumn(t,0),bk.crossVectors(this.object.up,bk)),bk.multiplyScalar(e),this._panOffset.add(bk)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;bk.copy(r).sub(this.target);let i=bk.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(xk*this._rotateDelta.x/t.clientHeight),this._rotateUp(xk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(xk*this._rotateDelta.x/t.clientHeight),this._rotateUp(xk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,Sb),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new sC(p,3)),f.setAttribute(`normal`,new sC(m,3)),o&&(f.setAttribute(`color`,new sC(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new vC,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new q,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new uC(c,3)),t.setAttribute(`normal`,new uC(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:fy}}},Nk=class extends CT{load(e,t,n,r){let i=this,a=i.path===``?qT.extractUrlBase(e):i.path,o=new ET(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new gT(r+`.position`,i,a)),o.length>0&&t.push(new mT(r+`.quaternion`,i,o)),s.length>0&&t.push(new gT(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=Ft;break;default:t=Pt}return t}function Se(e){let t=ye(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new tT;break;case`lambert`:r=new ite;break;default:r=new rC;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=oe(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=oe(e.id);if(i!==null){let t=xe(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?iy:ay,r.wrapT=e.wrapV?iy:ay,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=iy,r.wrapT=iy;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,Sb));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,Sb));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,Sb));break}}bx.colorSpaceToWorking(r.color,Sb),r.specular&&bx.colorSpaceToWorking(r.specular,Sb),r.emissive&&bx.colorSpaceToWorking(r.emissive,Sb);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new rx(1,1);break}}}return r}function Ce(e){return m(B.materials[e],Se)}function we(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function ze(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new uC(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new uC(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new uC(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new uC(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new uC(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new uC(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new uC(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function Ue(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Ze(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||te===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),Pk.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(Pk,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],Lk.compose(this.origPosition,this.origQuaternion,zk),Rk.setFromEuler(Fk.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),Bk.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Ik.compose(Bk,Rk,zk),Lk.premultiply(Ik),this.position.setFromMatrixPosition(Lk),this.rotation.setFromRotationMatrix(Lk),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],Lk.compose(this.origPosition,this.origQuaternion,zk),Rk.setFromAxisAngle(this.axis,this.jointValue[2]),Bk.set(this.jointValue[0],this.jointValue[1],0),Ik.compose(Bk,Rk,zk),Lk.premultiply(Ik),this.position.setFromMatrixPosition(Lk),this.rotation.setFromRotationMatrix(Lk),this.matrixWorldNeedsUpdate=!0,!0)}return t}},Kk=class extends Gk{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},qk=class extends Wk{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},Jk=new ix,Yk=new vS;function Xk(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Zk(e,t,n=!1){n||e.rotation.set(0,0,0),Yk.set(t[0],t[1],t[2],`ZYX`),Jk.setFromEuler(Yk),Jk.multiply(e.quaternion),e.quaternion.copy(Jk)}var Qk=class{constructor(e){this.manager=e||ST,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=qT.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new qk;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof Kk&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new Kk,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new Gk,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=Xk(e.getAttribute(`xyz`)),l=Xk(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),Zk(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new q(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new Wk);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=Xk(e.getAttribute(`xyz`)),r.inertial.origin.rpy=Xk(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new tT;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new kT(o),r=u(t);n.map=e.load(r),n.map.colorSpace=Sb}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new tT;let c=n?new Hk:new Uk;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=Xk(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof AC&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new AC;t.geometry=new NC(1,1,1),t.material=a;let n=Xk(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new AC;t.geometry=new nte(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new AC;t.geometry=new tte(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=Xk(e.getAttribute(`xyz`)),n=Xk(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),Zk(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new jk(t).load(e,e=>{n(new AC(e,new tT))},null,e=>n(null,e)):/\.dae$/i.test(e)?new Nk(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},$k=new rx,eA=()=>{},tA=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new tw,t=new jT(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new GT(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new pte({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=Sb;let i=new KC(75,1,.1,1e3);i.position.z=-10;let a=new FS;e.add(a);let o=new AC(new Qw(40,40),new rte({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new hte(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new tT({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` - ${this.tagName} { display: block; } - ${this.tagName} canvas { - width: 100%; - height: 100%; - } - `,document.head.appendChild(e),this.constructor._styletag=e}this.childElementCount===0&&this.appendChild(this.renderer.domElement),this.updateSize(),requestAnimationFrame(()=>this.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize($k);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new Ix;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new q);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new eS).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof rC&&(e=new tT),e.map&&(e.map.colorSpace=Sb),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new xT;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new Qk(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=eA,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function nA(e){return e.isURDFJoint&&e.jointType!==`fixed`}function rA(e){let t=e;for(;t;){if(nA(t))return t;t=t.parent}return t}var iA=new q,aA=new q,oA=new q,sA=new q,cA=new q,lA=new q,uA=new q,dA=new Dw,fA=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new uE,this.initialGrabPoint=new q,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=rA(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return sA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),oA.set(0,0,0).applyMatrix4(e.matrixWorld),dA.setFromNormalAndCoplanarPoint(sA,oA),dA.projectPoint(t,lA),dA.projectPoint(n,uA),lA.sub(oA),uA.sub(oA),sA.crossVectors(lA,uA),Math.sign(sA.dot(dA.normal))*uA.angleTo(lA)}getPrismaticDelta(e,t,n){return sA.subVectors(n,t),dA.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),sA.dot(dA.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,iA),e.at(n,aA);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,iA,aA):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,iA,aA)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},pA=class extends fA{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new uE,i=new rx;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return sA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),oA.set(0,0,0).applyMatrix4(e.matrixWorld),dA.setFromNormalAndCoplanarPoint(sA,oA),sA.copy(r.position).sub(i).normalize(),Math.abs(sA.dot(dA.normal))>.3?super.getRevoluteDelta(e,t,n):(sA.set(0,1,0).transformDirection(r.matrixWorld),dA.projectPoint(t,lA),dA.projectPoint(n,uA),sA.set(0,0,-1).transformDirection(r.matrixWorld),sA.cross(dA.normal),cA.subVectors(n,t),sA.dot(cA))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},mA=class extends tA{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new tT({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},hA=1e3,gA=3e4,_A=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=Rs(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(hA),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=hA,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,gA),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},vA=[`light`,`dark`],yA=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?vA.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&vA.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${yA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function bA(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new _j(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function SA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var CA={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},wA=class{constructor(e){this.parser=e,this.name=CA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},RA=class{constructor(e){this.parser=e,this.name=CA.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},zA=class{constructor(e){this.parser=e,this.name=CA.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},BA=class{constructor(e){this.name=CA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},VA=class{constructor(e){this.name=CA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==QA.TRIANGLES&&e.mode!==QA.TRIANGLE_STRIP&&e.mode!==QA.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new J,n=new q,a=new ix,s=new q(1,1,1),c=new Zee(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var gj=new J,_j=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new SA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new kT(this.options.manager):this.textureLoader=new YT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ET(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return cj(i,a,r),lj(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=ej[n.magFilter]||1006,t.minFilter=ej[n.minFilter]||1008,t.wrapS=tj[n.wrapS]||1e3,t.wrapT=tj[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new Ax(e);t.needsUpdate=!0,n(t)}),t.load(qT.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),lj(e,a),e.userData.mimeType=a.mimeType||hj(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[CA.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[CA.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[CA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Ww,nC.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new jw,nC.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return $w}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[CA.KHR_MATERIALS_UNLIT]){let e=r[CA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Y(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Cb),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Sb)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||oj.OPAQUE;if(l===oj.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===oj.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==rC&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new rx(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==rC&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==rC){let e=i.emissiveFactor;o.emissive=new Y().setRGB(e[0],e[1],e[2],Cb)}return i.emissiveTexture!==void 0&&a!==rC&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Sb)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),lj(n,i),t.associations.set(n,{materials:e}),i.extensions&&cj(r,n,i),n})}createUniqueName(e){let t=cE.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[CA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return yj(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&dj(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),lj(d,i),u.extensions&&cj(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new QC:t.length===1?t[0]:new FS,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new QC;n.name&&(i.name=r.createUniqueName(n.name)),lj(i,n),n.extensions&&cj(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof nC||e instanceof Ax)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];ij[i.path]===ij.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(ij[i.path]){case ij.weights:c=fT;break;case ij.rotation:c=mT;break;case ij.translation:case ij.scale:c=gT;break;default:switch(n.itemSize){case 1:c=fT;break;default:c=gT;break}break}let l=r.interpolation===void 0?mb:aj[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;Tj.fromArray(r,e),Ej.fromArray(r,t),Dj.fromArray(r,n),kj.subVectors(Dj,Ej),Oj.subVectors(Tj,Ej),kj.cross(Oj),kj.normalize(),i.push(kj.x,kj.y,kj.z),i.push(kj.x,kj.y,kj.z),i.push(kj.x,kj.y,kj.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n=7?(Aj.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),Sb),t.colors.push(Aj.r,Aj.g,Aj.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(wj),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new QC;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new uC(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new uC(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new uC(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new Ww({size:1,sizeAttenuation:!1}),n=new vC;n.setAttribute(`position`,new uC(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new uC(t.colors,3)),e.vertexColors=!0);let r=new Yw(n,e);i.add(r)}return i}},Nj=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new xA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new Mj(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new Nk(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new jk(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new AC(t,new tT))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new AC(new NC(.05,.05,.05),new tT({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}};function Pj(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),Rj(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new KT(14079702,1);n.scene.add(r);let i=new GT(16777215,.8);return i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i),n}function Fj(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{Nj(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function Ij(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function Lj(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),Nn.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function Rj(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,mA);var zj=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=rr(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=_A({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=Pj(e.current,!0);s.current=t,Fj(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=Lj(t,r,m.current,d,i));let p=Ij(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new Ix().setFromObject(e.robot),n=new q;t.getCenter(n);let r=new q;t.getSize(r);let i=Math.max(r.x,r.y,r.z);e.camera.position.copy(n);let a=new q;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,V.jsxs)(`div`,{className:W(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,V.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,V.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,V.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,V.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),Bj=({className:e,iconOnly:t=!1})=>(0,V.jsxs)(`div`,{className:W(`flex items-center gap-2`,e),children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,V.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),Vj=({onGoBack:e,className:t})=>(0,V.jsx)(`div`,{className:W(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,V.jsx)(Ca,{className:`h-5 w-5`})}),(0,V.jsx)(Bj,{iconOnly:!0}),(0,V.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,V.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,V.jsx)(zj,{})})]})}),Hj=()=>{let e=Re(),{toast:t}=_r(),{baseUrl:n,fetchWithHeaders:r}=Rs(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,V.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,V.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,V.jsx)(Vj,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`})})})},Uj=ga(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Wj({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{className:W(Uj({variant:t}),e),...n})}var Gj=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Kj=`Separator`,qj=`horizontal`,Jj=[`horizontal`,`vertical`],Yj=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=qj,...i}=e,a=Xj(r)?r:qj,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(Gj.div,{"data-orientation":a,...o,...i,ref:t})});Yj.displayName=Kj;function Xj(e){return Jj.includes(e)}var Zj=Yj,Qj=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(Zj,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));Qj.displayName=Zj.displayName;var $j=`Switch`,[eM,xte]=Sr($j),[tM,nM]=eM($j),rM=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=br(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=ui({prop:i,defaultProp:a??!1,onChange:l,caller:$j});return(0,V.jsxs)(tM,{scope:n,checked:v,disabled:s,children:[(0,V.jsx)(U.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":cM(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,V.jsx)(sM,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});rM.displayName=$j;var iM=`SwitchThumb`,aM=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=nM(iM,n);return(0,V.jsx)(U.span,{"data-state":cM(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});aM.displayName=iM;var oM=`SwitchBubbleInput`,sM=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=br(o,a),c=Ah(n),l=Lf(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,V.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});sM.displayName=oM;function cM(e){return e?`checked`:`unchecked`}var lM=rM,uM=aM,dM=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(lM,{className:W(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,V.jsx)(uM,{className:W(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));dM.displayName=lM.displayName;var fM=({onClick:e,robotType:t,className:n=``})=>(0,V.jsxs)(G,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` - h-8 px-2 - border-gray-600 hover:border-blue-500 - text-gray-400 hover:text-blue-400 - bg-gray-800 hover:bg-gray-700 - transition-all duration-200 - ${n} - `,title:`Find ${t||`robot`} port automatically`,children:[(0,V.jsx)(eo,{className:`w-3 h-3 mr-1`}),`Find`]}),pM=2e3,mM=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=_r(),{baseUrl:m,fetchWithHeaders:h}=Rs(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},pM);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,V.jsxs)(Ou,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,V.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(qa,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,V.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(Ma,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,V.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(ja,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,V.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,V.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,V.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,V.jsx)(G,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},hM={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},gM=.98;function _M(e,t,n){if(!e)return!1;let r=hM[e]?.[t];return r?n>=r*gM:!1}var vM=`Motor discontinuity detected`,yM=()=>{let e=Re(),t=Ie().state?.robot_name??null,{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(vM)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),I=e=>{l(e),F(e)},ee=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,V.jsx)(Sa,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,V.jsx)(Ma,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,V.jsx)(Fa,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,V.jsx)(ao,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(Bj,{iconOnly:!0}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,V.jsxs)(cg,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,V.jsxs)(vv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,V.jsxs)(B_,{value:o,onValueChange:N,children:[(0,V.jsx)(H_,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,V.jsx)(V_,{placeholder:`Select device type`})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,V.jsx)(K_,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,V.jsx)(K_,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Sh,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,V.jsx)(fM,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,V.jsxs)(G,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,V.jsxs)(G,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,V.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(Sa,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,V.jsxs)(vv,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,V.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,V.jsxs)(Wj,{className:`${ee.color} text-white rounded-md`,children:[ee.icon,(0,V.jsx)(`span`,{className:`ml-2`,children:ee.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sa,{className:`w-4 h-4 text-purple-400`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,V.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=_M(w.device_type,e,n);return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,V.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,V.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,V.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,V.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,V.jsx)(`span`,{children:t.min}),(0,V.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,V.jsxs)(cg,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>_M(w.device_type,e,t.max-t.min));return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsxs)(G,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,V.jsx)(Ma,{className:`w-4 h-4 mr-2`}):(0,V.jsx)(ja,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,V.jsxs)(cg,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,V.jsx)(Sa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,V.jsxs)(cg,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,V.jsx)(Ma,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(vM)?(0,V.jsxs)(cg,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,V.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,V.jsxs)(cg,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,V.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,V.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,V.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,V.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,V.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,V.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,V.jsx)(`br`,{}),(0,V.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,children:[(0,V.jsxs)(hv,{className:`flex-row items-center justify-between space-y-0`,children:[(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(kh,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,V.jsx)(dM,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,V.jsx)(vv,{children:m?(0,V.jsx)(Q_,{cameras:f,onCamerasChange:y}):(0,V.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,V.jsx)(Ta,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,V.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,V.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,V.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,V.jsx)(no,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,V.jsx)(mM,{open:b,onOpenChange:x,robotType:S,onPortDetected:I})]})},bM=`rovingFocusGroup.onEntryFocus`,xM={bubbles:!1,cancelable:!0},SM=`RovingFocusGroup`,[CM,wM,TM]=Ar(SM),[EM,DM]=Sr(SM,[TM]),[OM,kM]=EM(SM),AM=_.forwardRef((e,t)=>(0,V.jsx)(CM.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(CM.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(jM,{...e,ref:t})})}));AM.displayName=SM;var jM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=br(t,f),m=pg(a),[h,g]=ui({prop:o,defaultProp:s??null,onChange:c,caller:SM}),[v,y]=_.useState(!1),b=Rr(l),x=wM(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(bM,b),()=>e.removeEventListener(bM,b)},[b]),(0,V.jsx)(OM,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(U.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{S.current=!0}),onFocus:H(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(bM,xM);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);LM([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:H(e.onBlur,()=>y(!1))})})}),MM=`RovingFocusGroupItem`,NM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ws(),l=a||c,u=kM(MM,n),d=u.currentTabStopId===l,f=wM(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(CM.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(U.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=IM(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?RM(n,r+1):n.slice(r+1)}setTimeout(()=>LM(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});NM.displayName=MM;var PM={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function FM(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function IM(e,t,n){let r=FM(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return PM[r]}function LM(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function RM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zM=AM,BM=NM;function VM(e){let t=HM(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(WM);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function HM(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=KM(n),i=GM(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UM=Symbol(`radix.slottable`);function WM(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===UM}function GM(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function KM(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qM=[`Enter`,` `],JM=[`ArrowDown`,`PageUp`,`Home`],YM=[`ArrowUp`,`PageDown`,`End`],XM=[...JM,...YM],ZM={ltr:[...qM,`ArrowRight`],rtl:[...qM,`ArrowLeft`]},QM={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},$M=`Menu`,[eN,tN,nN]=Ar($M),[rN,iN]=Sr($M,[nN,Bf,DM]),aN=Bf(),oN=DM(),[sN,cN]=rN($M),[lN,uN]=rN($M),dN=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=aN(t),[c,l]=_.useState(null),u=_.useRef(!1),d=Rr(a),f=pg(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,V.jsx)(np,{...s,children:(0,V.jsx)(sN,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(lN,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};dN.displayName=$M;var fN=`MenuAnchor`,pN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=aN(n);return(0,V.jsx)(rp,{...i,...r,ref:t})});pN.displayName=fN;var mN=`MenuPortal`,[hN,gN]=rN(mN,{forceMount:void 0}),_N=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=cN(mN,t);return(0,V.jsx)(hN,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};_N.displayName=mN;var vN=`MenuContent`,[yN,bN]=rN(vN),xN=_.forwardRef((e,t)=>{let n=gN(vN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=cN(vN,e.__scopeMenu),o=uN(vN,e.__scopeMenu);return(0,V.jsx)(eN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(eN.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(SN,{...i,ref:t}):(0,V.jsx)(CN,{...i,ref:t})})})})}),SN=_.forwardRef((e,t)=>{let n=cN(vN,e.__scopeMenu),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(TN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),CN=_.forwardRef((e,t)=>{let n=cN(vN,e.__scopeMenu);return(0,V.jsx)(TN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wN=VM(`MenuContent.ScrollLock`),TN=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=cN(vN,n),v=uN(vN,n),y=aN(n),b=oN(n),x=tN(n),[S,C]=_.useState(null),w=_.useRef(null),T=br(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?_l:_.Fragment,N=m?{as:wN,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=lP(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),cc();let F=_.useCallback(e=>A.current===k.current?.side&&dP(e,k.current?.area),[]);return(0,V.jsx)(yN,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,V.jsx)(M,{...N,children:(0,V.jsx)(Ys,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(zM,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:H(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(ip,{role:`menu`,"aria-orientation":`vertical`,"data-state":iP(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!XM.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);YM.includes(e.key)&&a.reverse(),sP(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:H(e.onPointerMove,fP(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});xN.displayName=vN;var EN=`MenuGroup`,DN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`group`,...r,ref:t})});DN.displayName=EN;var ON=`MenuLabel`,kN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});kN.displayName=ON;var AN=`MenuItem`,jN=`menu.itemSelect`,MN=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=uN(AN,e.__scopeMenu),s=bN(AN,e.__scopeMenu),c=br(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(jN,{bubbles:!0,cancelable:!0});e.addEventListener(jN,e=>r?.(e),{once:!0}),Lr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(NN,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||qM.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});MN.displayName=AN;var NN=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=bN(AN,n),s=oN(n),c=_.useRef(null),l=br(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(eN.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(BM,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(U.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,fP(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,fP(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),PN=`MenuCheckboxItem`,FN=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(UN,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(MN,{role:`menuitemcheckbox`,"aria-checked":aP(n)?`mixed`:n,...i,ref:t,"data-state":oP(n),onSelect:H(i.onSelect,()=>r?.(aP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});FN.displayName=PN;var IN=`MenuRadioGroup`,[LN,RN]=rN(IN,{value:void 0,onValueChange:()=>{}}),zN=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rr(r);return(0,V.jsx)(LN,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(DN,{...i,ref:t})})});zN.displayName=IN;var BN=`MenuRadioItem`,VN=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=RN(BN,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(UN,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(MN,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":oP(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});VN.displayName=BN;var HN=`MenuItemIndicator`,[UN,WN]=rN(HN,{checked:!1}),GN=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=WN(HN,n);return(0,V.jsx)(ai,{present:r||aP(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{...i,ref:t,"data-state":oP(a.checked)})})});GN.displayName=HN;var KN=`MenuSeparator`,qN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qN.displayName=KN;var JN=`MenuArrow`,YN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=aN(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});YN.displayName=JN;var XN=`MenuSub`,[ZN,QN]=rN(XN),$N=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=cN(XN,t),o=aN(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Rr(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(np,{...o,children:(0,V.jsx)(sN,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(ZN,{scope:t,contentId:Ws(),triggerId:Ws(),trigger:s,onTriggerChange:c,children:n})})})};$N.displayName=XN;var eP=`MenuSubTrigger`,tP=_.forwardRef((e,t)=>{let n=cN(eP,e.__scopeMenu),r=uN(eP,e.__scopeMenu),i=QN(eP,e.__scopeMenu),a=bN(eP,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,V.jsx)(pN,{asChild:!0,...l,children:(0,V.jsx)(NN,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":iP(n.open),...e,ref:yr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,fP(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,fP(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||ZM[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});tP.displayName=eP;var nP=`MenuSubContent`,rP=_.forwardRef((e,t)=>{let n=gN(vN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=cN(vN,e.__scopeMenu),o=uN(vN,e.__scopeMenu),s=QN(nP,e.__scopeMenu),c=_.useRef(null),l=br(t,c);return(0,V.jsx)(eN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(eN.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(TN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=QM[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});rP.displayName=nP;function iP(e){return e?`open`:`closed`}function aP(e){return e===`indeterminate`}function oP(e){return aP(e)?`indeterminate`:e?`checked`:`unchecked`}function sP(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function lP(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=cP(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function uP(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dP(e,t){return t?uP({x:e.clientX,y:e.clientY},t):!1}function fP(e){return t=>t.pointerType===`mouse`?e(t):void 0}var pP=dN,mP=pN,hP=_N,gP=xN,_P=DN,vP=kN,yP=MN,bP=FN,xP=zN,SP=VN,CP=GN,wP=qN,TP=YN,EP=tP,DP=rP,OP=`DropdownMenu`,[kP,Ste]=Sr(OP,[iN]),AP=iN(),[jP,MP]=kP(OP),NP=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=AP(t),l=_.useRef(null),[u,d]=ui({prop:i,defaultProp:a??!1,onChange:o,caller:OP});return(0,V.jsx)(jP,{scope:t,triggerId:Ws(),triggerRef:l,contentId:Ws(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(pP,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};NP.displayName=OP;var PP=`DropdownMenuTrigger`,FP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=MP(PP,n),o=AP(n);return(0,V.jsx)(mP,{asChild:!0,...o,children:(0,V.jsx)(U.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:yr(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});FP.displayName=PP;var IP=`DropdownMenuPortal`,LP=e=>{let{__scopeDropdownMenu:t,...n}=e,r=AP(t);return(0,V.jsx)(hP,{...r,...n})};LP.displayName=IP;var RP=`DropdownMenuContent`,zP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=MP(RP,n),a=AP(n),o=_.useRef(!1);return(0,V.jsx)(gP,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});zP.displayName=RP;var BP=`DropdownMenuGroup`,VP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(_P,{...i,...r,ref:t})});VP.displayName=BP;var HP=`DropdownMenuLabel`,UP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(vP,{...i,...r,ref:t})});UP.displayName=HP;var WP=`DropdownMenuItem`,GP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(yP,{...i,...r,ref:t})});GP.displayName=WP;var KP=`DropdownMenuCheckboxItem`,qP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(bP,{...i,...r,ref:t})});qP.displayName=KP;var JP=`DropdownMenuRadioGroup`,YP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(xP,{...i,...r,ref:t})});YP.displayName=JP;var XP=`DropdownMenuRadioItem`,ZP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(SP,{...i,...r,ref:t})});ZP.displayName=XP;var QP=`DropdownMenuItemIndicator`,$P=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(CP,{...i,...r,ref:t})});$P.displayName=QP;var eF=`DropdownMenuSeparator`,tF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(wP,{...i,...r,ref:t})});tF.displayName=eF;var nF=`DropdownMenuArrow`,rF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(TP,{...i,...r,ref:t})});rF.displayName=nF;var iF=`DropdownMenuSubTrigger`,aF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(EP,{...i,...r,ref:t})});aF.displayName=iF;var oF=`DropdownMenuSubContent`,sF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(DP,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});sF.displayName=oF;var cF=NP,lF=FP,uF=LP,dF=zP,fF=UP,pF=GP,mF=qP,hF=ZP,gF=$P,_F=tF,vF=aF,yF=sF,bF=cF,xF=lF,SF=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,V.jsxs)(vF,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,V.jsx)(Oa,{className:`ml-auto h-4 w-4`})]}));SF.displayName=vF.displayName;var CF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yF,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));CF.displayName=yF.displayName;var wF=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(uF,{children:(0,V.jsx)(dF,{ref:r,sideOffset:t,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));wF.displayName=dF.displayName;var TF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(pF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));TF.displayName=pF.displayName;var EF=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,V.jsxs)(mF,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(gF,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),t]}));EF.displayName=mF.displayName;var DF=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(hF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(gF,{children:(0,V.jsx)(Ia,{className:`h-2 w-2 fill-current`})})}),t]}));DF.displayName=hF.displayName;var OF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(fF,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));OF.displayName=fF.displayName;var kF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_F,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));kF.displayName=_F.displayName;var AF=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest opacity-60`,e),...t});AF.displayName=`DropdownMenuShortcut`;var jF=`lelab.recording.muted`,MF=null,NF=()=>(MF||=new AudioContext,MF),PF=()=>localStorage.getItem(jF)===`1`,FF=e=>{localStorage.setItem(jF,e?`1`:`0`)},IF=(e,t,n=0)=>{if(PF())return;let r=NF(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},LF=()=>{IF(660,80,0),IF(880,80,90)},RF=()=>{IF(660,80,0),IF(440,80,90)},zF=()=>{IF(880,70,0),IF(880,70,1e3),IF(880,70,2e3)},BF=Symbol(`radix.slottable`);function VF(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=BF,t}var HF=`AlertDialog`,[UF,Cte]=Sr(HF,[Fl]),WF=Fl(),GF=e=>{let{__scopeAlertDialog:t,...n}=e,r=WF(t);return(0,V.jsx)(pu,{...r,...n,modal:!0})};GF.displayName=HF;var KF=`AlertDialogTrigger`,qF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(mu,{...i,...r,ref:t})});qF.displayName=KF;var JF=`AlertDialogPortal`,YF=e=>{let{__scopeAlertDialog:t,...n}=e,r=WF(t);return(0,V.jsx)(hu,{...r,...n})};YF.displayName=JF;var XF=`AlertDialogOverlay`,ZF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(gu,{...i,...r,ref:t})});ZF.displayName=XF;var QF=`AlertDialogContent`,[$F,eI]=UF(QF),tI=VF(`AlertDialogContent`),nI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=WF(n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return(0,V.jsx)(cu,{contentName:QF,titleName:rI,docsSlug:`alert-dialog`,children:(0,V.jsx)($F,{scope:n,cancelRef:c,children:(0,V.jsxs)(_u,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:H(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,V.jsx)(tI,{children:r}),(0,V.jsx)(dI,{contentRef:o})]})})})});nI.displayName=QF;var rI=`AlertDialogTitle`,iI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(vu,{...i,...r,ref:t})});iI.displayName=rI;var aI=`AlertDialogDescription`,oI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(yu,{...i,...r,ref:t})});oI.displayName=aI;var sI=`AlertDialogAction`,cI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(bu,{...i,...r,ref:t})});cI.displayName=sI;var lI=`AlertDialogCancel`,uI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=eI(lI,n),a=WF(n),o=br(t,i);return(0,V.jsx)(bu,{...a,...r,ref:o})});uI.displayName=lI;var dI=({contentRef:e})=>{let t=`\`${QF}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${QF}\` by passing a \`${aI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${QF}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},fI=GF,pI=YF,mI=ZF,hI=nI,gI=cI,_I=uI,vI=iI,yI=oI,bI=fI,xI=pI,SI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(mI,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));SI.displayName=mI.displayName;var CI=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(xI,{children:[(0,V.jsx)(SI,{}),(0,V.jsx)(hI,{ref:n,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));CI.displayName=hI.displayName;var wI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});wI.displayName=`AlertDialogHeader`;var TI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});TI.displayName=`AlertDialogFooter`;var EI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vI,{ref:n,className:W(`text-lg font-semibold`,e),...t}));EI.displayName=vI.displayName;var DI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yI,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));DI.displayName=yI.displayName;var OI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gI,{ref:n,className:W(js(),e),...t}));OI.displayName=gI.displayName;var kI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_I,{ref:n,className:W(js({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));kI.displayName=_I.displayName;var AI=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=Rs(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>PF()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useCallback)(()=>{g(e=>{let t=!e;return FF(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,D())},[o]);let w=(0,_.useRef)(d);w.current=d;let T=(0,_.useRef)(y);T.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let n=await e.json();c(n);let i=w.current;i&&n.current_phase===i&&f(null);let s=n.current_phase,l=v.current;l!==s&&(s===`recording`&&l!==null?LF():s===`resetting`&&RF(),v.current=s,x.current={phase:null,episode:null,tick:0});let u=n.phase_elapsed_seconds||0,d=n.phase_time_limit_s||0,p=d>3&&u>=d-3,m=n.current_episode??null,h=T.current,g=x.current;p&&i===null&&(g.phase!==s||g.episode!==m||g.tick!==h)&&(zF(),x.current={phase:s,episode:m,tick:h}),!n.recording_active&&n.session_ended&&t(`/upload`,{state:{datasetInfo:{dataset_repo_id:n.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:n.saved_episodes||0,session_elapsed_seconds:n.session_elapsed_seconds||0}}})}catch(e){console.error(`Error polling recording status:`,e)}};e();let n=setInterval(e,1e3);return()=>clearInterval(n)},[l,o,t,r,a]);let E=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},D=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},O=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),k=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),A=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),j=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),M=(0,_.useCallback)(async()=>{m(!1),await A()},[A]),N=(0,_.useRef)({handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p});(0,_.useEffect)(()=>{N.current={handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p}});let P=l&&s!==null;if((0,_.useEffect)(()=>{if(!P)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),N.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),N.current.handleRerecordEpisode();else if(e.key===`Escape`){if(N.current.showStopConfirm)return;N.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P]),!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,V.jsx)(G,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let F=s.current_phase,I=d??F,ee=s.current_episode??1,te=s.total_episodes??o.num_episodes,ne=d?0:s.phase_elapsed_seconds||0,re=I===`recording`?o.episode_time_s:I===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,ie=s.session_elapsed_seconds||0,ae=()=>I===`recording`?`RECORDING EPISODE ${ee}`:I===`resetting`?`RESET — GET READY`:I===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,oe=I===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:I===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},se=I===`recording`?`End Episode`:I===`resetting`?`Start Next Episode`:`Advance`,ce=I===`recording`?ro:Xa;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-2xl mx-auto`,children:[(0,V.jsx)(`div`,{className:`mb-8`,children:(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8`,children:[(0,V.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-6 text-sm text-gray-400`,children:[(0,V.jsxs)(`span`,{"aria-label":`Episode ${ee} of ${te}`,children:[`Episode `,(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:ee}),` / `,te]}),(0,V.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${E(ie)}`,children:E(ie)}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:C,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,V.jsx)(po,{className:`w-5 h-5`}):(0,V.jsx)(fo,{className:`w-5 h-5`})}),(0,V.jsxs)(bF,{children:[(0,V.jsx)(xF,{asChild:!0,children:(0,V.jsx)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,V.jsx)(Va,{className:`w-5 h-5`})})}),(0,V.jsxs)(wF,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TF,{onClick:k,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,V.jsx)($a,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,V.jsxs)(TF,{onClick:j,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${oe.pill}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${oe.dot} ${I===`completed`?``:`animate-pulse`}`}),ae()]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${oe.timer}`,children:E(ne)}),(0,V.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,E(re)]})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${oe.bar}`,style:{width:`${Math.min(ne/re*100,100)}%`}})}),(0,V.jsxs)(G,{onClick:O,disabled:!s.available_controls.exit_early||d!==null||I===`completed`,className:`w-full text-white font-semibold py-6 text-lg disabled:opacity-50 ${oe.button}`,children:[(0,V.jsx)(ce,{className:`w-5 h-5 mr-2`}),se,I!==`completed`&&(0,V.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),I===`completed`&&(0,V.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,V.jsx)(bI,{open:p,onOpenChange:m,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Stop recording?`}),(0,V.jsx)(DI,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,V.jsx)(OI,{onClick:M,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},jI=()=>{let e=Re();return(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(Bj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},MI=/^[\w.\-]+\/[\w.\-]+$/,NI=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();MI.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,V.jsxs)(vh,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Sh,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(G,{onClick:u,disabled:!MI.test(c.trim()),children:`Use`}),(0,V.jsx)(G,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,V.jsxs)(Om,{open:i,onOpenChange:a,children:[(0,V.jsx)(km,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(Am,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,V.jsxs)(ph,{className:`bg-gray-800 text-white`,children:[(0,V.jsx)(mh,{placeholder:`Search datasets…`,className:`text-white`}),(0,V.jsxs)(hh,{children:[(0,V.jsx)(gh,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,V.jsx)(_h,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,V.jsx)(_h,{heading:`Hugging Face`,children:f.map(p)}),(0,V.jsx)(_h,{children:(0,V.jsxs)(vh,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ya,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},PI=1500;function FI(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},PI);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function II(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function LI({state:e}){return e===`done`?(0,V.jsx)(Na,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,V.jsx)(Fa,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,V.jsx)(qa,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,V.jsx)(co,{className:`w-6 h-6 text-amber-400`})}var RI=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=_r();return(0,V.jsxs)(V.Fragment,{children:[e===`idle`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsx)(G,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,V.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,V.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,V.jsx)(G,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,V.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,V.jsx)(`div`,{children:e.message},t))})]})},zI=({purpose:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,V.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,V.jsxs)(`li`,{children:[`Press`,` `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,V.jsxs)(`li`,{children:[`Run`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),BI=({open:e,onOpenChange:t,installHint:n})=>{let r=FI(`system/wandb-extra`,e);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:r.state}),II(r.state,`Weights & Biases Not Installed`)]}),(0,V.jsx)(Ou,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`W&B logging`})})})]})})},VI=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=Rs(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsx)(gv,{className:`text-white`,children:`Run Configuration`})}),(0,V.jsxs)(vv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(NI,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,V.jsxs)(B_,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,V.jsx)(H_,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,V.jsx)(K_,{value:`diffusion`,children:`Diffusion Policy`}),(0,V.jsx)(K_,{value:`pi0`,children:`PI0`}),(0,V.jsx)(K_,{value:`smolvla`,children:`SmolVLA`}),(0,V.jsx)(K_,{value:`tdmpc`,children:`TD-MPC`}),(0,V.jsx)(K_,{value:`vqbet`,children:`VQ-BeT`}),(0,V.jsx)(K_,{value:`pi0_fast`,children:`PI0 Fast`}),(0,V.jsx)(K_,{value:`sac`,children:`SAC`}),(0,V.jsx)(K_,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,V.jsx)(Ch,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,V.jsx)(Ch,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)(dM,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(kh,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,V.jsx)(BI,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,V.jsx)(Sh,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},HI=({children:e})=>(0,V.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),wte=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsxs)(hv,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,V.jsx)(Da,{className:`w-4 h-4`}):(0,V.jsx)(Oa,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,V.jsxs)(vv,{className:`space-y-8`,children:[(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Policy`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,V.jsxs)(B_,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,V.jsx)(H_,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`cuda`,children:`CUDA (GPU)`}),(0,V.jsx)(K_,{value:`cpu`,children:`CPU`}),(0,V.jsx)(K_,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)(dM,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,V.jsx)(kh,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Training`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,V.jsx)(Ch,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,V.jsx)(Ch,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Optimizer`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,V.jsxs)(B_,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,V.jsx)(H_,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`adam`,children:`Adam`}),(0,V.jsx)(K_,{value:`adamw`,children:`AdamW`}),(0,V.jsx)(K_,{value:`sgd`,children:`SGD`}),(0,V.jsx)(K_,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,V.jsx)(Ch,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,V.jsx)(Ch,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,V.jsx)(Ch,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Logging & Checkpointing`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,V.jsx)(Ch,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,V.jsx)(Ch,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,V.jsx)(kh,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,V.jsx)(kh,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Weights & Biases`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,V.jsx)(Sh,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,V.jsx)(Sh,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,V.jsxs)(B_,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,V.jsx)(H_,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`online`,children:`Online`}),(0,V.jsx)(K_,{value:`offline`,children:`Offline`}),(0,V.jsx)(K_,{value:`disabled`,children:`Disabled`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,V.jsx)(kh,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Misc`}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,V.jsx)(kh,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},Tte=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,Ete=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${Tte(e.unit_cost_usd,e.unit_label)}`},Dte=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsx)(gv,{className:`text-white`,children:`Compute target`})}),(0,V.jsx)(vv,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{className:`text-slate-300`,children:`Run training on`}),(0,V.jsxs)(B_,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,V.jsx)(H_,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,V.jsx)(V_,{placeholder:i?`Loading…`:`Select target`})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,V.jsxs)(K_,{value:`hf:${e.name}`,disabled:!n,children:[Ete(e),!n&&(0,V.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},Ote=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,V.jsx)(Dte,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,V.jsx)(VI,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,V.jsx)(wte,{config:e,updateConfig:t})]}),UI=o(((e,t)=>{t.exports=Array.isArray})),WI=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),GI=o(((e,t)=>{var n=WI(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),KI=o(((e,t)=>{t.exports=GI().Symbol})),kte=o(((e,t)=>{var n=KI(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Ate=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),qI=o(((e,t)=>{var n=KI(),r=kte(),i=Ate(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),JI=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),YI=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),XI=o(((e,t)=>{var n=UI(),r=YI(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),ZI=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),QI=o(((e,t)=>{var n=qI(),r=ZI(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),jte=o(((e,t)=>{t.exports=GI()[`__core-js_shared__`]})),Mte=o(((e,t)=>{var n=jte(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),$I=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Nte=o(((e,t)=>{var n=QI(),r=Mte(),i=ZI(),a=$I(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Pte=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),eL=o(((e,t)=>{var n=Nte(),r=Pte();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),tL=o(((e,t)=>{t.exports=eL()(Object,`create`)})),Fte=o(((e,t)=>{var n=tL();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ite=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Lte=o(((e,t)=>{var n=tL(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Rte=o(((e,t)=>{var n=tL(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),zte=o(((e,t)=>{var n=tL(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Bte=o(((e,t)=>{var n=Fte(),r=Ite(),i=Lte(),a=Rte(),o=zte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),nL=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),rL=o(((e,t)=>{var n=nL();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Hte=o(((e,t)=>{var n=rL(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Ute=o(((e,t)=>{var n=rL();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Wte=o(((e,t)=>{var n=rL();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Gte=o(((e,t)=>{var n=rL();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),iL=o(((e,t)=>{var n=Vte(),r=Hte(),i=Ute(),a=Wte(),o=Gte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=eL()(GI(),`Map`)})),Kte=o(((e,t)=>{var n=Bte(),r=iL(),i=aL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),qte=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),oL=o(((e,t)=>{var n=qte();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Jte=o(((e,t)=>{var n=oL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),Yte=o(((e,t)=>{var n=oL();function r(e){return n(this,e).get(e)}t.exports=r})),Xte=o(((e,t)=>{var n=oL();function r(e){return n(this,e).has(e)}t.exports=r})),Zte=o(((e,t)=>{var n=oL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),sL=o(((e,t)=>{var n=Kte(),r=Jte(),i=Yte(),a=Xte(),o=Zte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=sL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),Qte=o(((e,t)=>{var n=cL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),$te=o(((e,t)=>{var n=Qte(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),lL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=KI(),r=lL(),i=UI(),a=YI(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),uL=o(((e,t)=>{var n=ene();function r(e){return e==null?``:n(e)}t.exports=r})),dL=o(((e,t)=>{var n=UI(),r=XI(),i=$te(),a=uL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),fL=o(((e,t)=>{var n=YI(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),pL=o(((e,t)=>{var n=dL(),r=fL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=pL();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),tne=o(((e,t)=>{function n(e){return e==null}t.exports=n})),nne=o(((e,t)=>{var n=qI(),r=UI(),i=JI(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),rne=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),ine=o(((e,t)=>{t.exports=rne()})),hL=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),ane=o(((e,t)=>{var n=hL();function r(e){return n(e)&&e!=+e}t.exports=r})),gL=l(nne()),_L=l(ane()),vL=l(mL()),one=l(hL()),yL=l(tne()),bL=function(e){return e===0?0:e>0?1:-1},xL=function(e){return(0,gL.default)(e)&&e.indexOf(`%`)===e.length-1},Z=function(e){return(0,one.default)(e)&&!(0,_L.default)(e)},sne=function(e){return(0,yL.default)(e)},SL=function(e){return Z(e)||(0,gL.default)(e)},CL=0,wL=function(e){var t=++CL;return`${e||``}${t}`},TL=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Z(e)&&!(0,gL.default)(e))return n;var i;if(xL(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,_L.default)(i)&&(i=n),r&&i>t&&(i=t),i},EL=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},DL=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qL(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function JL(e){"@babel/helpers - typeof";return JL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},JL(e)}var YL={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},XL=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},ZL=null,QL=null,$L=function e(t){if(t===ZL&&Array.isArray(QL))return QL;var n=[];return _.Children.forEach(t,function(t){(0,yL.default)(t)||((0,UL.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),QL=n,ZL=t,n};function eR(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return XL(e)}):[XL(t)],$L(e).forEach(function(e){var t=(0,vL.default)(e,`type.displayName`)||(0,vL.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function tR(e,t){var n=eR(e,t);return n&&n[0]}var nR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Z(n)||n<=0||!Z(r)||r<=0)},rR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),iR=function(e){return e&&e.type&&(0,gL.default)(e.type)&&rR.indexOf(e.type)>=0},aR=function(e){return e&&JL(e)===`object`&&`clipDot`in e},oR=function(e,t,n,r){var i=LL?.[r]??[];return t.startsWith(`data-`)||!(0,HL.default)(e)&&(r&&i.includes(t)||FL.includes(t))||n&&RL.includes(t)},sR=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,ML.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){oR(r?.[e],e,t,n)&&(i[e]=r[e])}),i},cR=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return lR(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _R(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=hR(e,pR),u=i||{width:n,height:r,x:0,y:0},d=pa(`recharts-surface`,a);return _.createElement(`svg`,mR({},sR(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var vR=[`children`,`className`];function yR(){return yR=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var SR=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=bR(e,vR),a=pa(`recharts-layer`,r);return _.createElement(`g`,yR({className:a},sR(i,!0),{ref:t}),n)}),CR=!1,wR=function(e,t){var n=[...arguments].slice(2);if(CR&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},TR=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=TR();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),DR=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),OR=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),kR=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),AR=o(((e,t)=>{var n=OR(),r=DR(),i=kR();function a(e){return r(e)?i(e):n(e)}t.exports=a})),jR=o(((e,t)=>{var n=ER(),r=DR(),i=AR(),a=uL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),MR=o(((e,t)=>{t.exports=jR()(`toUpperCase`)}));function NR(e){return function(){return e}}var PR=Math.cos,FR=Math.sin,IR=Math.sqrt,LR=Math.PI;LR/2;var RR=2*LR,zR=Math.PI,BR=2*zR,VR=1e-6,HR=BR-VR;function UR(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return UR;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tVR)if(!(Math.abs(u*s-c*l)>VR)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((zR-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>VR&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>VR||Math.abs(this._y1-l)>VR)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%BR+BR),d>HR?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>VR&&this._append`A${n},${n},0,${+(d>=zR)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function KR(){return new GR}KR.prototype=GR.prototype;function qR(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new GR(t)}Array.prototype.slice;function JR(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function YR(e){this._context=e}YR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function XR(e){return new YR(e)}function ZR(e){return e[0]}function QR(e){return e[1]}function $R(e,t){var n=NR(!0),r=null,i=XR,a=null,o=qR(s);e=typeof e==`function`?e:e===void 0?ZR:NR(e),t=typeof t==`function`?t:t===void 0?QR:NR(t);function s(s){var c,l=(s=JR(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return $R().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:NR(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:NR(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:NR(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:NR(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:NR(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var tz=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function nz(e){return new tz(e,!0)}function rz(e){return new tz(e,!1)}var iz={draw(e,t){let n=IR(t/LR);e.moveTo(n,0),e.arc(0,0,n,0,RR)}},az={draw(e,t){let n=IR(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},oz=IR(1/3),sz=oz*2,cz={draw(e,t){let n=IR(t/sz),r=n*oz;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},lz={draw(e,t){let n=IR(t),r=-n/2;e.rect(r,r,n,n)}},uz=.8908130915292852,dz=FR(LR/10)/FR(7*LR/10),fz=FR(RR/10)*dz,pz=-PR(RR/10)*dz,mz={draw(e,t){let n=IR(t*uz),r=fz*n,i=pz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=RR*t/5,o=PR(a),s=FR(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},hz=IR(3),gz={draw(e,t){let n=-IR(t/(hz*3));e.moveTo(0,n*2),e.lineTo(-hz*n,-n),e.lineTo(hz*n,-n),e.closePath()}},_z=-.5,vz=IR(3)/2,yz=1/IR(12),bz=(yz/2+1)*3,xz={draw(e,t){let n=IR(t/bz),r=n/2,i=n*yz,a=r,o=n*yz+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(_z*r-vz*i,vz*r+_z*i),e.lineTo(_z*a-vz*o,vz*a+_z*o),e.lineTo(_z*s-vz*c,vz*s+_z*c),e.lineTo(_z*r+vz*i,_z*i-vz*r),e.lineTo(_z*a+vz*o,_z*o-vz*a),e.lineTo(_z*s+vz*c,_z*c-vz*s),e.closePath()}};function Sz(e,t){let n=null,r=qR(i);e=typeof e==`function`?e:NR(e||iz),t=typeof t==`function`?t:NR(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:NR(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Cz(){}function wz(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Tz(e){this._context=e}Tz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wz(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ez(e){return new Tz(e)}function Dz(e){this._context=e}Dz.prototype={areaStart:Cz,areaEnd:Cz,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Oz(e){return new Dz(e)}function kz(e){this._context=e}kz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Az(e){return new kz(e)}function jz(e){this._context=e}jz.prototype={areaStart:Cz,areaEnd:Cz,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Mz(e){return new jz(e)}function Nz(e){return e<0?-1:1}function Pz(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Nz(a)+Nz(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Fz(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Iz(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Lz(e){this._context=e}Lz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Iz(this,this._t0,Fz(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Iz(this,Fz(this,n=Pz(this,e,t)),n);break;default:Iz(this,this._t0,n=Pz(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Rz(e){this._context=new zz(e)}(Rz.prototype=Object.create(Lz.prototype)).point=function(e,t){Lz.prototype.point.call(this,t,e)};function zz(e){this._context=e}zz.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Bz(e){return new Lz(e)}function Vz(e){return new Rz(e)}function Hz(e){this._context=e}Hz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Uz(e),i=Uz(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function Kz(e){return new Gz(e,.5)}function qz(e){return new Gz(e,0)}function Jz(e){return new Gz(e,1)}function Yz(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Zz(e,t){return e[t]}function Qz(e){let t=[];return t.key=e,t}function $z(){var e=NR([]),t=Xz,n=Yz,r=Zz;function i(i){var a=Array.from(e.apply(this,arguments),Qz),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pB(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var mB={symbolCircle:iz,symbolCross:az,symbolDiamond:cz,symbolSquare:lz,symbolStar:mz,symbolTriangle:gz,symbolWye:xz},hB=Math.PI/180,gB=function(e){return mB[`symbol${(0,rB.default)(e)}`]||iz},_B=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*hB;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vB=function(e,t){mB[`symbol${(0,rB.default)(e)}`]=t},yB=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=cB(cB({},fB(e,aB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=gB(n);return Sz().type(e).size(_B(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=sR(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,oB({},f,{className:pa(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};yB.registerSymbol=vB;function bB(e){"@babel/helpers - typeof";return bB=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bB(e)}function xB(){return xB=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var f=t.inactive?o:t.color;return _.createElement(`li`,xB({className:u,style:c,key:`legend-item-${n}`},VL(e.props,t,n)),_.createElement(_R,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);PB(RB,`displayName`,`Legend`),PB(RB,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var zB=o(((e,t)=>{var n=iL();function r(){this.__data__=new n,this.size=0}t.exports=r})),BB=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),VB=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),HB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),UB=o(((e,t)=>{var n=iL(),r=aL(),i=sL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=iL(),r=zB(),i=BB(),a=VB(),o=HB(),s=UB();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),GB=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),KB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),qB=o(((e,t)=>{var n=sL(),r=GB(),i=KB();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),XB=o(((e,t)=>{var n=qB(),r=JB(),i=YB(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=GI().Uint8Array})),QB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),$B=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),eV=o(((e,t)=>{var n=KI(),r=ZB(),i=nL(),a=XB(),o=QB(),s=$B(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),tV=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=tV(),r=UI();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),rV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),aV=o(((e,t)=>{var n=rV(),r=iV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),oV=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=qI(),r=JI(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),cV=o(((e,t)=>{var n=sV(),r=JI(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),lV=o(((e,t)=>{function n(){return!1}t.exports=n})),uV=o(((e,t)=>{var n=GI(),r=lV(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),dV=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),pV=o(((e,t)=>{var n=qI(),r=fV(),i=JI(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),mV=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),hV=o(((e,t)=>{var n=WI(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),gV=o(((e,t)=>{var n=pV(),r=mV(),i=hV(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),_V=o(((e,t)=>{var n=oV(),r=cV(),i=UI(),a=uV(),o=dV(),s=gV(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),vV=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),yV=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),bV=o(((e,t)=>{t.exports=yV()(Object.keys,Object)})),xV=o(((e,t)=>{var n=vV(),r=bV(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),SV=o(((e,t)=>{var n=QI(),r=fV();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),CV=o(((e,t)=>{var n=_V(),r=xV(),i=SV();function a(e){return i(e)?n(e):r(e)}t.exports=a})),wV=o(((e,t)=>{var n=nV(),r=aV(),i=CV();function a(e){return n(e,i,r)}t.exports=a})),TV=o(((e,t)=>{var n=wV(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=eL()(GI(),`DataView`)})),DV=o(((e,t)=>{t.exports=eL()(GI(),`Promise`)})),OV=o(((e,t)=>{t.exports=eL()(GI(),`Set`)})),kV=o(((e,t)=>{t.exports=eL()(GI(),`WeakMap`)})),AV=o(((e,t)=>{var n=EV(),r=aL(),i=DV(),a=OV(),o=kV(),s=qI(),c=$I(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),jV=o(((e,t)=>{var n=WB(),r=XB(),i=eV(),a=TV(),o=AV(),s=UI(),c=uV(),l=gV(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),MV=o(((e,t)=>{var n=jV(),r=JI();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),NV=o(((e,t)=>{var n=WB(),r=MV(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=ZI();function r(e){return e===e&&!n(e)}t.exports=r})),FV=o(((e,t)=>{var n=PV(),r=CV();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),IV=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),LV=o(((e,t)=>{var n=NV(),r=FV(),i=IV();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),RV=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),zV=o(((e,t)=>{var n=dL(),r=cV(),i=UI(),a=dV(),o=fV(),s=fL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=RV(),r=zV();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),VV=o(((e,t)=>{var n=MV(),r=mL(),i=BV(),a=XI(),o=PV(),s=IV(),c=fL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),HV=o(((e,t)=>{function n(e){return e}t.exports=n})),UV=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),WV=o(((e,t)=>{var n=pL();function r(e){return function(t){return n(t,e)}}t.exports=r})),GV=o(((e,t)=>{var n=UV(),r=WV(),i=XI(),a=fL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),KV=o(((e,t)=>{var n=LV(),r=VV(),i=HV(),a=UI(),o=GV();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),qV=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),YV=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=qV(),r=JV(),i=YV();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),ZV=o(((e,t)=>{var n=XV();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),QV=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),eH=o(((e,t)=>{var n=OV(),r=$V(),i=$B();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),tH=o(((e,t)=>{var n=qB(),r=ZV(),i=QV(),a=YB(),o=eH(),s=$B(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=KV(),r=tH();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function rH(e,t,n){return t===!0?(0,nH.default)(e,n):(0,HL.default)(t)?(0,nH.default)(e,t):e}function iH(e){"@babel/helpers - typeof";return iH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},iH(e)}var aH=[`ref`];function oH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sH(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function SH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function CH(e){return e.value}function wH(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=xH(t,aH);return _.createElement(RB,n)}var TH=1,EH=function(e){function t(){var e;cH(this,t);var n=[...arguments];return e=dH(this,t,[].concat(n)),vH(e,`lastBoundingBox`,{width:-1,height:-1}),e}return gH(t,e),uH(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>TH||Math.abs(t.height-this.lastBoundingBox.height)>TH)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sH({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return sH(sH({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=sH(sH({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},wH(n,sH(sH({},this.props),{},{payload:rH(s,o,CH)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=sH(sH({},this.defaultProps),e.props).layout;return n===`vertical`&&Z(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);vH(EH,`displayName`,`Legend`),vH(EH,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var DH=o(((e,t)=>{var n=KI(),r=cV(),i=UI(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),OH=o(((e,t)=>{var n=tV(),r=DH();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),kH=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),AH=o(((e,t)=>{t.exports=kH()()})),jH=o(((e,t)=>{var n=AH(),r=CV();function i(e,t){return e&&n(e,t,r)}t.exports=i})),MH=o(((e,t)=>{var n=SV();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=jH();t.exports=MH()(n)})),PH=o(((e,t)=>{var n=NH(),r=SV();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),FH=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),IH=o(((e,t)=>{var n=YI();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=IH();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),RH=o(((e,t)=>{var n=lL(),r=pL(),i=KV(),a=PH(),o=FH(),s=mV(),c=LH(),l=HV(),u=UI();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),zH=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),BH=o(((e,t)=>{var n=zH(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),HH=o(((e,t)=>{var n=eL();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),UH=o(((e,t)=>{var n=VH(),r=HH(),i=HV();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),WH=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),GH=o(((e,t)=>{var n=UH();t.exports=WH()(n)})),KH=o(((e,t)=>{var n=HV(),r=BH(),i=GH();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),qH=o(((e,t)=>{var n=nL(),r=SV(),i=dV(),a=ZI();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),JH=l(o(((e,t)=>{var n=OH(),r=RH(),i=KH(),a=qH();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function YH(e){"@babel/helpers - typeof";return YH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},YH(e)}function XH(){return XH=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${mU}-left`,Z(n)&&t&&Z(t.x)&&n=t.y),`${mU}-top`,Z(r)&&t&&Z(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function vU(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function yU(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=_U({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=_U({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=vU({translateX:u,translateY:d,useTranslate3d:s})):l=hU,{cssProperties:l,cssClasses:gU({translateX:u,translateY:d,coordinate:n})}}function bU(e){"@babel/helpers - typeof";return bU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bU(e)}function xU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SU(e){for(var t=1;tIU||Math.abs(e.height-this.state.lastBoundingBox.height)>IU)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=yU({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=SU(SU({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),RU={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return RU[e]},set:function(e,t){if(typeof e==`string`)RU[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){RU[t]=e[t]})}}};function zU(e){"@babel/helpers - typeof";return zU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},zU(e)}function BU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VU(e){for(var t=1;t0;return _.createElement(LU,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},nW(o,VU(VU({},this.props),{},{payload:y})))}}])}(_.PureComponent);QU(rW,`displayName`,`Tooltip`),QU(rW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!RU.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var iW=o(((e,t)=>{var n=GI();t.exports=function(){return n.Date.now()}})),aW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),oW=o(((e,t)=>{var n=aW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),sW=o(((e,t)=>{var n=oW(),r=ZI(),i=YI(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),cW=o(((e,t)=>{var n=ZI(),r=iW(),i=sW(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),lW=l(o(((e,t)=>{var n=cW(),r=ZI(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function uW(e){"@babel/helpers - typeof";return uW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},uW(e)}function dW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fW(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,lW.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;wR(xL(o)||xL(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),wR(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=xL(o)?e:o,i=xL(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),wR(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&XL(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,fW({width:r,height:i},a?{style:fW({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:pa(`recharts-responsive-container`,v),style:fW(fW({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),CW=function(e){return null};CW.displayName=`Cell`;function wW(e){"@babel/helpers - typeof";return wW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wW(e)}function TW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function EW(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||RU.isSsr)return{width:0,height:0};var n=PW(t),r=JSON.stringify({text:e,copyStyle:n});if(AW.widthCache[r])return AW.widthCache[r];try{var i=document.getElementById(NW);i||(i=document.createElement(`span`),i.setAttribute(`id`,NW),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=EW(EW({},MW),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return AW.widthCache[r]=s,++AW.cacheCount>jW&&(AW.cacheCount=0,AW.widthCache={}),s}catch{return{width:0,height:0}}},IW=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function LW(e){"@babel/helpers - typeof";return LW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},LW(e)}function RW(e,t){return UW(e)||HW(e,t)||BW(e,t)||zW()}function zW(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BW(e,t){if(e){if(typeof e==`string`)return VW(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VW(e,t)}}function VW(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hG(e,t){return bG(e)||yG(e,t)||_G(e,t)||gG()}function gG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _G(e,t){if(e){if(typeof e==`string`)return vG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vG(e,t)}}function vG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=SG({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=hG(h(b-1),2),S=x[0],C=x[1],w=hG(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},wG=function(e){return[{words:(0,yL.default)(e)?[]:e.toString().split(xG)}]},TG=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!RU.isSsr){var s,c,l=SG({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return wG(r);return CG({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return wG(r)},EG=`#808080`,DG=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?EG:h,v=pG(e,uG),y=(0,_.useMemo)(function(){return TG({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=pG(v,dG);if(!SL(n)||!SL(i))return null;var E=n+(Z(b)?b:0),D=i+(Z(x)?x:0),O;switch(m){case`start`:O=lG(`calc(${c})`);break;case`middle`:O=lG(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=lG(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Z(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,fG({},sR(T,!0),{x:E,y:D,className:pa(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?EG:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function OG(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function kG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function AG(e){let t,n,r;e.length===2?(t=e===OG||e===kG?e:jG,n=e,r=e):(t=OG,n=(t,n)=>OG(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function jG(){return 0}function MG(e){return e===null?NaN:+e}function*NG(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var PG=AG(OG),FG=PG.right;PG.left,AG(MG).center;var IG=class extends Map{constructor(e,t=BG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(LG(this,e))}has(e){return super.has(LG(this,e))}set(e,t){return super.set(RG(this,e),t)}delete(e){return super.delete(zG(this,e))}};function LG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function RG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function zG({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function BG(e){return typeof e==`object`&&e?e.valueOf():e}function VG(e=OG){if(e===OG)return HG;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function HG(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var UG=Math.sqrt(50),WG=Math.sqrt(10),GG=Math.sqrt(2);function KG(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=UG?10:a>=WG?5:a>=GG?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function ZG(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function QG(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?HG:VG(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));QG(e,t,u,d,i)}let a=e[t],o=n,s=r;for($G(e,n,t),i(e[r],a)>0&&$G(e,n,r);o0;)--s}i(e[n],a)===0?$G(e,n,s):(++s,$G(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function $G(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function eK(e,t,n){if(e=Float64Array.from(NG(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ZG(e);if(t>=1)return XG(e);var r,i=(r-1)*t,a=Math.floor(i),o=XG(QG(e,a).subarray(0,a+1));return o+(ZG(e.subarray(a+1))-o)*(i-a)}}function tK(e,t,n=MG){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function nK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?MK(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?MK(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yK.exec(e))?new FK(t[1],t[2],t[3],1):(t=bK.exec(e))?new FK(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xK.exec(e))?MK(t[1],t[2],t[3],t[4]):(t=SK.exec(e))?MK(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CK.exec(e))?HK(t[1],t[2]/100,t[3]/100,1):(t=wK.exec(e))?HK(t[1],t[2]/100,t[3]/100,t[4]):TK.hasOwnProperty(e)?jK(TK[e]):e===`transparent`?new FK(NaN,NaN,NaN,0):null}function jK(e){return new FK(e>>16&255,e>>8&255,e&255,1)}function MK(e,t,n,r){return r<=0&&(e=t=n=NaN),new FK(e,t,n,r)}function NK(e){return e instanceof fK||(e=AK(e)),e?(e=e.rgb(),new FK(e.r,e.g,e.b,e.opacity)):new FK}function PK(e,t,n,r){return arguments.length===1?NK(e):new FK(e,t,n,r??1)}function FK(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}uK(FK,PK,dK(fK,{brighter(e){return e=e==null?mK:mK**+e,new FK(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pK:pK**+e,new FK(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new FK(BK(this.r),BK(this.g),BK(this.b),zK(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:IK,formatHex:IK,formatHex8:LK,formatRgb:RK,toString:RK}));function IK(){return`#${VK(this.r)}${VK(this.g)}${VK(this.b)}`}function LK(){return`#${VK(this.r)}${VK(this.g)}${VK(this.b)}${VK((isNaN(this.opacity)?1:this.opacity)*255)}`}function RK(){let e=zK(this.opacity);return`${e===1?`rgb(`:`rgba(`}${BK(this.r)}, ${BK(this.g)}, ${BK(this.b)}${e===1?`)`:`, ${e})`}`}function zK(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function BK(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function VK(e){return e=BK(e),(e<16?`0`:``)+e.toString(16)}function HK(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new GK(e,t,n,r)}function UK(e){if(e instanceof GK)return new GK(e.h,e.s,e.l,e.opacity);if(e instanceof fK||(e=AK(e)),!e)return new GK;if(e instanceof GK)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new GK(o,s,c,e.opacity)}function WK(e,t,n,r){return arguments.length===1?UK(e):new GK(e,t,n,r??1)}function GK(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}uK(GK,WK,dK(fK,{brighter(e){return e=e==null?mK:mK**+e,new GK(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pK:pK**+e,new GK(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new FK(JK(e>=240?e-240:e+120,i,r),JK(e,i,r),JK(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new GK(KK(this.h),qK(this.s),qK(this.l),zK(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=zK(this.opacity);return`${e===1?`hsl(`:`hsla(`}${KK(this.h)}, ${qK(this.s)*100}%, ${qK(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function KK(e){return e=(e||0)%360,e<0?e+360:e}function qK(e){return Math.max(0,Math.min(1,e||0))}function JK(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var YK=e=>()=>e;function XK(e,t){return function(n){return e+n*t}}function ZK(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function QK(e){return(e=+e)==1?$K:function(t,n){return n-t?ZK(t,n,e):YK(isNaN(t)?n:t)}}function $K(e,t){var n=t-e;return n?XK(e,n):YK(isNaN(e)?t:e)}var eq=(function e(t){var n=QK(t);function r(e,t){var r=n((e=PK(e)).r,(t=PK(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$K(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function tq(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:aq(r,i)})),n=cq.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function xq(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Sq:xq,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),aq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,gq),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=pq,u()},d.clamp=function(e){return arguments.length?(o=e?!0:vq,u()):o!==vq},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Tq(){return wq()(vq,vq)}function Eq(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Dq(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Oq(e){return e=Dq(Math.abs(e)),e?e[1]:NaN}function kq(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Aq(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var jq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mq(e){if(!(t=jq.exec(e)))throw Error(`invalid format: `+e);var t;return new Nq({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mq.prototype=Nq.prototype;function Nq(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Nq.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Pq(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Fq;function Iq(e,t){var n=Dq(e,t);if(!n)return Fq=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Fq=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Dq(e,Math.max(0,t+a-1))[0]}function Lq(e,t){var n=Dq(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Rq={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Eq,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Lq(e*100,t),r:Lq,s:Iq,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function zq(e){return e}var Bq=Array.prototype.map,Vq=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Hq(e){var t=e.grouping===void 0||e.thousands===void 0?zq:kq(Bq.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?zq:Aq(Bq.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Mq(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Rq[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Rq[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Pq(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Fq!==void 0?Vq[8+Fq/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Oq(t)/3)))*3,r=10**-n,i=l((e=Mq(e),e.type=`f`,e),{suffix:Vq[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Uq,Wq,Gq;Kq({thousands:`,`,grouping:[3],currency:[`$`,``]});function Kq(e){return Uq=Hq(e),Wq=Uq.format,Gq=Uq.formatPrefix,Uq}function qq(e){return Math.max(0,-Oq(Math.abs(e)))}function Jq(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Oq(t)/3)))*3-Oq(Math.abs(e)))}function Yq(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Oq(t)-Oq(e))+1}function Xq(e,t,n,r){var i=YG(e,t,n),a;switch(r=Mq(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Jq(i,o))&&(r.precision=a),Gq(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Yq(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=qq(i))&&(r.precision=a-(r.type===`%`)*2);break}return Wq(r)}function Zq(e){var t=e.domain;return e.ticks=function(e){var n=t();return qG(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Xq(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=JG(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Qq(){var e=Tq();return e.copy=function(){return Cq(e,Qq())},rK.apply(e,arguments),Zq(e)}function $q(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,gq),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return $q(e).unknown(t)},e=arguments.length?Array.from(e,gq):[0,1],Zq(n)}function eJ(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function sJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function cJ(e){return(t,n)=>-e(-t,n)}function lJ(e){let t=e(tJ,nJ),n=t.domain,r=10,i,a;function o(){return i=sJ(r),a=oJ(r),n()[0]<0?(i=cJ(i),a=cJ(a),e(rJ,iJ)):e(tJ,nJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Mq(n)).precision==null&&(n.trim=!0),n=Wq(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(eJ(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function uJ(){let e=lJ(wq()).domain([1,10]);return e.copy=()=>Cq(e,uJ()).base(e.base()),rK.apply(e,arguments),e}function dJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function fJ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function pJ(e){var t=1,n=e(dJ(t),fJ(t));return n.constant=function(n){return arguments.length?e(dJ(t=+n),fJ(t)):t},Zq(n)}function mJ(){var e=pJ(wq());return e.copy=function(){return Cq(e,mJ()).constant(e.constant())},rK.apply(e,arguments)}function hJ(e){return function(t){return t<0?-((-t)**+e):t**+e}}function gJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function _J(e){return e<0?-e*e:e*e}function vJ(e){var t=e(vq,vq),n=1;function r(){return n===1?e(vq,vq):n===.5?e(gJ,_J):e(hJ(n),hJ(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Zq(t)}function yJ(){var e=vJ(wq());return e.copy=function(){return Cq(e,yJ()).exponent(e.exponent())},rK.apply(e,arguments),e}function bJ(){return yJ.apply(null,arguments).exponent(.5)}function xJ(e){return Math.sign(e)*e*e}function SJ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function CJ(){var e=Tq(),t=[0,1],n=!1,r;function i(t){var i=SJ(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(xJ(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,gq)).map(xJ)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return CJ(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},rK.apply(i,arguments),Zq(i)}function wJ(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return TJ().domain([e,t]).range(i).unknown(a)},rK.apply(Zq(o),arguments)}function EJ(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[FG(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return EJ().domain(e).range(t).unknown(n)},rK.apply(i,arguments)}var DJ=new Date,OJ=new Date;function kJ(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(skJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(DJ.setTime(+t),OJ.setTime(+r),e(DJ),e(OJ),Math.floor(n(DJ,OJ))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var AJ=kJ(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);AJ.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?kJ(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):AJ),AJ.range;var jJ=1e3,MJ=jJ*60,NJ=MJ*60,PJ=NJ*24,FJ=PJ*7,IJ=PJ*30,LJ=PJ*365,RJ=kJ(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getUTCSeconds());RJ.range;var zJ=kJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jJ)},(e,t)=>{e.setTime(+e+t*MJ)},(e,t)=>(t-e)/MJ,e=>e.getMinutes());zJ.range;var BJ=kJ(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*MJ)},(e,t)=>(t-e)/MJ,e=>e.getUTCMinutes());BJ.range;var VJ=kJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jJ-e.getMinutes()*MJ)},(e,t)=>{e.setTime(+e+t*NJ)},(e,t)=>(t-e)/NJ,e=>e.getHours());VJ.range;var HJ=kJ(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*NJ)},(e,t)=>(t-e)/NJ,e=>e.getUTCHours());HJ.range;var UJ=kJ(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*MJ)/PJ,e=>e.getDate()-1);UJ.range;var WJ=kJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/PJ,e=>e.getUTCDate()-1);WJ.range;var GJ=kJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/PJ,e=>Math.floor(e/PJ));GJ.range;function KJ(e){return kJ(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*MJ)/FJ)}var qJ=KJ(0),JJ=KJ(1),YJ=KJ(2),XJ=KJ(3),ZJ=KJ(4),QJ=KJ(5),$J=KJ(6);qJ.range,JJ.range,YJ.range,XJ.range,ZJ.range,QJ.range,$J.range;function eY(e){return kJ(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/FJ)}var tY=eY(0),nY=eY(1),rY=eY(2),iY=eY(3),aY=eY(4),oY=eY(5),sY=eY(6);tY.range,nY.range,rY.range,iY.range,aY.range,oY.range,sY.range;var cY=kJ(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());cY.range;var lY=kJ(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());lY.range;var uY=kJ(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());uY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:kJ(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),uY.range;var dY=kJ(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());dY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:kJ(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),dY.range;function fY(e,t,n,r,i,a){let o=[[RJ,1,jJ],[RJ,5,5*jJ],[RJ,15,15*jJ],[RJ,30,30*jJ],[a,1,MJ],[a,5,5*MJ],[a,15,15*MJ],[a,30,30*MJ],[i,1,NJ],[i,3,3*NJ],[i,6,6*NJ],[i,12,12*NJ],[r,1,PJ],[r,2,2*PJ],[n,1,FJ],[t,1,IJ],[t,3,3*IJ],[e,1,LJ]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(YG(t/LJ,n/LJ,r));if(a===0)return AJ.every(Math.max(YG(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=vY(yY(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?nY.ceil(a):nY(a),a=WJ.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=_Y(yY(r.y,0,1)),o=a.getDay(),a=o>4||o===0?JJ.ceil(a):JJ(a),a=UJ.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?vY(yY(r.y,0,1)).getUTCDay():_Y(yY(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,vY(r)):_Y(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in xY?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function I(e){return s[e.getMonth()]}function ee(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function ne(e){return o[e.getUTCDay()]}function re(e){return a[e.getUTCDay()]}function ie(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var xY={"-":``,_:` `,0:`0`},SY=/^\s*\d+/,CY=/^%/,wY=/[\\^$*+?|[\]().{}]/g;function TY(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function kY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function AY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function jY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function MY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function NY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function PY(e,t,n){var r=SY.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function FY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function IY(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function LY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function RY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function zY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function BY(e,t,n){var r=SY.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function VY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function HY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function UY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function WY(e,t,n){var r=SY.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function GY(e,t,n){var r=SY.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function KY(e,t,n){var r=CY.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function qY(e,t,n){var r=SY.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function JY(e,t,n){var r=SY.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function YY(e,t){return TY(e.getDate(),t,2)}function XY(e,t){return TY(e.getHours(),t,2)}function ZY(e,t){return TY(e.getHours()%12||12,t,2)}function QY(e,t){return TY(1+UJ.count(uY(e),e),t,3)}function $Y(e,t){return TY(e.getMilliseconds(),t,3)}function eX(e,t){return $Y(e,t)+`000`}function tX(e,t){return TY(e.getMonth()+1,t,2)}function nX(e,t){return TY(e.getMinutes(),t,2)}function rX(e,t){return TY(e.getSeconds(),t,2)}function iX(e){var t=e.getDay();return t===0?7:t}function aX(e,t){return TY(qJ.count(uY(e)-1,e),t,2)}function oX(e){var t=e.getDay();return t>=4||t===0?ZJ(e):ZJ.ceil(e)}function sX(e,t){return e=oX(e),TY(ZJ.count(uY(e),e)+(uY(e).getDay()===4),t,2)}function cX(e){return e.getDay()}function lX(e,t){return TY(JJ.count(uY(e)-1,e),t,2)}function uX(e,t){return TY(e.getFullYear()%100,t,2)}function dX(e,t){return e=oX(e),TY(e.getFullYear()%100,t,2)}function fX(e,t){return TY(e.getFullYear()%1e4,t,4)}function pX(e,t){var n=e.getDay();return e=n>=4||n===0?ZJ(e):ZJ.ceil(e),TY(e.getFullYear()%1e4,t,4)}function mX(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+TY(t/60|0,`0`,2)+TY(t%60,`0`,2)}function hX(e,t){return TY(e.getUTCDate(),t,2)}function gX(e,t){return TY(e.getUTCHours(),t,2)}function _X(e,t){return TY(e.getUTCHours()%12||12,t,2)}function vX(e,t){return TY(1+WJ.count(dY(e),e),t,3)}function yX(e,t){return TY(e.getUTCMilliseconds(),t,3)}function bX(e,t){return yX(e,t)+`000`}function xX(e,t){return TY(e.getUTCMonth()+1,t,2)}function SX(e,t){return TY(e.getUTCMinutes(),t,2)}function CX(e,t){return TY(e.getUTCSeconds(),t,2)}function wX(e){var t=e.getUTCDay();return t===0?7:t}function TX(e,t){return TY(tY.count(dY(e)-1,e),t,2)}function EX(e){var t=e.getUTCDay();return t>=4||t===0?aY(e):aY.ceil(e)}function DX(e,t){return e=EX(e),TY(aY.count(dY(e),e)+(dY(e).getUTCDay()===4),t,2)}function OX(e){return e.getUTCDay()}function kX(e,t){return TY(nY.count(dY(e)-1,e),t,2)}function AX(e,t){return TY(e.getUTCFullYear()%100,t,2)}function jX(e,t){return e=EX(e),TY(e.getUTCFullYear()%100,t,2)}function MX(e,t){return TY(e.getUTCFullYear()%1e4,t,4)}function NX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?aY(e):aY.ceil(e),TY(e.getUTCFullYear()%1e4,t,4)}function PX(){return`+0000`}function FX(){return`%`}function IX(e){return+e}function LX(e){return Math.floor(e/1e3)}var RX,zX,BX;VX({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function VX(e){return RX=bY(e),zX=RX.format,RX.parse,BX=RX.utcFormat,RX.utcParse,RX}function HX(e){return new Date(e)}function UX(e){return e instanceof Date?+e:+new Date(+e)}function WX(e,t,n,r,i,a,o,s,c,l){var u=Tq(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>eK(e,r/t))},n.copy=function(){return eZ(t).domain(e)},iK.apply(n,arguments)}function tZ(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=vq,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*esK,scaleDiverging:()=>nZ,scaleDivergingLog:()=>rZ,scaleDivergingPow:()=>aZ,scaleDivergingSqrt:()=>oZ,scaleDivergingSymlog:()=>iZ,scaleIdentity:()=>$q,scaleImplicit:()=>aK,scaleLinear:()=>Qq,scaleLog:()=>uJ,scaleOrdinal:()=>oK,scalePoint:()=>lK,scalePow:()=>yJ,scaleQuantile:()=>wJ,scaleQuantize:()=>TJ,scaleRadial:()=>CJ,scaleSequential:()=>YX,scaleSequentialLog:()=>XX,scaleSequentialPow:()=>QX,scaleSequentialQuantile:()=>eZ,scaleSequentialSqrt:()=>$X,scaleSequentialSymlog:()=>ZX,scaleSqrt:()=>bJ,scaleSymlog:()=>mJ,scaleThreshold:()=>EJ,scaleTime:()=>GX,scaleUtc:()=>KX,tickFormat:()=>Xq}),cZ=o(((e,t)=>{var n=YI();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),uZ=o(((e,t)=>{var n=cZ(),r=lZ(),i=HV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),dZ=o(((e,t)=>{function n(e,t){return e{var n=cZ(),r=dZ(),i=HV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),pZ=o(((e,t)=>{var n=lL(),r=KV(),i=PH(),a=UI();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),mZ=o(((e,t)=>{var n=OH(),r=pZ();function i(e,t){return n(r(e,t),1)}t.exports=i})),hZ=o(((e,t)=>{var n=MV();function r(e,t){return n(e,t)}t.exports=r})),gZ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function _Z(e){return xZ(e)||bZ(e)||yZ(e)||vZ()}function vZ(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yZ(e,t){if(e){if(typeof e==`string`)return SZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SZ(e,t)}}function bZ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function xZ(e){if(Array.isArray(e))return SZ(e)}function SZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,EZ(function(){var e=[...arguments],t=r.map(function(t){return TZ(t)?e.shift():t});return n.apply(void 0,_Z(t).concat(e))}))})},OZ=function(e){return DZ(e.length,e)},kZ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function qZ(e){if(Array.isArray(e))return e}function JZ(e){var t=HZ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function YZ(e,t,n){if(e.lte(0))return new PZ.default(0);var r=LZ.getDigitCount(e.toNumber()),i=new PZ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new PZ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new PZ.default(Math.ceil(s))}function XZ(e,t,n){var r=1,i=new PZ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new PZ.default(10).pow(LZ.getDigitCount(e)-1),i=new PZ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new PZ.default(Math.floor(e)))}else e===0?i=new PZ.default(Math.floor((t-1)/2)):n||(i=new PZ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return jZ(AZ(function(e){return i.add(new PZ.default(e-o).mul(r)).toNumber()}),kZ)(0,t)}function ZZ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new PZ.default(0),tickMin:new PZ.default(0),tickMax:new PZ.default(0)};var a=YZ(new PZ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new PZ.default(0):(o=new PZ.default(e).add(t).div(2),o=o.sub(new PZ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new PZ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?ZZ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new PZ.default(s).mul(a)),tickMax:o.add(new PZ.default(c).mul(a))})}function QZ(e){var t=HZ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=HZ(JZ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(RZ(kZ(0,i-1).map(function(){return 1/0}))):[].concat(RZ(kZ(0,i-1).map(function(){return-1/0})),[l]);return n>r?MZ(u):u}if(c===l)return XZ(c,i,a);var d=ZZ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=LZ.rangeStep(p,m.add(new PZ.default(.1).mul(f)),f);return n>r?MZ(h):h}function $Z(e,t){var n=HZ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=HZ(JZ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=YZ(new PZ.default(c).sub(s).div(l-1),a,0),d=[].concat(RZ(LZ.rangeStep(new PZ.default(s),new PZ.default(c).sub(new PZ.default(.99).mul(u)),u)),[c]);return r>i?MZ(d):d}var eQ=NZ(QZ),tQ=NZ($Z),nQ=!0,rQ=`Invariant failed`;function iQ(e,t){if(!e){if(nQ)throw Error(rQ);var n=typeof t==`function`?t():t,r=n?`${rQ}: ${n}`:rQ;throw Error(r)}}var aQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function oQ(e){"@babel/helpers - typeof";return oQ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},oQ(e)}function sQ(){return sQ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gQ(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function _Q(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(bL(l-c)!==bL(u-l)){var f=[];if(bL(u-l)===bL(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},n$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?YQ(YQ({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},r$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:YQ(YQ({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,yL.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,yL.default)(x)?void 0:TL(x,n,0)})}}return a},i$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=TL(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(HQ(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=TL(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(HQ(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},a$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=IQ({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Z(e[d]))return YQ(YQ({},e),{},XQ({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Z(e[f]))return YQ(YQ({},e),{},XQ({},f,e[f]+(u||0)))}return e},o$=function(e,t,n){return(0,yL.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},s$=function(e,t,n,r,i){var a=t.props.children,o=eR(a,kQ).filter(function(e){return o$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=$Q(t,n);if((0,yL.default)(r))return e;var i=Array.isArray(r)?[(0,RQ.default)(r),(0,LQ.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=$Q(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},c$=function(e,t,n,r,i){var a=t.map(function(t){return s$(e,t,n,i,r)}).filter(function(e){return!(0,yL.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},l$=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&s$(e,t,a,r)||e$(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?bL(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,_L.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},f$=new WeakMap,p$=function(e,t){if(typeof t!=`function`)return e;f$.has(e)||f$.set(e,new WeakMap);var n=f$.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},m$=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:sK(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:Qq(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:lK(),realScaleType:`point`}:i===`category`?{scale:sK(),realScaleType:`band`}:{scale:Qq(),realScaleType:`linear`};if((0,gL.default)(r)){var s=`scale${(0,rB.default)(r)}`;return{scale:(sZ[s]||lK)(),realScaleType:sZ[s]?s:`point`}}return(0,HL.default)(r)?{scale:r}:{scale:lK(),realScaleType:`point`}},h$=1e-4,g$=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-h$,a=Math.max(r[0],r[1])+h$,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},_$=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:eB,none:Yz,silhouette:tB,wiggle:nB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},b$=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=y$[n];return $z().keys(r).value(function(e,t){return+$Q(e,t,0)}).order(Xz).offset(i)(e)},x$=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?YQ(YQ({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(SL(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[wL(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return YQ(YQ({},e),{},XQ({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return YQ(YQ({},t),{},XQ({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:b$(e,o.items,i)}))},{})),YQ(YQ({},t),{},XQ({},a,s))},{})},S$=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=eQ(c,i,o);return e.domain([(0,RQ.default)(l),(0,LQ.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:tQ(e.domain(),i,o)}:null};function C$(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,yL.default)(i[t.dataKey])){var s=kL(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=$Q(i,(0,yL.default)(o)?t.dataKey:o);return(0,yL.default)(c)?null:t.scale(c)}var w$=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=$Q(a,t.dataKey,t.domain[o]);return(0,yL.default)(s)?null:t.scale(s)-i/2+r},T$=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},E$=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?YQ(YQ({},e.type.defaultProps),e.props):e.props).stackId;if(SL(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},D$=function(e){return e.reduce(function(e,t){return[(0,RQ.default)(t.concat([e[0]]).filter(Z)),(0,LQ.default)(t.concat([e[1]]).filter(Z))]},[1/0,-1/0])},O$=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=D$(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},k$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,A$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,j$=function(e,t,n){if((0,HL.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Z(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(k$.test(e[0])){var i=+k$.exec(e[0])[1];r[0]=t[0]-i}else (0,HL.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Z(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(A$.test(e[1])){var a=+A$.exec(e[1])[1];r[1]=t[1]+a}else (0,HL.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},M$=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,JH.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:H$(c),angleInRadian:c}},K$=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},q$=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},J$=function(e,t){var n=e.x,r=e.y,i=G$({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=K$(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?L$(L$({},t),{},{radius:a,angle:q$(f,t)}):null};function Y$(e){"@babel/helpers - typeof";return Y$=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Y$(e)}var cne=[`offset`];function X$(e){return e1(e)||$$(e)||Q$(e)||Z$()}function Z$(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Q$(e,t){if(e){if(typeof e==`string`)return t1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t1(e,t)}}function $$(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function e1(e){if(Array.isArray(e))return t1(e)}function t1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function r1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=U$(c,l,h,y),S=U$(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} - A${h},${h},0,1,${+!b}, - ${S.x},${S.y}`,w=(0,yL.default)(e.id)?wL(`recharts-radial-line-`):e.id;return _.createElement(`text`,l1({},n,{dominantBaseline:`central`,className:pa(`recharts-radial-bar-label`,o)}),_.createElement(`defs`,null,_.createElement(`path`,{id:w,d:C})),_.createElement(`textPath`,{xlinkHref:`#${w}`},t))},p1=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=U$(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=U$(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},m1=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return a1(a1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return a1(a1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return a1(a1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return a1(a1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?a1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?a1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?a1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?a1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?a1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?a1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?a1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?a1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,ML.default)(i)&&(Z(i.x)||xL(i.x))&&(Z(i.y)||xL(i.y))?a1({x:o+TL(i.x,c),y:s+TL(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):a1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},h1=function(e){return`cx`in e&&Z(e.cx)};function g1(e){var t=e.offset,n=t===void 0?5:t,r=n1(e,cne),i=a1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,yL.default)(s)&&(0,yL.default)(c)&&!(0,_.isValidElement)(l)&&!(0,HL.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,HL.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=u1(i);var m=h1(a),h=sR(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return f1(i,p,h);var g=m?p1(i):m1(i);return _.createElement(DG,l1({className:pa(`recharts-label`,d)},h,g,{breakAll:f}),p)}g1.displayName=`Label`;var _1=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Z(m)&&Z(h)){if(Z(u)&&Z(d))return{x:u,y:d,width:m,height:h};if(Z(f)&&Z(p))return{x:f,y:p,width:m,height:h}}return Z(u)&&Z(d)?{x:u,y:d,width:0,height:0}:Z(t)&&Z(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},v1=function(e,t){return e?e===!0?_.createElement(g1,{key:`label-implicit`,viewBox:t}):SL(e)?_.createElement(g1,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===g1?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(g1,{key:`label-implicit`,content:e,viewBox:t}):(0,HL.default)(e)?_.createElement(g1,{key:`label-implicit`,content:e,viewBox:t}):(0,ML.default)(e)?_.createElement(g1,l1({viewBox:t},e,{key:`label-implicit`})):null:null};g1.parseViewBox=_1,g1.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=_1(e),a=eR(r,g1).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[v1(e.label,t||i)].concat(X$(a)):a};var y1=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function b1(e){"@babel/helpers - typeof";return b1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b1(e)}var x1=[`valueAccessor`],S1=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function C1(e){return D1(e)||E1(e)||T1(e)||w1()}function w1(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T1(e,t){if(e){if(typeof e==`string`)return O1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O1(e,t)}}function E1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function D1(e){if(Array.isArray(e))return O1(e)}function O1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function I1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var L1=function(e){return Array.isArray(e.value)?(0,y1.default)(e.value):e.value};function R1(e){var t=e.valueAccessor,n=t===void 0?L1:t,r=F1(e,x1),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=F1(r,S1);return!i||!i.length?null:_.createElement(SR,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,yL.default)(a)?n(e,t):$Q(e&&e.payload,a),i=(0,yL.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(g1,k1({},sR(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:g1.parseViewBox((0,yL.default)(o)?e:j1(j1({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}R1.displayName=`LabelList`;function z1(e,t){return e?e===!0?_.createElement(R1,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,HL.default)(e)?_.createElement(R1,{key:`labelList-implicit`,data:t,content:e}):(0,ML.default)(e)?_.createElement(R1,k1({data:t},e,{key:`labelList-implicit`})):null:null}function B1(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=eR(r,R1).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[z1(e.label,t)].concat(C1(i)):i}R1.renderCallByParent=B1;function V1(e){"@babel/helpers - typeof";return V1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V1(e)}function H1(){return H1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)}, - ${u.x},${u.y} - `;if(r>0){var f=U$(t,n,r,a),p=U$(t,n,r,c);d+=`L ${p.x},${p.y} - A ${r},${r},0, - ${+(Math.abs(s)>180)},${+(a<=c)}, - ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},Z1=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=bL(l-c),d=Y1({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=Y1({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} - a${a},${a},0,0,1,${a*2},0 - a${a},${a},0,0,1,${-a*2},0 - `:X1({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} - A${a},${a},0,0,${+(u<0)},${f.x},${f.y} - A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y} - A${a},${a},0,0,${+(u<0)},${_.x},${_.y} - `;if(r>0){var x=Y1({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=Y1({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} - A${a},${a},0,0,${+(u<0)},${E.x},${E.y} - A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y} - A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},Q1={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$1=function(e){var t=W1(W1({},Q1),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?Z1({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):X1({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,H1({},sR(t,!0),{className:f,d:h,role:`img`}))};function e0(e){"@babel/helpers - typeof";return e0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e0(e)}function t0(){return t0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),h0=o(((e,t)=>{var n=m0();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),g0=o(((e,t)=>{t.exports=h0()()})),{getOwnPropertyNames:_0,getOwnPropertySymbols:v0}=Object,{hasOwnProperty:y0}=Object.prototype;function b0(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function x0(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function S0(e){return e?.[Symbol.toStringTag]}function C0(e){return _0(e).concat(v0(e))}var w0=Object.hasOwn||((e,t)=>y0.call(e,t));function T0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var E0=`__v`,D0=`__o`,O0=`_owner`,{getOwnPropertyDescriptor:k0,keys:A0}=Object;function j0(e,t){return e.byteLength===t.byteLength&&W0(new Uint8Array(e),new Uint8Array(t))}function M0(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function N0(e,t){return e.byteLength===t.byteLength&&W0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function P0(e,t){return T0(e.getTime(),t.getTime())}function F0(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function I0(e,t){return e===t}function L0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var R0=T0;function z0(e,t,n){let r=A0(e),i=r.length;if(A0(t).length!==i)return!1;for(;i-- >0;)if(!K0(e,t,n,r[i]))return!1;return!0}function B0(e,t,n){let r=C0(e),i=r.length;if(C0(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!K0(e,t,n,a)||(o=k0(e,a),s=k0(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function V0(e,t){return T0(e.valueOf(),t.valueOf())}function H0(e,t){return e.source===t.source&&e.flags===t.flags}function U0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function W0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function G0(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function K0(e,t,n,r){return(r===O0||r===D0||r===E0)&&(e.$$typeof||t.$$typeof)?!0:w0(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var q0=`[object ArrayBuffer]`,J0=`[object Arguments]`,Y0=`[object Boolean]`,X0=`[object DataView]`,Z0=`[object Date]`,Q0=`[object Error]`,$0=`[object Map]`,e2=`[object Number]`,t2=`[object Object]`,n2=`[object RegExp]`,r2=`[object Set]`,i2=`[object String]`,a2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},o2=`[object URL]`,s2=Object.prototype.toString;function c2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=s2.call(h);if(b===Z0)return r(h,g,_);if(b===n2)return u(h,g,_);if(b===$0)return o(h,g,_);if(b===r2)return d(h,g,_);if(b===t2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===o2)return p(h,g,_);if(b===Q0)return i(h,g,_);if(b===J0)return c(h,g,_);if(a2[b])return f(h,g,_);if(b===q0)return e(h,g,_);if(b===X0)return n(h,g,_);if(b===Y0||b===e2||b===i2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=S0(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function l2({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:j0,areArraysEqual:n?B0:M0,areDataViewsEqual:N0,areDatesEqual:P0,areErrorsEqual:F0,areFunctionsEqual:I0,areMapsEqual:n?b0(L0,B0):L0,areNumbersEqual:R0,areObjectsEqual:n?B0:z0,arePrimitiveWrappersEqual:V0,areRegExpsEqual:H0,areSetsEqual:n?b0(U0,B0):U0,areTypedArraysEqual:n?b0(W0,B0):W0,areUrlsEqual:G0,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=x0(r.areArraysEqual),t=x0(r.areMapsEqual),n=x0(r.areObjectsEqual),i=x0(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function u2(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function d2({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var f2=p2();p2({strict:!0}),p2({circular:!0}),p2({circular:!0,strict:!0}),p2({createInternalComparator:()=>T0}),p2({strict:!0,createInternalComparator:()=>T0}),p2({circular:!0,createInternalComparator:()=>T0}),p2({circular:!0,createInternalComparator:()=>T0,strict:!0});function p2(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=c2(l2(e));return d2({circular:t,comparator:a,createState:r,equals:n?n(a):u2(a),strict:i})}function m2(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function h2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):m2(r)})}function g2(e){"@babel/helpers - typeof";return g2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g2(e)}function _2(e){return S2(e)||x2(e)||y2(e)||v2()}function v2(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y2(e,t){if(e){if(typeof e==`string`)return b2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b2(e,t)}}function b2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=X2(t,r),c=X2(n,i),l=Z2(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T4(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function E4(e){return A4(e)||k4(e)||O4(e)||D4()}function D4(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O4(e,t){if(e){if(typeof e==`string`)return j4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j4(e,t)}}function k4(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function A4(e){if(Array.isArray(e))return j4(e)}function j4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function K4(e){return K4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K4(e)}var q4=function(e){B4(n,e);var t=H4(n);function n(e,r){var i;F4(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(W4(i)),i.changeStyle=i.changeStyle.bind(W4(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),U4(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},U4(i);i.state={style:s?P4({},s,c):c}}else i.state={style:{}};return i}return L4(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?P4({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(f2(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?P4({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(N4(N4({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=b4(n,r,e4(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(E4(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(E4(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=P2(f,a,s),m=N4(N4(N4({},d.style),c),{},{transition:p});return[].concat(E4(e),[m,a,u]).filter(j2)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=C2();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?P4({},r,i):i,f=P2(Object.keys(d),n,a);u.start([o,t,N4(N4({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=w4(e,C4),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,N4(N4({},i),{},{style:N4(N4({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);q4.displayName=`Animate`,q4.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},q4.propTypes={from:x4.default.oneOfType([x4.default.object,x4.default.string]),to:x4.default.oneOfType([x4.default.object,x4.default.string]),attributeName:x4.default.string,duration:x4.default.number,begin:x4.default.number,easing:x4.default.oneOfType([x4.default.string,x4.default.func]),steps:x4.default.arrayOf(x4.default.shape({duration:x4.default.number.isRequired,style:x4.default.object.isRequired,easing:x4.default.oneOfType([x4.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),x4.default.func]),properties:x4.default.arrayOf(`string`),onAnimationEnd:x4.default.func})),children:x4.default.oneOfType([x4.default.node,x4.default.func]),isActive:x4.default.bool,canBegin:x4.default.bool,onAnimationEnd:x4.default.func,shouldReAnimate:x4.default.bool,onAnimationStart:x4.default.func,onAnimationReStart:x4.default.func};var J4=q4;function Y4(e){"@babel/helpers - typeof";return Y4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Y4(e)}function X4(){return X4=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, - ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c}, - ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c}, - ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p} - A ${p},${p},0,0,${c},${e+s*p},${t} - L ${e+n-s*p},${t} - A ${p},${p},0,0,${c},${e+n},${t+o*p} - L ${e+n},${t+r-o*p} - A ${p},${p},0,0,${c},${e+n-s*p},${t+r} - L ${e+s*p},${t+r} - A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},l3=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},u3={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},d3=function(e){var t=i3(i3({},u3),e),n=(0,_.useRef)(),r=Z4((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=pa(`recharts-rectangle`,d);return g?_.createElement(J4,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(J4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,X4({},sR(t,!0),{className:v,d:c3(o,s,r,a,u),ref:n})))}):_.createElement(`path`,X4({},sR(t,!0),{className:v,d:c3(o,s,c,l,u)}))};function f3(){return f3=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function C3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var w3=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},T3=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=S3(e,h3),h=v3({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Z(n)||!Z(i)||!Z(u)||!Z(f)||!Z(o)||!Z(c)?null:_.createElement(`path`,g3({},sR(h,!0),{className:pa(`recharts-cross`,p),d:w3(n,i,u,f,o,c)}))},E3=o(((e,t)=>{t.exports=yV()(Object.getPrototypeOf,Object)})),D3=o(((e,t)=>{var n=qI(),r=E3(),i=JI(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),O3=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function k3(e){"@babel/helpers - typeof";return k3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k3(e)}function A3(){return A3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(J4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,A3({},sR(t,!0),{className:g,d:H3(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,A3({},sR(t,!0),{className:g,d:H3(o,s,c,l,u)})))},G3=l(D3()),K3=l(O3()),q3=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function J3(e){"@babel/helpers - typeof";return J3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},J3(e)}function Y3(e,t){if(e==null)return{};var n=X3(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function X3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Z3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q3(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),v6=o(((e,t)=>{var n=sW(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),y6=o(((e,t)=>{var n=_6(),r=qH(),i=v6();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=y6()()}));function x6(e){"@babel/helpers - typeof";return x6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x6(e)}function S6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C6(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),W6(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),W6(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),W6(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),W6(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),W6(n,`handleSlideDragStart`,function(e){var t=J6(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return H6(t,e),I6(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=$Q(n[e],i,e);return(0,HL.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=J6(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(W6(W6({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(W6({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=N6(N6({},sR(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(SR,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(SR,{className:`recharts-brush-texts`},_.createElement(DG,j6({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(DG,j6({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Z(i)||!Z(a)||!Z(o)||!Z(s)||o<=0||s<=0)return null;var g=pa(`recharts-brush`,n),v=_.Children.count(r)===1,y=O6(`userSelect`,`none`);return _.createElement(SR,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,HL.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return N6({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?q6({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);W6(Y6,`displayName`,`Brush`),W6(Y6,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var X6=o(((e,t)=>{var n=NH();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),Z6=o(((e,t)=>{var n=JB(),r=KV(),i=X6(),a=UI(),o=qH();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),Q6=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},$6=o(((e,t)=>{var n=HH();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),e8=o(((e,t)=>{var n=$6(),r=jH(),i=KV();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),t8=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=NH();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),r8=o(((e,t)=>{var n=t8(),r=n8(),i=KV(),a=UI(),o=qH();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),i8=[`x`,`y`];function a8(e){"@babel/helpers - typeof";return a8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a8(e)}function o8(){return o8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function p8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function m8(e,t){var n=e.x,r=e.y,i=f8(e,i8),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return c8(c8(c8(c8(c8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function h8(e){return _.createElement(o6,o8({shapeType:`rectangle`,propTransformer:m8,activeClassName:`recharts-active-bar`},e))}var g8=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Z(n)||sne(n);return i?e(n,r):(!i&&iQ(!1),t)}},_8=[`value`,`background`],v8;function y8(e){"@babel/helpers - typeof";return y8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y8(e)}function b8(e,t){if(e==null)return{};var n=x8(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function x8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function S8(){return S8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=TL(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=m$(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),g$(j);var N=S$(j,K8(K8({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=K8(K8(K8({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=M$(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),K8(K8({},a),{},q8({},o,P))},{})},Z8=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},Q8=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Z8({x:t,y:n},{x:r,y:i})},$8=function(){function e(t){H8(this,e),this.scale=t}return W8(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();q8($8,`EPS`,1e-4);var e5=function(e){var t=Object.keys(e).reduce(function(t,n){return K8(K8({},t),{},q8({},n,$8.create(e[n])))},{});return K8(K8({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,z8.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,B8.default)(e,function(e,n){return t[n].isInRange(e)})}})};function t5(e){return(e%180+180)%180}var n5=function(e){var t=e.width,n=e.height,r=t5(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=KV(),r=SV(),i=CV();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),i5=o(((e,t)=>{var n=v6();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),a5=o(((e,t)=>{var n=qV(),r=KV(),i=i5(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),o5=o(((e,t)=>{t.exports=r5()(a5())})),s5=(0,l(cL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});o5();var c5=(0,_.createContext)(void 0),l5=(0,_.createContext)(void 0),u5=(0,_.createContext)(void 0),d5=(0,_.createContext)({}),f5=(0,_.createContext)(void 0),p5=(0,_.createContext)(0),m5=(0,_.createContext)(0),h5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=s5(i);return _.createElement(c5.Provider,{value:n},_.createElement(l5.Provider,{value:r},_.createElement(d5.Provider,{value:i},_.createElement(u5.Provider,{value:l},_.createElement(f5.Provider,{value:a},_.createElement(p5.Provider,{value:c},_.createElement(m5.Provider,{value:s},o)))))))},g5=function(){return(0,_.useContext)(f5)},_5=function(e){var t=(0,_.useContext)(c5);t??iQ(!1);var n=t[e];return n??iQ(!1),n},v5=function(e){var t=(0,_.useContext)(l5);t??iQ(!1);var n=t[e];return n??iQ(!1),n},y5=function(){return(0,_.useContext)(u5)},b5=function(){return(0,_.useContext)(m5)},x5=function(){return(0,_.useContext)(p5)},S5=l(Z6());function C5(e){"@babel/helpers - typeof";return C5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C5(e)}function w5(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function T5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Ene(e,t){return y7(e,t+1)}function Dne(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:y7(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||b7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function x7(e){"@babel/helpers - typeof";return x7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x7(e)}function S7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=C7(C7({},r),{},{tickCoord:r.coordinate});b7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=C7(C7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function Mne(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=C7(C7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),b7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=C7(C7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=C7(C7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=C7(C7({},r),{},{tickCoord:r.coordinate});b7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=C7(C7({},r),{},{isShow:!0}))},h=0;h=2?bL(i[1].coordinate-i[0].coordinate):1,_=Tne(a,g,p);return c===`equidistantPreserveStart`?Dne(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?Mne(g,_,h,i,o,c===`preserveStartEnd`):jne(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var Pne=[`viewBox`],Fne=[`viewBox`],Ine=[`ticks`];function w7(e){"@babel/helpers - typeof";return w7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},w7(e)}function T7(){return T7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Rne(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function k7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(SR,{className:pa(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),g1.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=pa(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,D7(D7({},t),{},{className:i})):(0,HL.default)(e)?e(D7(D7({},t),{},{className:i})):_.createElement(DG,T7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);N7(F7,`displayName`,`CartesianAxis`),N7(F7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var Gne=[`type`,`layout`,`connectNulls`,`ref`],Kne=[`key`];function I7(e){"@babel/helpers - typeof";return I7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},I7(e)}function L7(e,t){if(e==null)return{};var n=qne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function R7(){return R7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(V7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(V7(t.repeat(i,o)),V7(l),f).map(function(e){return`${e}px`}).join(`, `)}),q7(e,`id`,wL(`recharts-line-`)),q7(e,`pathRef`,function(t){e.mainCurve=t}),q7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),q7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return rre(t,e),$ne(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=eR(s,kQ);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:$Q(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(SR,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=sR(this.props,!1),l=sR(a,!0),u=o.map(function(e,n){var r=B7(B7(B7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(SR,R7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=B7(B7(B7({},sR(L7(i,Gne),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(p0,R7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(J4,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=OL(r.x,e.x),a=OL(r.y,e.y);return B7(B7({},e),{},{x:i(o),y:a(o)})}if(d){var c=OL(f*2,e.x),l=OL(p/2,e.y);return B7(B7({},e),{},{x:c(o),y:l(o)})}return B7(B7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=OL(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,BQ.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=pa(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,yL.default)(f)?this.id:f,x=sR(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(aR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(SR,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&R1.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(V7(e),[0]),r=[],i=0;ie.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Hre(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function j9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Z(r)&&Z(i)?e.slice(r,i+1):[]};function U9(e){return e===`number`?[0,`auto`]:void 0}var W9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=H9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?kL(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(F9(i),[P$(s,l)]):i},[])},G9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=eie(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=t$(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:W9(e,t,l,u),activeCoordinate:tie(n,o,l,i)}}return null},nie=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=u$(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=H9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;kre(p.domain,g,m)&&(w=j$(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=e$(S,h,`category`)));var D=U9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=e$(S,h,m),m===`category`&&f){var k=DL(w);_&&k?(T=w,w=(0,k6.default)(0,C)):_||(w=N$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(F9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,yL.default)(e)}):N$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,yL.default)(t)?e:[].concat(F9(e),[t])},[]);else if(m===`number`){var A=c$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=e$(S,h,`category`))}else w=f?(0,k6.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:O$(o[x].stackGroups,s,c):l$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=g9(u,w,x,i,y),O&&(w=j$(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},$({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},rie=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=H9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=u$(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=U9(`number`);if(!e[h]){m++;var _;return p?_=(0,k6.default)(0,f):o&&o[h]&&o[h].hasStack?(_=O$(o[h].stackGroups,s,c),_=g9(u,_,h,i)):(_=j$(g,l$(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=g9(u,_,h,i)),Q(Q({},e),{},$({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,vL.default)(Qre,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},iie=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=eR(l,i),f={};return d&&d.length?f=nie(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=rie(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},aie=function(e){var t=EL(e),n=d$(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,JH.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:M$(t,n)}},K9=function(e){var t=e.children,n=e.defaultShowTooltip,r=tR(t,Y6),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},oie=function(e){return!e||!e.length?!1:e.some(function(e){var t=XL(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},q9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},sie=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=tR(u,Y6),p=tR(u,EH),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,(0,vL.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||Y6.defaultProps.height),p&&t&&(h=a$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},cie=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},J9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=q9(u),h=m.numericAxisName,g=m.cateAxisName,_=oie(n),v=[];return n.forEach(function(n,m){var y=H9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&iQ(!1);var a=r[i];return Q(Q({},e),{},$($({},n.axisType,a),`${n.axisType}Ticks`,d$(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&E$(n,r[C].stackGroups),k=XL(n.type).indexOf(`Bar`)>=0,A=M$(E,D),j=[],M=_&&r$({barSize:l,stackGroups:r,totalSize:cie(T,g)});if(k){var N=(0,yL.default)(S)?p:S,P=M$(E,D,!0)??N??0;j=i$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:Q(Q({},F(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},$($($({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:fR(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!nR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=q9(f),_=g.numericAxisName,v=g.cateAxisName,y=eR(u,n),b=x$(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},$({},n,iie(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=sie(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=aie(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return Hre(this,n),r=Wre(this,n,[e]),$(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),$(r,`accessibilityManager`,new Ore),$(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),$(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),$(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),$(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,HL.default)(i)&&i(n,e)}}),$(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,HL.default)(i)&&i(n,e)}),$(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),$(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),$(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),$(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,HL.default)(n)&&n(t,e)}),$(r,`handleOuterEvent`,function(e){var t=dR(e),n=(0,vL.default)(r.props,`${t}`);t&&(0,HL.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),$(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,HL.default)(i)&&i(n,e)}}),$(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),$(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),$(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),$(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&_9.emit(v9,r.props.syncId,e,r.eventEmitterSymbol)}),$(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=kL(m,k,u),O=h&&g&&kL(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,yL.default)(D))return[T].concat(F9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,Q(Q(Q({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),$(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),$(r,`renderMap`,{CartesianGrid:{handler:V9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:V9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:V9},YAxis:{handler:V9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??wL(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,lW.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return qre(n,e),Ure(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=tR(t,rW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=W9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){cR([tR(e.children,rW)],[tR(this.props.children,rW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=tR(this.props.children,rW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=IW(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=G9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=EL(c).scale,p=EL(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=EL(c);return J$({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=tR(e,rW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},zL(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){_9.on(v9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){_9.removeListener(v9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=Rs();(0,_.useEffect)(()=>{let t=!1;return av(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,V.jsxs)(vv,{className:`p-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,V.jsx)(Sa,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,V.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,V.jsx)(La,{className:`w-4 h-4 text-purple-400`}),(0,V.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,V.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,V.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{className:`pb-2`,children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,V.jsx)(Ma,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Loss`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,V.jsx)(vv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(SW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(J9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(i9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(p9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,V.jsx)(rW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,V.jsx)(Y7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{className:`pb-2`,children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,V.jsx)(Sa,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,V.jsx)(vv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(SW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(J9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(i9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(p9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,V.jsx)(rW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,V.jsx)(Y7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},uie=({logs:e,logContainerRef:t})=>(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,V.jsx)(Ga,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,V.jsx)(vv,{children:(0,V.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,V.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,V.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,V.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),die=({installHint:e})=>{let t=FI(`system/training-extra`);return(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:t.state}),II(t.state,`Training Extra Not Installed`)]})}),(0,V.jsx)(vv,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`training`})})})]})})},fie=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=FI(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:o.state}),II(o.state,s)]}),(0,V.jsxs)(Ou,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training a `,(0,V.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`${n} training`})})})]})})},pie=()=>{let{auth:e,refetch:t}=Vs(),{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,V.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,V.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,V.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,V.jsx)(Ha,{className:`w-3 h-3`})]}),` `,`with `,(0,V.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,V.jsx)(Sh,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,V.jsx)(G,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,V.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},mie=1e3,Y9=5e3;function hie(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function gie(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset}}var _ie=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{auth:n}=Vs(),{toast:r}=_r(),i=Re(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:Ie().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),Xv(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{tv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),dv(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await ov(e,t,gie(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),tv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(die,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(pie,{}),(0,V.jsx)(Ote,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,V.jsx)(G,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`span`,{tabIndex:0,children:e})}),(0,V.jsx)(Kp,{children:P})]}):e})()})]}),b&&(0,V.jsx)(fie,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},vie=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),i=Re(),{selectedRecord:a}=Vv(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return iv(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{bv(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await nv(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await rv(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>Y9?t.slice(t.length-Y9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},mie);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await cv(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await lv(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,V.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,V.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,V.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,V.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,V.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,V.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,V.jsxs)(G,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,V.jsxs)(G,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(so,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,V.jsx)(lie,{jobId:e,trainingStatus:hie(o,!1),getProgressPercentage:S,formatTime:x}),(0,V.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,V.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Sv,{checkpoints:p,selectedStep:h,onChange:g}),(0,V.jsxs)(G,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,V.jsx)(Xa,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,V.jsx)(Iv,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,V.jsx)(uie,{logs:u,logContainerRef:f})]})})},X9=()=>{let{jobId:e}=Be();return e?(0,V.jsx)(vie,{jobId:e}):(0,V.jsx)(_ie,{})},yie=1e3;function Z9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var bie=()=>{let e=Re(),{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await Mv(t,n)}catch{}},s=async()=>{try{let s=await Nv(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,yie);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await Mv(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(Bj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:Z9(h?f:d)}),(0,V.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${Z9(p)}`})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,V.jsxs)(G,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,V.jsx)(bI,{open:o,onOpenChange:s,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Stop inference?`}),(0,V.jsx)(DI,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,V.jsx)(OI,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},xie=()=>(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col items-center justify-center p-4`,children:[(0,V.jsx)(`h1`,{className:`text-5xl font-bold tracking-tight`,children:`Edit Dataset`}),(0,V.jsx)(`p`,{className:`mt-4 text-xl text-gray-400`,children:`This page is under construction.`})]}),Sie=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,V.jsxs)(`span`,{children:[a.message||e,` `,(0,V.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,V.jsx)(G,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,V.jsx)(Ma,{className:`w-8 h-8 text-green-500`}):(0,V.jsx)(za,{className:`w-8 h-8 text-blue-500`}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,V.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,V.jsx)(Ma,{className:`w-6 h-6 text-green-500`}),(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,V.jsxs)(G,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,V.jsx)(G,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,V.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,V.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,V.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,V.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,V.jsx)(Sh,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(Kh,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,V.jsx)(Ua,{className:`w-4 h-4 text-gray-400`}):(0,V.jsx)(Wa,{className:`w-4 h-4 text-gray-400`}),(0,V.jsx)(kh,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,V.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,V.jsxs)(G,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,V.jsx)(Ha,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(G,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lo,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,V.jsx)(G,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,V.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,V.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,V.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,V.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,V.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,V.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,V.jsx)(bI,{open:y,onOpenChange:b,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Delete dataset from disk?`}),(0,V.jsxs)(DI,{className:`text-gray-400`,children:[`This permanently removes `,(0,V.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,V.jsx)(OI,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Cie=()=>{let e=Ie();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,V.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,V.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},wie=`lelab-tabs-v1`,Tie=1e3,Eie=3e3,Die=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Eie;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(wie);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Tie),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,V.jsxs)(V.Fragment,{children:[e,!t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,V.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,V.jsx)(G,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Oie=()=>{let{toast:e}=_r();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function kie(){let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(Qv())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Aie=()=>{let{status:e,open:t,dismiss:n}=kie(),{baseUrl:r,fetchWithHeaders:i}=Rs(),{toast:a}=_r(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,V.jsx)(xu,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(io,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,V.jsxs)(Ou,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,V.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,V.jsx)(og,{className:`pt-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,V.jsx)(G,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]})})]}),u&&(0,V.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,V.jsx)(Kh,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,V.jsx)(G,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},jie=new mn;function Mie(){return(0,V.jsx)(_n,{client:jie,children:(0,V.jsx)(hp,{children:(0,V.jsx)(yn,{children:(0,V.jsx)(Ls,{children:(0,V.jsx)(Bs,{children:(0,V.jsx)(nr,{children:(0,V.jsx)(ar,{children:(0,V.jsxs)(pt,{children:[(0,V.jsxs)(Die,{children:[(0,V.jsx)(Oie,{}),(0,V.jsx)(Aie,{}),(0,V.jsxs)(ct,{children:[(0,V.jsx)(ot,{path:`/`,element:(0,V.jsx)(ey,{})}),(0,V.jsx)(ot,{path:`/teleoperation`,element:(0,V.jsx)(Hj,{})}),(0,V.jsx)(ot,{path:`/recording`,element:(0,V.jsx)(AI,{})}),(0,V.jsx)(ot,{path:`/upload`,element:(0,V.jsx)(Sie,{})}),(0,V.jsx)(ot,{path:`/training`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/training/:jobId`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/inference`,element:(0,V.jsx)(bie,{})}),(0,V.jsx)(ot,{path:`/calibration`,element:(0,V.jsx)(yM,{})}),(0,V.jsx)(ot,{path:`/edit-dataset`,element:(0,V.jsx)(xie,{})}),(0,V.jsx)(ot,{path:`*`,element:(0,V.jsx)(Cie,{})})]})]}),(0,V.jsx)(ys,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(Mie,{})); \ No newline at end of file diff --git a/frontend/dist/assets/index-Vh3JnQ1R.js b/frontend/dist/assets/index-Vh3JnQ1R.js new file mode 100644 index 00000000..1ff7d107 --- /dev/null +++ b/frontend/dist/assets/index-Vh3JnQ1R.js @@ -0,0 +1,3956 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ie(e):``}function se(e){switch(e.tag){case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ce(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function L(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fe(e){e._valueTracker||=L(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function R(e,t){var n=t.checked;return ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function he(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function z(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ge(e,t){z(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ve(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ae={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ae).forEach(function(e){je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ae[t]=Ae[e]})});function Me(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ae.hasOwnProperty(e)&&Ae[e]?(``+t).trim():t+`px`}function Ne(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Me(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Pe=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fe(e,t){if(t){if(Pe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ie(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Le=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,Ve=null;function He(e){if(e=zi(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),ze(e.stateNode,e.type,t))}}function Ue(e){Be?Ve?Ve.push(e):Ve=[e]:Be=e}function We(){if(Be){var e=Be,t=Ve;if(Ve=Be=null,He(e),t)for(e=0;e>>=0,e===0?32:31-(Dt(e)/Ot|0)|0}var At=64,jt=4194304;function Mt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Mt(a))):r=Mt(s)}else o=n&~i,o===0?a!==0&&(r=Mt(a)):r=Mt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function B(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Fr(e){var t=Nr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mr(n.ownerDocument.documentElement,n)){if(r!==null&&Pr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=jr(n,a);var o=jr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,U=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||U==null||U!==me(r)||(r=U,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function Ki(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var qi={},Ji=Wi(qi),Yi=Wi(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qi(e){return e=e.childContextTypes,e!=null}function $i(){Gi(Yi),Gi(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));Ki(Ji,t),Ki(Yi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return ne({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qi,Xi=Ji.current,Ki(Ji,e),Ki(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,Gi(Yi),Gi(Ji),Ki(Ji,e)):Gi(Yi),Ki(Yi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=Vt;try{var n=ia;for(Vt=1;e>=o,i-=o,_a=1<<32-Et(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ta&&ya(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ta&&ya(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ta&&ya(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ta&&ya(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&za(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=La(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=iu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ru(i.type,i.key,i.props,null,e.mode,o),o.ref=La(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=su(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ye(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Ra(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=ou(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Va=Ba(!0),Ha=Ba(!1),Ua=Wi(null),Wa=null,Ga=null,Ka=null;function qa(){Ka=Ga=Wa=null}function Ja(e){var t=Ua.current;Gi(Ua),e._currentValue=t}function Ya(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xa(e,t){Wa=e,Ka=Ga=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Za(e){var t=e._currentValue;if(Ka!==e)if(e={context:e,memoizedValue:t,next:null},Ga===null){if(Wa===null)throw Error(r(308));Ga=e,Wa.dependencies={lanes:0,firstContext:e}}else Ga=Ga.next=e;return t}var Qa=null;function $a(e){Qa===null?Qa=[e]:Qa.push(e)}function eo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,$a(t)):(n.next=i.next,i.next=n),t.interleaved=n,to(e,r)}function to(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ao(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,to(e,n)}return i=r.interleaved,i===null?(t.next=t,$a(r)):(t.next=i.next,i.next=t),r.interleaved=t,to(e,n)}function so(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}function co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lo(e,t,n,r){var i=e.updateQueue;no=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=ne({},d,f);break a;case 2:no=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);tl|=o,e.lanes=o,e.memoizedState=d}}function uo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{Vt=n,Eo.transition=r}}function fs(){return Bo().memoizedState}function ps(e,t,n){var r=bl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e))gs(t,n);else if(n=eo(e,t,n,r),n!==null){var i=yl();xl(n,e,r,i),_s(n,t,r)}}function ms(e,t,n){var r=bl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))gs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o)){var c=t.interleaved;c===null?(i.next=i,$a(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=eo(e,t,i,r),n!==null&&(i=yl(),xl(n,e,r,i),_s(n,t,r))}}function hs(e){var t=e.alternate;return e===Oo||t!==null&&t===Oo}function gs(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _s(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var vs={readContext:Za,useCallback:Fo,useContext:Fo,useEffect:Fo,useImperativeHandle:Fo,useInsertionEffect:Fo,useLayoutEffect:Fo,useMemo:Fo,useReducer:Fo,useRef:Fo,useState:Fo,useDebugValue:Fo,useDeferredValue:Fo,useTransition:Fo,useMutableSource:Fo,useSyncExternalStore:Fo,useId:Fo,unstable_isNewReconciler:!1},ys={readContext:Za,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:Za,useEffect:ns,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),es(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){return es(4,2,e,t)},useMemo:function(e,t){var n=zo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ps.bind(null,Oo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:Zo,useDebugValue:cs,useDeferredValue:function(e){return zo().memoizedState=e},useTransition:function(){var e=Zo(!1),t=e[0];return e=ds.bind(null,e[1]),zo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Oo,a=zo();if(Ta){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Jc===null)throw Error(r(349));Do&30||Ko(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Jo.bind(null,i,o,e),[e]),i.flags|=2048,Qo(9,qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=zo(),t=Jc.identifierPrefix;if(Ta){var n=va,r=_a;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=No++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ie(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;osl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=So(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ta)return fc(t),null}else 2*gt()-s.renderingStartTime>sl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=gt(),t.sibling=null,n=xo.current,Ki(xo,i?n&1|2:n&1),t);case 22:case 23:return jl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Zc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Sa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vo(),Gi(Yi),Gi(Ji),wo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bo(t),null;case 13:if(Gi(xo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(xo),null;case 4:return vo(),null;case 10:return Ja(t.type._context),null;case 22:case 23:return jl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Gl(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Gl(e,t,n)}}var bc=!1;function xc(e,t){if(bi=mn,e=Nr(),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},mn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ss(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Gl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var Ac=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount==`function`)try{wt.onCommitFiberUnmount(Ct,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=Ac,i=jc;Ac=null,Mc(e,t,n),Ac=r,jc=i,Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ac.removeChild(n.stateNode));break;case 18:Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),fn(e)):Oi(Ac,n.stateNode));break;case 4:r=Ac,i=jc,Ac=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),Ac=r,jc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Gl(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Mc(e,t,n),gc=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Yl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=gt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10e?16:e,pl===null)var i=!1;else{if(e=pl,pl=null,ml=0,qc&6)throw Error(r(331));var a=qc;for(qc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lgt()-ol?Ml(e,0):rl|=n),Sl(e,t)}function ql(e,t){t===0&&(e.mode&1?(t=jt,jt<<=1,!(jt&130023424)&&(jt=4194304)):t=1);var n=yl();e=to(e,t),e!==null&&(zt(e,t,n),Sl(e,n))}function Jl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ql(e,n)}function Yl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),ql(e,n)}var Xl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Ta&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Xa(t,n),a=Lo(null,t,i,e,a,n);var o=Ro();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ro(t),a.updater=ws,t.stateNode=a,a._reactInternals=t,Os(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,Ta&&o&&xa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=tu(i),e=Ss(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,Ss(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,io(e,t),lo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=ks(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=ks(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(wa=ki(t.stateNode.containerInfo.firstChild),Ca=t,Ta=!0,Ea=null,n=Ha(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Pa(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return yo(t),e===null&&Aa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Aa(t),null;case 13:return Qs(e,t,n);case 4:return _o(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Va(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ua,i._currentValue),i._currentValue=s,o!==null)if(Or(o.value,s)){if(o.children===a.children&&!Yi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ao(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ya(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ya(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Xa(t,n),a=Za(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=Ss(i,t.pendingProps),a=Ss(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),ac(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Xa(t,n),Es(t,i,a),Os(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Zl(e,t){return ft(e,t)}function Ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $l(e,t,n,r){return new Ql(e,t,n,r)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tu(e){if(typeof e==`function`)return+!!eu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function nu(e,t){var n=e.alternate;return n===null?(n=$l(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ru(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)eu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return iu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=$l(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=$l(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=$l(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return au(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=$l(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function iu(e,t,n,r){return e=$l(7,e,r,t),e.lanes=n,e}function au(e,t,n,r){return e=$l(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function ou(e,t,n){return e=$l(6,e,null,t),e.lanes=n,e}function su(e,t,n){return t=$l(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lu(e,t,n,r,i,a,o,s,c){return e=new cu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=$l(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ro(a),e}function uu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d()),v=l(h()),y=g();function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function j(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=x.Pop,c=null,l=u();l??(l=0,o.replaceState(b({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=x.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=x.Push;let r=O(h.location,e,t);n&&n(r,e),l=u()+1;let d=D(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=x.Replace;let r=O(h.location,e,t);n&&n(r,e),l=u();let i=D(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:k(e);return n=n.replace(/ $/,`%20`),w(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var M;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(M||={});function N(e,t,n){return n===void 0&&(n=`/`),P(e,t,n,!1)}function P(e,t,n,r){let i=pe((typeof t==`string`?A(t):t).pathname||`/`,n);if(i==null)return null;let a=F(e);ee(a);let o=null,s=fe(i);for(let e=0;o==null&&e{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(w(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=xe([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),F(e.children,t,c,s)),!(e.path==null&&!e.index)&&t.push({path:s,score:ce(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of I(e.path))i(e,t,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ee(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var te=/^:[\w-]+$/,ne=3,re=2,ie=1,ae=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=re),n.filter(e=>!se(e)).reduce((e,t)=>e+(te.test(t)?ne:t===``?ie:ae),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return i&&!c?e[r]=void 0:e[r]=(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function L(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "`+e+`" will be treated as if it were `+(`"`+e.replace(/\*$/,`/*`)+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+(`please change the route path to "`+e.replace(/\*$/,`/*`)+`".`));let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function pe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var me=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R=e=>me.test(e);function he(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;if(n)if(R(n))a=n;else{if(n.includes(`//`)){let e=n;n=be(n),T(!1,`Pathnames cannot have embedded double slashes - normalizing `+(e+` -> `+n))}a=n.startsWith(`/`)?z(n.substring(1),`/`):z(n,t)}else a=t;return{pathname:a,search:Ce(r),hash:we(i)}}function z(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in and the router will parse it for you.`}function _e(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ve(e,t){let n=_e(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function ye(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=A(e):(i=b({},e),w(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/\/\/+/g,`/`),xe=e=>be(e.join(`/`)),Se=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ce=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,we=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Ee=[`post`,`put`,`patch`,`delete`];new Set(Ee);var De=[`get`,...Ee];new Set(De);function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),_.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=ye(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:xe([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}function Be(){let{matches:e}=_.useContext(Ne),t=e[e.length-1];return t?t.params:{}}function Ve(e,t){return He(e,t)}function He(e,t,n,r){!Fe()&&w(!1);let{navigator:i}=_.useContext(je),{matches:a}=_.useContext(Ne),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=Ie(),u;if(t){let e=typeof t==`string`?A(t):t;!(c===`/`||e.pathname?.startsWith(c))&&w(!1),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=N(e,{pathname:f}),m=qe(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:xe([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:xe([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&m?_.createElement(Me.Provider,{value:{location:Oe({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:x.Pop}},m):m}function Ue(){let e=et(),t=Te(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return _.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var We=_.createElement(Ue,null),Ge=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:_.createElement(Ne.Provider,{value:this.props.routeContext},_.createElement(Pe.Provider,{value:this.state.error,children:this.props.component}))}};function Ke(e){let{routeContext:t,match:n,children:r}=e,i=_.useContext(ke);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),_.createElement(Ne.Provider,{value:t},r)}function qe(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&w(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||We,s&&(c<0&&i===0?(rt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?_.createElement(r.route.Component,null):r.route.element?r.route.element:e,_.createElement(Ke,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?_.createElement(Ge,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var Je=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(Je||{}),Ye=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(Ye||{});function Xe(e){let t=_.useContext(ke);return!t&&w(!1),t}function Ze(e){let t=_.useContext(Ae);return!t&&w(!1),t}function Qe(e){let t=_.useContext(Ne);return!t&&w(!1),t}function $e(e){let t=Qe(e),n=t.matches[t.matches.length-1];return!n.route.id&&w(!1),n.route.id}function et(){let e=_.useContext(Pe),t=Ze(Ye.UseRouteError),n=$e(Ye.UseRouteError);return e===void 0?t.errors?.[n]:e}function tt(){let{router:e}=Xe(Je.UseNavigateStable),t=$e(Ye.UseNavigateStable),n=_.useRef(!1);return Le(()=>{n.current=!0}),_.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,Oe({fromRouteId:t},i)))},[e,t])}var nt={};function rt(e,t,n){!t&&!nt[e]&&(nt[e]=!0)}var it=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function at(e,t){e?.v7_startTransition===void 0&&it(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&it(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&it(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&it(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&it(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&it(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function ot(e){w(!1)}function st(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=x.Pop,navigator:a,static:o=!1,future:s}=e;Fe()&&w(!1);let c=t.replace(/^\/*/,`/`),l=_.useMemo(()=>({basename:c,navigator:a,static:o,future:Oe({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=A(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=_.useMemo(()=>{let e=pe(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:_.createElement(je.Provider,{value:l},_.createElement(Me.Provider,{children:n,value:h}))}function ct(e){let{children:t,location:n}=e;return Ve(ut(t),n)}var lt=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(lt||{});new Promise(()=>{}),_.Component;function ut(e,t){t===void 0&&(t=[]);let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,ut(e.props.children,i));return}e.type!==ot&&w(!1),!(!e.props.index||!e.props.children)&&w(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ut(e.props.children,i)),n.push(a)}),n}var dt=`6`;try{window.__reactRouterVersion=dt}catch{}var ft=_.startTransition;function pt(e){let{basename:t,children:n,future:r,window:i}=e,a=_.useRef();a.current??=C({window:i,v5Compat:!0});let o=a.current,[s,c]=_.useState({action:o.action,location:o.location}),{v7_startTransition:l}=r||{},u=_.useCallback(e=>{l&&ft?ft(()=>c(e)):c(e)},[c,l]);return _.useLayoutEffect(()=>o.listen(u),[o,u]),_.useEffect(()=>at(r),[r]),_.createElement(st,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}typeof window<`u`&&window.document!==void 0&&window.document.createElement;var mt;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(mt||={});var ht;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(ht||={});var gt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_t=new class extends gt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},vt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt=new class{#e=vt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function bt(e){setTimeout(e,0)}var xt=typeof window>`u`||`Deno`in globalThis;function St(){}function Ct(e,t){return typeof e==`function`?e(t):e}function wt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Tt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e==`function`?e(t):e}function Dt(e,t){return typeof e==`function`?e(t):e}function Ot(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==At(o,t.options))return!1}else if(!Mt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function kt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jt(t.options.mutationKey)!==jt(a))return!1}else if(!Mt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function At(e,t){return(t?.queryKeyHashFn||jt)(e)}function jt(e){return JSON.stringify(e,(e,t)=>It(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Mt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Mt(e[n],t[n])):!1}var Nt=Object.prototype.hasOwnProperty;function Pt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ft(e)&&Ft(t);if(!r&&!(It(e)&&It(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{yt.setTimeout(t,e)})}function zt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Pt(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vt=Symbol();function Ht(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Vt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Wt=(()=>{let e=()=>xt;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Kt=bt;function qt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Kt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Jt=qt(),Yt=new class extends gt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xt(e){return Math.min(1e3*2**e,3e4)}function Zt(e){return(e??`online`)===`online`?Yt.isOnline():!0}var Qt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $t(e){let t=!1,n=0,r,i=Gt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_t.isFocused()&&(e.networkMode===`always`||Yt.isOnline())&&e.canRun(),u=()=>Zt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wt.isServer()?0:3),o=e.retryDelay??Xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var en=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wt(this.gcTime)&&(this.#e=yt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(yt.clearTimeout(this.#e),this.#e=void 0)}};function tn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ut(e,()=>t.signal,()=>n=!0)},u=Ht(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Bt:B;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rn:nn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:nn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function nn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var an=class extends en{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=cn(this.options);e.data!==void 0&&(this.setState(sn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=zt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Dt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Et(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Tt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ht(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?tn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=$t({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...on(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...sn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Jt.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function on(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function sn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function cn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ln=class extends en{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||un(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$t({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Jt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function un(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var dn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ln({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=fn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kt(t,e))}findAll(e={}){return this.getAll().filter(t=>kt(e,t))}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Jt.batch(()=>Promise.all(e.map(e=>e.continue().catch(St))))}};function fn(e){return e.options.scope?.id}var pn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??At(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Jt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ot(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ot(e,t)):t}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new pn,this.#t=e.mutationCache||new dn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Yt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Jt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Jt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Jt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Jt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(St).catch(St)}invalidateQueries(e,t={}){return Jt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Jt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(St)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(St)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Yt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(jt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Mt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=At(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Vt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},hn=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=hn()}))(),gn=_.createContext(void 0),_n=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(gn.Provider,{value:e,children:t})),vn=(0,_.createContext)({theme:`system`,setTheme:()=>null});function yn({children:e,defaultTheme:t=`system`,storageKey:n=`vite-ui-theme`,...r}){let[i,a]=(0,_.useState)(()=>localStorage.getItem(n)||t);(0,_.useEffect)(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),i===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(i)},[i]);let o=(0,_.useCallback)(e=>{localStorage.setItem(n,e),a(e)},[n]),s=(0,_.useMemo)(()=>({theme:i,setTheme:o}),[i,o]);return(0,V.jsx)(vn.Provider,{...r,value:s,children:e})}var bn=e=>{switch(e){case`success`:return Cn;case`info`:return Tn;case`warning`:return wn;case`error`:return En;default:return null}},xn=Array(12).fill(0),Sn=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},xn.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Cn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),wn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Tn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),En=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Dn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),On=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},kn=1,An=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:kn++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Mn(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||kn++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},jn=(e,t)=>{let n=t?.id||kn++;return An.addToast({title:e,...t,id:n}),n},Mn=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Nn=Object.assign(jn,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:()=>An.toasts,getToasts:()=>An.getActiveToasts()});function Pn(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Pn(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function Fn(e){return e.label!==void 0}var In=3,Ln=`32px`,Rn=`16px`,zn=4e3,Bn=356,Vn=14,Hn=20,Un=200;function Wn(...e){return e.filter(Boolean).join(` `)}function Gn(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kn=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,loadingIcon:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`,pauseWhenPageIsHidden:O}=e,[k,A]=_.useState(null),[j,M]=_.useState(null),[N,P]=_.useState(!1),[F,I]=_.useState(!1),[ee,te]=_.useState(!1),[ne,re]=_.useState(!1),[ie,ae]=_.useState(!1),[oe,se]=_.useState(0),[ce,le]=_.useState(0),ue=_.useRef(n.duration||b||zn),de=_.useRef(null),L=_.useRef(null),fe=c===0,pe=c+1<=o,me=n.type,R=n.dismissible!==!1,he=n.className||``,z=n.descriptionClassName||``,ge=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=_.useMemo(()=>n.duration||b||zn,[n.duration,b]),ye=_.useRef(0),be=_.useRef(0),xe=_.useRef(0),Se=_.useRef(null),[Ce,we]=x.split(`-`),Te=_.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=On(),De=n.invert||t,Oe=me===`loading`;be.current=_.useMemo(()=>ge*S+Te,[ge,Te]),_.useEffect(()=>{ue.current=ve},[ve]),_.useEffect(()=>{P(!0)},[]),_.useEffect(()=>{let e=L.current;if(e){let t=e.getBoundingClientRect().height;return le(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!N)return;let e=L.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,le(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id]);let ke=_.useCallback(()=>{I(!0),se(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Un)},[n,d,a,be]);_.useEffect(()=>{if(n.promise&&me===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||O&&Ee?(()=>{if(xe.current{var e;(e=n.onAutoClose)==null||e.call(n,n),ke()},ue.current)),()=>clearTimeout(e)},[u,i,n,me,O,Ee,ke]),_.useEffect(()=>{n.delete&&ke()},[ke,n.delete]);function Ae(){return E!=null&&E.loading?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},E.loading):C?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},C):_.createElement(Sn,{className:Wn(T?.loader,n?.classNames?.loader),visible:me===`loading`})}return _.createElement(`li`,{tabIndex:0,ref:L,className:Wn(v,he,T?.toast,n?.classNames?.toast,T?.default,T?.[me],n?.classNames?.[me]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":ie,"data-removed":F,"data-visible":pe,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":fe,"data-swiping":ee,"data-dismissible":R,"data-type":me,"data-invert":De,"data-swipe-out":ne,"data-swipe-direction":j,"data-expanded":!!(u||w&&N),style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?oe:be.current}px`,"--initial-height":w?`auto`:`${ce}px`,...m,...n.style},onDragEnd:()=>{te(!1),A(null),Se.current=null},onPointerDown:e=>{Oe||!R||(de.current=new Date,se(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e;if(ne||!R)return;Se.current=null;let t=Number(L.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),r=Number(L.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),i=new Date().getTime()-de.current?.getTime(),a=k===`x`?t:r,o=Math.abs(a)/i;if(Math.abs(a)>=Hn||o>.11){se(be.current),(e=n.onDismiss)==null||e.call(n,n),M(k===`x`?t>0?`right`:`left`:r>0?`down`:`up`),ke(),re(!0),ae(!1);return}te(!1),A(null)},onPointerMove:t=>{var n,r;if(!Se.current||!R||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??Gn(x);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0};k===`y`?(o.includes(`top`)||o.includes(`bottom`))&&(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)&&(s.y=i):k===`x`&&(o.includes(`left`)||o.includes(`right`))&&(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)&&(s.x=a),(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ae(!0),(n=L.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=L.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx?_.createElement(`button`,{"aria-label":D,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!R?()=>{}:()=>{var e;ke(),(e=n.onDismiss)==null||e.call(n,n)},className:Wn(T?.closeButton,n?.classNames?.closeButton)},E?.close??Dn):null,n.jsx||(0,_.isValidElement)(n.title)?n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title:_.createElement(_.Fragment,null,me||n.icon||n.promise?_.createElement(`div`,{"data-icon":``,className:Wn(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:n.icon||E?.[me]||bn(me)):null,_.createElement(`div`,{"data-content":``,className:Wn(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Wn(T?.title,n?.classNames?.title)},typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Wn(y,z,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),(0,_.isValidElement)(n.cancel)?n.cancel:n.cancel&&Fn(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{var t,r;Fn(n.cancel)&&R&&((r=(t=n.cancel).onClick)==null||r.call(t,e),ke())},className:Wn(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,(0,_.isValidElement)(n.action)?n.action:n.action&&Fn(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{var t,r;Fn(n.action)&&((r=(t=n.action).onClick)==null||r.call(t,e),!e.defaultPrevented&&ke())},className:Wn(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null))};function qn(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Jn(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Rn:Ln;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}(0,_.forwardRef)(function(e,t){let{invert:n,position:r=`bottom-right`,hotkey:i=[`altKey`,`KeyT`],expand:a,closeButton:o,className:s,offset:c,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:p,visibleToasts:m=In,toastOptions:h,dir:g=qn(),gap:y=Vn,loadingIcon:b,icons:x,containerAriaLabel:S=`Notifications`,pauseWhenPageIsHidden:C}=e,[w,T]=_.useState([]),E=_.useMemo(()=>Array.from(new Set([r].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,r]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=_.useRef(null),I=i.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ee=_.useRef(null),te=_.useRef(!1),ne=_.useCallback(e=>{T(t=>{var n;return(n=t.find(t=>t.id===e.id))!=null&&n.delete||An.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return _.useEffect(()=>An.subscribe(e=>{if(e.dismiss){T(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));return}setTimeout(()=>{v.flushSync(()=>{T(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),_.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),_.useEffect(()=>{w.length<=1&&A(!1)},[w]),_.useEffect(()=>{let e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(A(!0),(t=F.current)==null||t.focus()),e.code===`Escape`&&(document.activeElement===F.current||(n=F.current)!=null&&n.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),_.useEffect(()=>{if(F.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,te.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,r)=>{let[i,u]=t.split(`-`);return w.length?_.createElement(`ol`,{key:t,dir:g===`auto`?qn():g,tabIndex:-1,ref:F,className:s,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":i,"data-lifted":k&&w.length>1&&!a,"data-x-position":u,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Bn}px`,"--gap":`${y}px`,...p,...Jn(c,l)},onBlur:e=>{te.current&&!e.currentTarget.contains(e.relatedTarget)&&(te.current=!1,ee.current&&=(ee.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te.current||(te.current=!0,ee.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},w.filter(e=>!e.position&&r===0||e.position===t).map((r,i)=>_.createElement(Kn,{key:r.id,icons:x,index:i,toast:r,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:n,visibleToasts:m,closeButton:h?.closeButton??o,interacting:j,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:ne,toasts:w.filter(e=>e.position==r.position),heights:D.filter(e=>e.position==r.position),setHeights:O,expandByDefault:a,gap:y,loadingIcon:b,expanded:k,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections}))):null}))});function Yn(e){if(!(e instanceof DataTransfer))throw Error(`Data must be of type "DataTransfer"`);let t={};function n(e){let r=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.file==`function`&&`fullPath`in e,i=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.createReader==`function`;if(r(e)&&e.isFile)return new Promise(n=>{e.file(r=>{t[e.fullPath]=r,n()})});if(i(e)&&!e.isFile){let t=e.createReader();return new Promise(e=>{let r=[];function i(){t.readEntries(t=>{t.length===0?Promise.all(r).then(()=>e()):(t.forEach(e=>{r.push(n(e))}),i())})}i()})}return Promise.resolve()}return new Promise(r=>{let i=e.items&&Array.from(e.items),a=Array.from(e.files);if(i&&i.length&&`webkitGetAsEntry`in i[0]){let e=[];for(let t=0;tr(t))}else a.filter(e=>e.size!==0).forEach(e=>t[`/`+e.name]=e),r(t)})}function Xn(e){return e.replace(/\\/g,`/`).split(/\//g).reduce((e,t)=>(t===`..`?e.pop():t!==`.`&&e.push(t),e),[]).join(`/`)}var Zn={current:``};function Qn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{e.target&&e.target.result?t(e.target.result):n(Error(`Failed to read Urdf file content`))},r.onerror=()=>n(Error(`Error reading Urdf file`)),r.readAsText(e)})}async function $n(e,t){Zn.current=``;let n=await Yn(e),r=Object.keys(n).map(e=>Xn(e)),i=r.filter(e=>/urdf$/i.test(e)),a={};i.forEach(e=>{a[e]=URL.createObjectURL(n[e])});let o=``;if(i.length>0){let e=i[0].match(/^(\/[^/]+\/)/);e&&e[1]&&(o=e[1])}let s=o;return t.setUrlModifierFunc(e=>{s&&(Zn.current=s);let t=Xn(e).split(`/`).pop()||``,i=r.find(e=>e.endsWith(t));if(!i&&t.includes(`.`)){let e=`.`+t.split(`.`).pop();i=r.find(t=>t.endsWith(e))}if(i!=null){let e=i.split(`.`).pop()?.toLowerCase()||``,t=new Blob([n[i]],{type:er(e)}),r=URL.createObjectURL(t)+`#.`+e;return setTimeout(()=>URL.revokeObjectURL(r),5e3),r}return console.warn(`No matching file found for: ${e}`),e}),{files:n,availableModels:i,blobUrls:a}}function er(e){switch(e.toLowerCase()){case`stl`:return`model/stl`;case`obj`:return`model/obj`;case`gltf`:case`glb`:return`model/gltf+json`;case`dae`:return`model/vnd.collada+xml`;case`urdf`:return`application/xml`;default:return`application/octet-stream`}}var tr=(0,_.createContext)(void 0),nr=({children:e})=>{let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!d||p)return;let e=!1;return(async()=>{try{let t=await fetch(`/so-101-urdf/urdf/so101_new_calib.urdf`);if(!t.ok)throw Error(`Failed to fetch default Urdf: ${t.statusText}`);let n=await t.text();e||m(n)}catch(t){e||console.error(`Error loading default Urdf content:`,t)}})(),()=>{e=!0}},[d,p]);let v=(0,_.useRef)([]),y=(0,_.useCallback)(()=>{f(!0),m(null),g(null),Nn.info(`Switched to default model`,{description:`The default ARM100 robot model is now displayed.`})},[]),b=(0,_.useCallback)(e=>(v.current.push(e),()=>{v.current=v.current.filter(t=>t!==e)}),[]),x=(0,_.useCallback)(e=>{n(e)},[]),S=(0,_.useCallback)(e=>{e.hasUrdf?f(!1):y(),v.current.forEach(t=>t(e))},[y]),C=(0,_.useCallback)(async e=>{if(!t)return;let n=Object.values(r).filter(t=>t===e.blobUrl).map(e=>{let t=Object.keys(r).find(t=>r[t]===e);return t?{path:t,url:e}:null}).filter(e=>e!==null);if(n.length===0){console.error(`❌ Could not find file for selected Urdf model`);return}let i=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{let t=n[0]?.path;if(!t||!r[t])throw Error(`File not found in records`);let a=await(await fetch(e.blobUrl)).blob();m(await Qn(new File([a],t.split(`/`).pop()||`model.urdf`,{type:`application/xml`}))),Nn.dismiss(i),f(!1);let o=e.name||e.path.split(`/`).pop()||`Unknown`;Nn.success(`Urdf model loaded successfully`,{description:`Model: ${o}`,duration:3e3}),S({hasUrdf:!0,modelName:o})}catch(e){console.error(`❌ Error processing selected Urdf:`,e),Nn.dismiss(i),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3})}},[r,t,S]),w=(0,_.useCallback)(e=>{if(!t){console.error(`❌ No Urdf processor available`);return}c(!1);let n=e.name||e.path.split(`/`).pop()?.replace(/\.urdf$/i,``)||`Unknown`;t.loadUrdf(e.blobUrl),f(!1),Nn.info(`Loading model: ${n}`,{description:`Preparing 3D visualization`,duration:2e3}),S({hasUrdf:!0,modelName:n}),C(e)},[t,S,C]),T=(0,_.useCallback)(async(e,n)=>{Object.values(r).forEach(URL.revokeObjectURL),i({}),o([]),u([]);try{if(n.length>0&&t){let r={};if(n.forEach(t=>{e[t]&&(r[t]=URL.createObjectURL(e[t]))}),i(r),o(n),u(n.map(e=>{let t=(e.split(`/`).pop()||``).replace(/\.urdf$/i,``);return{path:e,blobUrl:r[e],name:t}})),n.length===1){let i=(n[0].split(`/`).pop()||``).replace(/\.urdf$/i,``),a=r[n[0]];if(a)if(t.loadUrdf(a),f(!1),e[n[0]]){let t=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{m(await Qn(e[n[0]])),Nn.dismiss(t),Nn.success(`Urdf model loaded successfully`,{description:`Model: ${i}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}catch(e){console.error(`Error loading Urdf:`,e),Nn.dismiss(t),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}}else console.error(`Could not find file for Urdf model:`,n[0]),S({hasUrdf:!0,modelName:i});else console.warn(`No blob URL found for ${n[0]}, using path directly`),t.loadUrdf(n[0]),f(!1),S({hasUrdf:!0,modelName:i})}else c(!0),S({hasUrdf:!0,modelName:`Multiple models available`})}else S({hasUrdf:!1}),y(),Nn.error(`No Urdf file found`,{description:`Please upload a folder containing a .urdf file.`,duration:3e3})}catch(e){console.error(`Error processing Urdf files:`,e),Nn.error(`Error processing files`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),y()}},[S,r,t,y]),E=(0,_.useRef)(r);E.current=r,(0,_.useEffect)(()=>()=>{Object.values(E.current).forEach(URL.revokeObjectURL)},[]);let D=(0,_.useMemo)(()=>({urdfProcessor:t,registerUrdfProcessor:x,onUrdfDetected:b,processUrdfFiles:T,urdfBlobUrls:r,alternativeUrdfModels:a,isSelectionModalOpen:s,setIsSelectionModalOpen:c,urdfModelOptions:l,selectUrdfModel:w,isDefaultModel:d,setIsDefaultModel:f,resetToDefaultModel:y,urdfContent:p,currentAnimationConfig:h,setCurrentAnimationConfig:g}),[t,x,b,T,r,a,s,l,w,d,y,p,h]);return(0,V.jsx)(tr.Provider,{value:D,children:e})},rr=()=>{let e=(0,_.useContext)(tr);if(e===void 0)throw Error(`useUrdf must be used within a UrdfProvider`);return e},ir=(0,_.createContext)(void 0),ar=({children:e})=>{let[t,n]=(0,_.useState)(!1),{urdfProcessor:r,processUrdfFiles:i}=rr(),a=e=>{e.preventDefault(),e.stopPropagation()},o=e=>{e.preventDefault(),e.stopPropagation(),n(!0)},s=e=>{e.preventDefault(),e.stopPropagation(),(!e.relatedTarget||!e.relatedTarget.closest(`html`))&&n(!1)},c=(0,_.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),n(!1),!(!e.dataTransfer||!r))try{let{availableModels:t,files:n}=await $n(e.dataTransfer,r);await i(n,t)}catch(e){console.error(`Error in handleDrop:`,e)}},[r,i]);(0,_.useEffect)(()=>(document.addEventListener(`dragover`,a),document.addEventListener(`dragenter`,o),document.addEventListener(`dragleave`,s),document.addEventListener(`drop`,c),()=>{document.removeEventListener(`dragover`,a),document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragleave`,s),document.removeEventListener(`drop`,c)}),[c]);let l=(0,_.useMemo)(()=>({isDragging:t,setIsDragging:n,handleDrop:c}),[t,c]);return(0,V.jsxs)(ir.Provider,{value:l,children:[e,t&&(0,V.jsx)(`div`,{className:`fixed inset-0 bg-primary/10 pointer-events-none z-50 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-background p-8 rounded-lg shadow-lg text-center`,children:[(0,V.jsx)(`div`,{className:`text-3xl font-bold mb-4`,children:`Drop Urdf Files Here`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Release to upload your robot model`})]})})]})},or=1,sr=1e6,cr=0;function lr(){return cr=(cr+1)%(2**53-1),cr.toString()}var ur=new Map,dr=e=>{if(ur.has(e))return;let t=setTimeout(()=>{ur.delete(e),hr({type:`REMOVE_TOAST`,toastId:e})},sr);ur.set(e,t)},fr=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,or)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?dr(n):e.toasts.forEach(e=>{dr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},pr=[],mr={toasts:[]};function hr(e){mr=fr(mr,e),pr.forEach(e=>{e(mr)})}function gr({...e}){let t=lr(),n=e=>hr({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>hr({type:`DISMISS_TOAST`,toastId:t});return hr({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function _r(){let[e,t]=_.useState(mr);return _.useEffect(()=>(pr.push(t),()=>{let e=pr.indexOf(t);e>-1&&pr.splice(e,1)}),[e]),{...e,toast:gr,dismiss:e=>hr({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function vr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function yr(...e){return t=>{let n=!1,r=e.map(e=>{let r=vr(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=_.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Sr(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cr(i,...t)]}function Cr(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function wr(e){let t=Tr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Dr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=kr(n),i=Or(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Er=Symbol(`radix.slottable`);function Dr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Er}function Or(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function kr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ar(e){let t=e+`CollectionProvider`,[n,r]=Sr(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=wr(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,V.jsx)(c,{ref:br(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=wr(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=br(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}function jr(e){let t=Mr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Pr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ir(n),i=Fr(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nr=Symbol(`radix.slottable`);function Pr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Nr}function Fr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ir(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jr(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lr(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}function Rr(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...e)=>t.current?.(...e),[])}function zr(e,t=globalThis?.document){let n=Rr(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Br=`DismissableLayer`,Vr=`dismissableLayer.update`,Hr=`dismissableLayer.pointerDownOutside`,Ur=`dismissableLayer.focusOutside`,Wr,Gr=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kr=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=_.useContext(Gr),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=_.useState({}),m=br(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Yr(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Xr(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zr(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wr=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zr(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wr)}},[u,f,n,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zr())},[u,l]),_.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vr,e),()=>document.removeEventListener(Vr,e)},[]),(0,V.jsx)(U.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,C.onFocusCapture),onBlurCapture:H(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,S.onPointerDownCapture)})});Kr.displayName=Br;var qr=`DismissableLayerBranch`,Jr=_.forwardRef((e,t)=>{let n=_.useContext(Gr),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(U.div,{...e,ref:i})});Jr.displayName=qr;function Yr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qr(Hr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qr(Ur,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zr(){let e=new CustomEvent(Vr);document.dispatchEvent(e)}function Qr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var $r=Kr,ei=Jr,ti=globalThis?.document?_.useLayoutEffect:()=>{},ni=`Portal`,ri=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);ti(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?v.createPortal((0,V.jsx)(U.div,{...r,ref:t}),o):null});ri.displayName=ni;function ii(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var ai=e=>{let{present:t,children:n}=e,r=oi(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=br(r.ref,ci(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};ai.displayName=`Presence`;function oi(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=ii(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=si(r.current);a.current=o===`mounted`?e:`none`},[o]),ti(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=si(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ti(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=si(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=si(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function si(e){return e?.animationName||`none`}function ci(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var li=_.useInsertionEffect||ti;function ui({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=di({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=fi(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function di({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return li(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function fi(e){return typeof e==`function`}var pi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),mi=`VisuallyHidden`,hi=_.forwardRef((e,t)=>(0,V.jsx)(U.span,{...e,ref:t,style:{...pi,...e.style}}));hi.displayName=mi;var gi=hi,_i=`ToastProvider`,[vi,yi,bi]=Ar(`Toast`),[xi,Si]=Sr(`Toast`,[bi]),[Ci,wi]=xi(_i),Ti=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=_.useState(null),[l,u]=_.useState(0),d=_.useRef(!1),f=_.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${_i}\`. Expected non-empty \`string\`.`),(0,V.jsx)(vi.Provider,{scope:t,children:(0,V.jsx)(Ci,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:_.useCallback(()=>u(e=>e+1),[]),onToastRemove:_.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};Ti.displayName=_i;var Ei=`ToastViewport`,Di=[`F8`],Oi=`toast.viewportPause`,ki=`toast.viewportResume`,Ai=_.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=Di,label:i=`Notifications ({hotkey})`,...a}=e,o=wi(Ei,n),s=yi(n),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=br(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;_.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),_.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Oi);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ki);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=_.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...ra(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return _.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);ia(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,V.jsxs)(ei,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,V.jsx)(Mi,{ref:l,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`forwards`}))}}),(0,V.jsx)(vi.Slot,{scope:n,children:(0,V.jsx)(U.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,V.jsx)(Mi,{ref:u,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`backwards`}))}})]})});Ai.displayName=Ei;var ji=`ToastFocusProxy`,Mi=_.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=wi(ji,n);return(0,V.jsx)(hi,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Mi.displayName=ji;var Ni=`Toast`,Pi=`toast.swipeStart`,Fi=`toast.swipeMove`,Ii=`toast.swipeCancel`,Li=`toast.swipeEnd`,Ri=_.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ui({prop:r,defaultProp:i??!0,onChange:a,caller:Ni});return(0,V.jsx)(ai,{present:n||s,children:(0,V.jsx)(Vi,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Rr(e.onPause),onResume:Rr(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ri.displayName=Ni;var[zi,Bi]=xi(Ni,{onClose(){}}),Vi=_.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=wi(Ni,n),[g,y]=_.useState(null),b=br(t,e=>y(e)),x=_.useRef(null),S=_.useRef(null),C=i||h.duration,w=_.useRef(0),T=_.useRef(C),E=_.useRef(0),{onToastAdd:D,onToastRemove:O}=h,k=Rr(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),A=_.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(k,e))},[k]);_.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{A(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(Oi,n),e.addEventListener(ki,t),()=>{e.removeEventListener(Oi,n),e.removeEventListener(ki,t)}}},[h.viewport,C,c,l,A]),_.useEffect(()=>{a&&!h.isClosePausedRef.current&&A(C)},[a,C,h.isClosePausedRef,A]),_.useEffect(()=>(D(),()=>O()),[D,O]);let j=_.useMemo(()=>g?Qi(g):null,[g]);return h.viewport?(0,V.jsxs)(V.Fragment,{children:[j&&(0,V.jsx)(Hi,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:j}),(0,V.jsx)(zi,{scope:n,onClose:k,children:v.createPortal((0,V.jsx)(vi.ItemSlot,{scope:n,children:(0,V.jsx)($r,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||k(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,V.jsx)(U.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(S.current=l,$i(Fi,d,f,{discrete:!1})):ea(l,h.swipeDirection,c)?(S.current=l,$i(Pi,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};ea(t,h.swipeDirection,h.swipeThreshold)?$i(Li,p,r,{discrete:!0}):$i(Ii,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Hi=e=>{let{__scopeToast:t,children:n,...r}=e,i=wi(Ni,t),[a,o]=_.useState(!1),[s,c]=_.useState(!1);return ta(()=>o(!0)),_.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,V.jsx)(ri,{asChild:!0,children:(0,V.jsx)(hi,{...r,children:a&&(0,V.jsxs)(V.Fragment,{children:[i.label,` `,n]})})})},Ui=`ToastTitle`,Wi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Wi.displayName=Ui;var Gi=`ToastDescription`,Ki=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Ki.displayName=Gi;var qi=`ToastAction`,Ji=_.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,V.jsx)(Zi,{altText:n,asChild:!0,children:(0,V.jsx)(Xi,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${qi}\`. Expected non-empty \`string\`.`),null)});Ji.displayName=qi;var Yi=`ToastClose`,Xi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Bi(Yi,n);return(0,V.jsx)(Zi,{asChild:!0,children:(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Xi.displayName=Yi;var Zi=_.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,V.jsx)(U.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Qi(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),na(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Qi(e))}}),t}function $i(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var ea=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ta(e=()=>{}){let t=Rr(e);ti(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function na(e){return e.nodeType===e.ELEMENT_NODE}function ra(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ia(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var aa=Ti,oa=Ai,sa=Ri,ca=Wi,la=Ki,ua=Ji,da=Xi;function fa(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,ha=pa,ga=(e,t)=>n=>{if(t?.variants==null)return ha(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ma(t)||ma(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ha(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},_a=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),va=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ya={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ba=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...ya,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:va(`lucide`,i),...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xa=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(ba,{ref:i,iconNode:t,className:va(`lucide-${_a(e)}`,n),...r}));return n.displayName=`${e}`,n},Sa=xa(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ca=xa(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),wa=xa(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ta=xa(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Ea=xa(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Da=xa(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Oa=xa(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ka=xa(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aa=xa(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ja=xa(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ma=xa(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Na=xa(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pa=xa(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Fa=xa(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ia=xa(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),La=xa(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Ra=xa(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=xa(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ba=xa(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Va=xa(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ha=xa(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ua=xa(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wa=xa(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ga=xa(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=xa(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),qa=xa(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ja=xa(`Lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ya=xa(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Xa=xa(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Za=xa(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Qa=xa(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=xa(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=xa(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),to=xa(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),no=xa(`ShieldQuestion`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ro=xa(`SkipForward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]),io=xa(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ao=xa(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),oo=xa(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),so=xa(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),co=xa(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),lo=xa(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),uo=xa(`VideoOff`,[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),fo=xa(`Volume2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),po=xa(`VolumeX`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),mo=xa(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ho=`-`,go=e=>{let t=bo(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(ho);return n[0]===``&&n.length!==1&&n.shift(),_o(n,t)||yo(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},_o=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?_o(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(ho);return t.validators.find(({validator:e})=>e(a))?.classGroupId},vo=/^\[(.+)\]$/,yo=e=>{if(vo.test(e)){let t=vo.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},bo=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wo(Object.entries(e.classGroups),n).forEach(([e,n])=>{xo(n,r,e,t)}),r},xo=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:So(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Co(e)){xo(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{xo(i,So(t,e),n,r)})})},So=(e,t)=>{let n=e;return t.split(ho).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Co=e=>e.isThemeGetter,wo=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,To=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Eo=`!`,Do=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;ls?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Oo=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},ko=e=>({cache:To(e.cacheSize),parseClassName:Do(e),...go(e)}),Ao=/\s+/,jo=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Ao),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Oo(c).join(`:`),h=l?m+Eo:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Mo(){let e=0,t,n,r=``;for(;e{if(typeof e==`string`)return e;let t,n=``;for(let r=0;rt(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=jo(e,n);return i(e,a),a}return function(){return a(Mo.apply(null,arguments))}}var Fo=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lo=/^\d+\/\d+$/,Ro=new Set([`px`,`full`,`screen`]),zo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ho=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wo=e=>Ko(e)||Ro.has(e)||Lo.test(e),Go=e=>as(e,`length`,os),Ko=e=>!!e&&!Number.isNaN(Number(e)),qo=e=>as(e,`number`,Ko),Jo=e=>!!e&&Number.isInteger(Number(e)),Yo=e=>e.endsWith(`%`)&&Ko(e.slice(0,-1)),Xo=e=>Io.test(e),Zo=e=>zo.test(e),Qo=new Set([`length`,`size`,`percentage`]),$o=e=>as(e,Qo,ss),es=e=>as(e,`position`,ss),ts=new Set([`image`,`url`]),ns=e=>as(e,ts,ls),rs=e=>as(e,``,cs),is=()=>!0,as=(e,t,n)=>{let r=Io.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},os=e=>Bo.test(e)&&!Vo.test(e),ss=()=>!1,cs=e=>Ho.test(e),ls=e=>Uo.test(e),us=Po(()=>{let e=Fo(`colors`),t=Fo(`spacing`),n=Fo(`blur`),r=Fo(`brightness`),i=Fo(`borderColor`),a=Fo(`borderRadius`),o=Fo(`borderSpacing`),s=Fo(`borderWidth`),c=Fo(`contrast`),l=Fo(`grayscale`),u=Fo(`hueRotate`),d=Fo(`invert`),f=Fo(`gap`),p=Fo(`gradientColorStops`),m=Fo(`gradientColorStopPositions`),h=Fo(`inset`),g=Fo(`margin`),_=Fo(`opacity`),v=Fo(`padding`),y=Fo(`saturate`),b=Fo(`scale`),x=Fo(`sepia`),S=Fo(`skew`),C=Fo(`space`),w=Fo(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,Xo,t],O=()=>[Xo,t],k=()=>[``,Wo,Go],A=()=>[`auto`,Ko,Xo],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,Xo],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],ee=()=>[Ko,Xo];return{cacheSize:500,separator:`:`,theme:{colors:[is],spacing:[Wo,Go],blur:[`none`,``,Zo,Xo],brightness:ee(),borderColor:[e],borderRadius:[`none`,``,`full`,Zo,Xo],borderSpacing:O(),borderWidth:k(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Yo,Go],inset:D(),margin:D(),opacity:ee(),padding:O(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,Xo]}],container:[`container`],columns:[{columns:[Zo]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),Xo]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Jo,Xo]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,Xo]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Jo,Xo]}],"grid-cols":[{"grid-cols":[is]}],"col-start-end":[{col:[`auto`,{span:[`full`,Jo,Xo]},Xo]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[is]}],"row-start-end":[{row:[`auto`,{span:[Jo,Xo]},Xo]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,Xo]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,Xo]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,Xo,t]}],"min-w":[{"min-w":[Xo,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[Xo,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Zo]},Zo]}],h:[{h:[Xo,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[Xo,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Zo,Go]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,qo]}],"font-family":[{font:[is]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,Xo]}],"line-clamp":[{"line-clamp":[`none`,Ko,qo]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Wo,Xo]}],"list-image":[{"list-image":[`none`,Xo]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,Xo]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Wo,Go]}],"underline-offset":[{"underline-offset":[`auto`,Wo,Xo]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Xo]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Xo]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),es]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,$o]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ns]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Wo,Xo]}],"outline-w":[{outline:[Wo,Go]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Wo,Go]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Zo,rs]}],"shadow-color":[{shadow:[is]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Zo,Xo]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,Xo]}],duration:[{duration:ee()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,Xo]}],delay:[{delay:ee()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,Xo]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Jo,Xo]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,Xo]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Xo]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Xo]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Wo,Go,qo]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function W(...e){return us(pa(e))}var ds=aa,fs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oa,{ref:n,className:W(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));fs.displayName=oa.displayName;var ps=ga(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),ms=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(sa,{ref:r,className:W(ps({variant:t}),e),...n}));ms.displayName=sa.displayName;var hs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ua,{ref:n,className:W(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));hs.displayName=ua.displayName;var gs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(da,{ref:n,className:W(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,V.jsx)(mo,{className:`h-4 w-4`})}));gs.displayName=da.displayName;var _s=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ca,{ref:n,className:W(`text-sm font-semibold`,e),...t}));_s.displayName=ca.displayName;var vs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(la,{ref:n,className:W(`text-sm opacity-90`,e),...t}));vs.displayName=la.displayName;function ys(){let{toasts:e}=_r();return(0,V.jsxs)(ds,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,V.jsxs)(ms,{...i,children:[(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,V.jsx)(_s,{children:t}),n&&(0,V.jsx)(vs,{children:n})]}),r,(0,V.jsx)(gs,{})]},e)}),(0,V.jsx)(fs,{})]})}var bs=Symbol.for(`react.lazy`),xs=_.use;function Ss(e){return typeof e==`object`&&!!e&&`then`in e}function Cs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===bs&&`_payload`in e&&Ss(e._payload)}function ws(e){let t=Es(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e;Cs(r)&&typeof xs==`function`&&(r=xs(r._payload));let a=_.Children.toArray(r),o=a.find(Os);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ts=ws(`Slot`);function Es(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(Cs(n)&&typeof xs==`function`&&(n=xs(n._payload)),_.isValidElement(n)){let e=As(n),i=ks(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ds=Symbol(`radix.slottable`);function Os(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ds}function ks(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function As(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var js=ga(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),G=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,V.jsx)(r?Ts:`button`,{className:W(js({variant:t,size:n,className:e})),ref:a,...i}));G.displayName=`Button`;var Ms=(0,_.createContext)(void 0),Ns=`lelab.apiBaseUrl`,Ps=`http://localhost:8000`,Fs=e=>e.replace(/^http(s?):/,`ws$1:`),Is=()=>{if(typeof window>`u`)return Ps;let e=new URLSearchParams(window.location.search).get(`api`);if(e)try{new URL(e);let t=e.replace(/\/$/,``);return window.localStorage.setItem(Ns,t),t}catch{console.warn("Invalid `api` query param, ignoring:",e)}return window.localStorage.getItem(Ns)||Ps},Ls=({children:e})=>{let[t]=(0,_.useState)(Is),n=Fs(t),r=(0,_.useCallback)(async(e,t={})=>fetch(e,{...t,headers:{"Content-Type":`application/json`,...t.headers}}),[]),i=(0,_.useMemo)(()=>({baseUrl:t,wsBaseUrl:n,fetchWithHeaders:r}),[t,n,r]);return(0,V.jsx)(Ms.Provider,{value:i,children:e})},Rs=()=>{let e=(0,_.useContext)(Ms);if(e===void 0)throw Error(`useApi must be used within an ApiProvider`);return e},zs=(0,_.createContext)(void 0),Bs=({children:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)({status:`loading`}),a=(0,_.useCallback)(async()=>{i({status:`loading`});try{let e=await(await n(`${t}/hf-auth-status`)).json();e.authenticated?i({status:`authenticated`,username:e.username,orgs:e.orgs??[]}):i({status:`unauthenticated`,loginCommand:e.login_command??`hf auth login`})}catch(e){console.warn(`HF auth status fetch failed:`,e),i({status:`unauthenticated`,loginCommand:`hf auth login`})}},[t,n]);(0,_.useEffect)(()=>{a()},[a]);let o=(0,_.useMemo)(()=>({auth:r,refetch:a}),[r,a]);return(0,V.jsx)(zs.Provider,{value:o,children:e})},Vs=()=>{let e=(0,_.useContext)(zs);if(e===void 0)throw Error(`useHfAuth must be used within an HfAuthProvider`);return e},Hs=_.useId||(()=>void 0),Us=0;function Ws(e){let[t,n]=_.useState(Hs());return ti(()=>{e||n(e=>e??String(Us++))},[e]),e||(t?`radix-${t}`:``)}var Gs=`focusScope.autoFocusOnMount`,Ks=`focusScope.autoFocusOnUnmount`,qs={bubbles:!1,cancelable:!0},Js=`FocusScope`,Ys=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Rr(i),u=Rr(a),d=_.useRef(null),f=br(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:nc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||nc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nc(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){rc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Gs,qs);s.addEventListener(Gs,l),s.dispatchEvent(t),t.defaultPrevented||(Xs(oc(Qs(s)),{select:!0}),document.activeElement===e&&nc(s))}return()=>{s.removeEventListener(Gs,l),setTimeout(()=>{let t=new CustomEvent(Ks,qs);s.addEventListener(Ks,u),s.dispatchEvent(t),t.defaultPrevented||nc(e??document.body,{select:!0}),s.removeEventListener(Ks,u),rc.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Zs(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&nc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&nc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(U.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ys.displayName=Js;function Xs(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nc(r,{select:t}),document.activeElement!==n)return}function Zs(e){let t=Qs(e);return[$s(t,e),$s(t.reverse(),e)]}function Qs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $s(e,t){for(let n of e)if(!ec(n,{upTo:t}))return n}function ec(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function tc(e){return e instanceof HTMLInputElement&&`select`in e}function nc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tc(e)&&t&&e.select()}}var rc=ic();function ic(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ac(e,t),e.unshift(t)},remove(t){e=ac(e,t),e[0]?.resume()}}}function ac(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oc(e){return e.filter(e=>e.tagName!==`A`)}var sc=0;function cc(){_.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??lc()),document.body.insertAdjacentElement(`beforeend`,e[1]??lc()),sc++,()=>{sc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),sc--}},[])}function lc(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var uc=function(){return uc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Lc;var t=zc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Vc=Ic(),Hc=`data-scroll-locked`,Uc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` + .${hc} { + overflow: hidden ${r}; + padding-right: ${s}px ${r}; + } + body[${Hc}] { + overflow: hidden ${r}; + overscroll-behavior: contain; + ${[t&&`position: relative ${r};`,n===`margin`&&` + padding-left: ${i}px; + padding-top: ${a}px; + padding-right: ${o}px; + margin-left:0; + margin-top:0; + margin-right: ${s}px ${r}; + `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} + } + + .${pc} { + right: ${s}px ${r}; + } + + .${mc} { + margin-right: ${s}px ${r}; + } + + .${pc} .${pc} { + right: 0 ${r}; + } + + .${mc} .${mc} { + margin-right: 0 ${r}; + } + + body[${Hc}] { + ${gc}: ${s}px; + } +`},Wc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Gc=function(){_.useEffect(function(){return document.body.setAttribute(Hc,(Wc()+1).toString()),function(){var e=Wc()-1;e<=0?document.body.removeAttribute(Hc):document.body.setAttribute(Hc,e.toString())}},[])},Kc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Gc();var a=_.useMemo(function(){return Bc(i)},[i]);return _.createElement(Vc,{styles:Uc(a,!t,i,n?``:`!important`)})},qc=!1;if(typeof window<`u`)try{var Jc=Object.defineProperty({},"passive",{get:function(){return qc=!0,!0}});window.addEventListener(`test`,Jc,Jc),window.removeEventListener(`test`,Jc,Jc)}catch{qc=!1}var Yc=qc?{passive:!1}:!1,Xc=function(e){return e.tagName===`TEXTAREA`},Zc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xc(e)&&n[t]===`visible`)},Qc=function(e){return Zc(e,`overflowY`)},$c=function(e){return Zc(e,`overflowX`)},el=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rl(e,r)){var i=il(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rl=function(e,t){return e===`v`?Qc(t):$c(t)},il=function(e,t){return e===`v`?tl(t):nl(t)},al=function(e,t){return e===`h`&&t===`rtl`?-1:1},ol=function(e,t,n,r,i){var a=al(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=il(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cl=function(e){return[e.deltaX,e.deltaY]},ll=function(e){return e&&`current`in e?e.current:e},ul=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dl=function(e){return` + .block-interactivity-${e} {pointer-events: none;} + .allow-interactivity-${e} {pointer-events: all;} +`},fl=0,pl=[];function ml(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(fl++)[0],a=_.useState(Ic)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fc([e.lockRef.current],(e.shards||[]).map(ll),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=el(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=el(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ol(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!pl.length||pl[pl.length-1]!==a)){var r=`deltaY`in n?cl(n):sl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ul(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ll).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=sl(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,cl(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,sl(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return pl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yc),document.addEventListener(`touchmove`,c,Yc),document.addEventListener(`touchstart`,u,Yc),function(){pl=pl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yc),document.removeEventListener(`touchmove`,c,Yc),document.removeEventListener(`touchstart`,u,Yc)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:dl(i)}):null,p?_.createElement(Kc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gl=Tc(Ec,ml),_l=_.forwardRef(function(e,t){return _.createElement(Oc,uc({},e,{ref:t,sideCar:gl}))});_l.classNames=Oc.classNames;var vl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},yl=new WeakMap,bl=new WeakMap,xl={},Sl=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},wl=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cl(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Tl=function(e,t,n,r){var i=wl(t,Array.isArray(e)?e:[e]);xl[n]||(xl[n]=new WeakMap);var a=xl[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(yl.get(e)||0)+1,l=(a.get(e)||0)+1;yl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bl.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sl++,function(){o.forEach(function(e){var t=yl.get(e)-1,i=a.get(e)-1;yl.set(e,t),a.set(e,i),t||(bl.has(e)||e.removeAttribute(r),bl.delete(e)),i||e.removeAttribute(n)}),Sl--,Sl||(yl=new WeakMap,yl=new WeakMap,bl=new WeakMap,xl={})}},El=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Tl(r,i,n,`aria-hidden`)):function(){return null}};function Dl(e){let t=Ol(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Al);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ol(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ml(n),i=jl(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kl=Symbol(`radix.slottable`);function Al(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kl}function jl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ml(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Nl=`Dialog`,[Pl,Fl]=Sr(Nl),[Il,Ll]=Pl(Nl),Rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:Nl});return(0,V.jsx)(Il,{scope:t,triggerRef:s,contentRef:c,contentId:Ws(),titleId:Ws(),descriptionId:Ws(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Rl.displayName=Nl;var zl=`DialogTrigger`,Bl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(zl,n),a=br(t,i.triggerRef);return(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ou(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Bl.displayName=zl;var Vl=`DialogPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ll(Vl,t);return(0,V.jsx)(Hl,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:e})}))})};Wl.displayName=Vl;var Gl=`DialogOverlay`,Kl=_.forwardRef((e,t)=>{let n=Ul(Gl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Gl,e.__scopeDialog);return a.modal?(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(Jl,{...i,ref:t})}):null});Kl.displayName=Gl;var ql=Dl(`DialogOverlay.RemoveScroll`),Jl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(Gl,n);return(0,V.jsx)(_l,{as:ql,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(U.div,{"data-state":ou(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Yl=`DialogContent`,Xl=_.forwardRef((e,t)=>{let n=Ul(Yl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Yl,e.__scopeDialog);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(Zl,{...i,ref:t}):(0,V.jsx)(Ql,{...i,ref:t})})});Xl.displayName=Yl;var Zl=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(null),i=br(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)($l,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Ql=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)($l,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$l=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ll(Yl,n),c=_.useRef(null),l=br(t,c);return cc(),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ou(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(uu,{titleId:s.titleId}),(0,V.jsx)(fu,{contentRef:c,descriptionId:s.descriptionId})]})]})}),eu=`DialogTitle`,tu=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(eu,n);return(0,V.jsx)(U.h2,{id:i.titleId,...r,ref:t})});tu.displayName=eu;var nu=`DialogDescription`,ru=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(nu,n);return(0,V.jsx)(U.p,{id:i.descriptionId,...r,ref:t})});ru.displayName=nu;var iu=`DialogClose`,au=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(iu,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});au.displayName=iu;function ou(e){return e?`open`:`closed`}var su=`DialogTitleWarning`,[cu,lu]=xr(su,{contentName:Yl,titleName:eu,docsSlug:`dialog`}),uu=({titleId:e})=>{let t=lu(su),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},du=`DialogDescriptionWarning`,fu=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lu(du).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},pu=Rl,mu=Bl,hu=Wl,gu=Kl,_u=Xl,vu=tu,yu=ru,bu=au,xu=pu,Su=hu,Cu=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gu,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Cu.displayName=gu.displayName;var wu=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,V.jsxs)(Su,{children:[(0,V.jsx)(Cu,{}),(0,V.jsxs)(_u,{ref:i,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,V.jsxs)(bu,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,V.jsx)(mo,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));wu.displayName=_u.displayName;var Tu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Tu.displayName=`DialogHeader`;var Eu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Eu.displayName=`DialogFooter`;var Du=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vu,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Du.displayName=vu.displayName;var Ou=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yu,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Ou.displayName=yu.displayName;var ku=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Vs(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,V.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,V.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,V.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,V.jsx)(Ea,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,V.jsx)(Qa,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},eee=()=>{let{auth:e}=Vs(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,V.jsx)(qa,{className:`w-3 h-3 animate-spin`}),(0,V.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:e.username})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`HF not configured`})]}),(0,V.jsx)(ku,{open:t,onOpenChange:n})]})},tee=()=>(0,V.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,V.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,V.jsx)(eee,{})]})}),nee=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:Ka},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:wa},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,V.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,V.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],ree=()=>(0,V.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,V.jsxs)(`span`,{children:[`Powered by`,` `,(0,V.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,V.jsx)(`nav`,{className:`flex items-center gap-4`,children:nee.map(({href:e,label:t,Icon:n})=>(0,V.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,V.jsx)(n,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:t})]},t))})]})}),iee=[`top`,`right`,`bottom`,`left`],Au=Math.min,ju=Math.max,Mu=Math.round,Nu=Math.floor,Pu=e=>({x:e,y:e}),Fu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Iu(e,t,n){return ju(e,Au(t,n))}function Lu(e,t){return typeof e==`function`?e(t):e}function Ru(e){return e.split(`-`)[0]}function zu(e){return e.split(`-`)[1]}function Bu(e){return e===`x`?`y`:`x`}function Vu(e){return e===`y`?`height`:`width`}function Hu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Uu(e){return Bu(Hu(e))}function Wu(e,t,n){n===void 0&&(n=!1);let r=zu(e),i=Uu(e),a=Vu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$u(o)),[o,$u(o)]}function Gu(e){let t=$u(e);return[Ku(e),t,Ku(t)]}function Ku(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qu=[`left`,`right`],Ju=[`right`,`left`],Yu=[`top`,`bottom`],Xu=[`bottom`,`top`];function Zu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ju:qu:t?qu:Ju;case`left`:case`right`:return t?Yu:Xu;default:return[]}}function Qu(e,t,n,r){let i=zu(e),a=Zu(Ru(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ku)))),a}function $u(e){let t=Ru(e);return Fu[t]+e.slice(t.length)}function ed(e){return{top:0,right:0,bottom:0,left:0,...e}}function td(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ed(e)}function nd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function rd(e,t,n){let{reference:r,floating:i}=e,a=Hu(t),o=Uu(t),s=Vu(o),c=Ru(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(zu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function id(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Lu(t,e),p=td(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=nd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=nd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ad=50,od=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:id},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rd(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Lu(e,t)||{};if(l==null)return{};let d=td(u),f={x:n,y:r},p=Uu(i),m=Vu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Au(d[_],T),D=Au(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Iu(O,A,k),M=!c.arrow&&zu(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Hu(t))||T.every(e=>Hu(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Hu(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ld(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ud(e){return iee.some(t=>e[t]>=0)}var dd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Lu(e,t);switch(i){case`referenceHidden`:{let e=ld(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ud(e)}}}case`escaped`:{let e=ld(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ud(e)}}}default:return{}}}}},fd=new Set([`left`,`top`]);async function pd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ru(n),s=zu(n),c=Hu(n)===`y`,l=fd.has(o)?-1:1,u=a&&c?-1:1,d=Lu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var md=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pd(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hd=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Lu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Hu(Ru(i)),p=Bu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Iu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Iu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gd=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Lu(e,t),u={x:n,y:r},d=Hu(i),f=Bu(d),p=u[f],m=u[d],h=Lu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fd.has(Ru(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},_d=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Lu(e,t),u=await o.detectOverflow(t,l),d=Ru(i),f=zu(i),p=Hu(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Au(h-u[g],v),x=Au(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ju(u.left,0),t=ju(u.right,0),n=ju(u.top,0),r=ju(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ju(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ju(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vd(){return typeof window<`u`}function yd(e){return Sd(e)?(e.nodeName||``).toLowerCase():`#document`}function bd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xd(e){return((Sd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Sd(e){return vd()?e instanceof Node||e instanceof bd(e).Node:!1}function Cd(e){return vd()?e instanceof Element||e instanceof bd(e).Element:!1}function wd(e){return vd()?e instanceof HTMLElement||e instanceof bd(e).HTMLElement:!1}function Td(e){return!vd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof bd(e).ShadowRoot}function Ed(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Pd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function aee(e){return/^(table|td|th)$/.test(yd(e))}function Dd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var oee=/transform|translate|scale|rotate|perspective|filter/,see=/paint|layout|strict|content/,Od=e=>!!e&&e!==`none`,kd;function Ad(e){let t=Cd(e)?Pd(e):e;return Od(t.transform)||Od(t.translate)||Od(t.scale)||Od(t.rotate)||Od(t.perspective)||!Md()&&(Od(t.backdropFilter)||Od(t.filter))||oee.test(t.willChange||``)||see.test(t.contain||``)}function jd(e){let t=Id(e);for(;wd(t)&&!Nd(t);){if(Ad(t))return t;if(Dd(t))return null;t=Id(t)}return null}function Md(){return kd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),kd}function Nd(e){return/^(html|body|#document)$/.test(yd(e))}function Pd(e){return bd(e).getComputedStyle(e)}function Fd(e){return Cd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Id(e){if(yd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Td(e)&&e.host||xd(e);return Td(t)?t.host:t}function Ld(e){let t=Id(e);return Nd(t)?e.ownerDocument?e.ownerDocument.body:e.body:wd(t)&&Ed(t)?t:Ld(t)}function Rd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ld(e),i=r===e.ownerDocument?.body,a=bd(r);if(i){let e=zd(a);return t.concat(a,a.visualViewport||[],Ed(r)?r:[],e&&n?Rd(e):[])}else return t.concat(r,Rd(r,[],n))}function zd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Bd(e){let t=Pd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=wd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Mu(n)!==a||Mu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Vd(e){return Cd(e)?e:e.contextElement}function Hd(e){let t=Vd(e);if(!wd(t))return Pu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Bd(t),o=(a?Mu(n.width):n.width)/r,s=(a?Mu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ud=Pu(0);function Wd(e){let t=bd(e);return!Md()||!t.visualViewport?Ud:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bd(e)?!1:t}function Kd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Vd(e),o=Pu(1);t&&(r?Cd(r)&&(o=Hd(r)):o=Hd(e));let s=Gd(a,n,r)?Wd(a):Pu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=bd(a),t=r&&Cd(r)?bd(r):r,n=e,i=zd(n);for(;i&&r&&t!==n;){let e=Hd(i),t=i.getBoundingClientRect(),r=Pd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=bd(i),i=zd(n)}}return nd({width:u,height:d,x:c,y:l})}function qd(e,t){let n=Fd(e).scrollLeft;return t?t.left+n:Kd(xd(e)).left+n}function Jd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qd(e,n),y:n.top+t.scrollTop}}function Yd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=xd(r),s=t?Dd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pu(1),u=Pu(0),d=wd(r);if((d||!d&&!a)&&((yd(r)!==`body`||Ed(o))&&(c=Fd(r)),d)){let e=Kd(r);l=Hd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Jd(o,c):Pu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Xd(e){return Array.from(e.getClientRects())}function Zd(e){let t=xd(e),n=Fd(e),r=e.ownerDocument.body,i=ju(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ju(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+qd(e),s=-n.scrollTop;return Pd(r).direction===`rtl`&&(o+=ju(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Qd=25;function $d(e,t){let n=bd(e),r=xd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Md();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=qd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Qd&&(a-=o)}else l<=Qd&&(a+=l);return{width:a,height:o,x:s,y:c}}function ef(e,t){let n=Kd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=wd(e)?Hd(e):Pu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function tf(e,t,n){let r;if(t===`viewport`)r=$d(e,n);else if(t===`document`)r=Zd(xd(e));else if(Cd(t))r=ef(t,n);else{let n=Wd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return nd(r)}function nf(e,t){let n=Id(e);return n===t||!Cd(n)||Nd(n)?!1:Pd(n).position===`fixed`||nf(n,t)}function rf(e,t){let n=t.get(e);if(n)return n;let r=Rd(e,[],!1).filter(e=>Cd(e)&&yd(e)!==`body`),i=null,a=Pd(e).position===`fixed`,o=a?Id(e):e;for(;Cd(o)&&!Nd(o);){let t=Pd(o),n=Ad(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ed(o)&&!n&&nf(e,o))?r=r.filter(e=>e!==o):i=t,o=Id(o)}return t.set(e,r),r}function af(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dd(t)?[]:rf(t,this._c):[].concat(n),r],o=tf(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!mf(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function gf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Vd(e),u=i||a?[...l?Rd(l):[],...t?Rd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?hf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Kd(e):null;c&&g();function g(){let t=Kd(e);h&&!mf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _f=md,vf=hd,yf=cd,bf=_d,xf=dd,Sf=sd,Cf=gd,wf=(e,t,n)=>{let r=new Map,i={platform:pf,...n},a={...i.platform,_c:r};return od(e,t,{...i,platform:a})},Tf=typeof document<`u`?_.useLayoutEffect:function(){};function Ef(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ef(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ef(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Df(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Of(e,t){let n=Df(e);return Math.round(t*n)/n}function kf(e){let t=_.useRef(e);return Tf(()=>{t.current=e}),t}function Af(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Ef(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=kf(c),k=kf(i),A=kf(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),wf(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Ef(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Tf(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);Tf(()=>(M.current=!0,()=>{M.current=!1}),[]),Tf(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Of(P.floating,u.x),r=Of(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Df(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var jf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Sf({element:r.current,padding:i}).fn(n):r?Sf({element:r,padding:i}).fn(n):{}}}},Mf=(e,t)=>{let n=_f(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nf=(e,t)=>{let n=vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pf=(e,t)=>({fn:Cf(e).fn,options:[e,t]}),Ff=(e,t)=>{let n=yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},If=(e,t)=>{let n=bf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lf=(e,t)=>{let n=xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rf=(e,t)=>{let n=jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},zf=`Arrow`,Bf=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(U.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Bf.displayName=zf;var Vf=Bf;function Hf(e){let[t,n]=_.useState(void 0);return ti(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Uf=`Popper`,[Wf,Gf]=Sr(Uf),[Kf,qf]=Wf(Uf),Jf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,V.jsx)(Kf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Jf.displayName=Uf;var Yf=`PopperAnchor`,Xf=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=qf(Yf,n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(U.div,{...i,ref:s})});Xf.displayName=Yf;var Zf=`PopperContent`,[cee,lee]=Wf(Zf),Qf=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=qf(Zf,n),[v,y]=_.useState(null),b=br(t,e=>y(e)),[x,S]=_.useState(null),C=Hf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(dee),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Af({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>gf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Mf({mainAxis:i+T,alignmentAxis:o}),c&&Nf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Pf():void 0,...A}),c&&Ff({...A}),If({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Rf({element:x,padding:s}),fee({arrowWidth:w,arrowHeight:T}),f&&Lf({strategy:`referenceHidden`,...A})]}),[I,ee]=tp(N),te=Rr(m);ti(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=_.useState();return ti(()=>{v&&oe(window.getComputedStyle(v).zIndex)},[v]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(cee,{scope:n,placedSide:I,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,V.jsx)(U.div,{"data-side":I,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Qf.displayName=Zf;var $f=`PopperArrow`,uee={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ep=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=lee($f,n),a=uee[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(Vf,{...r,ref:t,style:{...r.style,display:`block`}})})});ep.displayName=$f;function dee(e){return e!==null}var fee=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function tp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var np=Jf,rp=Xf,ip=Qf,ap=ep,op=Symbol(`radix.slottable`);function sp(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=op,t}var[cp,pee]=Sr(`Tooltip`,[Gf]),lp=Gf(),up=`TooltipProvider`,dp=700,fp=`tooltip.open`,[pp,mp]=cp(up),hp=e=>{let{__scopeTooltip:t,delayDuration:n=dp,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(pp,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hp.displayName=up;var gp=`Tooltip`,[_p,vp]=cp(gp),yp=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mp(gp,e.__scopeTooltip),l=lp(t),[u,d]=_.useState(null),f=Ws(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=ui({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fp))):c.onClose(),a?.(e)},caller:gp}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(np,{...l,children:(0,V.jsx)(_p,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};yp.displayName=gp;var bp=`TooltipTrigger`,xp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vp(bp,n),a=mp(bp,n),o=lp(n),s=br(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(rp,{asChild:!0,...o,children:(0,V.jsx)(U.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});xp.displayName=bp;var Sp=`TooltipPortal`,[Cp,wp]=cp(Sp,{forceMount:void 0}),Tp=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vp(Sp,t);return(0,V.jsx)(Cp,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};Tp.displayName=Sp;var Ep=`TooltipContent`,Dp=_.forwardRef((e,t)=>{let n=wp(Ep,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vp(Ep,e.__scopeTooltip);return(0,V.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(Mp,{side:i,...a,ref:t}):(0,V.jsx)(Op,{side:i,...a,ref:t})})}),Op=_.forwardRef((e,t)=>{let n=vp(Ep,e.__scopeTooltip),r=mp(Ep,e.__scopeTooltip),i=_.useRef(null),a=br(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ip(r,Fp(r,n.getBoundingClientRect())),a=Lp(t.getBoundingClientRect());s(zp([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rp(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(Mp,{...e,ref:a})}),[kp,Ap]=cp(gp,{isInside:!1}),jp=sp(`TooltipContent`),Mp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vp(Ep,n),l=lp(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(fp,u),()=>document.removeEventListener(fp,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(ip,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(jp,{children:r}),(0,V.jsx)(kp,{scope:n,isInside:!0,children:(0,V.jsx)(gi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dp.displayName=Ep;var Np=`TooltipArrow`,Pp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lp(n);return Ap(Np,n).isInside?null:(0,V.jsx)(ap,{...i,...r,ref:t})});Pp.displayName=Np;function Fp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ip(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zp(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Bp(t)}function Bp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vp=yp,Hp=xp,Up=Dp,Wp=Vp,Gp=Hp,Kp=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(Up,{ref:r,sideOffset:t,className:W(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kp.displayName=Up.displayName;function qp(e){let t=Jp(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Xp);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Jp(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Qp(n),i=Zp(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yp=Symbol(`radix.slottable`);function Xp(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Yp}function Zp(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qp(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $p=`Popover`,[em,mee]=Sr($p,[Gf]),tm=Gf(),[hee,nm]=em($p),rm=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tm(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:$p});return(0,V.jsx)(np,{...s,children:(0,V.jsx)(hee,{scope:t,contentId:Ws(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};rm.displayName=$p;var im=`PopoverAnchor`,gee=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(im,n),a=tm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(rp,{...a,...r,ref:t})});gee.displayName=im;var am=`PopoverTrigger`,om=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(am,n),a=tm(n),o=br(t,i.triggerRef),s=(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":pm(i.open),...r,ref:o,onClick:H(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(rp,{asChild:!0,...a,children:s})});om.displayName=am;var sm=`PopoverPortal`,[_ee,vee]=em(sm,{forceMount:void 0}),cm=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=nm(sm,t);return(0,V.jsx)(_ee,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};cm.displayName=sm;var lm=`PopoverContent`,um=_.forwardRef((e,t)=>{let n=vee(lm,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=nm(lm,e.__scopePopover);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(bee,{...i,ref:t}):(0,V.jsx)(xee,{...i,ref:t})})});um.displayName=lm;var yee=qp(`PopoverContent.RemoveScroll`),bee=_.forwardRef((e,t)=>{let n=nm(lm,e.__scopePopover),r=_.useRef(null),i=br(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(_l,{as:yee,allowPinchZoom:!0,children:(0,V.jsx)(dm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xee=_.forwardRef((e,t)=>{let n=nm(lm,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)(dm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),dm=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=nm(lm,n),p=tm(n);return cc(),(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(ip,{"data-state":pm(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),fm=`PopoverClose`,See=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(fm,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});See.displayName=fm;var Cee=`PopoverArrow`,wee=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tm(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});wee.displayName=Cee;function pm(e){return e?`open`:`closed`}var Tee=rm,Eee=om,mm=cm,hm=um,gm=Tee,_m=Eee,vm=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,V.jsx)(mm,{children:(0,V.jsx)(hm,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));vm.displayName=hm.displayName;var ym=1,bm=.9,xm=.8,Sm=.17,Cm=.1,wm=.999,Tm=.9999,Em=.99,Dm=/[\\\/_+.#"@\[\(\{&]/,Om=/[\\\/_+.#"@\[\(\{&]/g,km=/[\s-]/,Am=/[\s-]/g;function jm(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ym:Em;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=jm(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ym:Dm.test(e.charAt(l-1))?(d*=xm,p=e.slice(i,l-1).match(Om),p&&i>0&&(d*=wm**+p.length)):km.test(e.charAt(l-1))?(d*=bm,m=e.slice(i,l-1).match(Am),m&&i>0&&(d*=wm**+m.length)):(d*=Sm,i>0&&(d*=wm**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Tm)),(dd&&(d=f*Cm)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Mm(e){return e.toLowerCase().replace(Am,` `)}function Nm(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,jm(e,t,Mm(e),Mm(t),0,0,{})}var Pm=`[cmdk-group=""]`,Fm=`[cmdk-group-items=""]`,Im=`[cmdk-group-heading=""]`,Lm=`[cmdk-item=""]`,Rm=`${Lm}:not([aria-disabled="true"])`,zm=`cmdk-item-select`,Bm=`data-value`,Vm=(e,t,n)=>Nm(e,t,n),Hm=_.createContext(void 0),Um=()=>_.useContext(Hm),Wm=_.createContext(void 0),Gm=()=>_.useContext(Wm),Km=_.createContext(void 0),qm=_.forwardRef((e,t)=>{let n=sh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=sh(()=>new Set),i=sh(()=>new Map),a=sh(()=>new Map),o=sh(()=>new Set),s=ah(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Ws(),b=Ws(),x=Ws(),S=_.useRef(null),C=uh();oh(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),oh(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Vm;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Fm);t?t.appendChild(e.parentElement===t?e:e.closest(`${Fm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Fm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Pm}[${Bm}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Bm);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Pm)?.querySelector(Im))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Lm}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Rm)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Bm))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Bm))}function F(e){let t=j()?.closest(Pm),n;for(;t&&!n;)t=e>0?rh(t,Pm):ih(t,Pm),n=t?.querySelector(Rm);n?w.setState(`value`,n.getAttribute(Bm)):P(e)}let I=()=>N(M().length-1),ee=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},te=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(U.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(zm);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:ph},c),fh(e,e=>_.createElement(Wm.Provider,{value:w},_.createElement(Hm.Provider,{value:T},e))))}),Jm=_.forwardRef((e,t)=>{let n=Ws(),r=_.useRef(null),i=_.useContext(Km),a=Um(),o=ah(e),s=o.current?.forceMount??i?.forceMount;oh(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=lh(n,r,[e.value,e.children,r],e.keywords),l=Gm(),u=ch(e=>e.value&&e.value===c.current),d=ch(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(zm,f),()=>t.removeEventListener(zm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(U.div,{ref:yr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Ym=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ws(),s=_.useRef(null),c=_.useRef(null),l=Ws(),u=Um(),d=ch(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);oh(()=>u.group(o),[]),lh(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(U.div,{ref:yr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),fh(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(Km.Provider,{value:f},e))))}),Xm=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=ch(e=>!e.search);return!n&&!a?null:_.createElement(U.div,{ref:yr(i,t),...r,"cmdk-separator":``,role:`separator`})}),Zm=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Gm(),o=ch(e=>e.search),s=ch(e=>e.selectedItemId),c=Um();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(U.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Qm=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=ch(e=>e.selectedItemId),c=Um();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(U.div,{ref:yr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},fh(e,e=>_.createElement(`div`,{ref:yr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),$m=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(pu,{open:n,onOpenChange:r},_.createElement(hu,{container:o},_.createElement(gu,{"cmdk-overlay":``,className:i}),_.createElement(_u,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(qm,{ref:t,...s}))))}),eh=_.forwardRef((e,t)=>ch(e=>e.filtered.count===0)?_.createElement(U.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),th=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(U.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},fh(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),nh=Object.assign(qm,{List:Qm,Item:Jm,Input:Zm,Group:Ym,Separator:Xm,Dialog:$m,Empty:eh,Loading:th});function rh(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ih(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ah(e){let t=_.useRef(e);return oh(()=>{t.current=e}),t}var oh=typeof window>`u`?_.useEffect:_.useLayoutEffect;function sh(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function ch(e){let t=Gm(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function lh(e,t,n,r=[]){let i=_.useRef(),a=Um();return oh(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Bm,s),i.current=s}),i}var uh=()=>{let[e,t]=_.useState(),n=sh(()=>new Map);return oh(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function dh(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function fh({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(dh(t),{ref:t.ref},n(t.props.children)):n(t)}var ph={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},mh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh,{ref:n,className:W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));mh.displayName=nh.displayName;var hh=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,V.jsx)(eo,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,V.jsx)(nh.Input,{ref:n,className:W(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));hh.displayName=nh.Input.displayName;var gh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.List,{ref:n,className:W(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));gh.displayName=nh.List.displayName;var _h=_.forwardRef((e,t)=>(0,V.jsx)(nh.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));_h.displayName=nh.Empty.displayName;var vh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Group,{ref:n,className:W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));vh.displayName=nh.Group.displayName;var yh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Separator,{ref:n,className:W(`-mx-1 h-px bg-border`,e),...t}));yh.displayName=nh.Separator.displayName;var bh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Item,{ref:n,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));bh.displayName=nh.Item.displayName;var xh=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});xh.displayName=`CommandShortcut`;var Sh=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,V.jsxs)(gm,{open:a,onOpenChange:o,children:[(0,V.jsx)(_m,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,V.jsx)(`span`,{className:W(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(vm,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,V.jsxs)(mh,{className:`bg-gray-800`,children:[(0,V.jsx)(hh,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,V.jsxs)(gh,{children:[t.length===0&&(0,V.jsx)(_h,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,V.jsx)(vh,{heading:`Existing`,children:t.map(t=>(0,V.jsxs)(bh,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),p]})]})})]})},Ch=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,V.jsx)(Sh,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,V.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,children:(0,V.jsx)(to,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Configure (calibrate)`})]}),(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Delete robot config`})]})]})]}),e&&(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsx)(G,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,V.jsx)(Kp,{children:`Configure the robot first.`})]}),e&&(0,V.jsx)(xu,{open:l,onOpenChange:u,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{children:`Delete robot config?`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,V.jsxs)(Eu,{className:`flex gap-2 justify-end`,children:[(0,V.jsx)(G,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,V.jsx)(G,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},wh=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=Re(),{baseUrl:c,fetchWithHeaders:l}=Rs(),{toast:u}=_r();return(0,V.jsx)(Ch,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},Th=_.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:W(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Th.displayName=`Input`;var Eh=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,V.jsx)(Th,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:W(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});Eh.displayName=`NumberInput`;var Dh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Oh=`Label`,kh=_.forwardRef((e,t)=>(0,V.jsx)(Dh.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));kh.displayName=Oh;var Ah=kh,jh=ga(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),q=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Ah,{ref:n,className:W(jh(),e),...t}));q.displayName=Ah.displayName;function Mh(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Nh=`Checkbox`,[Ph,Dee]=Sr(Nh),[Fh,Ih]=Ph(Nh);function Lh(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:i??!1,onChange:c,caller:Nh}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Kh(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,V.jsx)(Fh,{scope:t,...x,children:Gh(d)?d(x):r})}var Rh=`CheckboxTrigger`,zh=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Ih(Rh,e),h=br(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(U.button,{type:`button`,role:`checkbox`,"aria-checked":Kh(c)?`mixed`:c,"aria-required":l,"data-state":qh(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>Kh(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});zh.displayName=Rh;var Bh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(Lh,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zh,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Wh,{__scopeCheckbox:n})]})})});Bh.displayName=Nh;var Vh=`CheckboxIndicator`,Hh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ih(Vh,n);return(0,V.jsx)(ai,{present:r||Kh(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{"data-state":qh(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Hh.displayName=Vh;var Uh=`CheckboxBubbleInput`,Wh=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Ih(Uh,e),m=br(n,p),h=Mh(a),g=Hf(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Kh(a),n.call(e,Kh(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(Kh(a)?!1:a);return(0,V.jsx)(U.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Wh.displayName=Uh;function Gh(e){return typeof e==`function`}function Kh(e){return e===`indeterminate`}function qh(e){return Kh(e)?`indeterminate`:e?`checked`:`unchecked`}var Jh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Bh,{ref:n,className:W(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,V.jsx)(Hh,{className:W(`flex items-center justify-center text-current`),children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}));Jh.displayName=Bh.displayName;var Yh=`Collapsible`,[Xh,Oee]=Sr(Yh),[Zh,Qh]=Xh(Yh),$h=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ui({prop:r,defaultProp:i??!1,onChange:o,caller:Yh});return(0,V.jsx)(Zh,{scope:n,disabled:a,contentId:Ws(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,V.jsx)(U.div,{"data-state":ag(c),"data-disabled":a?``:void 0,...s,ref:t})})});$h.displayName=Yh;var eg=`CollapsibleTrigger`,tg=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Qh(eg,n);return(0,V.jsx)(U.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":ag(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});tg.displayName=eg;var ng=`CollapsibleContent`,rg=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Qh(ng,e.__scopeCollapsible);return(0,V.jsx)(ai,{present:n||i.open,children:({present:e})=>(0,V.jsx)(ig,{...r,ref:t,present:e})})});rg.displayName=ng;var ig=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Qh(ng,n),[s,c]=_.useState(r),l=_.useRef(null),u=br(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),ti(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,V.jsx)(U.div,{"data-state":ag(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function ag(e){return e?`open`:`closed`}var og=$h,sg=tg,cg=rg,lg=ga(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),ug=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(`div`,{ref:r,role:`alert`,className:W(lg({variant:t}),e),...n}));ug.displayName=`Alert`;var dg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h5`,{ref:n,className:W(`mb-1 font-medium leading-none tracking-tight`,e),...t}));dg.displayName=`AlertTitle`;var fg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`text-sm [&_p]:leading-relaxed`,e),...t}));fg.displayName=`AlertDescription`;function pg(e,[t,n]){return Math.min(n,Math.max(t,e))}var mg=_.createContext(void 0);function hg(e){let t=_.useContext(mg);return e||t||`ltr`}function gg(e){let t=_g(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(yg);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function _g(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=xg(n),i=bg(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vg=Symbol(`radix.slottable`);function yg(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===vg}function bg(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function xg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Cg=[` `,`Enter`],wg=`Select`,[Tg,Eg,Dg]=Ar(wg),[Og,kee]=Sr(wg,[Dg,Gf]),kg=Gf(),[Ag,jg]=Og(wg),[Mg,Ng]=Og(wg),Pg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=kg(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=hg(l),[w,T]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:wg}),[E,D]=ui({prop:o,defaultProp:s,onChange:c,caller:wg}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,V.jsx)(np,{...h,children:(0,V.jsxs)(Ag,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ws(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,V.jsx)(Tg.Provider,{scope:t,children:(0,V.jsx)(Mg,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,V.jsxs)(k_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,V.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Pg.displayName=wg;var Fg=`SelectTrigger`,Ig=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=kg(n),o=jg(Fg,n),s=o.disabled||r,c=br(t,o.onTriggerChange),l=Eg(n),u=_.useRef(`touch`),[d,f,p]=j_(e=>{let t=l().filter(e=>!e.disabled),n=M_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,V.jsx)(rp,{asChild:!0,...a,children:(0,V.jsx)(U.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":A_(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Sg.includes(e.key)&&(m(),e.preventDefault())})})})});Ig.displayName=Fg;var Lg=`SelectValue`,Rg=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=jg(Lg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=br(t,c.onValueNodeChange);return ti(()=>{l(u)},[l,u]),(0,V.jsx)(U.span,{...s,ref:d,style:{pointerEvents:`none`},children:A_(c.value)?(0,V.jsx)(V.Fragment,{children:o}):a})});Rg.displayName=Lg;var zg=`SelectIcon`,Bg=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(U.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Bg.displayName=zg;var Vg=`SelectPortal`,Hg=e=>(0,V.jsx)(ri,{asChild:!0,...e});Hg.displayName=Vg;var Ug=`SelectContent`,Wg=_.forwardRef((e,t)=>{let n=jg(Ug,e.__scopeSelect),[r,i]=_.useState();if(ti(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,V.jsx)(Kg,{scope:e.__scopeSelect,children:(0,V.jsx)(Tg.Slot,{scope:e.__scopeSelect,children:(0,V.jsx)(`div`,{children:e.children})})}),t):null}return(0,V.jsx)(Xg,{...e,ref:t})});Wg.displayName=Ug;var Gg=10,[Kg,qg]=Og(Ug),Jg=`SelectContentImpl`,Yg=gg(`SelectContent.RemoveScroll`),Xg=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=jg(Ug,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=br(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=Eg(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return El(b)},[b]),cc();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ee,te]=j_(e=>{let t=k().filter(e=>!e.disabled),n=M_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ne=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),re=_.useCallback(()=>b?.focus(),[b]),ie=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ae=r===`popper`?e_:Qg,oe=ae===e_?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,V.jsx)(Kg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ne,selectedItem:T,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:ee,children:(0,V.jsx)(_l,{as:Yg,allowPinchZoom:!0,children:(0,V.jsx)(Ys,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,V.jsx)(ae,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...oe,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:H(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Xg.displayName=Jg;var Zg=`SelectItemAlignedPosition`,Qg=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=jg(Ug,n),o=qg(Ug,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=br(t,e=>u(e)),f=Eg(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Gg,d=pg(a,[Gg,Math.max(Gg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Gg,d=pg(a,[Gg,Math.max(Gg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Gg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Gg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Gg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);ti(()=>b(),[b]);let[x,S]=_.useState();return ti(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,V.jsx)(t_,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(U.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Qg.displayName=Zg;var $g=`SelectPopperPosition`,e_=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Gg,...a}=e,o=kg(n);return(0,V.jsx)(ip,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});e_.displayName=$g;var[t_,n_]=Og(Ug,{}),r_=`SelectViewport`,i_=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=qg(r_,n),o=n_(r_,n),s=br(t,a.onViewportChange),c=_.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(Tg.Slot,{scope:n,children:(0,V.jsx)(U.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Gg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});i_.displayName=r_;var a_=`SelectGroup`,[o_,s_]=Og(a_),c_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ws();return(0,V.jsx)(o_,{scope:n,id:i,children:(0,V.jsx)(U.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});c_.displayName=a_;var l_=`SelectLabel`,u_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=s_(l_,n);return(0,V.jsx)(U.div,{id:i.id,...r,ref:t})});u_.displayName=l_;var d_=`SelectItem`,[f_,p_]=Og(d_),m_=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=jg(d_,n),c=qg(d_,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=br(t,e=>c.itemRefCallback?.(e,r,i)),h=Ws(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,V.jsx)(f_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(Tg.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(U.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Cg.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});m_.displayName=d_;var h_=`SelectItemText`,g_=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=jg(h_,n),s=qg(h_,n),c=p_(h_,n),l=Ng(h_,n),[u,d]=_.useState(null),f=br(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return ti(()=>(h(m),()=>g(m)),[h,g,m]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(U.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});g_.displayName=h_;var __=`SelectItemIndicator`,v_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return p_(__,n).isSelected?(0,V.jsx)(U.span,{"aria-hidden":!0,...r,ref:t}):null});v_.displayName=__;var y_=`SelectScrollUpButton`,b_=_.forwardRef((e,t)=>{let n=qg(y_,e.__scopeSelect),r=n_(y_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(C_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});b_.displayName=y_;var x_=`SelectScrollDownButton`,S_=_.forwardRef((e,t)=>{let n=qg(x_,e.__scopeSelect),r=n_(x_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(C_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});S_.displayName=x_;var C_=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=qg(`SelectScrollButton`,n),o=_.useRef(null),s=Eg(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),ti(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(U.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),w_=`SelectSeparator`,T_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,V.jsx)(U.div,{"aria-hidden":!0,...r,ref:t})});T_.displayName=w_;var E_=`SelectArrow`,D_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kg(n),a=jg(E_,n),o=qg(E_,n);return a.open&&o.position===`popper`?(0,V.jsx)(ap,{...i,...r,ref:t}):null});D_.displayName=E_;var O_=`SelectBubbleInput`,k_=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=br(r,i),o=Mh(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,V.jsx)(U.select,{...n,style:{...pi,...n.style},ref:a,defaultValue:t})});k_.displayName=O_;function A_(e){return e===``||e===void 0}function j_(e){let t=Rr(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function M_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=N_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function N_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var P_=Pg,F_=Ig,I_=Rg,L_=Bg,R_=Hg,z_=Wg,B_=i_,V_=u_,H_=m_,U_=g_,W_=v_,G_=b_,K_=S_,q_=T_,J_=P_,Y_=I_,X_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(F_,{ref:r,className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,V.jsx)(L_,{asChild:!0,children:(0,V.jsx)(Da,{className:`h-4 w-4 text-slate-400`})})]}));X_.displayName=F_.displayName;var Z_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(G_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(ka,{className:`h-4 w-4`})}));Z_.displayName=G_.displayName;var Q_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(K_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(Da,{className:`h-4 w-4`})}));Q_.displayName=K_.displayName;var $_=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(R_,{children:(0,V.jsxs)(z_,{ref:i,className:W(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,V.jsx)(Z_,{}),(0,V.jsx)(B_,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,V.jsx)(Q_,{})]})}));$_.displayName=z_.displayName;var ev=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(V_,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));ev.displayName=V_.displayName;var tv=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(H_,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(W_,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),(0,V.jsx)(U_,{children:t})]}));tv.displayName=H_.displayName;var nv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(q_,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));nv.displayName=q_.displayName;var rv=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function iv({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=rv(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>rv(e.label)===r)||i.find(e=>rv(e.label).startsWith(r))||i.find(e=>rv(e.label).includes(r)||r.includes(rv(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}var av=4,ov=300,sv=new Set([`NotReadableError`,`AbortError`]);function cv(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(!1);return s.current=r,(0,_.useEffect)(()=>{let e=()=>{s.current&&o(e=>e+1)};return navigator.mediaDevices.addEventListener(`devicechange`,e),()=>navigator.mediaDevices.removeEventListener(`devicechange`,e)},[]),(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null,o=null;i(!1);let s=async t=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch(e){if(r)return;let n=e instanceof DOMException?e.name:``;ts(t+1),ov*2**t):i(!0)}};return s(0),()=>{r=!0,o&&clearTimeout(o),a&&a.getTracks().forEach(e=>e.stop())}},[e,t,a]),{videoRef:n,hasError:r}}var lv=`__auto__`,uv=`__default__`,dv=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],fv=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],pv=({cameras:e,onCamerasChange:t,releaseStreamsRef:n})=>{let{toast:r}=_r(),{cameras:i,isLoading:a,refresh:o}=iv(),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(i.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=i.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[i]);let d=()=>{if(!s||!l.trim()){r({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(s),a=i.find(e=>e.index===n);if(!a){r({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===a.index||a.deviceId&&e.device_id===a.deviceId)){r({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:l.trim(),type:`opencv`,camera_index:a.index,device_id:a.deviceId,width:640,height:480,fps:30};t([...e,o]),c(``),u(``),r({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},f=n=>{t(e.filter(e=>e.id!==n)),r({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},p=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[m,h]=(0,_.useState)(!1),g=(0,_.useCallback)(()=>{h(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=g)},[n,g]),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Camera Configuration`}),(0,V.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,V.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>o(),disabled:a,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,V.jsx)(Qa,{className:`w-3.5 h-3.5 ${a?`animate-spin`:``}`})})]}),(0,V.jsxs)(J_,{value:s,onValueChange:c,disabled:a,children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,V.jsx)(Y_,{placeholder:a?`Loading cameras...`:`Select camera`})}),(0,V.jsx)($_,{className:`bg-gray-800 border-gray-700`,children:i.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,V.jsx)(tv,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,V.jsx)(Th,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,V.jsxs)(G,{onClick:d,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!s||!l.trim(),children:[(0,V.jsx)(Za,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,V.jsx)(mv,{camera:e,paused:m,onRemove:()=>f(e.id),onUpdate:t=>p(e.id,t)},e.id))})]}),e.length===0&&(0,V.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,V.jsx)(Ta,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,V.jsx)(`p`,{children:`No cameras configured. Add a camera to get started.`})]})]})},mv=({camera:e,paused:t,onRemove:n,onUpdate:r})=>{let{videoRef:i,hasError:a}=cv(e.device_id,t);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!a?(0,V.jsx)(`video`,{ref:i,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,V.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),(0,V.jsx)(G,{onClick:n,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,V.jsx)(mo,{className:`w-4 h-4`})})]}),(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,V.jsxs)(cg,{className:`pt-2 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(Eh,{value:e.width,onChange:e=>{e!==void 0&&r({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,V.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,V.jsx)(Eh,{value:e.height,onChange:e=>{e!==void 0&&r({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,V.jsx)(Eh,{value:e.fps??30,onChange:e=>{e!==void 0&&r({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,V.jsxs)(J_,{value:e.fourcc??lv,onValueChange:e=>r({fourcc:e===lv?void 0:e}),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(tv,{value:lv,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),dv.map(e=>(0,V.jsx)(tv,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,V.jsxs)(J_,{value:e.backend??uv,onValueChange:e=>r({backend:e===uv?void 0:e}),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(tv,{value:uv,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),fv.map(e=>(0,V.jsx)(tv,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,V.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},hv=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Vs(),b=!!n&&n.is_clean;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,V.jsx)(Th,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,V.jsx)(`code`,{children:`.`}),` `,(0,V.jsx)(`code`,{children:`_`}),` `,(0,V.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,V.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,V.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,V.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,V.jsx)(Th,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,V.jsx)(Eh,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,V.jsx)(Eh,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,V.jsx)(Eh,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(pv,{cameras:h,onCamerasChange:g,releaseStreamsRef:v})}),(0,V.jsxs)(og,{className:`space-y-4 group`,children:[(0,V.jsxs)(sg,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,V.jsx)(`span`,{children:`Advanced Parameters`}),(0,V.jsx)(Da,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,V.jsx)(cg,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(Jh,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(q,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsx)(G,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},gv=/^[\w.\-]+\/[\w.\-]+$/,Aee=/^[A-Za-z0-9._-]+$/,jee=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=gv.test(u),p=Aee.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,V.jsxs)(bh,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,V.jsxs)(gm,{open:o,onOpenChange:s,children:[(0,V.jsx)(_m,{asChild:!0,children:a}),(0,V.jsx)(vm,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,V.jsxs)(mh,{className:`bg-gray-800`,children:[(0,V.jsx)(hh,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,V.jsxs)(gh,{children:[e.length===0&&!m&&!h&&(0,V.jsx)(_h,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,V.jsx)(vh,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,V.jsx)(vh,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,V.jsx)(vh,{heading:`Custom repo`,children:(0,V.jsxs)(bh,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ha,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),v]})]})})]})},Mee=(e,t)=>{let{wsBaseUrl:n}=Rs(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},_v=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function vv(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new _v(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function yv(e,t,n=10,r){return(await vv(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function Nee(e,t,n,r){return vv(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function Pee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function Fee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function Iee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function Lee(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await vv(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof _v&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function Ree(e,t,n,r){return vv(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function bv(e,t,n){return vv(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function xv(e,t,n){await vv(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var zee={authenticated:!1,username:null,flavors:[]};async function Bee(e,t,n){try{return await vv(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof _v)return zee;throw e}}var Vee={authenticated:!1,jobs:[],models:[]};async function Hee(e,t,n){try{return await vv(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof _v)return Vee;throw e}}var Sv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Sv.displayName=`Card`;var Cv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex flex-col space-y-1.5 p-6`,e),...t}));Cv.displayName=`CardHeader`;var wv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h3`,{ref:n,className:W(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wv.displayName=`CardTitle`;var Uee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`p`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Uee.displayName=`CardDescription`;var Tv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`p-6 pt-0`,e),...t}));Tv.displayName=`CardContent`;var Wee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex items-center p-6 pt-0`,e),...t}));Wee.displayName=`CardFooter`;async function Ev(e,t,n,r){return(await vv(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function Gee(e,t,n,r,i){return vv(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var Dv=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,V.jsxs)(J_,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,V.jsx)(X_,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Y_,{placeholder:i})}),(0,V.jsx)($_,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,V.jsx)(tv,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function Ov(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var Kee={running:{label:`Running`,color:`text-green-400`,Icon:qa},done:{label:`Done`,color:`text-slate-400`,Icon:Na},failed:{label:`Failed`,color:`text-red-400`,Icon:Fa},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:co}},kv=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=Re(),{baseUrl:a,fetchWithHeaders:o}=Rs(),s=Kee[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${Ov(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${Ov(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return Ev(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,V.jsx)(Sv,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,V.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,V.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})}):(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,V.jsx)(ao,{className:`w-3.5 h-3.5`}):(0,V.jsx)(mo,{className:`w-3.5 h-3.5`})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,V.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,V.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Dv,{checkpoints:g,selectedStep:y,onChange:b}),(0,V.jsx)(G,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,V.jsx)(Xa,{className:`w-4 h-4`})})]}):null]})})};function qee(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Jee={RUNNING:{label:`Running`,color:`text-green-400`,Icon:qa,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:La},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:La},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:Na},FAILED:{label:`Failed`,color:`text-red-400`,Icon:Fa},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:co},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:co}},Av=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=Jee[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:Pa},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,V.jsx)(Sv,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,V.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,qee(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,V.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function Yee(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Xee=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,V.jsx)(Sv,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,V.jsx)(lo,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,V.jsx)(Ja,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,V.jsx)(`span`,{className:`truncate`,children:n})]}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,Yee(e.last_modified)]})]})]})})};async function Zee(e,t,n){return vv(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function jv(e,t){return vv(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Qee(e,t,n){return vv(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var $ee=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=cv(e,t);return t||r||!e?(0,V.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},ete=30,Mv=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=Rs(),{toast:s}=_r(),c=Re(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=iv({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return Ev(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),Gee(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:ete})}try{await Zee(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(Xa,{className:`w-4 h-4 text-white`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`No checkpoints available for this job yet.`})]}):(0,V.jsx)(Dv,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,V.jsx)(Th,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,V.jsx)(Eh,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,V.jsxs)(ug,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-200`,children:e}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,V.jsxs)(J_,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,V.jsx)(Y_,{placeholder:`Select a camera`})}),(0,V.jsx)($_,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,V.jsxs)(tv,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,V.jsx)($ee,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsxs)(G,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Nv=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=Rs(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,V.jsx)(Ou,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,V.jsx)(Th,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,V.jsx)(Th,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,V.jsxs)(ug,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:d})]}):null,(0,V.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,V.jsxs)(G,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await Ree(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}):(0,V.jsx)(Ba,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Pv=`lelab.selectedRobot`,Fv=()=>{try{let e=localStorage.getItem(Pv);return e&&typeof e==`string`?e:null}catch{return null}},Iv=e=>{try{e?localStorage.setItem(Pv,e):localStorage.removeItem(Pv)}catch{}},Lv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),r=Ie(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>Fv()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{Iv(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Rv=10,zv=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Bv=e=>e.state===`running`||e.checkpoint_count>0,Vv=e=>zv.has((e.status?.stage??``).toUpperCase()),Hv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Lv(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([yv(e,t,Rv),Hee(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),Mee(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await bv(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await xv(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),I=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),ee=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),te=(0,_.useMemo)(()=>M.filter(e=>!ee.has(e.id)),[M,ee]),ne=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),re=(0,_.useMemo)(()=>N.filter(e=>!ne.has(e.repo_id)),[N,ne]),ie=(0,_.useMemo)(()=>P.filter(Bv),[P]),ae=(0,_.useMemo)(()=>P.filter(e=>!Bv(e)),[P]),oe=(0,_.useMemo)(()=>F.filter(Bv),[F]),se=(0,_.useMemo)(()=>F.filter(e=>!Bv(e)),[F]),ce=(0,_.useMemo)(()=>te.filter(Vv),[te]),le=(0,_.useMemo)(()=>te.filter(e=>!Vv(e)),[te]),ue=ae.length+se.length+le.length;return(0,V.jsxs)(`section`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(eo,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,V.jsx)(Th,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,V.jsx)(Ba,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})})]})]}),d?(0,V.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ie.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:ie.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ie.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),I.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,I.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:I.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,oe.length+ce.length+re.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:!l&&F.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):oe.length===0&&ce.length===0&&re.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,V.jsx)(Av,{job:e},e.id)),re.map(e=>(0,V.jsx)(Xee,{model:e},e.repo_id))]})})]}),ue>0?(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,ue,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[ae.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),se.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,V.jsx)(Av,{job:e},e.id))]})})]}):null,x?(0,V.jsx)(Mv,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,V.jsx)(Nv,{open:y,onOpenChange:b,onImported:T})]})},Uv=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,Wv=`http://localhost:8000/`,Gv=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,V.jsx)(xu,{open:e,onOpenChange:n?t:()=>void 0,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,V.jsxs)(Tu,{className:`text-center sm:text-center min-w-0`,children:[(0,V.jsxs)(Du,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,V.jsx)(oo,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,V.jsx)(Ou,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(Uv),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,V.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,V.jsx)(`code`,{className:`text-green-400`,children:Uv})}),(0,V.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ea,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ra,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,V.jsx)(G,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,V.jsxs)(`a`,{href:Wv,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})};async function Kv(e,t,n){return vv(e,t,`/datasets`,{signal:n,action:`List datasets`})}var tte=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),Kv(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},qv=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),Jv=qv(),Yv=()=>{let[e,t]=(0,_.useState)(Jv),{auth:n}=Vs(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Lv(),{datasets:u,loading:d}=tte(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=Re(),{toast:j}=_r();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,V.jsx)(tee,{}),(0,V.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,V.jsx)(wh,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,V.jsx)(jee,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/upload`,{state:{datasetInfo:{dataset_repo_id:e.repo_id,source:e.source}}});return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,V.jsx)(G,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,V.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,V.jsx)(Hv,{})}),(0,V.jsx)(ree,{}),(0,V.jsx)(Gv,{open:e,onOpenChange:t,dismissible:!Jv}),(0,V.jsx)(hv,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},Xv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Qv=`attached`,$v=1e3,ey=1001,ty=1002,ny=1003,ry=1004,iy=1005,ay=1006,oy=1007,sy=1008,cy=1009,ly=1010,uy=1011,dy=1012,fy=1013,py=1014,my=1015,hy=1016,gy=1017,_y=1018,vy=1020,yy=35902,nte=1021,rte=1022,by=1023,xy=1026,Sy=1027,Cy=1028,wy=1029,Ty=1030,Ey=1031,Dy=1033,Oy=33776,ky=33777,Ay=33778,jy=33779,My=35840,Ny=35841,Py=35842,Fy=35843,Iy=36196,Ly=37492,Ry=37496,zy=37808,By=37809,Vy=37810,Hy=37811,Uy=37812,Wy=37813,Gy=37814,Ky=37815,qy=37816,Jy=37817,Yy=37818,Xy=37819,Zy=37820,Qy=37821,$y=36492,eb=36494,tb=36495,nb=36283,rb=36284,ib=36285,ab=36286,ob=2300,sb=2301,cb=2302,lb=2400,ub=2401,db=2402,fb=2500,pb=3200,mb=3201,hb=`srgb`,gb=`srgb-linear`,_b=`linear`,vb=`srgb`,yb=7680,bb=35044,xb=2e3,Sb=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Cb[e>>16&255]+Cb[e>>24&255]+`-`+Cb[t&255]+Cb[t>>8&255]+`-`+Cb[t>>16&15|64]+Cb[t>>24&255]+`-`+Cb[n&63|128]+Cb[n>>8&255]+`-`+Cb[n>>16&255]+Cb[n>>24&255]+Cb[r&255]+Cb[r>>8&255]+Cb[r>>16&255]+Cb[r>>24&255]).toLowerCase()}function Ob(e,t,n){return Math.max(t,Math.min(n,e))}function kb(e,t){return(e%t+t)%t}function ite(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function ate(e,t,n){return e===t?0:(n-e)/(t-e)}function Ab(e,t,n){return(1-n)*e+n*t}function ote(e,t,n,r){return Ab(e,t,1-Math.exp(-n*r))}function ste(e,t=1){return t-Math.abs(kb(e,t*2)-t)}function cte(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function lte(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function ute(e,t){return e+Math.floor(Math.random()*(t-e+1))}function jb(e,t){return e+Math.random()*(t-e)}function Mb(e){return e*(.5-Math.random())}function Nb(e){e!==void 0&&(wb=e);let t=wb+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Pb(e){return e*Tb}function Fb(e){return e*Eb}function Ib(e){return(e&e-1)==0&&e!==0}function Lb(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Rb(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function zb(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Bb(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function Vb(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var Hb={DEG2RAD:Tb,RAD2DEG:Eb,generateUUID:Db,clamp:Ob,euclideanModulo:kb,mapLinear:ite,inverseLerp:ate,lerp:Ab,damp:ote,pingpong:ste,smoothstep:cte,smootherstep:lte,randInt:ute,randFloat:jb,randFloatSpread:Mb,seededRandom:Nb,degToRad:Pb,radToDeg:Fb,isPowerOfTwo:Ib,ceilPowerOfTwo:Lb,floorPowerOfTwo:Rb,setQuaternionFromProperEuler:zb,normalize:Vb,denormalize:Bb},Ub=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ob(this.x,e.x,t.x),this.y=Ob(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ob(this.x,e,t),this.y=Ob(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ob(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ob(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Wb=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ob(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},J=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Kb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Kb.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ob(this.x,e.x,t.x),this.y=Ob(this.y,e.y,t.y),this.z=Ob(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ob(this.x,e,t),this.y=Ob(this.y,e,t),this.z=Ob(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ob(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Gb.copy(this).projectOnVector(e),this.sub(Gb)}reflect(e){return this.sub(Gb.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ob(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Gb=new J,Kb=new Wb,qb=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Jb.makeScale(e,t)),this}rotate(e){return this.premultiply(Jb.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Jb=new qb;function Yb(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Xb(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Zb(){let e=Xb(`canvas`);return e.style.display=`block`,e}var Qb={};function $b(e){e in Qb||(Qb[e]=!0,console.warn(e))}function ex(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function tx(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function nx(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var rx=new qb().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ix=new qb().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ax(){let e={enabled:!0,workingColorSpace:gb,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=sx(e.r),e.g=sx(e.g),e.b=sx(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=cx(e.r),e.g=cx(e.g),e.b=cx(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?_b:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return $b(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return $b(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[gb]:{primaries:t,whitePoint:r,transfer:_b,toXYZ:rx,fromXYZ:ix,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:hb},outputColorSpaceConfig:{drawingBufferColorSpace:hb}},[hb]:{primaries:t,whitePoint:r,transfer:vb,toXYZ:rx,fromXYZ:ix,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:hb}}}),e}var ox=ax();function sx(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function cx(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var lx,ux=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{lx===void 0&&(lx=Xb(`canvas`)),lx.width=e.width,lx.height=e.height;let t=lx.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=lx}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=Xb(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(hx).x}get height(){return this.source.getSize(hx).y}get depth(){return this.source.getSize(hx).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case $v:e.x-=Math.floor(e.x);break;case ey:e.x=e.x<0?0:1;break;case ty:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case $v:e.y-=Math.floor(e.y);break;case ey:e.y=e.y<0?0:1;break;case ty:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};gx.DEFAULT_IMAGE=null,gx.DEFAULT_MAPPING=300,gx.DEFAULT_ANISOTROPY=1;var _x=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,wx),wx.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mx),Nx.subVectors(this.max,Mx),Ex.subVectors(e.a,Mx),Dx.subVectors(e.b,Mx),Ox.subVectors(e.c,Mx),kx.subVectors(Dx,Ex),Ax.subVectors(Ox,Dx),jx.subVectors(Ex,Ox);let t=[0,-kx.z,kx.y,0,-Ax.z,Ax.y,0,-jx.z,jx.y,kx.z,0,-kx.x,Ax.z,0,-Ax.x,jx.z,0,-jx.x,-kx.y,kx.x,0,-Ax.y,Ax.x,0,-jx.y,jx.x,0];return!Ix(t,Ex,Dx,Ox,Nx)||(t=[1,0,0,0,1,0,0,0,1],!Ix(t,Ex,Dx,Ox,Nx))?!1:(Px.crossVectors(kx,Ax),t=[Px.x,Px.y,Px.z],Ix(t,Ex,Dx,Ox,Nx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wx).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wx).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Cx[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cx[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cx[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cx[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cx[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cx[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cx[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cx[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cx),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Cx=[new J,new J,new J,new J,new J,new J,new J,new J],wx=new J,Tx=new Sx,Ex=new J,Dx=new J,Ox=new J,kx=new J,Ax=new J,jx=new J,Mx=new J,Nx=new J,Px=new J,Fx=new J;function Ix(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Fx.fromArray(e,a);let o=i.x*Math.abs(Fx.x)+i.y*Math.abs(Fx.y)+i.z*Math.abs(Fx.z),s=t.dot(Fx),c=n.dot(Fx),l=r.dot(Fx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Lx=new Sx,Rx=new J,zx=new J,Bx=class{constructor(e=new J,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Lx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Rx.subVectors(e,this.center);let t=Rx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Rx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(zx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Rx.copy(e.center).add(zx)),this.expandByPoint(Rx.copy(e.center).sub(zx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Vx=new J,Hx=new J,Ux=new J,Wx=new J,Gx=new J,Kx=new J,qx=new J,Jx=class{constructor(e=new J,t=new J(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Vx)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Vx.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Vx.copy(this.origin).addScaledVector(this.direction,t),Vx.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Hx.copy(e).add(t).multiplyScalar(.5),Ux.copy(t).sub(e).normalize(),Wx.copy(this.origin).sub(Hx);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Ux),o=Wx.dot(this.direction),s=-Wx.dot(Ux),c=Wx.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Hx).addScaledVector(Ux,d),f}intersectSphere(e,t){Vx.subVectors(e.center,this.origin);let n=Vx.dot(this.direction),r=Vx.dot(Vx)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Vx)!==null}intersectTriangle(e,t,n,r,i){Gx.subVectors(t,e),Kx.subVectors(n,e),qx.crossVectors(Gx,Kx);let a=this.direction.dot(qx),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Wx.subVectors(this.origin,e);let s=o*this.direction.dot(Kx.crossVectors(Wx,Kx));if(s<0)return null;let c=o*this.direction.dot(Gx.cross(Wx));if(c<0||s+c>a)return null;let l=-o*Wx.dot(qx);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Y=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/Yx.setFromMatrixColumn(e,0).length(),i=1/Yx.setFromMatrixColumn(e,1).length(),a=1/Yx.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Zx,e,Qx)}lookAt(e,t,n){let r=this.elements;return tS.subVectors(e,t),tS.lengthSq()===0&&(tS.z=1),tS.normalize(),$x.crossVectors(n,tS),$x.lengthSq()===0&&(Math.abs(n.z)===1?tS.x+=1e-4:tS.z+=1e-4,tS.normalize(),$x.crossVectors(n,tS)),$x.normalize(),eS.crossVectors(tS,$x),r[0]=$x.x,r[4]=eS.x,r[8]=tS.x,r[1]=$x.y,r[5]=eS.y,r[9]=tS.y,r[2]=$x.z,r[6]=eS.z,r[10]=tS.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=Yx.set(r[0],r[1],r[2]).length(),a=Yx.set(r[4],r[5],r[6]).length(),o=Yx.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Xx.copy(this);let s=1/i,c=1/a,l=1/o;return Xx.elements[0]*=s,Xx.elements[1]*=s,Xx.elements[2]*=s,Xx.elements[4]*=c,Xx.elements[5]*=c,Xx.elements[6]*=c,Xx.elements[8]*=l,Xx.elements[9]*=l,Xx.elements[10]*=l,t.setFromRotationMatrix(Xx),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=xb){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=xb){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Yx=new J,Xx=new Y,Zx=new J(0,0,0),Qx=new J(1,1,1),$x=new J,eS=new J,tS=new J,nS=new Y,rS=new Wb,iS=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(Ob(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-Ob(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(Ob(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-Ob(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(Ob(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-Ob(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return nS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nS,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rS.setFromEuler(this),this.setFromQuaternion(rS,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};iS.DEFAULT_ORDER=`XYZ`;var aS=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){SS.subVectors(r,t),CS.subVectors(n,t),wS.subVectors(e,t);let a=SS.dot(SS),o=SS.dot(CS),s=SS.dot(wS),c=CS.dot(CS),l=CS.dot(wS),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,TS)===null?!1:TS.x>=0&&TS.y>=0&&TS.x+TS.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,TS)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,TS.x),s.addScaledVector(a,TS.y),s.addScaledVector(o,TS.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return MS.setScalar(0),NS.setScalar(0),PS.setScalar(0),MS.fromBufferAttribute(e,t),NS.fromBufferAttribute(e,n),PS.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(MS,i.x),a.addScaledVector(NS,i.y),a.addScaledVector(PS,i.z),a}static isFrontFacing(e,t,n,r){return SS.subVectors(n,t),CS.subVectors(e,t),SS.cross(CS).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return SS.subVectors(this.c,this.b),CS.subVectors(this.a,this.b),SS.cross(CS).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;ES.subVectors(r,n),DS.subVectors(i,n),kS.subVectors(e,n);let s=ES.dot(kS),c=DS.dot(kS);if(s<=0&&c<=0)return t.copy(n);AS.subVectors(e,r);let l=ES.dot(AS),u=DS.dot(AS);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(ES,a);jS.subVectors(e,i);let f=ES.dot(jS),p=DS.dot(jS);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(DS,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return OS.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(OS,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(ES,a).addScaledVector(DS,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},IS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},LS={h:0,s:0,l:0},RS={h:0,s:0,l:0};function zS(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=hb){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ox.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ox.workingColorSpace){return this.r=e,this.g=t,this.b=n,ox.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ox.workingColorSpace){if(e=kb(e,1),t=Ob(t,0,1),n=Ob(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=zS(i,r,e+1/3),this.g=zS(i,r,e),this.b=zS(i,r,e-1/3)}return ox.colorSpaceToWorking(this,r),this}setStyle(e,t=hb){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=hb){let n=IS[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=sx(e.r),this.g=sx(e.g),this.b=sx(e.b),this}copyLinearToSRGB(e){return this.r=cx(e.r),this.g=cx(e.g),this.b=cx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=hb){return ox.workingToColorSpace(BS.copy(this),e),Math.round(Ob(BS.r*255,0,255))*65536+Math.round(Ob(BS.g*255,0,255))*256+Math.round(Ob(BS.b*255,0,255))}getHexString(e=hb){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ox.workingColorSpace){ox.workingToColorSpace(BS.copy(this),t);let n=BS.r,r=BS.g,i=BS.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},US=class extends HS{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},WS=new J,GS=new Ub,KS=0,qS=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:KS++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=bb,this.updateRanges=[],this.gpuType=my,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Sx);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(aC.copy(i).invert(),oC.copy(e.ray).applyMatrix4(aC),!(n.boundingBox!==null&&oC.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,oC)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:hC.clone(),object:e}}function vC(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,lC),e.getVertexPosition(c,uC),e.getVertexPosition(l,dC);let u=_C(e,t,n,r,lC,uC,dC,mC);if(u){let e=new J;FS.getBarycoord(mC,lC,uC,dC,e),i&&(u.uv=FS.getInterpolatedAttribute(i,s,c,l,e,new Ub)),a&&(u.uv1=FS.getInterpolatedAttribute(a,s,c,l,e,new Ub)),o&&(u.normal=FS.getInterpolatedAttribute(o,s,c,l,e,new J),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new J,materialIndex:0};FS.getNormal(lC,uC,dC,t.normal),u.face=t,u.barycoord=e}return u}var yC=class e extends iC{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new XS(c,3)),this.setAttribute(`normal`,new XS(l,3)),this.setAttribute(`uv`,new XS(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new J;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},OC=class extends xS{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new Y,this.projectionMatrix=new Y,this.projectionMatrixInverse=new Y,this.coordinateSystem=xb}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},kC=new J,AC=new Ub,jC=new Ub,MC=class extends OC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Eb*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Tb*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Eb*2*Math.atan(Math.tan(Tb*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){kC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kC.x,kC.y).multiplyScalar(-e/kC.z),kC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(kC.x,kC.y).multiplyScalar(-e/kC.z)}getViewSize(e,t){return this.getViewBounds(e,AC,jC),t.subVectors(jC,AC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Tb*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},NC=-90,PC=1,FC=class extends xS{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new MC(NC,PC,e,t);r.layers=this.layers,this.add(r);let i=new MC(NC,PC,e,t);i.layers=this.layers,this.add(i);let a=new MC(NC,PC,e,t);a.layers=this.layers,this.add(a);let o=new MC(NC,PC,e,t);o.layers=this.layers,this.add(o);let s=new MC(NC,PC,e,t);s.layers=this.layers,this.add(s);let c=new MC(NC,PC,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},IC=class extends gx{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},LC=class extends yx{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new IC(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new yC(5,5,5),i=new DC({name:`CubemapFromEquirect`,uniforms:bC(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new gC(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=ay),new FC(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},RC=class extends xS{constructor(){super(),this.isGroup=!0,this.type=`Group`}},zC={type:`move`},BC=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new RC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new RC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new RC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zC)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new RC;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},VC=class extends xS{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new iS,this.environmentIntensity=1,this.environmentRotation=new iS,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},HC=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=bb,this.updateRanges=[],this.version=0,this.uuid=Db()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||_w.getNormalMatrix(e),r=this.coplanarPoint(hw).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},yw=new Bx,bw=new J,xw=class{constructor(e=new vw,t=new vw,n=new vw,r=new vw,i=new vw,a=new vw){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=xb){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),yw.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),yw.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(yw)}intersectsSprite(e){return yw.center.set(0,0,0),yw.radius=.7071067811865476,yw.applyMatrix4(e.matrixWorld),this.intersectsSphere(yw)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,bw.y=r.normal.y>0?e.max.y:e.min.y,bw.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(bw)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Sw=class extends HS{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Cw=new J,ww=new J,Tw=new Y,Ew=new Jx,Dw=new Bx,Ow=new J,kw=new J,Aw=class extends xS{constructor(e=new iC,t=new Sw){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Ow.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Ow);if(!(ct.far))return{distance:c,point:kw.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Mw=new J,Nw=new J,Pw=class extends Aw{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Uw=class extends gx{constructor(e,t,n=py,r,i,a,o=ny,s=ny,c,l=xy,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new fx(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ww=class e extends iC{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new XS(u,3)),this.setAttribute(`normal`,new XS(d,3)),this.setAttribute(`uv`,new XS(f,2));function _(){let a=new J,_=new J,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new Ub,m=new J,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Xw=class extends HS{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ub(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Zw=class extends HS{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ub(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Qw=class extends HS{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=pb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},dte=class extends HS{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function $w(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function eT(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function tT(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function nT(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function rT(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var iT=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&eT(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===cb,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};cT.prototype.ValueTypeName=``,cT.prototype.TimeBufferType=Float32Array,cT.prototype.ValueBufferType=Float32Array,cT.prototype.DefaultInterpolation=sb;var lT=class extends cT{constructor(e,t,n){super(e,t,n)}};lT.prototype.ValueTypeName=`bool`,lT.prototype.ValueBufferType=Array,lT.prototype.DefaultInterpolation=ob,lT.prototype.InterpolantFactoryMethodLinear=void 0,lT.prototype.InterpolantFactoryMethodSmooth=void 0;var uT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};uT.prototype.ValueTypeName=`color`;var dT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};dT.prototype.ValueTypeName=`number`;var fT=class extends iT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Wb.slerpFlat(i,0,a,c-o,a,c,s);return i}},pT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new fT(this.times,this.values,this.getValueSize(),e)}};pT.prototype.ValueTypeName=`quaternion`,pT.prototype.InterpolantFactoryMethodSmooth=void 0;var mT=class extends cT{constructor(e,t,n){super(e,t,n)}};mT.prototype.ValueTypeName=`string`,mT.prototype.ValueBufferType=Array,mT.prototype.DefaultInterpolation=ob,mT.prototype.InterpolantFactoryMethodLinear=void 0,mT.prototype.InterpolantFactoryMethodSmooth=void 0;var hT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};hT.prototype.ValueTypeName=`vector`;var gT=class{constructor(e=``,t=-1,n=[],r=fb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Db(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(vT(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(cT.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];rT(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(CT[e]!==void 0){CT[e].push({onLoad:t,onProgress:n,onError:r});return}CT[e]=[],CT[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=CT[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new wT(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{yT.add(e,t);let n=CT[e];delete CT[e];for(let e=0,r=n.length;e{let n=CT[e];if(n===void 0)throw this.manager.itemError(e),t;delete CT[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},ET=class extends ST{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=yT.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=Xb(`img`);function s(){l(),yT.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},DT=class extends ST{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new nw,o=new TT(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?ey:n.wrapS,a.wrapT=n.wrapT===void 0?ey:n.wrapT,a.magFilter=n.magFilter===void 0?ay:n.magFilter,a.minFilter=n.minFilter===void 0?ay:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=sy),n.mipmapCount===1&&(a.minFilter=ay),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},OT=class extends ST{constructor(e){super(e)}load(e,t,n,r){let i=new gx,a=new ET(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},kT=class extends xS{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new X(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},AT=class extends kT{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},jT=new Y,MT=new J,NT=new J,PT=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ub(512,512),this.mapType=cy,this.map=null,this.mapPass=null,this.matrix=new Y,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xw,this._frameExtents=new Ub(1,1),this._viewportCount=1,this._viewports=[new _x(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;MT.setFromMatrixPosition(e.matrixWorld),t.position.copy(MT),NT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NT),t.updateMatrixWorld(),jT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jT),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(jT)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},FT=class extends PT{constructor(){super(new MC(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Eb*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},IT=class extends kT{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.target=new xS,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new FT}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},LT=new Y,RT=new J,zT=new J,BT=class extends PT{constructor(){super(new MC(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ub(4,2),this._viewportCount=6,this._viewports=[new _x(2,1,1,1),new _x(0,1,1,1),new _x(3,1,1,1),new _x(1,1,1,1),new _x(3,0,1,1),new _x(1,0,1,1)],this._cubeDirections=[new J(1,0,0),new J(-1,0,0),new J(0,0,1),new J(0,0,-1),new J(0,1,0),new J(0,-1,0)],this._cubeUps=[new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,0,1),new J(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),RT.setFromMatrixPosition(e.matrixWorld),n.position.copy(RT),zT.copy(n.position),zT.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(zT),n.updateMatrixWorld(),r.makeTranslation(-RT.x,-RT.y,-RT.z),LT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(LT)}},VT=class extends kT{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new BT}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},HT=class extends OC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},UT=class extends PT{constructor(){super(new HT(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},WT=class extends kT{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.target=new xS,this.shadow=new UT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},GT=class extends kT{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},KT=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},qT=new WeakMap,JT=class extends ST{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=yT.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(qT.has(a)===!0)r&&r(qT.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return yT.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),qT.set(s,t),yT.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});yT.add(e,s),i.manager.itemStart(e)}},YT=class extends MC{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},XT=`\\[\\]\\.:\\/`,ZT=RegExp(`[\\[\\]\\.:\\/]`,`g`),QT=`[^\\[\\]\\.:\\/]`,$T=`[^`+XT.replace(`\\.`,``)+`]`,eE=`((?:WC+[\\/:])*)`.replace(`WC`,QT),tE=`(WCOD+)?`.replace(`WCOD`,$T),nE=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,QT),rE=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,QT),iE=RegExp(`^`+eE+tE+nE+rE+`$`),aE=[`material`,`materials`,`bones`,`map`],oE=class{constructor(e,t,n){let r=n||sE.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},sE=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(ZT,``)}static parseTrackName(e){let t=iE.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);aE.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,common:`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,envmap_fragment:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,envmap_vertex:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex:`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex:`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment:`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fog_pars_fragment:`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment:`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,lights_toon_fragment:`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,lights_fragment_begin:` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,map_fragment:`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment:`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex:`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,opaque_fragment:`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment:`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,shadowmask_pars_fragment:`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex:`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,skinning_vertex:`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,skinnormal_vertex:`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,specularmap_fragment:`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment:`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,background_vert:`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,background_frag:`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,backgroundCube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,cube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,cube_frag:`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,depth_vert:`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,depth_frag:`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,distanceRGBA_vert:`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,distanceRGBA_frag:`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,equirect_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,equirect_frag:`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,linedashed_vert:`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,linedashed_frag:`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,meshbasic_vert:`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,meshbasic_frag:`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,meshlambert_vert:`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshlambert_frag:`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshmatcap_vert:`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,meshmatcap_frag:`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,meshnormal_vert:`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,meshnormal_frag:`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,meshphong_vert:`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshphong_frag:`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshphysical_vert:`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,meshphysical_frag:`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,meshtoon_vert:`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,meshtoon_frag:`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,points_vert:`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,points_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,shadow_vert:`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,shadow_frag:`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,sprite_vert:`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,sprite_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`},Z={common:{diffuse:{value:new X(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qb},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qb}},envmap:{envMap:{value:null},envMapRotation:{value:new qb},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qb}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qb}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qb},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qb},normalScale:{value:new Ub(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qb},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qb}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qb}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qb}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new X(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0},uvTransform:{value:new qb}},sprite:{diffuse:{value:new X(16777215)},opacity:{value:1},center:{value:new Ub(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qb},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0}}},gE={basic:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:hE.meshbasic_vert,fragmentShader:hE.meshbasic_frag},lambert:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:hE.meshlambert_vert,fragmentShader:hE.meshlambert_frag},phong:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:hE.meshphong_vert,fragmentShader:hE.meshphong_frag},standard:{uniforms:xC([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new X(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hE.meshphysical_vert,fragmentShader:hE.meshphysical_frag},toon:{uniforms:xC([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:hE.meshtoon_vert,fragmentShader:hE.meshtoon_frag},matcap:{uniforms:xC([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:hE.meshmatcap_vert,fragmentShader:hE.meshmatcap_frag},points:{uniforms:xC([Z.points,Z.fog]),vertexShader:hE.points_vert,fragmentShader:hE.points_frag},dashed:{uniforms:xC([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hE.linedashed_vert,fragmentShader:hE.linedashed_frag},depth:{uniforms:xC([Z.common,Z.displacementmap]),vertexShader:hE.depth_vert,fragmentShader:hE.depth_frag},normal:{uniforms:xC([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:hE.meshnormal_vert,fragmentShader:hE.meshnormal_frag},sprite:{uniforms:xC([Z.sprite,Z.fog]),vertexShader:hE.sprite_vert,fragmentShader:hE.sprite_frag},background:{uniforms:{uvTransform:{value:new qb},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hE.background_vert,fragmentShader:hE.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qb}},vertexShader:hE.backgroundCube_vert,fragmentShader:hE.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hE.cube_vert,fragmentShader:hE.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hE.equirect_vert,fragmentShader:hE.equirect_frag},distanceRGBA:{uniforms:xC([Z.common,Z.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hE.distanceRGBA_vert,fragmentShader:hE.distanceRGBA_frag},shadow:{uniforms:xC([Z.lights,Z.fog,{color:{value:new X(0)},opacity:{value:1}}]),vertexShader:hE.shadow_vert,fragmentShader:hE.shadow_frag}};gE.physical={uniforms:xC([gE.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qb},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qb},clearcoatNormalScale:{value:new Ub(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qb},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qb},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qb},sheen:{value:0},sheenColor:{value:new X(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qb},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qb},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qb},transmissionSamplerSize:{value:new Ub},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qb},attenuationDistance:{value:0},attenuationColor:{value:new X(0)},specularColor:{value:new X(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qb},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qb},anisotropyVector:{value:new Ub},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qb}}]),vertexShader:hE.meshphysical_vert,fragmentShader:hE.meshphysical_frag};var _E={r:0,b:0,g:0},vE=new iS,hte=new Y;function gte(e,t,n,r,i,a,o){let s=new X(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new gC(new yC(1,1,1),new DC({name:`BackgroundCubeMaterial`,uniforms:bC(gE.backgroundCube.uniforms),vertexShader:gE.backgroundCube.vertexShader,fragmentShader:gE.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),vE.copy(n.backgroundRotation),vE.x*=-1,vE.y*=-1,vE.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(vE.y*=-1,vE.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(hte.makeRotationFromEuler(vE)),u.material.toneMapped=ox.getTransfer(r.colorSpace)!==vb,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new gC(new Gw(2,2),new DC({name:`BackgroundMaterial`,uniforms:bC(gE.background.uniforms),vertexShader:gE.background.vertexShader,fragmentShader:gE.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=ox.getTransfer(r.colorSpace)!==vb,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(_E,CC(e)),r.buffers.color.setClear(_E.r,_E.g,_E.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function _te(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function bte(e){let t=this,n=null,r=0,i=!1,a=!1,o=new vw,s=new qb,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new LC(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var yE=4,bE=[.125,.215,.35,.446,.526,.582],xE=20,SE=new HT,CE=new X,wE=null,TE=0,EE=0,DE=!1,OE=(1+Math.sqrt(5))/2,kE=1/OE,AE=[new J(-OE,kE,0),new J(OE,kE,0),new J(-kE,0,OE),new J(kE,0,OE),new J(0,OE,-kE),new J(0,OE,kE),new J(-1,1,-1),new J(1,1,-1),new J(-1,1,1),new J(1,1,1)],Ste=new J,jE=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=Ste}=i;wE=this._renderer.getRenderTarget(),TE=this._renderer.getActiveCubeFace(),EE=this._renderer.getActiveMipmapLevel(),DE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=FE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=IE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=FE());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new gC(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;NE(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,SE)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;txE&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${xE}`);let h=[],g=0;for(let e=0;e_-yE?r-_+yE:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,SE)}};function Cte(e){let t=[],n=[],r=[],i=e,a=e-yE+1+bE.length;for(let o=0;oe-yE?s=bE[o-e+yE-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new iC;h.setAttribute(`position`,new qS(f,3)),h.setAttribute(`uv`,new qS(p,2)),h.setAttribute(`faceIndex`,new qS(m,1)),t.push(h),i>yE&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function ME(e,t,n){let r=new yx(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function NE(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function PE(e,t,n){let r=new Float32Array(xE),i=new J(0,1,0);return new DC({name:`SphericalGaussianBlur`,defines:{n:xE,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:LE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function FE(){return new DC({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:LE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function IE(){return new DC({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:LE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function LE(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function RE(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new jE(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new jE(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function zE(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&$b(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function BE(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new bx(h,p,m,u);g.type=my,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=XE[i];if(a===void 0&&(a=new Float32Array(i),XE[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function nD(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` +`)}var nO=new qb;function rO(e){ox._getMatrix(nO,ox.workingColorSpace,e);let t=`mat3( ${nO.elements.map(e=>e.toFixed(4))} )`;switch(ox.getTransfer(e)){case _b:return[t,`LinearTransferOETF`];case vb:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function iO(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` + +`+i+` + +`+tO(e.getShaderSource(t),r)}else return i}function aO(e,t){let n=rO(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` +`)}function oO(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var sO=new J;function cO(){return ox.getLuminanceCoefficients(sO),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${sO.x.toFixed(4)}, ${sO.y.toFixed(4)}, ${sO.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` +`)}function lO(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(fO).join(` +`)}function uO(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` +`)}function dO(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function gO(e){return e.replace(hO,vO)}var _O=new Map;function vO(e,t){let n=hE[t];if(n===void 0){let e=_O.get(t);if(e!==void 0)n=hE[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return gO(n)}var yO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function bO(e){return e.replace(yO,xO)}function xO(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` +`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(fO).join(` +`),_.length>0&&(_+=` +`)):(g=[SO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` +`].filter(fO).join(` +`),_=[SO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:hE.tonemapping_pars_fragment,n.toneMapping===0?``:oO(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,hE.colorspace_pars_fragment,aO(`linearToOutputTexel`,n.outputColorSpace),cO(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` +`].filter(fO).join(` +`)),o=gO(o),o=pO(o,n),o=mO(o,n),s=gO(s),s=pO(s,n),s=mO(s,n),o=bO(o),s=bO(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es +`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` +`)+` +`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` +`)+` +`+_);let y=v+g+o,b=v+_+s,x=QD(i,i.VERTEX_SHADER,y),S=QD(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=iO(i,x,`vertex`),r=iO(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` + +Material Name: `+t.name+` +Material Type: `+t.type+` + +Program Info Log: `+n+` +`+e+` +`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new ZD(i,h),T=dO(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,$D)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=eO++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var kO=0,AO=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new jO(e),t.set(e,n)),n}},jO=class{constructor(e){this.id=kO++,this.code=e,this.usedTimes=0}};function MO(e,t,n,r,i,a,o){let s=new aS,c=new AO,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=gE[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,I=!!a.matcap,ee=!!x,te=!!a.aoMap,ne=!!a.lightMap,re=!!a.bumpMap,ie=!!a.normalMap,ae=!!a.displacementMap,oe=!!a.emissiveMap,se=!!a.metalnessMap,ce=!!a.roughnessMap,le=a.anisotropy>0,ue=a.clearcoat>0,de=a.dispersion>0,L=a.iridescence>0,fe=a.sheen>0,pe=a.transmission>0,me=le&&!!a.anisotropyMap,R=ue&&!!a.clearcoatMap,he=ue&&!!a.clearcoatNormalMap,z=ue&&!!a.clearcoatRoughnessMap,ge=L&&!!a.iridescenceMap,_e=L&&!!a.iridescenceThicknessMap,ve=fe&&!!a.sheenColorMap,ye=fe&&!!a.sheenRoughnessMap,be=!!a.specularMap,xe=!!a.specularColorMap,Se=!!a.specularIntensityMap,Ce=pe&&!!a.transmissionMap,we=pe&&!!a.thicknessMap,Te=!!a.gradientMap,Ee=!!a.alphaMap,De=a.alphaTest>0,Oe=!!a.alphaHash,ke=!!a.extensions,Ae=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ae=e.toneMapping);let je={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:gb,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:ie,displacementMap:f&&ae,emissiveMap:oe,normalMapObjectSpace:ie&&a.normalMapType===1,normalMapTangentSpace:ie&&a.normalMapType===0,metalnessMap:se,roughnessMap:ce,anisotropy:le,anisotropyMap:me,clearcoat:ue,clearcoatMap:R,clearcoatNormalMap:he,clearcoatRoughnessMap:z,dispersion:de,iridescence:L,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:fe,sheenColorMap:ve,sheenRoughnessMap:ye,specularMap:be,specularColorMap:xe,specularIntensityMap:Se,transmission:pe,transmissionMap:Ce,thicknessMap:we,gradientMap:Te,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:Ee,alphaTest:De,alphaHash:Oe,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:te&&h(a.aoMap.channel),lightMapUv:ne&&h(a.lightMap.channel),bumpMapUv:re&&h(a.bumpMap.channel),normalMapUv:ie&&h(a.normalMap.channel),displacementMapUv:ae&&h(a.displacementMap.channel),emissiveMapUv:oe&&h(a.emissiveMap.channel),metalnessMapUv:se&&h(a.metalnessMap.channel),roughnessMapUv:ce&&h(a.roughnessMap.channel),anisotropyMapUv:me&&h(a.anisotropyMap.channel),clearcoatMapUv:R&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:he&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:z&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ve&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:ye&&h(a.sheenRoughnessMap.channel),specularMapUv:be&&h(a.specularMap.channel),specularColorMapUv:xe&&h(a.specularColorMap.channel),specularIntensityMapUv:Se&&h(a.specularIntensityMap.channel),transmissionMapUv:Ce&&h(a.transmissionMap.channel),thicknessMapUv:we&&h(a.thicknessMap.channel),alphaMapUv:Ee&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ie||le),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||Ee),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ae,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&ox.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:oe&&a.emissiveMap.isVideoTexture===!0&&ox.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ke&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(ke&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return je.vertexUv1s=l.has(1),je.vertexUv2s=l.has(2),je.vertexUv3s=l.has(3),l.clear(),je}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=gE[t];n=wC.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||PO),r.length>1&&r.sort(t||FO),i.length>1&&i.sort(t||FO)}function u(){for(let n=t,r=e.length;n=r.length?(i=new IO,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function RO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new J,color:new X};break;case`SpotLight`:n={position:new J,direction:new J,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new J,color:new X,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new J,skyColor:new X,groundColor:new X};break;case`RectAreaLight`:n={color:new X,position:new J,halfWidth:new J,halfHeight:new J};break}return e[t.id]=n,n}}}function zO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var BO=0;function VO(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function HO(e){let t=new RO,n=zO(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new J);let i=new J,a=new Y,o=new Y;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(VO);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=BO++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new UO(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var GO=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,KO=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function qO(e,t,n){let r=new xw,i=new Ub,a=new Ub,o=new _x,s=new Qw({depthPacking:mb}),c=new dte,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new DC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ub},radius:{value:4}},vertexShader:GO,fragmentShader:KO}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new iC;m.setAttribute(`position`,new qS(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new gC(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:ny,magFilter:ny};d.map!==null&&d.map.dispose(),d.map=new yx(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,I={},ee=e.getParameter(e.SCISSOR_BOX),te=e.getParameter(e.VIEWPORT),ne=new _x().fromArray(ee),re=new _x().fromArray(te);function ie(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ub,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):Xb(`canvas`)}function h(e,t,n){let r=1,i=ve(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?_b:ox.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&ge(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{ae(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[$v]:e.REPEAT,[ey]:e.CLAMP_TO_EDGE,[ty]:e.MIRRORED_REPEAT},I={[ny]:e.NEAREST,[ry]:e.NEAREST_MIPMAP_NEAREST,[iy]:e.NEAREST_MIPMAP_LINEAR,[ay]:e.LINEAR,[oy]:e.LINEAR_MIPMAP_NEAREST,[sy]:e.LINEAR_MIPMAP_LINEAR},ee={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function te(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,I[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,I[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ee[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ne(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function re(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ie(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=pE(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=pE(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ve(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ve(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,he(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function ce(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=he(n);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?le(i.__webglFramebuffer[0],t):le(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),ce(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),ce(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function de(t,n,i){let a=r.get(t);n!==void 0&&se(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&ue(t)}function L(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ge(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function _e(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(ox.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ve(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=de,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=R,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=se,this.useMultisampledRTT=z}function ZO(e,t){function n(n,r=``){let i,a=ox.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var QO=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,$O=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`,ek=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new gx,i=e.properties.get(r);i.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new DC({vertexShader:QO,fragmentShader:$O,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new gC(new Gw(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},tk=class extends Sb{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new ek,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new Ub,x=null,S=new MC;S.viewport=new _x;let C=new MC;C.viewport=new _x;let w=[S,C],T=new YT,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new J,M=new J;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,nk.copy(o),nk.x*=-1,nk.y*=-1,nk.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(nk.y*=-1,nk.z*=-1),e.envMapRotation.value.setFromMatrix4(rk.makeRotationFromEuler(nk)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function ak(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ok=class{constructor(e={}){let{canvas:t=Zb(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=hb;let x=0,S=0,C=null,w=-1,T=null,E=new _x,D=new _x,O=null,k=new X(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,I=new _x(0,0,j,M),ee=new _x(0,0,j,M),te=!1,ne=new xw,re=!1,ie=!1,ae=new Y,oe=new Y,se=new J,ce=new _x,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ue=!1;function de(){return C===null?N:1}let L=n;function fe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Le,!1),t.addEventListener(`webglcontextrestored`,Re,!1),t.addEventListener(`webglcontextcreationerror`,ze,!1),L===null){let t=`webgl2`;if(L=fe(t,e),L===null)throw fe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let pe,me,R,he,z,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe;function Fe(){pe=new zE(L),pe.init(),Me=new ZO(L,pe),me=new yte(L,pe,e,Me),R=new YO(L,pe),me.reverseDepthBuffer&&d&&R.buffers.depth.setReversed(!0),he=new HE(L),z=new NO,ge=new XO(L,pe,R,z,me,Me,he),_e=new xte(y),ve=new RE(y),ye=new mte(L),Ne=new _te(L,ye),be=new BE(L,ye,he,Ne),xe=new WE(L,be,ye,he),ke=new UE(L,me,ge),Ee=new bte(z),Se=new MO(y,_e,ve,pe,me,Ne,Ee),Ce=new ik(y,z),we=new LO,Te=new WO(pe),Oe=new gte(y,_e,ve,R,xe,f,s),De=new qO(y,xe,me),Pe=new ak(L,he,me,R),Ae=new vte(L,pe,he),je=new VE(L,pe,he),he.programs=Se.programs,y.capabilities=me,y.extensions=pe,y.properties=z,y.renderLists=we,y.shadowMap=De,y.state=R,y.info=he}Fe();let Ie=new tk(y,L);this.xr=Ie,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Ie.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),R.viewport(E.copy(I).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(ee)},this.setScissor=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),R.scissor(D.copy(ee).multiplyScalar(N).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(e){R.setScissorTest(te=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=Oe.getClearColor(),r=Oe.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,L.clearBufferuiv(L.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,L.clearBufferiv(L.COLOR,0,m))}else r|=L.COLOR_BUFFER_BIT}t&&(r|=L.DEPTH_BUFFER_BIT),n&&(r|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Le,!1),t.removeEventListener(`webglcontextrestored`,Re,!1),t.removeEventListener(`webglcontextcreationerror`,ze,!1),Oe.dispose(),we.dispose(),Te.dispose(),z.dispose(),_e.dispose(),ve.dispose(),xe.dispose(),Ne.dispose(),Pe.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener(`sessionstart`,Ke),Ie.removeEventListener(`sessionend`,qe),Je.stop()};function Le(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function Re(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=he.autoReset,t=De.enabled,n=De.autoUpdate,r=De.needsUpdate,i=De.type;Fe(),he.autoReset=e,De.enabled=t,De.autoUpdate=n,De.needsUpdate=r,De.type=i}function ze(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Be(e){let t=e.target;t.removeEventListener(`dispose`,Be),Ve(t)}function Ve(e){He(e),z.remove(e)}function He(e){let t=z.get(e).programs;t!==void 0&&(t.forEach(function(e){Se.releaseProgram(e)}),e.isShaderMaterial&&Se.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=le);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=rt(e,t,n,r,i);R.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=be.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ne.setup(i,r,s,n,c);let h,g=Ae;if(c!==null&&(h=ye.get(c),g=je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(R.setLineWidth(r.wireframeLinewidth*de()),g.setMode(L.LINES)):g.setMode(L.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),R.setLineWidth(e*de()),i.isLineSegments?g.setMode(L.LINES):i.isLineLoop?g.setMode(L.LINE_LOOP):g.setMode(L.LINE_STRIP)}else i.isPoints?g.setMode(L.POINTS):i.isSprite&&g.setMode(L.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)$b(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(pe.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?ye.get(c).bytesPerElement:1,o=z.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){z.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}pe.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let We=null;function Ge(e){We&&We(e)}function Ke(){Je.stop()}function qe(){Je.start()}let Je=new mE;Je.setAnimationLoop(Ge),typeof self<`u`&&Je.setContext(self),this.setAnimationLoop=function(e){We=e,Ie.setAnimationLoop(e),e===null?Je.stop():Je.start()},Ie.addEventListener(`sessionstart`,Ke),Ie.addEventListener(`sessionend`,qe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(t),t=Ie.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Te.get(e,v.length),g.init(t),v.push(g),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ne.setFromProjectionMatrix(oe),ie=this.localClippingEnabled,re=Ee.init(this.clippingPlanes,ie),h=we.get(e,_.length),h.init(),_.push(h),Ie.enabled===!0&&Ie.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Ye(e,t,-1/0,y.sortObjects)}Ye(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),ue=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ue&&Oe.addToRenderList(h,e),this.info.render.frame++,re===!0&&Ee.beginShadows();let n=g.state.shadowsArray;De.render(n,e,t),re===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Ze(r,i,e,t),ue&&Oe.render(e),Xe(h,e,t);C!==null&&S===0&&(ge.updateMultisampleRenderTarget(C),ge.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Ne.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],re===!0&&Ee.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Ye(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ne.intersectsSprite(e)){r&&ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);let t=xe.update(e),i=e.material;i.visible&&h.push(e,t,i,n,ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ne.intersectsObject(e))){let t=xe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ce.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ce.copy(e.boundingSphere.center)),ce.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&Qe(i,t,n),a.length>0&&Qe(a,t,n),o.length>0&&Qe(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function Ze(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new yx(1,1,{generateMipmaps:!0,type:pe.has(`EXT_color_buffer_half_float`)||pe.has(`EXT_color_buffer_float`)?hy:cy,minFilter:sy,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ox.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),ue&&Oe.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),re===!0&&Ee.setGlobalState(y.clippingPlanes,r),Qe(e,n,r),ge.updateMultisampleRenderTarget(a),ge.updateRenderTargetMipmap(a),pe.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=z.get(r),b=g.state.lights;if(re===!0&&(ie===!0||e!==T)){let t=e===T&&r.id===w;Ee.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ee.numPlanes||v.numIntersection!==Ee.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=et(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(R.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){R.buffers.depth.getReversed()?(ae.copy(e.projectionMatrix),tx(ae),nx(ae),k.setValue(L,`projectionMatrix`,ae)):k.setValue(L,`projectionMatrix`,e.projectionMatrix),k.setValue(L,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(L,se.setFromMatrixPosition(e.matrixWorld)),me.logarithmicDepthBuffer&&k.setValue(L,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(L,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(L,i,`bindMatrix`),k.setOptional(L,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(L,`boneTexture`,e.boneTexture,ge))}i.isBatchedMesh&&(k.setOptional(L,i,`batchingTexture`),k.setValue(L,`batchingTexture`,i._matricesTexture,ge),k.setOptional(L,i,`batchingIdTexture`),k.setValue(L,`batchingIdTexture`,i._indirectTexture,ge),k.setOptional(L,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(L,`batchingColorTexture`,i._colorsTexture,ge));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&ke.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(L,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(L,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&it(A,O),a&&r.fog===!0&&Ce.refreshFogUniforms(A,a),Ce.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),ZD.upload(L,tt(v),A,ge)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(ZD.upload(L,tt(v),A,ge),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(L,`center`,i.center),k.setValue(L,`modelViewMatrix`,i.modelViewMatrix),k.setValue(L,`normalMatrix`,i.normalMatrix),k.setValue(L,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&ge.useMultisampledRTT(e)===!1?z.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(I).multiplyScalar(N).floor(),D.copy(ee).multiplyScalar(N).floor(),O=te;if(n!==0&&(i=ot),R.bindFramebuffer(L.FRAMEBUFFER,i)&&r&&R.drawBuffers(e,i),R.viewport(E),R.scissor(D),R.setScissorTest(O),a){let r=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=z.get(e.texture),i=t;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){R.bindFramebuffer(L.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!me.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!me.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(c),Me.convert(l),a))}finally{let e=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(L.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.bufferData(L.PIXEL_PACK_BUFFER,a.byteLength,L.STREAM_READ),e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(l),Me.convert(u),0);let f=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,f);let p=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await ex(L,p,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,a),L.deleteBuffer(d),L.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;ge.setTexture2D(e,0),L.copyTexSubImage2D(L.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let st=L.createFramebuffer(),ct=L.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:($b(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Me.convert(t.format),_=Me.convert(t.type),v;t.isData3DTexture?(ge.setTexture3D(t,0),v=L.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ge.setTexture2DArray(t,0),v=L.TEXTURE_2D_ARRAY):(ge.setTexture2D(t,0),v=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,t.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,t.unpackAlignment);let y=L.getParameter(L.UNPACK_ROW_LENGTH),b=L.getParameter(L.UNPACK_IMAGE_HEIGHT),x=L.getParameter(L.UNPACK_SKIP_PIXELS),S=L.getParameter(L.UNPACK_SKIP_ROWS),C=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,h.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,h.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,l),L.pixelStorei(L.UNPACK_SKIP_ROWS,u),L.pixelStorei(L.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=z.get(e),r=z.get(t),h=z.get(n.__renderTarget),g=z.get(r.__renderTarget);R.bindFramebuffer(L.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(L.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=mk),r<-Math.PI?r+=mk:r>Math.PI&&(r-=mk),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(pk.setFromSpherical(this._spherical),pk.applyQuaternion(this._quatInverse),t.copy(this.target).add(pk),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=pk.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new J(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new J(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=pk.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(uk.origin.copy(this.object.position),uk.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(uk.direction))gk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gk||this._lastTargetPosition.distanceToSquared(this.target)>gk?(this.dispatchEvent(sk),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?mk/60/60*this.autoRotateSpeed:mk/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){pk.setFromMatrixColumn(t,0),pk.multiplyScalar(-e),this._panOffset.add(pk)}_panUp(e,t){this.screenSpacePanning===!0?pk.setFromMatrixColumn(t,1):(pk.setFromMatrixColumn(t,0),pk.crossVectors(this.object.up,pk)),pk.multiplyScalar(e),this._panOffset.add(pk)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;pk.copy(r).sub(this.target);let i=pk.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(mk*this._rotateDelta.x/t.clientHeight),this._rotateUp(mk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(mk*this._rotateDelta.x/t.clientHeight),this._rotateUp(mk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,hb),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new qS(p,3)),f.setAttribute(`normal`,new qS(m,3)),o&&(f.setAttribute(`color`,new qS(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new iC,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new J,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new XS(c,3)),t.setAttribute(`normal`,new XS(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:sy}}},Mk=class extends ST{load(e,t,n,r){let i=this,a=i.path===``?KT.extractUrlBase(e):i.path,o=new TT(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new hT(r+`.position`,i,a)),o.length>0&&t.push(new pT(r+`.quaternion`,i,o)),s.length>0&&t.push(new hT(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=Ft;break;default:t=Pt}return t}function Se(e){let t=ye(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new Xw;break;case`lambert`:r=new Zw;break;default:r=new US;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=oe(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=oe(e.id);if(i!==null){let t=xe(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?$v:ey,r.wrapT=e.wrapV?$v:ey,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=$v,r.wrapT=$v;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,hb));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,hb));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,hb));break}}ox.colorSpaceToWorking(r.color,hb),r.specular&&ox.colorSpaceToWorking(r.specular,hb),r.emissive&&ox.colorSpaceToWorking(r.emissive,hb);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new Ub(1,1);break}}}return r}function Ce(e){return m(B.materials[e],Se)}function we(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function ze(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new XS(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new XS(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new XS(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new XS(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new XS(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new XS(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new XS(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function Ue(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Ze(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||te===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),Nk.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(Nk,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],Ik.compose(this.origPosition,this.origQuaternion,Rk),Lk.setFromEuler(Pk.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),zk.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Fk.compose(zk,Lk,Rk),Ik.premultiply(Fk),this.position.setFromMatrixPosition(Ik),this.rotation.setFromRotationMatrix(Ik),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],Ik.compose(this.origPosition,this.origQuaternion,Rk),Lk.setFromAxisAngle(this.axis,this.jointValue[2]),zk.set(this.jointValue[0],this.jointValue[1],0),Fk.compose(zk,Lk,Rk),Ik.premultiply(Fk),this.position.setFromMatrixPosition(Ik),this.rotation.setFromRotationMatrix(Ik),this.matrixWorldNeedsUpdate=!0,!0)}return t}},Gk=class extends Wk{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},Kk=class extends Uk{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},qk=new Wb,Jk=new iS;function Yk(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Xk(e,t,n=!1){n||e.rotation.set(0,0,0),Jk.set(t[0],t[1],t[2],`ZYX`),qk.setFromEuler(Jk),qk.multiply(e.quaternion),e.quaternion.copy(qk)}var Zk=class{constructor(e){this.manager=e||xT,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=KT.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new Kk;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof Gk&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new Gk,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new Wk,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=Yk(e.getAttribute(`xyz`)),l=Yk(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),Xk(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new J(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new Uk);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=Yk(e.getAttribute(`xyz`)),r.inertial.origin.rpy=Yk(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new Xw;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new OT(o),r=u(t);n.map=e.load(r),n.map.colorSpace=hb}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new Xw;let c=n?new Vk:new Hk;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=Yk(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof gC&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new gC;t.geometry=new yC(1,1,1),t.material=a;let n=Yk(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new gC;t.geometry=new Kw(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new gC;t.geometry=new Ww(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=Yk(e.getAttribute(`xyz`)),n=Yk(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),Xk(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new Ak(t).load(e,e=>{n(new gC(e,new Xw))},null,e=>n(null,e)):/\.dae$/i.test(e)?new Mk(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},Qk=new Ub,$k=()=>{},eA=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new VC,t=new AT(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new WT(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new ok({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=hb;let i=new MC(75,1,.1,1e3);i.position.z=-10;let a=new xS;e.add(a);let o=new gC(new Gw(40,40),new qw({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new _k(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new Xw({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` + ${this.tagName} { display: block; } + ${this.tagName} canvas { + width: 100%; + height: 100%; + } + `,document.head.appendChild(e),this.constructor._styletag=e}this.childElementCount===0&&this.appendChild(this.renderer.domElement),this.updateSize(),requestAnimationFrame(()=>this.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize(Qk);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new Sx;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new J);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new Bx).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof US&&(e=new Xw),e.map&&(e.map.colorSpace=hb),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new bT;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new Zk(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=$k,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function tA(e){return e.isURDFJoint&&e.jointType!==`fixed`}function nA(e){let t=e;for(;t;){if(tA(t))return t;t=t.parent}return t}var rA=new J,iA=new J,aA=new J,oA=new J,sA=new J,cA=new J,lA=new J,uA=new vw,dA=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new lE,this.initialGrabPoint=new J,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=nA(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return oA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),aA.set(0,0,0).applyMatrix4(e.matrixWorld),uA.setFromNormalAndCoplanarPoint(oA,aA),uA.projectPoint(t,cA),uA.projectPoint(n,lA),cA.sub(aA),lA.sub(aA),oA.crossVectors(cA,lA),Math.sign(oA.dot(uA.normal))*lA.angleTo(cA)}getPrismaticDelta(e,t,n){return oA.subVectors(n,t),uA.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),oA.dot(uA.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,rA),e.at(n,iA);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,rA,iA):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,rA,iA)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},fA=class extends dA{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new lE,i=new Ub;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return oA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),aA.set(0,0,0).applyMatrix4(e.matrixWorld),uA.setFromNormalAndCoplanarPoint(oA,aA),oA.copy(r.position).sub(i).normalize(),Math.abs(oA.dot(uA.normal))>.3?super.getRevoluteDelta(e,t,n):(oA.set(0,1,0).transformDirection(r.matrixWorld),uA.projectPoint(t,cA),uA.projectPoint(n,lA),oA.set(0,0,-1).transformDirection(r.matrixWorld),oA.cross(uA.normal),sA.subVectors(n,t),oA.dot(sA))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},pA=class extends eA{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new Xw({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},mA=1e3,hA=3e4,gA=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=Rs(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(mA),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=mA,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,hA),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},_A=[`light`,`dark`],vA=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?_A.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&_A.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${vA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function yA(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new gj(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function xA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var SA={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},CA=class{constructor(e){this.parser=e,this.name=SA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},LA=class{constructor(e){this.parser=e,this.name=SA.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},RA=class{constructor(e){this.parser=e,this.name=SA.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},zA=class{constructor(e){this.name=SA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},BA=class{constructor(e){this.name=SA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==ZA.TRIANGLES&&e.mode!==ZA.TRIANGLE_STRIP&&e.mode!==ZA.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new Y,n=new J,a=new Wb,s=new J(1,1,1),c=new mw(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var hj=new Y,gj=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new OT(this.options.manager):this.textureLoader=new JT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new TT(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return sj(i,a,r),cj(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=$A[n.magFilter]||1006,t.minFilter=$A[n.minFilter]||1008,t.wrapS=ej[n.wrapS]||1e3,t.wrapT=ej[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new gx(e);t.needsUpdate=!0,n(t)}),t.load(KT.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),cj(e,a),e.userData.mimeType=a.mimeType||mj(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[SA.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[SA.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[SA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Iw,HS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Sw,HS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Jw}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[SA.KHR_MATERIALS_UNLIT]){let e=r[SA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new X(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],gb),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,hb)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||aj.OPAQUE;if(l===aj.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===aj.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==US&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new Ub(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==US&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==US){let e=i.emissiveFactor;o.emissive=new X().setRGB(e[0],e[1],e[2],gb)}return i.emissiveTexture!==void 0&&a!==US&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,hb)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),cj(n,i),t.associations.set(n,{materials:e}),i.extensions&&sj(r,n,i),n})}createUniqueName(e){let t=sE.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[SA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return vj(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&uj(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),cj(d,i),u.extensions&&sj(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new RC:t.length===1?t[0]:new xS,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new RC;n.name&&(i.name=r.createUniqueName(n.name)),cj(i,n),n.extensions&&sj(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof HS||e instanceof gx)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];rj[i.path]===rj.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(rj[i.path]){case rj.weights:c=dT;break;case rj.rotation:c=pT;break;case rj.translation:case rj.scale:c=hT;break;default:switch(n.itemSize){case 1:c=dT;break;default:c=hT;break}break}let l=r.interpolation===void 0?sb:ij[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;wj.fromArray(r,e),Tj.fromArray(r,t),Ej.fromArray(r,n),Oj.subVectors(Ej,Tj),Dj.subVectors(wj,Tj),Oj.cross(Dj),Oj.normalize(),i.push(Oj.x,Oj.y,Oj.z),i.push(Oj.x,Oj.y,Oj.z),i.push(Oj.x,Oj.y,Oj.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n=7?(kj.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),hb),t.colors.push(kj.r,kj.g,kj.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(Cj),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new RC;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new XS(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new XS(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new XS(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new Iw({size:1,sizeAttenuation:!1}),n=new iC;n.setAttribute(`position`,new XS(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new XS(t.colors,3)),e.vertexColors=!0);let r=new Vw(n,e);i.add(r)}return i}},Mj=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new bA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new jj(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new Mk(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new Ak(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new gC(t,new Xw))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new gC(new yC(.05,.05,.05),new Xw({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}};function Nj(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),Lj(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new GT(14079702,1);n.scene.add(r);let i=new WT(16777215,.8);return i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i),n}function Pj(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{Mj(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function Fj(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function Ij(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),Nn.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function Lj(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,pA);var Rj=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=rr(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=gA({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=Nj(e.current,!0);s.current=t,Pj(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=Ij(t,r,m.current,d,i));let p=Fj(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new Sx().setFromObject(e.robot),n=new J;t.getCenter(n);let r=new J;t.getSize(r);let i=Math.max(r.x,r.y,r.z);e.camera.position.copy(n);let a=new J;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,V.jsxs)(`div`,{className:W(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,V.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,V.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,V.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,V.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),zj=({className:e,iconOnly:t=!1})=>(0,V.jsxs)(`div`,{className:W(`flex items-center gap-2`,e),children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,V.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),Bj=({onGoBack:e,className:t,rightSlot:n})=>(0,V.jsxs)(`div`,{className:W(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,V.jsx)(Ca,{className:`h-5 w-5`})}),(0,V.jsx)(zj,{iconOnly:!0}),(0,V.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,V.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,V.jsx)(Rj,{})})]}),n&&(0,V.jsx)(`div`,{className:`lg:w-96 flex flex-col`,children:n})]}),Vj=`Switch`,[Hj,wte]=Sr(Vj),[Uj,Wj]=Hj(Vj),Gj=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=br(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=ui({prop:i,defaultProp:a??!1,onChange:l,caller:Vj});return(0,V.jsxs)(Uj,{scope:n,checked:v,disabled:s,children:[(0,V.jsx)(U.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Xj(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,V.jsx)(Yj,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Gj.displayName=Vj;var Kj=`SwitchThumb`,qj=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Wj(Kj,n);return(0,V.jsx)(U.span,{"data-state":Xj(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});qj.displayName=Kj;var Jj=`SwitchBubbleInput`,Yj=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=br(o,a),c=Mh(n),l=Hf(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,V.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Yj.displayName=Jj;function Xj(e){return e?`checked`:`unchecked`}var Zj=Gj,Qj=qj,$j=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Zj,{className:W(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,V.jsx)(Qj,{className:W(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));$j.displayName=Zj.displayName;var eM=({deviceId:e,label:t})=>{let{videoRef:n,hasError:r}=cv(e,!1);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:e&&!r?(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:e?`Preview failed`:`No camera selected`})]})}),t&&(0,V.jsx)(`div`,{className:`p-2 text-sm text-gray-300 truncate border-t border-gray-800`,children:t})]})},tM=()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(0),{selectedRecord:i,isLoading:a}=Lv(),o=(i?.cameras??[]).map(e=>({key:e.id,name:e.name,deviceId:e.device_id}));return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex flex-col gap-4 h-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Cameras`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&o.length>0&&(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r(e=>e+1),className:`h-9 w-9 text-gray-400 hover:text-white flex-shrink-0`,title:`Retry camera feeds (e.g. after reconnecting a camera)`,"aria-label":`Retry camera feeds`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})}),(0,V.jsx)(q,{htmlFor:`teleop-camera-toggle`,className:`text-sm text-gray-400`,children:e?`On`:`Off`}),(0,V.jsx)($j,{id:`teleop-camera-toggle`,checked:e,onCheckedChange:t})]})]}),e?o.length>0?(0,V.jsx)(`div`,{className:`flex flex-col gap-3 overflow-y-auto`,children:o.map(e=>(0,V.jsx)(eM,{deviceId:e.deviceId,label:e.name},`${e.key}:${n}`))}):(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:a?`Loading robot...`:`No cameras configured for this robot. Add them during calibration to see live feeds here.`}):(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Turn on to watch your cameras while you teleoperate.`})]})},nM=()=>{let e=Re(),{toast:t}=_r(),{baseUrl:n,fetchWithHeaders:r}=Rs(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,V.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,V.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,V.jsx)(Bj,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`,rightSlot:(0,V.jsx)(tM,{})})})})},rM=ga(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function iM({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{className:W(rM({variant:t}),e),...n})}var aM=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),oM=`Separator`,sM=`horizontal`,cM=[`horizontal`,`vertical`],lM=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=sM,...i}=e,a=uM(r)?r:sM,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(aM.div,{"data-orientation":a,...o,...i,ref:t})});lM.displayName=oM;function uM(e){return cM.includes(e)}var dM=lM,fM=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(dM,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));fM.displayName=dM.displayName;var pM=({onClick:e,robotType:t,className:n=``})=>(0,V.jsxs)(G,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` + h-8 px-2 + border-gray-600 hover:border-blue-500 + text-gray-400 hover:text-blue-400 + bg-gray-800 hover:bg-gray-700 + transition-all duration-200 + ${n} + `,title:`Find ${t||`robot`} port automatically`,children:[(0,V.jsx)(eo,{className:`w-3 h-3 mr-1`}),`Find`]}),mM=2e3,hM=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=_r(),{baseUrl:m,fetchWithHeaders:h}=Rs(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},mM);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,V.jsxs)(Ou,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,V.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(qa,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,V.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(Ma,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,V.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(ja,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,V.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,V.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,V.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,V.jsx)(G,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},gM={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},_M=.98;function vM(e,t,n){if(!e)return!1;let r=gM[e]?.[t];return r?n>=r*_M:!1}var yM=`Motor discontinuity detected`,bM=()=>{let e=Re(),t=Ie().state?.robot_name??null,{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(yM)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),I=e=>{l(e),F(e)},ee=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,V.jsx)(Sa,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,V.jsx)(Ma,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,V.jsx)(Fa,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,V.jsx)(ao,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(zj,{iconOnly:!0}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,V.jsxs)(ug,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,V.jsxs)(J_,{value:o,onValueChange:N,children:[(0,V.jsx)(X_,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,V.jsx)(Y_,{placeholder:`Select device type`})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,V.jsx)(tv,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,V.jsx)(tv,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Th,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,V.jsx)(pM,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,V.jsxs)(G,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,V.jsxs)(G,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,V.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(Sa,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,V.jsxs)(Tv,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,V.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,V.jsxs)(iM,{className:`${ee.color} text-white rounded-md`,children:[ee.icon,(0,V.jsx)(`span`,{className:`ml-2`,children:ee.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sa,{className:`w-4 h-4 text-purple-400`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,V.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=vM(w.device_type,e,n);return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,V.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,V.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,V.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,V.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,V.jsx)(`span`,{children:t.min}),(0,V.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,V.jsxs)(ug,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>vM(w.device_type,e,t.max-t.min));return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsxs)(G,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,V.jsx)(Ma,{className:`w-4 h-4 mr-2`}):(0,V.jsx)(ja,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,V.jsxs)(ug,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,V.jsx)(Sa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,V.jsxs)(ug,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,V.jsx)(Ma,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(yM)?(0,V.jsxs)(ug,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,V.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,V.jsxs)(ug,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,V.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,V.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,V.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,V.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,V.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,V.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,V.jsx)(`br`,{}),(0,V.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,children:[(0,V.jsxs)(Cv,{className:`flex-row items-center justify-between space-y-0`,children:[(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(q,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,V.jsx)($j,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,V.jsx)(Tv,{children:m?(0,V.jsx)(pv,{cameras:f,onCamerasChange:y}):(0,V.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,V.jsx)(Ta,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,V.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,V.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,V.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,V.jsx)(no,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,V.jsx)(hM,{open:b,onOpenChange:x,robotType:S,onPortDetected:I})]})},xM=`rovingFocusGroup.onEntryFocus`,SM={bubbles:!1,cancelable:!0},CM=`RovingFocusGroup`,[wM,TM,EM]=Ar(CM),[DM,OM]=Sr(CM,[EM]),[kM,AM]=DM(CM),jM=_.forwardRef((e,t)=>(0,V.jsx)(wM.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(wM.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(MM,{...e,ref:t})})}));jM.displayName=CM;var MM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=br(t,f),m=hg(a),[h,g]=ui({prop:o,defaultProp:s??null,onChange:c,caller:CM}),[v,y]=_.useState(!1),b=Rr(l),x=TM(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(xM,b),()=>e.removeEventListener(xM,b)},[b]),(0,V.jsx)(kM,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(U.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{S.current=!0}),onFocus:H(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(xM,SM);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);RM([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:H(e.onBlur,()=>y(!1))})})}),NM=`RovingFocusGroupItem`,PM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ws(),l=a||c,u=AM(NM,n),d=u.currentTabStopId===l,f=TM(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(wM.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(U.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=LM(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?zM(n,r+1):n.slice(r+1)}setTimeout(()=>RM(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});PM.displayName=NM;var FM={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function IM(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function LM(e,t,n){let r=IM(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return FM[r]}function RM(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BM=jM,VM=PM;function HM(e){let t=UM(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(GM);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function UM(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=qM(n),i=KM(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WM=Symbol(`radix.slottable`);function GM(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===WM}function KM(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qM(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var JM=[`Enter`,` `],YM=[`ArrowDown`,`PageUp`,`Home`],XM=[`ArrowUp`,`PageDown`,`End`],ZM=[...YM,...XM],QM={ltr:[...JM,`ArrowRight`],rtl:[...JM,`ArrowLeft`]},$M={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},eN=`Menu`,[tN,nN,rN]=Ar(eN),[iN,aN]=Sr(eN,[rN,Gf,OM]),oN=Gf(),sN=OM(),[cN,lN]=iN(eN),[uN,dN]=iN(eN),fN=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=oN(t),[c,l]=_.useState(null),u=_.useRef(!1),d=Rr(a),f=hg(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,V.jsx)(np,{...s,children:(0,V.jsx)(cN,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(uN,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};fN.displayName=eN;var pN=`MenuAnchor`,mN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=oN(n);return(0,V.jsx)(rp,{...i,...r,ref:t})});mN.displayName=pN;var hN=`MenuPortal`,[gN,_N]=iN(hN,{forceMount:void 0}),vN=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=lN(hN,t);return(0,V.jsx)(gN,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};vN.displayName=hN;var yN=`MenuContent`,[bN,xN]=iN(yN),SN=_.forwardRef((e,t)=>{let n=_N(yN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=lN(yN,e.__scopeMenu),o=dN(yN,e.__scopeMenu);return(0,V.jsx)(tN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(tN.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(CN,{...i,ref:t}):(0,V.jsx)(wN,{...i,ref:t})})})})}),CN=_.forwardRef((e,t)=>{let n=lN(yN,e.__scopeMenu),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(EN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wN=_.forwardRef((e,t)=>{let n=lN(yN,e.__scopeMenu);return(0,V.jsx)(EN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),TN=HM(`MenuContent.ScrollLock`),EN=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=lN(yN,n),v=dN(yN,n),y=oN(n),b=sN(n),x=nN(n),[S,C]=_.useState(null),w=_.useRef(null),T=br(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?_l:_.Fragment,N=m?{as:TN,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=uP(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),cc();let F=_.useCallback(e=>A.current===k.current?.side&&fP(e,k.current?.area),[]);return(0,V.jsx)(bN,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,V.jsx)(M,{...N,children:(0,V.jsx)(Ys,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(BM,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:H(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(ip,{role:`menu`,"aria-orientation":`vertical`,"data-state":aP(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!ZM.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);XM.includes(e.key)&&a.reverse(),cP(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:H(e.onPointerMove,pP(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});SN.displayName=yN;var DN=`MenuGroup`,ON=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`group`,...r,ref:t})});ON.displayName=DN;var kN=`MenuLabel`,AN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});AN.displayName=kN;var jN=`MenuItem`,MN=`menu.itemSelect`,NN=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=dN(jN,e.__scopeMenu),s=xN(jN,e.__scopeMenu),c=br(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(MN,{bubbles:!0,cancelable:!0});e.addEventListener(MN,e=>r?.(e),{once:!0}),Lr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(PN,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||JM.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});NN.displayName=jN;var PN=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=xN(jN,n),s=sN(n),c=_.useRef(null),l=br(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(tN.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(VM,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(U.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,pP(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,pP(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),FN=`MenuCheckboxItem`,IN=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(WN,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(NN,{role:`menuitemcheckbox`,"aria-checked":oP(n)?`mixed`:n,...i,ref:t,"data-state":sP(n),onSelect:H(i.onSelect,()=>r?.(oP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});IN.displayName=FN;var LN=`MenuRadioGroup`,[RN,zN]=iN(LN,{value:void 0,onValueChange:()=>{}}),BN=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rr(r);return(0,V.jsx)(RN,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(ON,{...i,ref:t})})});BN.displayName=LN;var VN=`MenuRadioItem`,HN=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=zN(VN,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(WN,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(NN,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":sP(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});HN.displayName=VN;var UN=`MenuItemIndicator`,[WN,GN]=iN(UN,{checked:!1}),KN=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=GN(UN,n);return(0,V.jsx)(ai,{present:r||oP(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{...i,ref:t,"data-state":sP(a.checked)})})});KN.displayName=UN;var qN=`MenuSeparator`,JN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});JN.displayName=qN;var YN=`MenuArrow`,XN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=oN(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});XN.displayName=YN;var ZN=`MenuSub`,[QN,$N]=iN(ZN),eP=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=lN(ZN,t),o=oN(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Rr(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(np,{...o,children:(0,V.jsx)(cN,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(QN,{scope:t,contentId:Ws(),triggerId:Ws(),trigger:s,onTriggerChange:c,children:n})})})};eP.displayName=ZN;var tP=`MenuSubTrigger`,nP=_.forwardRef((e,t)=>{let n=lN(tP,e.__scopeMenu),r=dN(tP,e.__scopeMenu),i=$N(tP,e.__scopeMenu),a=xN(tP,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,V.jsx)(mN,{asChild:!0,...l,children:(0,V.jsx)(PN,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":aP(n.open),...e,ref:yr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,pP(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,pP(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||QM[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});nP.displayName=tP;var rP=`MenuSubContent`,iP=_.forwardRef((e,t)=>{let n=_N(yN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=lN(yN,e.__scopeMenu),o=dN(yN,e.__scopeMenu),s=$N(rP,e.__scopeMenu),c=_.useRef(null),l=br(t,c);return(0,V.jsx)(tN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(tN.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(EN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=$M[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});iP.displayName=rP;function aP(e){return e?`open`:`closed`}function oP(e){return e===`indeterminate`}function sP(e){return oP(e)?`indeterminate`:e?`checked`:`unchecked`}function cP(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function lP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uP(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=lP(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function dP(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function fP(e,t){return t?dP({x:e.clientX,y:e.clientY},t):!1}function pP(e){return t=>t.pointerType===`mouse`?e(t):void 0}var mP=fN,hP=mN,gP=vN,_P=SN,vP=ON,yP=AN,bP=NN,xP=IN,SP=BN,CP=HN,wP=KN,TP=JN,EP=XN,DP=nP,OP=iP,kP=`DropdownMenu`,[AP,Tte]=Sr(kP,[aN]),jP=aN(),[MP,NP]=AP(kP),PP=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=jP(t),l=_.useRef(null),[u,d]=ui({prop:i,defaultProp:a??!1,onChange:o,caller:kP});return(0,V.jsx)(MP,{scope:t,triggerId:Ws(),triggerRef:l,contentId:Ws(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(mP,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};PP.displayName=kP;var FP=`DropdownMenuTrigger`,IP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=NP(FP,n),o=jP(n);return(0,V.jsx)(hP,{asChild:!0,...o,children:(0,V.jsx)(U.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:yr(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});IP.displayName=FP;var LP=`DropdownMenuPortal`,RP=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jP(t);return(0,V.jsx)(gP,{...r,...n})};RP.displayName=LP;var zP=`DropdownMenuContent`,BP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=NP(zP,n),a=jP(n),o=_.useRef(!1);return(0,V.jsx)(_P,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});BP.displayName=zP;var VP=`DropdownMenuGroup`,HP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(vP,{...i,...r,ref:t})});HP.displayName=VP;var UP=`DropdownMenuLabel`,WP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(yP,{...i,...r,ref:t})});WP.displayName=UP;var GP=`DropdownMenuItem`,KP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(bP,{...i,...r,ref:t})});KP.displayName=GP;var qP=`DropdownMenuCheckboxItem`,JP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(xP,{...i,...r,ref:t})});JP.displayName=qP;var YP=`DropdownMenuRadioGroup`,XP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(SP,{...i,...r,ref:t})});XP.displayName=YP;var ZP=`DropdownMenuRadioItem`,QP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(CP,{...i,...r,ref:t})});QP.displayName=ZP;var $P=`DropdownMenuItemIndicator`,eF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(wP,{...i,...r,ref:t})});eF.displayName=$P;var tF=`DropdownMenuSeparator`,nF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(TP,{...i,...r,ref:t})});nF.displayName=tF;var rF=`DropdownMenuArrow`,iF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(EP,{...i,...r,ref:t})});iF.displayName=rF;var aF=`DropdownMenuSubTrigger`,oF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(DP,{...i,...r,ref:t})});oF.displayName=aF;var sF=`DropdownMenuSubContent`,cF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(OP,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});cF.displayName=sF;var lF=PP,uF=IP,dF=RP,fF=BP,pF=WP,mF=KP,hF=JP,gF=QP,_F=eF,vF=nF,yF=oF,bF=cF,xF=lF,SF=uF,CF=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,V.jsxs)(yF,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,V.jsx)(Oa,{className:`ml-auto h-4 w-4`})]}));CF.displayName=yF.displayName;var wF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(bF,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));wF.displayName=bF.displayName;var TF=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(dF,{children:(0,V.jsx)(fF,{ref:r,sideOffset:t,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));TF.displayName=fF.displayName;var EF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(mF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));EF.displayName=mF.displayName;var DF=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,V.jsxs)(hF,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(_F,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),t]}));DF.displayName=hF.displayName;var OF=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(gF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(_F,{children:(0,V.jsx)(Ia,{className:`h-2 w-2 fill-current`})})}),t]}));OF.displayName=gF.displayName;var kF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(pF,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));kF.displayName=pF.displayName;var AF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vF,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));AF.displayName=vF.displayName;var jF=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest opacity-60`,e),...t});jF.displayName=`DropdownMenuShortcut`;var MF=`lelab.recording.muted`,NF=null,PF=()=>(NF||=new AudioContext,NF),FF=()=>localStorage.getItem(MF)===`1`,IF=e=>{localStorage.setItem(MF,e?`1`:`0`)},LF=(e,t,n=0)=>{if(FF())return;let r=PF(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},RF=()=>{LF(660,80,0),LF(880,80,90)},zF=()=>{LF(660,80,0),LF(440,80,90)},BF=()=>{LF(880,70,0),LF(880,70,1e3),LF(880,70,2e3)},VF=Symbol(`radix.slottable`);function HF(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=VF,t}var UF=`AlertDialog`,[WF,Ete]=Sr(UF,[Fl]),GF=Fl(),KF=e=>{let{__scopeAlertDialog:t,...n}=e,r=GF(t);return(0,V.jsx)(pu,{...r,...n,modal:!0})};KF.displayName=UF;var qF=`AlertDialogTrigger`,JF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(mu,{...i,...r,ref:t})});JF.displayName=qF;var YF=`AlertDialogPortal`,XF=e=>{let{__scopeAlertDialog:t,...n}=e,r=GF(t);return(0,V.jsx)(hu,{...r,...n})};XF.displayName=YF;var ZF=`AlertDialogOverlay`,QF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(gu,{...i,...r,ref:t})});QF.displayName=ZF;var $F=`AlertDialogContent`,[eI,tI]=WF($F),nI=HF(`AlertDialogContent`),rI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=GF(n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return(0,V.jsx)(cu,{contentName:$F,titleName:iI,docsSlug:`alert-dialog`,children:(0,V.jsx)(eI,{scope:n,cancelRef:c,children:(0,V.jsxs)(_u,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:H(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,V.jsx)(nI,{children:r}),(0,V.jsx)(fI,{contentRef:o})]})})})});rI.displayName=$F;var iI=`AlertDialogTitle`,aI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(vu,{...i,...r,ref:t})});aI.displayName=iI;var oI=`AlertDialogDescription`,sI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(yu,{...i,...r,ref:t})});sI.displayName=oI;var cI=`AlertDialogAction`,lI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(bu,{...i,...r,ref:t})});lI.displayName=cI;var uI=`AlertDialogCancel`,dI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=tI(uI,n),a=GF(n),o=br(t,i);return(0,V.jsx)(bu,{...a,...r,ref:o})});dI.displayName=uI;var fI=({contentRef:e})=>{let t=`\`${$F}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${$F}\` by passing a \`${oI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${$F}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},pI=KF,mI=XF,hI=QF,gI=rI,_I=lI,vI=dI,yI=aI,bI=sI,xI=pI,SI=mI,CI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(hI,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));CI.displayName=hI.displayName;var wI=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(SI,{children:[(0,V.jsx)(CI,{}),(0,V.jsx)(gI,{ref:n,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));wI.displayName=gI.displayName;var TI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});TI.displayName=`AlertDialogHeader`;var EI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});EI.displayName=`AlertDialogFooter`;var DI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yI,{ref:n,className:W(`text-lg font-semibold`,e),...t}));DI.displayName=yI.displayName;var OI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(bI,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));OI.displayName=bI.displayName;var kI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_I,{ref:n,className:W(js(),e),...t}));kI.displayName=_I.displayName;var AI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vI,{ref:n,className:W(js({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));AI.displayName=vI.displayName;var Dte=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=Rs(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>FF()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useCallback)(()=>{g(e=>{let t=!e;return IF(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,D())},[o]);let w=(0,_.useRef)(d);w.current=d;let T=(0,_.useRef)(y);T.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let n=await e.json();c(n);let i=w.current;i&&n.current_phase===i&&f(null);let s=n.current_phase,l=v.current;l!==s&&(s===`recording`&&l!==null?RF():s===`resetting`&&zF(),v.current=s,x.current={phase:null,episode:null,tick:0});let u=n.phase_elapsed_seconds||0,d=n.phase_time_limit_s||0,p=d>3&&u>=d-3,m=n.current_episode??null,h=T.current,g=x.current;p&&i===null&&(g.phase!==s||g.episode!==m||g.tick!==h)&&(BF(),x.current={phase:s,episode:m,tick:h}),!n.recording_active&&n.session_ended&&t(`/upload`,{state:{datasetInfo:{dataset_repo_id:n.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:n.saved_episodes||0,session_elapsed_seconds:n.session_elapsed_seconds||0}}})}catch(e){console.error(`Error polling recording status:`,e)}};e();let n=setInterval(e,1e3);return()=>clearInterval(n)},[l,o,t,r,a]);let E=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},D=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},O=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),k=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),A=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),j=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),M=(0,_.useCallback)(async()=>{m(!1),await A()},[A]),N=(0,_.useRef)({handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p});(0,_.useEffect)(()=>{N.current={handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p}});let P=l&&s!==null;if((0,_.useEffect)(()=>{if(!P)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),N.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),N.current.handleRerecordEpisode();else if(e.key===`Escape`){if(N.current.showStopConfirm)return;N.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P]),!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,V.jsx)(G,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let F=s.current_phase,I=d??F,ee=s.current_episode??1,te=s.total_episodes??o.num_episodes,ne=d?0:s.phase_elapsed_seconds||0,re=I===`recording`?o.episode_time_s:I===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,ie=s.session_elapsed_seconds||0,ae=()=>I===`recording`?`RECORDING EPISODE ${ee}`:I===`resetting`?`RESET — GET READY`:I===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,oe=I===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:I===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},se=I===`recording`?`End Episode`:I===`resetting`?`Start Next Episode`:`Advance`,ce=I===`recording`?ro:Xa;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-2xl mx-auto`,children:[(0,V.jsx)(`div`,{className:`mb-8`,children:(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8`,children:[(0,V.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-6 text-sm text-gray-400`,children:[(0,V.jsxs)(`span`,{"aria-label":`Episode ${ee} of ${te}`,children:[`Episode `,(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:ee}),` / `,te]}),(0,V.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${E(ie)}`,children:E(ie)}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:C,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,V.jsx)(po,{className:`w-5 h-5`}):(0,V.jsx)(fo,{className:`w-5 h-5`})}),(0,V.jsxs)(xF,{children:[(0,V.jsx)(SF,{asChild:!0,children:(0,V.jsx)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,V.jsx)(Va,{className:`w-5 h-5`})})}),(0,V.jsxs)(TF,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(EF,{onClick:k,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,V.jsx)($a,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,V.jsxs)(EF,{onClick:j,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${oe.pill}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${oe.dot} ${I===`completed`?``:`animate-pulse`}`}),ae()]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${oe.timer}`,children:E(ne)}),(0,V.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,E(re)]})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${oe.bar}`,style:{width:`${Math.min(ne/re*100,100)}%`}})}),(0,V.jsxs)(G,{onClick:O,disabled:!s.available_controls.exit_early||d!==null||I===`completed`,className:`w-full text-white font-semibold py-6 text-lg disabled:opacity-50 ${oe.button}`,children:[(0,V.jsx)(ce,{className:`w-5 h-5 mr-2`}),se,I!==`completed`&&(0,V.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),I===`completed`&&(0,V.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,V.jsx)(xI,{open:p,onOpenChange:m,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Stop recording?`}),(0,V.jsx)(OI,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,V.jsx)(kI,{onClick:M,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},jI=()=>{let e=Re();return(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(zj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},MI=/^[\w.\-]+\/[\w.\-]+$/,Ote=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();MI.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,V.jsxs)(bh,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Th,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(G,{onClick:u,disabled:!MI.test(c.trim()),children:`Use`}),(0,V.jsx)(G,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,V.jsxs)(gm,{open:i,onOpenChange:a,children:[(0,V.jsx)(_m,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(vm,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,V.jsxs)(mh,{className:`bg-gray-800 text-white`,children:[(0,V.jsx)(hh,{placeholder:`Search datasets…`,className:`text-white`}),(0,V.jsxs)(gh,{children:[(0,V.jsx)(_h,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,V.jsx)(vh,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,V.jsx)(vh,{heading:`Hugging Face`,children:f.map(p)}),(0,V.jsx)(vh,{children:(0,V.jsxs)(bh,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ya,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},kte=1500;function NI(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},kte);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function PI(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function FI({state:e}){return e===`done`?(0,V.jsx)(Na,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,V.jsx)(Fa,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,V.jsx)(qa,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,V.jsx)(co,{className:`w-6 h-6 text-amber-400`})}var II=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=_r();return(0,V.jsxs)(V.Fragment,{children:[e===`idle`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsx)(G,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,V.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,V.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,V.jsx)(G,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,V.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,V.jsx)(`div`,{children:e.message},t))})]})},LI=({purpose:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,V.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,V.jsxs)(`li`,{children:[`Press`,` `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,V.jsxs)(`li`,{children:[`Run`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),Ate=({open:e,onOpenChange:t,installHint:n})=>{let r=NI(`system/wandb-extra`,e);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:r.state}),PI(r.state,`Weights & Biases Not Installed`)]}),(0,V.jsx)(Ou,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(II,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`W&B logging`})})})]})})},jte=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=Rs(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`Run Configuration`})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(Ote,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,V.jsxs)(J_,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,V.jsx)(X_,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,V.jsx)(tv,{value:`diffusion`,children:`Diffusion Policy`}),(0,V.jsx)(tv,{value:`pi0`,children:`PI0`}),(0,V.jsx)(tv,{value:`smolvla`,children:`SmolVLA`}),(0,V.jsx)(tv,{value:`groot`,children:`GR00T N1.7`}),(0,V.jsx)(tv,{value:`tdmpc`,children:`TD-MPC`}),(0,V.jsx)(tv,{value:`vqbet`,children:`VQ-BeT`}),(0,V.jsx)(tv,{value:`pi0_fast`,children:`PI0 Fast`}),(0,V.jsx)(tv,{value:`sac`,children:`SAC`}),(0,V.jsx)(tv,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,V.jsx)(Eh,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,V.jsx)(Eh,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)($j,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,V.jsx)(Ate,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,V.jsx)(Th,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},RI={policy_base_model_path:`nvidia/GR00T-N1.7-3B`,policy_embodiment_tag:`new_embodiment`,policy_chunk_size:16,policy_n_action_steps:16,policy_use_relative_actions:!0,policy_relative_exclude_joints:[`gripper`],policy_use_bf16:!0,dataset_image_transforms_enable:!0},Mte=({config:e,updateConfig:t})=>{let n=e.policy_type===`groot`;if((0,_.useEffect)(()=>{n&&Object.keys(RI).forEach(n=>{e[n]===void 0&&t(n,RI[n])})},[n]),!n)return null;let r=(e.policy_relative_exclude_joints??[]).join(`, `);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`GR00T N1.7`})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_base_model_path`,className:`text-slate-300`,children:`Base Model Path`}),(0,V.jsx)(Th,{id:`policy_base_model_path`,value:e.policy_base_model_path??``,onChange:e=>t(`policy_base_model_path`,e.target.value||void 0),placeholder:`nvidia/GR00T-N1.7-3B`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace repo of the pretrained GR00T backbone to fine-tune.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_embodiment_tag`,className:`text-slate-300`,children:`Embodiment Tag`}),(0,V.jsx)(Th,{id:`policy_embodiment_tag`,value:e.policy_embodiment_tag??``,onChange:e=>t(`policy_embodiment_tag`,e.target.value||void 0),placeholder:`new_embodiment`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_relative_exclude_joints`,className:`text-slate-300`,children:`Relative Exclude Joints`}),(0,V.jsx)(Th,{id:`policy_relative_exclude_joints`,value:r,onChange:e=>t(`policy_relative_exclude_joints`,e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)),placeholder:`gripper`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Comma-separated joints kept absolute when relative actions are on.`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_chunk_size`,className:`text-slate-300`,children:`Chunk Size`}),(0,V.jsx)(Eh,{id:`policy_chunk_size`,value:e.policy_chunk_size,onChange:e=>t(`policy_chunk_size`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_n_action_steps`,className:`text-slate-300`,children:`Action Steps`}),(0,V.jsx)(Eh,{id:`policy_n_action_steps`,value:e.policy_n_action_steps,onChange:e=>t(`policy_n_action_steps`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`policy_use_relative_actions`,checked:e.policy_use_relative_actions??!1,onCheckedChange:e=>t(`policy_use_relative_actions`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`policy_use_relative_actions`,className:`text-slate-300`,children:`Use Relative Actions`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`policy_use_bf16`,checked:e.policy_use_bf16??!1,onCheckedChange:e=>t(`policy_use_bf16`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`policy_use_bf16`,className:`text-slate-300`,children:`Use bfloat16`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`dataset_image_transforms_enable`,checked:e.dataset_image_transforms_enable??!1,onCheckedChange:e=>t(`dataset_image_transforms_enable`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`dataset_image_transforms_enable`,className:`text-slate-300`,children:`Enable Image Augmentations`})]})]})]})]})},zI=({children:e})=>(0,V.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),Nte=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsxs)(Cv,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,V.jsx)(Da,{className:`w-4 h-4`}):(0,V.jsx)(Oa,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,V.jsxs)(Tv,{className:`space-y-8`,children:[(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Policy`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,V.jsxs)(J_,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,V.jsx)(X_,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`cuda`,children:`CUDA (GPU)`}),(0,V.jsx)(tv,{value:`cpu`,children:`CPU`}),(0,V.jsx)(tv,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)($j,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,V.jsx)(q,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Training`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,V.jsx)(Eh,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,V.jsx)(Eh,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Optimizer`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,V.jsxs)(J_,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,V.jsx)(X_,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`adam`,children:`Adam`}),(0,V.jsx)(tv,{value:`adamw`,children:`AdamW`}),(0,V.jsx)(tv,{value:`sgd`,children:`SGD`}),(0,V.jsx)(tv,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,V.jsx)(Eh,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,V.jsx)(Eh,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,V.jsx)(Eh,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Logging & Checkpointing`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,V.jsx)(Eh,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,V.jsx)(Eh,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,V.jsx)(q,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,V.jsx)(q,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Weights & Biases`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,V.jsx)(Th,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,V.jsx)(Th,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,V.jsxs)(J_,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,V.jsx)(X_,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`online`,children:`Online`}),(0,V.jsx)(tv,{value:`offline`,children:`Offline`}),(0,V.jsx)(tv,{value:`disabled`,children:`Disabled`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,V.jsx)(q,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Misc`}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,V.jsx)(q,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},Pte=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,Fte=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${Pte(e.unit_cost_usd,e.unit_label)}`},Ite=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`Compute target`})}),(0,V.jsx)(Tv,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{className:`text-slate-300`,children:`Run training on`}),(0,V.jsxs)(J_,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,V.jsx)(X_,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,V.jsx)(Y_,{placeholder:i?`Loading…`:`Select target`})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,V.jsxs)(tv,{value:`hf:${e.name}`,disabled:!n,children:[Fte(e),!n&&(0,V.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},Lte=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,V.jsx)(Ite,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,V.jsx)(jte,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,V.jsx)(Mte,{config:e,updateConfig:t}),(0,V.jsx)(Nte,{config:e,updateConfig:t})]}),BI=o(((e,t)=>{t.exports=Array.isArray})),VI=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),HI=o(((e,t)=>{var n=VI(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),UI=o(((e,t)=>{t.exports=HI().Symbol})),Rte=o(((e,t)=>{var n=UI(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),zte=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),WI=o(((e,t)=>{var n=UI(),r=Rte(),i=zte(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),GI=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),KI=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),qI=o(((e,t)=>{var n=BI(),r=KI(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),JI=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),YI=o(((e,t)=>{var n=WI(),r=JI(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Bte=o(((e,t)=>{t.exports=HI()[`__core-js_shared__`]})),Vte=o(((e,t)=>{var n=Bte(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),XI=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Hte=o(((e,t)=>{var n=YI(),r=Vte(),i=JI(),a=XI(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Ute=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),ZI=o(((e,t)=>{var n=Hte(),r=Ute();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),QI=o(((e,t)=>{t.exports=ZI()(Object,`create`)})),Wte=o(((e,t)=>{var n=QI();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Gte=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Kte=o(((e,t)=>{var n=QI(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),qte=o(((e,t)=>{var n=QI(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Jte=o(((e,t)=>{var n=QI(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Yte=o(((e,t)=>{var n=Wte(),r=Gte(),i=Kte(),a=qte(),o=Jte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),$I=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),eL=o(((e,t)=>{var n=$I();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Zte=o(((e,t)=>{var n=eL(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Qte=o(((e,t)=>{var n=eL();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),$te=o(((e,t)=>{var n=eL();function r(e){return n(this.__data__,e)>-1}t.exports=r})),ene=o(((e,t)=>{var n=eL();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),tL=o(((e,t)=>{var n=Xte(),r=Zte(),i=Qte(),a=$te(),o=ene();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=ZI()(HI(),`Map`)})),tne=o(((e,t)=>{var n=Yte(),r=tL(),i=nL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),nne=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),rL=o(((e,t)=>{var n=nne();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),rne=o(((e,t)=>{var n=rL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),ine=o(((e,t)=>{var n=rL();function r(e){return n(this,e).get(e)}t.exports=r})),ane=o(((e,t)=>{var n=rL();function r(e){return n(this,e).has(e)}t.exports=r})),one=o(((e,t)=>{var n=rL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),iL=o(((e,t)=>{var n=tne(),r=rne(),i=ine(),a=ane(),o=one();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=iL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),sne=o(((e,t)=>{var n=aL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),cne=o(((e,t)=>{var n=sne(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),oL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=UI(),r=oL(),i=BI(),a=KI(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),sL=o(((e,t)=>{var n=lne();function r(e){return e==null?``:n(e)}t.exports=r})),cL=o(((e,t)=>{var n=BI(),r=qI(),i=cne(),a=sL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),lL=o(((e,t)=>{var n=KI(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),uL=o(((e,t)=>{var n=cL(),r=lL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=uL();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),une=o(((e,t)=>{function n(e){return e==null}t.exports=n})),dne=o(((e,t)=>{var n=WI(),r=BI(),i=GI(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),fne=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),pne=o(((e,t)=>{t.exports=fne()})),fL=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),mne=o(((e,t)=>{var n=fL();function r(e){return n(e)&&e!=+e}t.exports=r})),pL=l(dne()),mL=l(mne()),hL=l(dL()),hne=l(fL()),gL=l(une()),_L=function(e){return e===0?0:e>0?1:-1},vL=function(e){return(0,pL.default)(e)&&e.indexOf(`%`)===e.length-1},Q=function(e){return(0,hne.default)(e)&&!(0,mL.default)(e)},yL=function(e){return(0,gL.default)(e)},bL=function(e){return Q(e)||(0,pL.default)(e)},xL=0,SL=function(e){var t=++xL;return`${e||``}${t}`},CL=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Q(e)&&!(0,pL.default)(e))return n;var i;if(vL(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,mL.default)(i)&&(i=n),r&&i>t&&(i=t),i},wL=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},TL=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function GL(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function KL(e){"@babel/helpers - typeof";return KL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},KL(e)}var qL={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},JL=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},YL=null,XL=null,ZL=function e(t){if(t===YL&&Array.isArray(XL))return XL;var n=[];return _.Children.forEach(t,function(t){(0,gL.default)(t)||((0,VL.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),XL=n,YL=t,n};function QL(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return JL(e)}):[JL(t)],ZL(e).forEach(function(e){var t=(0,hL.default)(e,`type.displayName`)||(0,hL.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function $L(e,t){var n=QL(e,t);return n&&n[0]}var eR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Q(n)||n<=0||!Q(r)||r<=0)},tR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),nR=function(e){return e&&e.type&&(0,pL.default)(e.type)&&tR.indexOf(e.type)>=0},rR=function(e){return e&&KL(e)===`object`&&`clipDot`in e},iR=function(e,t,n,r){var i=FL?.[r]??[];return t.startsWith(`data-`)||!(0,BL.default)(e)&&(r&&i.includes(t)||NL.includes(t))||n&&IL.includes(t)},aR=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,AL.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){iR(r?.[e],e,t,n)&&(i[e]=r[e])}),i},oR=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return sR(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hR(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=pR(e,dR),u=i||{width:n,height:r,x:0,y:0},d=pa(`recharts-surface`,a);return _.createElement(`svg`,fR({},aR(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var gR=[`children`,`className`];function _R(){return _R=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bR=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=vR(e,gR),a=pa(`recharts-layer`,r);return _.createElement(`g`,_R({className:a},aR(i,!0),{ref:t}),n)}),xR=!1,SR=function(e,t){var n=[...arguments].slice(2);if(xR&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},CR=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=CR();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),TR=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),ER=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),DR=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),OR=o(((e,t)=>{var n=ER(),r=TR(),i=DR();function a(e){return r(e)?i(e):n(e)}t.exports=a})),kR=o(((e,t)=>{var n=wR(),r=TR(),i=OR(),a=sL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),AR=o(((e,t)=>{t.exports=kR()(`toUpperCase`)}));function jR(e){return function(){return e}}var MR=Math.cos,NR=Math.sin,PR=Math.sqrt,FR=Math.PI;FR/2;var IR=2*FR,LR=Math.PI,RR=2*LR,zR=1e-6,BR=RR-zR;function VR(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return VR;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tzR)if(!(Math.abs(u*s-c*l)>zR)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((LR-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>zR&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>zR||Math.abs(this._y1-l)>zR)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%RR+RR),d>BR?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>zR&&this._append`A${n},${n},0,${+(d>=LR)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function WR(){return new UR}WR.prototype=UR.prototype;function GR(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new UR(t)}Array.prototype.slice;function KR(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function qR(e){this._context=e}qR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function JR(e){return new qR(e)}function YR(e){return e[0]}function XR(e){return e[1]}function ZR(e,t){var n=jR(!0),r=null,i=JR,a=null,o=GR(s);e=typeof e==`function`?e:e===void 0?YR:jR(e),t=typeof t==`function`?t:t===void 0?XR:jR(t);function s(s){var c,l=(s=KR(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ZR().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:jR(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:jR(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:jR(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:jR(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:jR(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var $R=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function ez(e){return new $R(e,!0)}function tz(e){return new $R(e,!1)}var nz={draw(e,t){let n=PR(t/FR);e.moveTo(n,0),e.arc(0,0,n,0,IR)}},rz={draw(e,t){let n=PR(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},iz=PR(1/3),az=iz*2,oz={draw(e,t){let n=PR(t/az),r=n*iz;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},sz={draw(e,t){let n=PR(t),r=-n/2;e.rect(r,r,n,n)}},cz=.8908130915292852,lz=NR(FR/10)/NR(7*FR/10),uz=NR(IR/10)*lz,dz=-MR(IR/10)*lz,fz={draw(e,t){let n=PR(t*cz),r=uz*n,i=dz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=IR*t/5,o=MR(a),s=NR(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},pz=PR(3),mz={draw(e,t){let n=-PR(t/(pz*3));e.moveTo(0,n*2),e.lineTo(-pz*n,-n),e.lineTo(pz*n,-n),e.closePath()}},hz=-.5,gz=PR(3)/2,_z=1/PR(12),vz=(_z/2+1)*3,yz={draw(e,t){let n=PR(t/vz),r=n/2,i=n*_z,a=r,o=n*_z+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(hz*r-gz*i,gz*r+hz*i),e.lineTo(hz*a-gz*o,gz*a+hz*o),e.lineTo(hz*s-gz*c,gz*s+hz*c),e.lineTo(hz*r+gz*i,hz*i-gz*r),e.lineTo(hz*a+gz*o,hz*o-gz*a),e.lineTo(hz*s+gz*c,hz*c-gz*s),e.closePath()}};function bz(e,t){let n=null,r=GR(i);e=typeof e==`function`?e:jR(e||nz),t=typeof t==`function`?t:jR(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:jR(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function xz(){}function Sz(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Cz(e){this._context=e}Cz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Sz(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function wz(e){return new Cz(e)}function Tz(e){this._context=e}Tz.prototype={areaStart:xz,areaEnd:xz,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ez(e){return new Tz(e)}function Dz(e){this._context=e}Dz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Oz(e){return new Dz(e)}function kz(e){this._context=e}kz.prototype={areaStart:xz,areaEnd:xz,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Az(e){return new kz(e)}function jz(e){return e<0?-1:1}function Mz(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(jz(a)+jz(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Nz(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Pz(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Fz(e){this._context=e}Fz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Pz(this,this._t0,Nz(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Pz(this,Nz(this,n=Mz(this,e,t)),n);break;default:Pz(this,this._t0,n=Mz(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Iz(e){this._context=new Lz(e)}(Iz.prototype=Object.create(Fz.prototype)).point=function(e,t){Fz.prototype.point.call(this,t,e)};function Lz(e){this._context=e}Lz.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Rz(e){return new Fz(e)}function zz(e){return new Iz(e)}function Bz(e){this._context=e}Bz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Vz(e),i=Vz(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function Wz(e){return new Uz(e,.5)}function Gz(e){return new Uz(e,0)}function Kz(e){return new Uz(e,1)}function qz(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Yz(e,t){return e[t]}function Xz(e){let t=[];return t.key=e,t}function Zz(){var e=jR([]),t=Jz,n=qz,r=Yz;function i(i){var a=Array.from(e.apply(this,arguments),Xz),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dB(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fB={symbolCircle:nz,symbolCross:rz,symbolDiamond:oz,symbolSquare:sz,symbolStar:fz,symbolTriangle:mz,symbolWye:yz},pB=Math.PI/180,mB=function(e){return fB[`symbol${(0,tB.default)(e)}`]||nz},hB=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*pB;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gB=function(e,t){fB[`symbol${(0,tB.default)(e)}`]=t},_B=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=oB(oB({},uB(e,rB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=mB(n);return bz().type(e).size(hB(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=aR(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,iB({},f,{className:pa(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};_B.registerSymbol=gB;function vB(e){"@babel/helpers - typeof";return vB=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vB(e)}function yB(){return yB=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var f=t.inactive?o:t.color;return _.createElement(`li`,yB({className:u,style:c,key:`legend-item-${n}`},zL(e.props,t,n)),_.createElement(hR,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);MB(IB,`displayName`,`Legend`),MB(IB,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var LB=o(((e,t)=>{var n=tL();function r(){this.__data__=new n,this.size=0}t.exports=r})),RB=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),zB=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),BB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),VB=o(((e,t)=>{var n=tL(),r=nL(),i=iL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=tL(),r=LB(),i=RB(),a=zB(),o=BB(),s=VB();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),UB=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),WB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),GB=o(((e,t)=>{var n=iL(),r=UB(),i=WB();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),JB=o(((e,t)=>{var n=GB(),r=KB(),i=qB(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=HI().Uint8Array})),XB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),ZB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),QB=o(((e,t)=>{var n=UI(),r=YB(),i=$I(),a=JB(),o=XB(),s=ZB(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),$B=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=$B(),r=BI();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),tV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),rV=o(((e,t)=>{var n=tV(),r=nV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),iV=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=WI(),r=GI(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),oV=o(((e,t)=>{var n=aV(),r=GI(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),sV=o(((e,t)=>{function n(){return!1}t.exports=n})),cV=o(((e,t)=>{var n=HI(),r=sV(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),lV=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),dV=o(((e,t)=>{var n=WI(),r=uV(),i=GI(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),fV=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),pV=o(((e,t)=>{var n=VI(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),mV=o(((e,t)=>{var n=dV(),r=fV(),i=pV(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),hV=o(((e,t)=>{var n=iV(),r=oV(),i=BI(),a=cV(),o=lV(),s=mV(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),gV=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),_V=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),vV=o(((e,t)=>{t.exports=_V()(Object.keys,Object)})),yV=o(((e,t)=>{var n=gV(),r=vV(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),bV=o(((e,t)=>{var n=YI(),r=uV();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),xV=o(((e,t)=>{var n=hV(),r=yV(),i=bV();function a(e){return i(e)?n(e):r(e)}t.exports=a})),SV=o(((e,t)=>{var n=eV(),r=rV(),i=xV();function a(e){return n(e,i,r)}t.exports=a})),CV=o(((e,t)=>{var n=SV(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=ZI()(HI(),`DataView`)})),TV=o(((e,t)=>{t.exports=ZI()(HI(),`Promise`)})),EV=o(((e,t)=>{t.exports=ZI()(HI(),`Set`)})),DV=o(((e,t)=>{t.exports=ZI()(HI(),`WeakMap`)})),OV=o(((e,t)=>{var n=wV(),r=nL(),i=TV(),a=EV(),o=DV(),s=WI(),c=XI(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),kV=o(((e,t)=>{var n=HB(),r=JB(),i=QB(),a=CV(),o=OV(),s=BI(),c=cV(),l=mV(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),AV=o(((e,t)=>{var n=kV(),r=GI();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),jV=o(((e,t)=>{var n=HB(),r=AV(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=JI();function r(e){return e===e&&!n(e)}t.exports=r})),NV=o(((e,t)=>{var n=MV(),r=xV();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),PV=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),FV=o(((e,t)=>{var n=jV(),r=NV(),i=PV();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),IV=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),LV=o(((e,t)=>{var n=cL(),r=oV(),i=BI(),a=lV(),o=uV(),s=lL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=IV(),r=LV();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),zV=o(((e,t)=>{var n=AV(),r=dL(),i=RV(),a=qI(),o=MV(),s=PV(),c=lL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),BV=o(((e,t)=>{function n(e){return e}t.exports=n})),VV=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),HV=o(((e,t)=>{var n=uL();function r(e){return function(t){return n(t,e)}}t.exports=r})),UV=o(((e,t)=>{var n=VV(),r=HV(),i=qI(),a=lL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),WV=o(((e,t)=>{var n=FV(),r=zV(),i=BV(),a=BI(),o=UV();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),GV=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),qV=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=GV(),r=KV(),i=qV();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),YV=o(((e,t)=>{var n=JV();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),XV=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),QV=o(((e,t)=>{var n=EV(),r=ZV(),i=ZB();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),$V=o(((e,t)=>{var n=GB(),r=YV(),i=XV(),a=qB(),o=QV(),s=ZB(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=WV(),r=$V();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function tH(e,t,n){return t===!0?(0,eH.default)(e,n):(0,BL.default)(t)?(0,eH.default)(e,t):e}function nH(e){"@babel/helpers - typeof";return nH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nH(e)}var rH=[`ref`];function iH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aH(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xH(e){return e.value}function SH(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=yH(t,rH);return _.createElement(IB,n)}var CH=1,wH=function(e){function t(){var e;oH(this,t);var n=[...arguments];return e=lH(this,t,[].concat(n)),gH(e,`lastBoundingBox`,{width:-1,height:-1}),e}return mH(t,e),cH(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>CH||Math.abs(t.height-this.lastBoundingBox.height)>CH)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?aH({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return aH(aH({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=aH(aH({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},SH(n,aH(aH({},this.props),{},{payload:tH(s,o,xH)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=aH(aH({},this.defaultProps),e.props).layout;return n===`vertical`&&Q(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);gH(wH,`displayName`,`Legend`),gH(wH,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var TH=o(((e,t)=>{var n=UI(),r=oV(),i=BI(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),EH=o(((e,t)=>{var n=$B(),r=TH();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),DH=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),OH=o(((e,t)=>{t.exports=DH()()})),kH=o(((e,t)=>{var n=OH(),r=xV();function i(e,t){return e&&n(e,t,r)}t.exports=i})),AH=o(((e,t)=>{var n=bV();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=kH();t.exports=AH()(n)})),MH=o(((e,t)=>{var n=jH(),r=bV();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),NH=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),PH=o(((e,t)=>{var n=KI();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=PH();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),IH=o(((e,t)=>{var n=oL(),r=uL(),i=WV(),a=MH(),o=NH(),s=fV(),c=FH(),l=BV(),u=BI();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),LH=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),RH=o(((e,t)=>{var n=LH(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),BH=o(((e,t)=>{var n=ZI();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),VH=o(((e,t)=>{var n=zH(),r=BH(),i=BV();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),HH=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),UH=o(((e,t)=>{var n=VH();t.exports=HH()(n)})),WH=o(((e,t)=>{var n=BV(),r=RH(),i=UH();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),GH=o(((e,t)=>{var n=$I(),r=bV(),i=lV(),a=JI();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),KH=l(o(((e,t)=>{var n=EH(),r=IH(),i=WH(),a=GH();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function qH(e){"@babel/helpers - typeof";return qH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qH(e)}function JH(){return JH=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${fU}-left`,Q(n)&&t&&Q(t.x)&&n=t.y),`${fU}-top`,Q(r)&&t&&Q(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function gU(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function _U(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=hU({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=hU({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=gU({translateX:u,translateY:d,useTranslate3d:s})):l=pU,{cssProperties:l,cssClasses:mU({translateX:u,translateY:d,coordinate:n})}}function vU(e){"@babel/helpers - typeof";return vU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vU(e)}function yU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bU(e){for(var t=1;tPU||Math.abs(e.height-this.state.lastBoundingBox.height)>PU)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=_U({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=bU(bU({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),IU={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return IU[e]},set:function(e,t){if(typeof e==`string`)IU[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){IU[t]=e[t]})}}};function LU(e){"@babel/helpers - typeof";return LU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},LU(e)}function RU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zU(e){for(var t=1;t0;return _.createElement(FU,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},eW(o,zU(zU({},this.props),{},{payload:y})))}}])}(_.PureComponent);XU(tW,`displayName`,`Tooltip`),XU(tW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!IU.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var nW=o(((e,t)=>{var n=HI();t.exports=function(){return n.Date.now()}})),rW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),iW=o(((e,t)=>{var n=rW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),aW=o(((e,t)=>{var n=iW(),r=JI(),i=KI(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),oW=o(((e,t)=>{var n=JI(),r=nW(),i=aW(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),sW=l(o(((e,t)=>{var n=oW(),r=JI(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function cW(e){"@babel/helpers - typeof";return cW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cW(e)}function lW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uW(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,sW.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;SR(vL(o)||vL(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),SR(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=vL(o)?e:o,i=vL(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),SR(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&JL(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,uW({width:r,height:i},a?{style:uW({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:pa(`recharts-responsive-container`,v),style:uW(uW({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),xW=function(e){return null};xW.displayName=`Cell`;function SW(e){"@babel/helpers - typeof";return SW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},SW(e)}function CW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wW(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||IU.isSsr)return{width:0,height:0};var n=MW(t),r=JSON.stringify({text:e,copyStyle:n});if(OW.widthCache[r])return OW.widthCache[r];try{var i=document.getElementById(jW);i||(i=document.createElement(`span`),i.setAttribute(`id`,jW),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=wW(wW({},AW),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return OW.widthCache[r]=s,++OW.cacheCount>kW&&(OW.cacheCount=0,OW.widthCache={}),s}catch{return{width:0,height:0}}},PW=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function FW(e){"@babel/helpers - typeof";return FW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},FW(e)}function IW(e,t){return VW(e)||BW(e,t)||RW(e,t)||LW()}function LW(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RW(e,t){if(e){if(typeof e==`string`)return zW(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zW(e,t)}}function zW(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function pG(e,t){return vG(e)||_G(e,t)||hG(e,t)||mG()}function mG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hG(e,t){if(e){if(typeof e==`string`)return gG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gG(e,t)}}function gG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=bG({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=pG(h(b-1),2),S=x[0],C=x[1],w=pG(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},SG=function(e){return[{words:(0,gL.default)(e)?[]:e.toString().split(yG)}]},CG=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!IU.isSsr){var s,c,l=bG({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return SG(r);return xG({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return SG(r)},wG=`#808080`,TG=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?wG:h,v=dG(e,cG),y=(0,_.useMemo)(function(){return CG({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=dG(v,lG);if(!bL(n)||!bL(i))return null;var E=n+(Q(b)?b:0),D=i+(Q(x)?x:0),O;switch(m){case`start`:O=sG(`calc(${c})`);break;case`middle`:O=sG(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=sG(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Q(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,uG({},aR(T,!0),{x:E,y:D,className:pa(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?wG:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function EG(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function DG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function OG(e){let t,n,r;e.length===2?(t=e===EG||e===DG?e:kG,n=e,r=e):(t=EG,n=(t,n)=>EG(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function kG(){return 0}function AG(e){return e===null?NaN:+e}function*jG(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var MG=OG(EG),NG=MG.right;MG.left,OG(AG).center;var PG=class extends Map{constructor(e,t=RG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(FG(this,e))}has(e){return super.has(FG(this,e))}set(e,t){return super.set(IG(this,e),t)}delete(e){return super.delete(LG(this,e))}};function FG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function IG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function LG({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function RG(e){return typeof e==`object`&&e?e.valueOf():e}function zG(e=EG){if(e===EG)return BG;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function BG(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var VG=Math.sqrt(50),HG=Math.sqrt(10),UG=Math.sqrt(2);function WG(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=VG?10:a>=HG?5:a>=UG?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function YG(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function XG(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?BG:zG(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));XG(e,t,u,d,i)}let a=e[t],o=n,s=r;for(ZG(e,n,t),i(e[r],a)>0&&ZG(e,n,r);o0;)--s}i(e[n],a)===0?ZG(e,n,s):(++s,ZG(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function ZG(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function QG(e,t,n){if(e=Float64Array.from(jG(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return YG(e);if(t>=1)return JG(e);var r,i=(r-1)*t,a=Math.floor(i),o=JG(XG(e,a).subarray(0,a+1));return o+(YG(e.subarray(a+1))-o)*(i-a)}}function $G(e,t,n=AG){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function eK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?AK(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?AK(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_K.exec(e))?new NK(t[1],t[2],t[3],1):(t=vK.exec(e))?new NK(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yK.exec(e))?AK(t[1],t[2],t[3],t[4]):(t=bK.exec(e))?AK(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xK.exec(e))?BK(t[1],t[2]/100,t[3]/100,1):(t=SK.exec(e))?BK(t[1],t[2]/100,t[3]/100,t[4]):CK.hasOwnProperty(e)?kK(CK[e]):e===`transparent`?new NK(NaN,NaN,NaN,0):null}function kK(e){return new NK(e>>16&255,e>>8&255,e&255,1)}function AK(e,t,n,r){return r<=0&&(e=t=n=NaN),new NK(e,t,n,r)}function jK(e){return e instanceof uK||(e=OK(e)),e?(e=e.rgb(),new NK(e.r,e.g,e.b,e.opacity)):new NK}function MK(e,t,n,r){return arguments.length===1?jK(e):new NK(e,t,n,r??1)}function NK(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cK(NK,MK,lK(uK,{brighter(e){return e=e==null?fK:fK**+e,new NK(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dK:dK**+e,new NK(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new NK(RK(this.r),RK(this.g),RK(this.b),LK(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:PK,formatHex:PK,formatHex8:FK,formatRgb:IK,toString:IK}));function PK(){return`#${zK(this.r)}${zK(this.g)}${zK(this.b)}`}function FK(){return`#${zK(this.r)}${zK(this.g)}${zK(this.b)}${zK((isNaN(this.opacity)?1:this.opacity)*255)}`}function IK(){let e=LK(this.opacity);return`${e===1?`rgb(`:`rgba(`}${RK(this.r)}, ${RK(this.g)}, ${RK(this.b)}${e===1?`)`:`, ${e})`}`}function LK(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function RK(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zK(e){return e=RK(e),(e<16?`0`:``)+e.toString(16)}function BK(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new UK(e,t,n,r)}function VK(e){if(e instanceof UK)return new UK(e.h,e.s,e.l,e.opacity);if(e instanceof uK||(e=OK(e)),!e)return new UK;if(e instanceof UK)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new UK(o,s,c,e.opacity)}function HK(e,t,n,r){return arguments.length===1?VK(e):new UK(e,t,n,r??1)}function UK(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cK(UK,HK,lK(uK,{brighter(e){return e=e==null?fK:fK**+e,new UK(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dK:dK**+e,new UK(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new NK(KK(e>=240?e-240:e+120,i,r),KK(e,i,r),KK(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new UK(WK(this.h),GK(this.s),GK(this.l),LK(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=LK(this.opacity);return`${e===1?`hsl(`:`hsla(`}${WK(this.h)}, ${GK(this.s)*100}%, ${GK(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function WK(e){return e=(e||0)%360,e<0?e+360:e}function GK(e){return Math.max(0,Math.min(1,e||0))}function KK(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var qK=e=>()=>e;function JK(e,t){return function(n){return e+n*t}}function YK(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function XK(e){return(e=+e)==1?ZK:function(t,n){return n-t?YK(t,n,e):qK(isNaN(t)?n:t)}}function ZK(e,t){var n=t-e;return n?JK(e,n):qK(isNaN(e)?t:e)}var QK=(function e(t){var n=XK(t);function r(e,t){var r=n((e=MK(e)).r,(t=MK(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ZK(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $K(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:rq(r,i)})),n=oq.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function yq(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?bq:yq,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),rq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,mq),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=dq,u()},d.clamp=function(e){return arguments.length?(o=e?!0:gq,u()):o!==gq},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Cq(){return Sq()(gq,gq)}function wq(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Tq(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Eq(e){return e=Tq(Math.abs(e)),e?e[1]:NaN}function Dq(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Oq(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var kq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Aq(e){if(!(t=kq.exec(e)))throw Error(`invalid format: `+e);var t;return new jq({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Aq.prototype=jq.prototype;function jq(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}jq.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Mq(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Nq;function Pq(e,t){var n=Tq(e,t);if(!n)return Nq=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Nq=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Tq(e,Math.max(0,t+a-1))[0]}function Fq(e,t){var n=Tq(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Iq={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:wq,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Fq(e*100,t),r:Fq,s:Pq,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Lq(e){return e}var Rq=Array.prototype.map,zq=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Bq(e){var t=e.grouping===void 0||e.thousands===void 0?Lq:Dq(Rq.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Lq:Oq(Rq.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Aq(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Iq[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Iq[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Mq(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Nq!==void 0?zq[8+Nq/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Eq(t)/3)))*3,r=10**-n,i=l((e=Aq(e),e.type=`f`,e),{suffix:zq[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Vq,Hq,Uq;Wq({thousands:`,`,grouping:[3],currency:[`$`,``]});function Wq(e){return Vq=Bq(e),Hq=Vq.format,Uq=Vq.formatPrefix,Vq}function Gq(e){return Math.max(0,-Eq(Math.abs(e)))}function Kq(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eq(t)/3)))*3-Eq(Math.abs(e)))}function qq(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Eq(t)-Eq(e))+1}function Jq(e,t,n,r){var i=qG(e,t,n),a;switch(r=Aq(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Kq(i,o))&&(r.precision=a),Uq(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=qq(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Gq(i))&&(r.precision=a-(r.type===`%`)*2);break}return Hq(r)}function Yq(e){var t=e.domain;return e.ticks=function(e){var n=t();return GG(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Jq(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=KG(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Xq(){var e=Cq();return e.copy=function(){return xq(e,Xq())},tK.apply(e,arguments),Yq(e)}function Zq(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,mq),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Zq(e).unknown(t)},e=arguments.length?Array.from(e,mq):[0,1],Yq(n)}function Qq(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function aJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function oJ(e){return(t,n)=>-e(-t,n)}function sJ(e){let t=e($q,eJ),n=t.domain,r=10,i,a;function o(){return i=aJ(r),a=iJ(r),n()[0]<0?(i=oJ(i),a=oJ(a),e(tJ,nJ)):e($q,eJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Aq(n)).precision==null&&(n.trim=!0),n=Hq(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Qq(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function cJ(){let e=sJ(Sq()).domain([1,10]);return e.copy=()=>xq(e,cJ()).base(e.base()),tK.apply(e,arguments),e}function lJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function uJ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function dJ(e){var t=1,n=e(lJ(t),uJ(t));return n.constant=function(n){return arguments.length?e(lJ(t=+n),uJ(t)):t},Yq(n)}function fJ(){var e=dJ(Sq());return e.copy=function(){return xq(e,fJ()).constant(e.constant())},tK.apply(e,arguments)}function pJ(e){return function(t){return t<0?-((-t)**+e):t**+e}}function mJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function hJ(e){return e<0?-e*e:e*e}function gJ(e){var t=e(gq,gq),n=1;function r(){return n===1?e(gq,gq):n===.5?e(mJ,hJ):e(pJ(n),pJ(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Yq(t)}function _J(){var e=gJ(Sq());return e.copy=function(){return xq(e,_J()).exponent(e.exponent())},tK.apply(e,arguments),e}function vJ(){return _J.apply(null,arguments).exponent(.5)}function yJ(e){return Math.sign(e)*e*e}function bJ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function xJ(){var e=Cq(),t=[0,1],n=!1,r;function i(t){var i=bJ(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(yJ(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,mq)).map(yJ)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return xJ(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},tK.apply(i,arguments),Yq(i)}function SJ(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return CJ().domain([e,t]).range(i).unknown(a)},tK.apply(Yq(o),arguments)}function wJ(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[NG(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return wJ().domain(e).range(t).unknown(n)},tK.apply(i,arguments)}var TJ=new Date,EJ=new Date;function DJ(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sDJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(TJ.setTime(+t),EJ.setTime(+r),e(TJ),e(EJ),Math.floor(n(TJ,EJ))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var OJ=DJ(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);OJ.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?DJ(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):OJ),OJ.range;var kJ=1e3,AJ=kJ*60,jJ=AJ*60,MJ=jJ*24,NJ=MJ*7,PJ=MJ*30,FJ=MJ*365,IJ=DJ(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*kJ)},(e,t)=>(t-e)/kJ,e=>e.getUTCSeconds());IJ.range;var LJ=DJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*kJ)},(e,t)=>{e.setTime(+e+t*AJ)},(e,t)=>(t-e)/AJ,e=>e.getMinutes());LJ.range;var RJ=DJ(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*AJ)},(e,t)=>(t-e)/AJ,e=>e.getUTCMinutes());RJ.range;var zJ=DJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*kJ-e.getMinutes()*AJ)},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getHours());zJ.range;var BJ=DJ(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getUTCHours());BJ.range;var VJ=DJ(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*AJ)/MJ,e=>e.getDate()-1);VJ.range;var HJ=DJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/MJ,e=>e.getUTCDate()-1);HJ.range;var UJ=DJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/MJ,e=>Math.floor(e/MJ));UJ.range;function WJ(e){return DJ(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*AJ)/NJ)}var GJ=WJ(0),KJ=WJ(1),qJ=WJ(2),JJ=WJ(3),YJ=WJ(4),XJ=WJ(5),ZJ=WJ(6);GJ.range,KJ.range,qJ.range,JJ.range,YJ.range,XJ.range,ZJ.range;function QJ(e){return DJ(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/NJ)}var $J=QJ(0),eY=QJ(1),tY=QJ(2),nY=QJ(3),rY=QJ(4),iY=QJ(5),aY=QJ(6);$J.range,eY.range,tY.range,nY.range,rY.range,iY.range,aY.range;var oY=DJ(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());oY.range;var sY=DJ(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());sY.range;var cY=DJ(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());cY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:DJ(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),cY.range;var lY=DJ(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());lY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:DJ(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),lY.range;function uY(e,t,n,r,i,a){let o=[[IJ,1,kJ],[IJ,5,5*kJ],[IJ,15,15*kJ],[IJ,30,30*kJ],[a,1,AJ],[a,5,5*AJ],[a,15,15*AJ],[a,30,30*AJ],[i,1,jJ],[i,3,3*jJ],[i,6,6*jJ],[i,12,12*jJ],[r,1,MJ],[r,2,2*MJ],[n,1,NJ],[t,1,PJ],[t,3,3*PJ],[e,1,FJ]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(qG(t/FJ,n/FJ,r));if(a===0)return OJ.every(Math.max(qG(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=gY(_Y(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?eY.ceil(a):eY(a),a=HJ.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=hY(_Y(r.y,0,1)),o=a.getDay(),a=o>4||o===0?KJ.ceil(a):KJ(a),a=VJ.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?gY(_Y(r.y,0,1)).getUTCDay():hY(_Y(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,gY(r)):hY(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in yY?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function I(e){return s[e.getMonth()]}function ee(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function ne(e){return o[e.getUTCDay()]}function re(e){return a[e.getUTCDay()]}function ie(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var yY={"-":``,_:` `,0:`0`},bY=/^\s*\d+/,xY=/^%/,SY=/[\\^$*+?|[\]().{}]/g;function CY(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function DY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function OY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function kY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function AY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function jY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function MY(e,t,n){var r=bY.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function NY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function PY(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function FY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function IY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function LY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function RY(e,t,n){var r=bY.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function zY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function BY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function VY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function HY(e,t,n){var r=bY.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function UY(e,t,n){var r=bY.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function WY(e,t,n){var r=xY.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function GY(e,t,n){var r=bY.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function KY(e,t,n){var r=bY.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function qY(e,t){return CY(e.getDate(),t,2)}function JY(e,t){return CY(e.getHours(),t,2)}function YY(e,t){return CY(e.getHours()%12||12,t,2)}function XY(e,t){return CY(1+VJ.count(cY(e),e),t,3)}function ZY(e,t){return CY(e.getMilliseconds(),t,3)}function QY(e,t){return ZY(e,t)+`000`}function $Y(e,t){return CY(e.getMonth()+1,t,2)}function eX(e,t){return CY(e.getMinutes(),t,2)}function tX(e,t){return CY(e.getSeconds(),t,2)}function nX(e){var t=e.getDay();return t===0?7:t}function rX(e,t){return CY(GJ.count(cY(e)-1,e),t,2)}function iX(e){var t=e.getDay();return t>=4||t===0?YJ(e):YJ.ceil(e)}function aX(e,t){return e=iX(e),CY(YJ.count(cY(e),e)+(cY(e).getDay()===4),t,2)}function oX(e){return e.getDay()}function sX(e,t){return CY(KJ.count(cY(e)-1,e),t,2)}function cX(e,t){return CY(e.getFullYear()%100,t,2)}function lX(e,t){return e=iX(e),CY(e.getFullYear()%100,t,2)}function uX(e,t){return CY(e.getFullYear()%1e4,t,4)}function dX(e,t){var n=e.getDay();return e=n>=4||n===0?YJ(e):YJ.ceil(e),CY(e.getFullYear()%1e4,t,4)}function fX(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+CY(t/60|0,`0`,2)+CY(t%60,`0`,2)}function pX(e,t){return CY(e.getUTCDate(),t,2)}function mX(e,t){return CY(e.getUTCHours(),t,2)}function hX(e,t){return CY(e.getUTCHours()%12||12,t,2)}function gX(e,t){return CY(1+HJ.count(lY(e),e),t,3)}function _X(e,t){return CY(e.getUTCMilliseconds(),t,3)}function vX(e,t){return _X(e,t)+`000`}function yX(e,t){return CY(e.getUTCMonth()+1,t,2)}function bX(e,t){return CY(e.getUTCMinutes(),t,2)}function xX(e,t){return CY(e.getUTCSeconds(),t,2)}function SX(e){var t=e.getUTCDay();return t===0?7:t}function CX(e,t){return CY($J.count(lY(e)-1,e),t,2)}function wX(e){var t=e.getUTCDay();return t>=4||t===0?rY(e):rY.ceil(e)}function TX(e,t){return e=wX(e),CY(rY.count(lY(e),e)+(lY(e).getUTCDay()===4),t,2)}function EX(e){return e.getUTCDay()}function DX(e,t){return CY(eY.count(lY(e)-1,e),t,2)}function OX(e,t){return CY(e.getUTCFullYear()%100,t,2)}function kX(e,t){return e=wX(e),CY(e.getUTCFullYear()%100,t,2)}function AX(e,t){return CY(e.getUTCFullYear()%1e4,t,4)}function jX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?rY(e):rY.ceil(e),CY(e.getUTCFullYear()%1e4,t,4)}function MX(){return`+0000`}function NX(){return`%`}function PX(e){return+e}function FX(e){return Math.floor(e/1e3)}var IX,LX,RX;zX({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function zX(e){return IX=vY(e),LX=IX.format,IX.parse,RX=IX.utcFormat,IX.utcParse,IX}function BX(e){return new Date(e)}function VX(e){return e instanceof Date?+e:+new Date(+e)}function HX(e,t,n,r,i,a,o,s,c,l){var u=Cq(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>QG(e,r/t))},n.copy=function(){return QX(t).domain(e)},nK.apply(n,arguments)}function $X(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=gq,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eaK,scaleDiverging:()=>eZ,scaleDivergingLog:()=>tZ,scaleDivergingPow:()=>rZ,scaleDivergingSqrt:()=>iZ,scaleDivergingSymlog:()=>nZ,scaleIdentity:()=>Zq,scaleImplicit:()=>rK,scaleLinear:()=>Xq,scaleLog:()=>cJ,scaleOrdinal:()=>iK,scalePoint:()=>sK,scalePow:()=>_J,scaleQuantile:()=>SJ,scaleQuantize:()=>CJ,scaleRadial:()=>xJ,scaleSequential:()=>qX,scaleSequentialLog:()=>JX,scaleSequentialPow:()=>XX,scaleSequentialQuantile:()=>QX,scaleSequentialSqrt:()=>ZX,scaleSequentialSymlog:()=>YX,scaleSqrt:()=>vJ,scaleSymlog:()=>fJ,scaleThreshold:()=>wJ,scaleTime:()=>UX,scaleUtc:()=>WX,tickFormat:()=>Jq}),oZ=o(((e,t)=>{var n=KI();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),cZ=o(((e,t)=>{var n=oZ(),r=sZ(),i=BV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),lZ=o(((e,t)=>{function n(e,t){return e{var n=oZ(),r=lZ(),i=BV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),dZ=o(((e,t)=>{var n=oL(),r=WV(),i=MH(),a=BI();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),fZ=o(((e,t)=>{var n=EH(),r=dZ();function i(e,t){return n(r(e,t),1)}t.exports=i})),pZ=o(((e,t)=>{var n=AV();function r(e,t){return n(e,t)}t.exports=r})),mZ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function hZ(e){return yZ(e)||vZ(e)||_Z(e)||gZ()}function gZ(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Z(e,t){if(e){if(typeof e==`string`)return bZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bZ(e,t)}}function vZ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function yZ(e){if(Array.isArray(e))return bZ(e)}function bZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,wZ(function(){var e=[...arguments],t=r.map(function(t){return CZ(t)?e.shift():t});return n.apply(void 0,hZ(t).concat(e))}))})},EZ=function(e){return TZ(e.length,e)},DZ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function GZ(e){if(Array.isArray(e))return e}function KZ(e){var t=BZ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function qZ(e,t,n){if(e.lte(0))return new MZ.default(0);var r=FZ.getDigitCount(e.toNumber()),i=new MZ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new MZ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new MZ.default(Math.ceil(s))}function JZ(e,t,n){var r=1,i=new MZ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new MZ.default(10).pow(FZ.getDigitCount(e)-1),i=new MZ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new MZ.default(Math.floor(e)))}else e===0?i=new MZ.default(Math.floor((t-1)/2)):n||(i=new MZ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return kZ(OZ(function(e){return i.add(new MZ.default(e-o).mul(r)).toNumber()}),DZ)(0,t)}function YZ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new MZ.default(0),tickMin:new MZ.default(0),tickMax:new MZ.default(0)};var a=qZ(new MZ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new MZ.default(0):(o=new MZ.default(e).add(t).div(2),o=o.sub(new MZ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new MZ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?YZ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new MZ.default(s).mul(a)),tickMax:o.add(new MZ.default(c).mul(a))})}function XZ(e){var t=BZ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=BZ(KZ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(IZ(DZ(0,i-1).map(function(){return 1/0}))):[].concat(IZ(DZ(0,i-1).map(function(){return-1/0})),[l]);return n>r?AZ(u):u}if(c===l)return JZ(c,i,a);var d=YZ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=FZ.rangeStep(p,m.add(new MZ.default(.1).mul(f)),f);return n>r?AZ(h):h}function ZZ(e,t){var n=BZ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=BZ(KZ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=qZ(new MZ.default(c).sub(s).div(l-1),a,0),d=[].concat(IZ(FZ.rangeStep(new MZ.default(s),new MZ.default(c).sub(new MZ.default(.99).mul(u)),u)),[c]);return r>i?AZ(d):d}var QZ=jZ(XZ),$Z=jZ(ZZ),eQ=!0,tQ=`Invariant failed`;function nQ(e,t){if(!e){if(eQ)throw Error(tQ);var n=typeof t==`function`?t():t,r=n?`${tQ}: ${n}`:tQ;throw Error(r)}}var rQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function iQ(e){"@babel/helpers - typeof";return iQ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},iQ(e)}function aQ(){return aQ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mQ(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function hQ(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(_L(l-c)!==_L(u-l)){var f=[];if(_L(u-l)===_L(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},e$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?qQ(qQ({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},t$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:qQ(qQ({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,gL.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,gL.default)(x)?void 0:CL(x,n,0)})}}return a},n$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=CL(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(BQ(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=CL(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(BQ(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},r$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=PQ({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Q(e[d]))return qQ(qQ({},e),{},JQ({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Q(e[f]))return qQ(qQ({},e),{},JQ({},f,e[f]+(u||0)))}return e},i$=function(e,t,n){return(0,gL.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},a$=function(e,t,n,r,i){var a=t.props.children,o=QL(a,DQ).filter(function(e){return i$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=ZQ(t,n);if((0,gL.default)(r))return e;var i=Array.isArray(r)?[(0,IQ.default)(r),(0,FQ.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=ZQ(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},o$=function(e,t,n,r,i){var a=t.map(function(t){return a$(e,t,n,i,r)}).filter(function(e){return!(0,gL.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},s$=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&a$(e,t,a,r)||QQ(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?_L(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,mL.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},u$=new WeakMap,d$=function(e,t){if(typeof t!=`function`)return e;u$.has(e)||u$.set(e,new WeakMap);var n=u$.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},f$=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:aK(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:Xq(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:sK(),realScaleType:`point`}:i===`category`?{scale:aK(),realScaleType:`band`}:{scale:Xq(),realScaleType:`linear`};if((0,pL.default)(r)){var s=`scale${(0,tB.default)(r)}`;return{scale:(aZ[s]||sK)(),realScaleType:aZ[s]?s:`point`}}return(0,BL.default)(r)?{scale:r}:{scale:sK(),realScaleType:`point`}},p$=1e-4,m$=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-p$,a=Math.max(r[0],r[1])+p$,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},h$=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:Qz,none:qz,silhouette:$z,wiggle:eB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},v$=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=_$[n];return Zz().keys(r).value(function(e,t){return+ZQ(e,t,0)}).order(Jz).offset(i)(e)},y$=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?qQ(qQ({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(bL(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[SL(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return qQ(qQ({},e),{},JQ({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return qQ(qQ({},t),{},JQ({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:v$(e,o.items,i)}))},{})),qQ(qQ({},t),{},JQ({},a,s))},{})},b$=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=QZ(c,i,o);return e.domain([(0,IQ.default)(l),(0,FQ.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:$Z(e.domain(),i,o)}:null};function x$(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,gL.default)(i[t.dataKey])){var s=DL(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=ZQ(i,(0,gL.default)(o)?t.dataKey:o);return(0,gL.default)(c)?null:t.scale(c)}var S$=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=ZQ(a,t.dataKey,t.domain[o]);return(0,gL.default)(s)?null:t.scale(s)-i/2+r},C$=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},w$=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?qQ(qQ({},e.type.defaultProps),e.props):e.props).stackId;if(bL(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},T$=function(e){return e.reduce(function(e,t){return[(0,IQ.default)(t.concat([e[0]]).filter(Q)),(0,FQ.default)(t.concat([e[1]]).filter(Q))]},[1/0,-1/0])},E$=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=T$(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},D$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,O$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,k$=function(e,t,n){if((0,BL.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Q(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(D$.test(e[0])){var i=+D$.exec(e[0])[1];r[0]=t[0]-i}else (0,BL.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Q(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(O$.test(e[1])){var a=+O$.exec(e[1])[1];r[1]=t[1]+a}else (0,BL.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},A$=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,KH.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:B$(c),angleInRadian:c}},W$=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},G$=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},K$=function(e,t){var n=e.x,r=e.y,i=U$({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=W$(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?F$(F$({},t),{},{radius:a,angle:G$(f,t)}):null};function q$(e){"@babel/helpers - typeof";return q$=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},q$(e)}var J$=[`offset`];function Y$(e){return $$(e)||Q$(e)||Z$(e)||X$()}function X$(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z$(e,t){if(e){if(typeof e==`string`)return e1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e1(e,t)}}function Q$(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function $$(e){if(Array.isArray(e))return e1(e)}function e1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function n1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=V$(c,l,h,y),S=V$(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} + A${h},${h},0,1,${+!b}, + ${S.x},${S.y}`,w=(0,gL.default)(e.id)?SL(`recharts-radial-line-`):e.id;return _.createElement(`text`,c1({},n,{dominantBaseline:`central`,className:pa(`recharts-radial-bar-label`,o)}),_.createElement(`defs`,null,_.createElement(`path`,{id:w,d:C})),_.createElement(`textPath`,{xlinkHref:`#${w}`},t))},f1=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=V$(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=V$(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},p1=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return i1(i1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return i1(i1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return i1(i1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return i1(i1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?i1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?i1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?i1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?i1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?i1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?i1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?i1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?i1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,AL.default)(i)&&(Q(i.x)||vL(i.x))&&(Q(i.y)||vL(i.y))?i1({x:o+CL(i.x,c),y:s+CL(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):i1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},m1=function(e){return`cx`in e&&Q(e.cx)};function h1(e){var t=e.offset,n=t===void 0?5:t,r=t1(e,J$),i=i1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,gL.default)(s)&&(0,gL.default)(c)&&!(0,_.isValidElement)(l)&&!(0,BL.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,BL.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=l1(i);var m=m1(a),h=aR(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return d1(i,p,h);var g=m?f1(i):p1(i);return _.createElement(TG,c1({className:pa(`recharts-label`,d)},h,g,{breakAll:f}),p)}h1.displayName=`Label`;var g1=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Q(m)&&Q(h)){if(Q(u)&&Q(d))return{x:u,y:d,width:m,height:h};if(Q(f)&&Q(p))return{x:f,y:p,width:m,height:h}}return Q(u)&&Q(d)?{x:u,y:d,width:0,height:0}:Q(t)&&Q(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},_1=function(e,t){return e?e===!0?_.createElement(h1,{key:`label-implicit`,viewBox:t}):bL(e)?_.createElement(h1,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===h1?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(h1,{key:`label-implicit`,content:e,viewBox:t}):(0,BL.default)(e)?_.createElement(h1,{key:`label-implicit`,content:e,viewBox:t}):(0,AL.default)(e)?_.createElement(h1,c1({viewBox:t},e,{key:`label-implicit`})):null:null};h1.parseViewBox=g1,h1.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=g1(e),a=QL(r,h1).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[_1(e.label,t||i)].concat(Y$(a)):a};var v1=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function y1(e){"@babel/helpers - typeof";return y1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y1(e)}var b1=[`valueAccessor`],x1=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function S1(e){return E1(e)||T1(e)||w1(e)||C1()}function C1(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w1(e,t){if(e){if(typeof e==`string`)return D1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D1(e,t)}}function T1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function E1(e){if(Array.isArray(e))return D1(e)}function D1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var I1=function(e){return Array.isArray(e.value)?(0,v1.default)(e.value):e.value};function L1(e){var t=e.valueAccessor,n=t===void 0?I1:t,r=P1(e,b1),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=P1(r,x1);return!i||!i.length?null:_.createElement(bR,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,gL.default)(a)?n(e,t):ZQ(e&&e.payload,a),i=(0,gL.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(h1,O1({},aR(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:h1.parseViewBox((0,gL.default)(o)?e:A1(A1({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}L1.displayName=`LabelList`;function R1(e,t){return e?e===!0?_.createElement(L1,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,BL.default)(e)?_.createElement(L1,{key:`labelList-implicit`,data:t,content:e}):(0,AL.default)(e)?_.createElement(L1,O1({data:t},e,{key:`labelList-implicit`})):null:null}function z1(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=QL(r,L1).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[R1(e.label,t)].concat(S1(i)):i}L1.renderCallByParent=z1;function B1(e){"@babel/helpers - typeof";return B1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},B1(e)}function V1(){return V1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)}, + ${u.x},${u.y} + `;if(r>0){var f=V$(t,n,r,a),p=V$(t,n,r,c);d+=`L ${p.x},${p.y} + A ${r},${r},0, + ${+(Math.abs(s)>180)},${+(a<=c)}, + ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},X1=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=_L(l-c),d=J1({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=J1({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} + a${a},${a},0,0,1,${a*2},0 + a${a},${a},0,0,1,${-a*2},0 + `:Y1({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} + A${a},${a},0,0,${+(u<0)},${f.x},${f.y} + A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y} + A${a},${a},0,0,${+(u<0)},${_.x},${_.y} + `;if(r>0){var x=J1({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=J1({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} + A${a},${a},0,0,${+(u<0)},${E.x},${E.y} + A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y} + A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},Z1={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Q1=function(e){var t=U1(U1({},Z1),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?X1({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):Y1({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,V1({},aR(t,!0),{className:f,d:h,role:`img`}))};function $1(e){"@babel/helpers - typeof";return $1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$1(e)}function e0(){return e0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),m0=o(((e,t)=>{var n=p0();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),h0=o(((e,t)=>{t.exports=m0()()})),{getOwnPropertyNames:g0,getOwnPropertySymbols:_0}=Object,{hasOwnProperty:v0}=Object.prototype;function y0(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function b0(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function x0(e){return e?.[Symbol.toStringTag]}function S0(e){return g0(e).concat(_0(e))}var C0=Object.hasOwn||((e,t)=>v0.call(e,t));function w0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var T0=`__v`,E0=`__o`,D0=`_owner`,{getOwnPropertyDescriptor:O0,keys:k0}=Object;function A0(e,t){return e.byteLength===t.byteLength&&U0(new Uint8Array(e),new Uint8Array(t))}function j0(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function M0(e,t){return e.byteLength===t.byteLength&&U0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function N0(e,t){return w0(e.getTime(),t.getTime())}function P0(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function F0(e,t){return e===t}function I0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var L0=w0;function R0(e,t,n){let r=k0(e),i=r.length;if(k0(t).length!==i)return!1;for(;i-- >0;)if(!G0(e,t,n,r[i]))return!1;return!0}function z0(e,t,n){let r=S0(e),i=r.length;if(S0(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!G0(e,t,n,a)||(o=O0(e,a),s=O0(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function B0(e,t){return w0(e.valueOf(),t.valueOf())}function V0(e,t){return e.source===t.source&&e.flags===t.flags}function H0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function U0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function W0(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function G0(e,t,n,r){return(r===D0||r===E0||r===T0)&&(e.$$typeof||t.$$typeof)?!0:C0(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var K0=`[object ArrayBuffer]`,q0=`[object Arguments]`,J0=`[object Boolean]`,Y0=`[object DataView]`,X0=`[object Date]`,Z0=`[object Error]`,Q0=`[object Map]`,$0=`[object Number]`,e2=`[object Object]`,t2=`[object RegExp]`,n2=`[object Set]`,r2=`[object String]`,i2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},a2=`[object URL]`,o2=Object.prototype.toString;function s2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=o2.call(h);if(b===X0)return r(h,g,_);if(b===t2)return u(h,g,_);if(b===Q0)return o(h,g,_);if(b===n2)return d(h,g,_);if(b===e2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===a2)return p(h,g,_);if(b===Z0)return i(h,g,_);if(b===q0)return c(h,g,_);if(i2[b])return f(h,g,_);if(b===K0)return e(h,g,_);if(b===Y0)return n(h,g,_);if(b===J0||b===$0||b===r2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=x0(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function c2({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:A0,areArraysEqual:n?z0:j0,areDataViewsEqual:M0,areDatesEqual:N0,areErrorsEqual:P0,areFunctionsEqual:F0,areMapsEqual:n?y0(I0,z0):I0,areNumbersEqual:L0,areObjectsEqual:n?z0:R0,arePrimitiveWrappersEqual:B0,areRegExpsEqual:V0,areSetsEqual:n?y0(H0,z0):H0,areTypedArraysEqual:n?y0(U0,z0):U0,areUrlsEqual:W0,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=b0(r.areArraysEqual),t=b0(r.areMapsEqual),n=b0(r.areObjectsEqual),i=b0(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function l2(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function u2({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var d2=f2();f2({strict:!0}),f2({circular:!0}),f2({circular:!0,strict:!0}),f2({createInternalComparator:()=>w0}),f2({strict:!0,createInternalComparator:()=>w0}),f2({circular:!0,createInternalComparator:()=>w0}),f2({circular:!0,createInternalComparator:()=>w0,strict:!0});function f2(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=s2(c2(e));return u2({circular:t,comparator:a,createState:r,equals:n?n(a):l2(a),strict:i})}function p2(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function m2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):p2(r)})}function h2(e){"@babel/helpers - typeof";return h2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h2(e)}function g2(e){return x2(e)||b2(e)||v2(e)||_2()}function _2(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v2(e,t){if(e){if(typeof e==`string`)return y2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y2(e,t)}}function y2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=Y2(t,r),c=Y2(n,i),l=X2(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function w4(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function T4(e){return k4(e)||O4(e)||D4(e)||E4()}function E4(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D4(e,t){if(e){if(typeof e==`string`)return A4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A4(e,t)}}function O4(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function k4(e){if(Array.isArray(e))return A4(e)}function A4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function G4(e){return G4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G4(e)}var K4=function(e){z4(n,e);var t=V4(n);function n(e,r){var i;P4(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(U4(i)),i.changeStyle=i.changeStyle.bind(U4(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),H4(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},H4(i);i.state={style:s?N4({},s,c):c}}else i.state={style:{}};return i}return I4(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?N4({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(d2(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?N4({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(M4(M4({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=y4(n,r,$2(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(T4(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(T4(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=N2(f,a,s),m=M4(M4(M4({},d.style),c),{},{transition:p});return[].concat(T4(e),[m,a,u]).filter(A2)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=S2();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?N4({},r,i):i,f=N2(Object.keys(d),n,a);u.start([o,t,M4(M4({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=C4(e,S4),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,M4(M4({},i),{},{style:M4(M4({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);K4.displayName=`Animate`,K4.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},K4.propTypes={from:b4.default.oneOfType([b4.default.object,b4.default.string]),to:b4.default.oneOfType([b4.default.object,b4.default.string]),attributeName:b4.default.string,duration:b4.default.number,begin:b4.default.number,easing:b4.default.oneOfType([b4.default.string,b4.default.func]),steps:b4.default.arrayOf(b4.default.shape({duration:b4.default.number.isRequired,style:b4.default.object.isRequired,easing:b4.default.oneOfType([b4.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),b4.default.func]),properties:b4.default.arrayOf(`string`),onAnimationEnd:b4.default.func})),children:b4.default.oneOfType([b4.default.node,b4.default.func]),isActive:b4.default.bool,canBegin:b4.default.bool,onAnimationEnd:b4.default.func,shouldReAnimate:b4.default.bool,onAnimationStart:b4.default.func,onAnimationReStart:b4.default.func};var q4=K4;function J4(e){"@babel/helpers - typeof";return J4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},J4(e)}function Y4(){return Y4=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, + ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c}, + ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c}, + ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p} + A ${p},${p},0,0,${c},${e+s*p},${t} + L ${e+n-s*p},${t} + A ${p},${p},0,0,${c},${e+n},${t+o*p} + L ${e+n},${t+r-o*p} + A ${p},${p},0,0,${c},${e+n-s*p},${t+r} + L ${e+s*p},${t+r} + A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},c3=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},l3={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},u3=function(e){var t=r3(r3({},l3),e),n=(0,_.useRef)(),r=X4((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=pa(`recharts-rectangle`,d);return g?_.createElement(q4,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(q4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,Y4({},aR(t,!0),{className:v,d:s3(o,s,r,a,u),ref:n})))}):_.createElement(`path`,Y4({},aR(t,!0),{className:v,d:s3(o,s,c,l,u)}))};function d3(){return d3=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function S3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var C3=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},w3=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=x3(e,m3),h=_3({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Q(n)||!Q(i)||!Q(u)||!Q(f)||!Q(o)||!Q(c)?null:_.createElement(`path`,h3({},aR(h,!0),{className:pa(`recharts-cross`,p),d:C3(n,i,u,f,o,c)}))},T3=o(((e,t)=>{t.exports=_V()(Object.getPrototypeOf,Object)})),E3=o(((e,t)=>{var n=WI(),r=T3(),i=GI(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),D3=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function O3(e){"@babel/helpers - typeof";return O3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},O3(e)}function k3(){return k3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(q4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,k3({},aR(t,!0),{className:g,d:V3(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,k3({},aR(t,!0),{className:g,d:V3(o,s,c,l,u)})))},W3=l(E3()),G3=l(D3()),K3=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function q3(e){"@babel/helpers - typeof";return q3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},q3(e)}function J3(e,t){if(e==null)return{};var n=Y3(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Y3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function X3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z3(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),_6=o(((e,t)=>{var n=aW(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),v6=o(((e,t)=>{var n=g6(),r=GH(),i=_6();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=v6()()}));function b6(e){"@babel/helpers - typeof";return b6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b6(e)}function x6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function S6(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),U6(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),U6(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),U6(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),U6(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),U6(n,`handleSlideDragStart`,function(e){var t=q6(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return V6(t,e),F6(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=ZQ(n[e],i,e);return(0,BL.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=q6(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(U6(U6({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(U6({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=M6(M6({},aR(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(bR,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(bR,{className:`recharts-brush-texts`},_.createElement(TG,A6({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(TG,A6({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Q(i)||!Q(a)||!Q(o)||!Q(s)||o<=0||s<=0)return null;var g=pa(`recharts-brush`,n),v=_.Children.count(r)===1,y=D6(`userSelect`,`none`);return _.createElement(bR,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,BL.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return M6({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?K6({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);U6(J6,`displayName`,`Brush`),U6(J6,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Y6=o(((e,t)=>{var n=jH();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),X6=o(((e,t)=>{var n=KB(),r=WV(),i=Y6(),a=BI(),o=GH();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),Z6=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},Q6=o(((e,t)=>{var n=BH();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),$6=o(((e,t)=>{var n=Q6(),r=kH(),i=WV();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),e8=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=jH();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),n8=o(((e,t)=>{var n=e8(),r=t8(),i=WV(),a=BI(),o=GH();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),r8=[`x`,`y`];function i8(e){"@babel/helpers - typeof";return i8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i8(e)}function a8(){return a8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function f8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function p8(e,t){var n=e.x,r=e.y,i=d8(e,r8),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return s8(s8(s8(s8(s8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function m8(e){return _.createElement(a6,a8({shapeType:`rectangle`,propTransformer:p8,activeClassName:`recharts-active-bar`},e))}var h8=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Q(n)||yL(n);return i?e(n,r):(!i&&nQ(!1),t)}},g8=[`value`,`background`],_8;function v8(e){"@babel/helpers - typeof";return v8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},v8(e)}function y8(e,t){if(e==null)return{};var n=b8(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function b8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function x8(){return x8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=CL(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=f$(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),m$(j);var N=b$(j,G8(G8({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=G8(G8(G8({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=A$(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),G8(G8({},a),{},K8({},o,P))},{})},X8=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},Z8=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return X8({x:t,y:n},{x:r,y:i})},Q8=function(){function e(t){V8(this,e),this.scale=t}return U8(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();K8(Q8,`EPS`,1e-4);var $8=function(e){var t=Object.keys(e).reduce(function(t,n){return G8(G8({},t),{},K8({},n,Q8.create(e[n])))},{});return G8(G8({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,R8.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,z8.default)(e,function(e,n){return t[n].isInRange(e)})}})};function e5(e){return(e%180+180)%180}var t5=function(e){var t=e.width,n=e.height,r=e5(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=WV(),r=bV(),i=xV();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),r5=o(((e,t)=>{var n=_6();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),i5=o(((e,t)=>{var n=GV(),r=WV(),i=r5(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),a5=o(((e,t)=>{t.exports=n5()(i5())})),o5=(0,l(aL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});a5();var s5=(0,_.createContext)(void 0),c5=(0,_.createContext)(void 0),l5=(0,_.createContext)(void 0),u5=(0,_.createContext)({}),d5=(0,_.createContext)(void 0),f5=(0,_.createContext)(0),p5=(0,_.createContext)(0),m5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=o5(i);return _.createElement(s5.Provider,{value:n},_.createElement(c5.Provider,{value:r},_.createElement(u5.Provider,{value:i},_.createElement(l5.Provider,{value:l},_.createElement(d5.Provider,{value:a},_.createElement(f5.Provider,{value:c},_.createElement(p5.Provider,{value:s},o)))))))},h5=function(){return(0,_.useContext)(d5)},g5=function(e){var t=(0,_.useContext)(s5);t??nQ(!1);var n=t[e];return n??nQ(!1),n},_5=function(e){var t=(0,_.useContext)(c5);t??nQ(!1);var n=t[e];return n??nQ(!1),n},v5=function(){return(0,_.useContext)(l5)},y5=function(){return(0,_.useContext)(p5)},b5=function(){return(0,_.useContext)(f5)},x5=l(X6());function S5(e){"@babel/helpers - typeof";return S5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S5(e)}function C5(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function w5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Pne(e,t){return _7(e,t+1)}function Fne(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:_7(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||v7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function y7(e){"@babel/helpers - typeof";return y7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y7(e)}function b7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=x7(x7({},r),{},{tickCoord:r.coordinate});v7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=x7(x7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function Bne(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=x7(x7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),v7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=x7(x7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=x7(x7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=x7(x7({},r),{},{tickCoord:r.coordinate});v7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=x7(x7({},r),{},{isShow:!0}))},h=0;h=2?_L(i[1].coordinate-i[0].coordinate):1,_=Nne(a,g,p);return c===`equidistantPreserveStart`?Fne(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?Bne(g,_,h,i,o,c===`preserveStartEnd`):zne(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var Hne=[`viewBox`],Une=[`viewBox`],Wne=[`ticks`];function S7(e){"@babel/helpers - typeof";return S7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S7(e)}function C7(){return C7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Kne(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function D7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(bR,{className:pa(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),h1.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=pa(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,T7(T7({},t),{},{className:i})):(0,BL.default)(e)?e(T7(T7({},t),{},{className:i})):_.createElement(TG,C7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);j7(N7,`displayName`,`CartesianAxis`),j7(N7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var $ne=[`type`,`layout`,`connectNulls`,`ref`],ere=[`key`];function P7(e){"@babel/helpers - typeof";return P7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},P7(e)}function F7(e,t){if(e==null)return{};var n=tre(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function I7(){return I7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(z7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(z7(t.repeat(i,o)),z7(l),f).map(function(e){return`${e}px`}).join(`, `)}),G7(e,`id`,SL(`recharts-line-`)),G7(e,`pathRef`,function(t){e.mainCurve=t}),G7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),G7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return dre(t,e),sre(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=QL(s,DQ);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:ZQ(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(bR,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=aR(this.props,!1),l=aR(a,!0),u=o.map(function(e,n){var r=R7(R7(R7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(bR,I7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=R7(R7(R7({},aR(F7(i,$ne),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(f0,I7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(q4,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=EL(r.x,e.x),a=EL(r.y,e.y);return R7(R7({},e),{},{x:i(o),y:a(o)})}if(d){var c=EL(f*2,e.x),l=EL(p/2,e.y);return R7(R7({},e),{},{x:c(o),y:l(o)})}return R7(R7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=EL(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,RQ.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=pa(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,gL.default)(f)?this.id:f,x=aR(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(rR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(bR,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&L1.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(z7(e),[0]),r=[],i=0;ie.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Xre(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function k9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Q(r)&&Q(i)?e.slice(r,i+1):[]};function H9(e){return e===`number`?[0,`auto`]:void 0}var U9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=V9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?DL(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(N9(i),[M$(s,l)]):i},[])},W9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=cie(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=$Q(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:U9(e,t,l,u),activeCoordinate:lie(n,o,l,i)}}return null},uie=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=c$(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=V9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Lre(p.domain,g,m)&&(w=k$(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=QQ(S,h,`category`)));var D=H9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=QQ(S,h,m),m===`category`&&f){var k=TL(w);_&&k?(T=w,w=(0,O6.default)(0,C)):_||(w=j$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(N9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,gL.default)(e)}):j$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,gL.default)(t)?e:[].concat(N9(e),[t])},[]);else if(m===`number`){var A=o$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=QQ(S,h,`category`))}else w=f?(0,O6.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:E$(o[x].stackGroups,s,c):s$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=m9(u,w,x,i,y),O&&(w=k$(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return $($({},t),{},L9({},x,$($({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},die=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=V9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=c$(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:$($({},t.type.defaultProps),t.props))[a],g=H9(`number`);if(!e[h]){m++;var _;return p?_=(0,O6.default)(0,f):o&&o[h]&&o[h].hasStack?(_=E$(o[h].stackGroups,s,c),_=m9(u,_,h,i)):(_=k$(g,s$(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=m9(u,_,h,i)),$($({},e),{},L9({},h,$($({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,hL.default)(oie,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},fie=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=QL(l,i),f={};return d&&d.length?f=uie(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=die(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},pie=function(e){var t=wL(e),n=l$(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,KH.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:A$(t,n)}},G9=function(e){var t=e.children,n=e.defaultShowTooltip,r=$L(t,J6),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},mie=function(e){return!e||!e.length?!1:e.some(function(e){var t=JL(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},K9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},hie=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=$L(u,J6),p=$L(u,wH),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},L9({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=$($({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},L9({},r,(0,hL.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||J6.defaultProps.height),p&&t&&(h=r$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return $($({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},gie=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},q9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=K9(u),h=m.numericAxisName,g=m.cateAxisName,_=mie(n),v=[];return n.forEach(function(n,m){var y=V9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&nQ(!1);var a=r[i];return $($({},e),{},L9(L9({},n.axisType,a),`${n.axisType}Ticks`,l$(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&w$(n,r[C].stackGroups),k=JL(n.type).indexOf(`Bar`)>=0,A=A$(E,D),j=[],M=_&&t$({barSize:l,stackGroups:r,totalSize:gie(T,g)});if(k){var N=(0,gL.default)(S)?p:S,P=A$(E,D,!0)??N??0;j=n$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return $($({},e),{},{position:$($({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:$($({},F($($({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},L9(L9(L9({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:uR(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!eR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=K9(f),_=g.numericAxisName,v=g.cateAxisName,y=QL(u,n),b=y$(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return $($({},e),{},L9({},n,fie(i,$($({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=hie($($({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=pie(C);return $($({formattedGraphicalItems:d(i,$($({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return Xre(this,n),r=Qre(this,n,[e]),L9(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),L9(r,`accessibilityManager`,new Ire),L9(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState($({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},$($({},r.state),{},{legendBBox:e}))))}}),L9(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),L9(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return $({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),L9(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,BL.default)(i)&&i(n,e)}}),L9(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?$($({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,BL.default)(i)&&i(n,e)}),L9(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),L9(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),L9(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),L9(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,BL.default)(n)&&n(t,e)}),L9(r,`handleOuterEvent`,function(e){var t=lR(e),n=(0,hL.default)(r.props,`${t}`);t&&(0,BL.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),L9(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,BL.default)(i)&&i(n,e)}}),L9(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),L9(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),L9(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),L9(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&h9.emit(g9,r.props.syncId,e,r.eventEmitterSymbol)}),L9(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState($({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=DL(m,k,u),O=h&&g&&DL(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,$($($({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,gL.default)(D))return[T].concat(N9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,$($($({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),L9(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,$($({key:`recharts-customized-${n}`},r.props),r.state))}),L9(r,`renderMap`,{CartesianGrid:{handler:B9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:B9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:B9},YAxis:{handler:B9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??SL(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,sW.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return tie(n,e),Zre(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=$L(t,tW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=U9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=$($({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){oR([$L(e.children,tW)],[$L(this.props.children,tW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=$L(this.props.children,tW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=PW(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=W9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=wL(c).scale,p=wL(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return $($({},i),{},{xValue:m,yValue:h},d)}return d?$($({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=wL(c);return K$({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=$L(e,tW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),$($({},LL(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){h9.on(g9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){h9.removeListener(g9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=Rs();(0,_.useEffect)(()=>{let t=!1;return Iee(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,V.jsxs)(Tv,{className:`p-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,V.jsx)(Sa,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,V.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,V.jsx)(La,{className:`w-4 h-4 text-purple-400`}),(0,V.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,V.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,V.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{className:`pb-2`,children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,V.jsx)(Ma,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Loss`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,V.jsx)(Tv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(bW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(q9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(n9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(d9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,V.jsx)(tW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,V.jsx)(q7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{className:`pb-2`,children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,V.jsx)(Sa,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,V.jsx)(Tv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(bW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(q9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(n9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(d9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,V.jsx)(tW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,V.jsx)(q7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},J9=({logs:e,logContainerRef:t})=>(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,V.jsx)(Ga,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,V.jsx)(Tv,{children:(0,V.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,V.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,V.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,V.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),vie=({installHint:e})=>{let t=NI(`system/training-extra`);return(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:t.state}),PI(t.state,`Training Extra Not Installed`)]})}),(0,V.jsx)(Tv,{className:`space-y-4`,children:(0,V.jsx)(II,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`training`})})})]})})},yie=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=NI(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:o.state}),PI(o.state,s)]}),(0,V.jsxs)(Ou,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(II,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training a `,(0,V.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`${n} training`})})})]})})},bie=()=>{let{auth:e,refetch:t}=Vs(),{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,V.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,V.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,V.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,V.jsx)(Ha,{className:`w-3 h-3`})]}),` `,`with `,(0,V.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,V.jsx)(Th,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,V.jsx)(G,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,V.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},xie=1e3,Y9=5e3;function Sie(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function Cie(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset,dataset_image_transforms_enable:e.dataset_image_transforms_enable,eval_steps:e.eval_steps,...e.policy_type===`groot`?{policy_base_model_path:e.policy_base_model_path,policy_embodiment_tag:e.policy_embodiment_tag,policy_chunk_size:e.policy_chunk_size,policy_n_action_steps:e.policy_n_action_steps,policy_use_relative_actions:e.policy_use_relative_actions,policy_relative_exclude_joints:e.policy_relative_exclude_joints,policy_use_bf16:e.policy_use_bf16}:{}}}var wie=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{auth:n}=Vs(),{toast:r}=_r(),i=Re(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:Ie().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),Kv(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{yv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),Bee(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}if(a.target.runner===`local`)try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await Lee(e,t,Cie(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),yv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(vie,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(bie,{}),(0,V.jsx)(Lte,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,V.jsx)(G,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`span`,{tabIndex:0,children:e})}),(0,V.jsx)(Kp,{children:P})]}):e})()})]}),b&&(0,V.jsx)(yie,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},Tie=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),i=Re(),{selectedRecord:a}=Lv(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return Fee(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{Ev(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await Nee(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await Pee(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>Y9?t.slice(t.length-Y9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},xie);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await bv(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await xv(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,V.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,V.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,V.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,V.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,V.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,V.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,V.jsxs)(G,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,V.jsxs)(G,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(so,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,V.jsx)(_ie,{jobId:e,trainingStatus:Sie(o,!1),getProgressPercentage:S,formatTime:x}),(0,V.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,V.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Dv,{checkpoints:p,selectedStep:h,onChange:g}),(0,V.jsxs)(G,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,V.jsx)(Xa,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,V.jsx)(Mv,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,V.jsx)(J9,{logs:u,logContainerRef:f})]})})},X9=()=>{let{jobId:e}=Be();return e?(0,V.jsx)(Tie,{jobId:e}):(0,V.jsx)(wie,{})},Eie=1e3;function Z9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var Die=()=>{let e=Re(),{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await jv(t,n)}catch{}},s=async()=>{try{let s=await Qee(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,Eie);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await jv(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(zj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:Z9(h?f:d)}),(0,V.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${Z9(p)}`})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,V.jsxs)(G,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,V.jsx)(xI,{open:o,onOpenChange:s,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Stop inference?`}),(0,V.jsx)(OI,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,V.jsx)(kI,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},Oie=()=>(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col items-center justify-center p-4`,children:[(0,V.jsx)(`h1`,{className:`text-5xl font-bold tracking-tight`,children:`Edit Dataset`}),(0,V.jsx)(`p`,{className:`mt-4 text-xl text-gray-400`,children:`This page is under construction.`})]}),kie=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,V.jsxs)(`span`,{children:[a.message||e,` `,(0,V.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,V.jsx)(G,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,V.jsx)(Ma,{className:`w-8 h-8 text-green-500`}):(0,V.jsx)(za,{className:`w-8 h-8 text-blue-500`}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,V.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,V.jsx)(Ma,{className:`w-6 h-6 text-green-500`}),(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,V.jsxs)(G,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,V.jsx)(G,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,V.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,V.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,V.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,V.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,V.jsx)(Th,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(Jh,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,V.jsx)(Ua,{className:`w-4 h-4 text-gray-400`}):(0,V.jsx)(Wa,{className:`w-4 h-4 text-gray-400`}),(0,V.jsx)(q,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,V.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,V.jsxs)(G,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,V.jsx)(Ha,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(G,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lo,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,V.jsx)(G,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,V.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,V.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,V.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,V.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,V.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,V.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,V.jsx)(xI,{open:y,onOpenChange:b,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Delete dataset from disk?`}),(0,V.jsxs)(OI,{className:`text-gray-400`,children:[`This permanently removes `,(0,V.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,V.jsx)(kI,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Aie=()=>{let e=Ie();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,V.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,V.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},jie=`lelab-tabs-v1`,Mie=1e3,Nie=3e3,Pie=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Nie;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(jie);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Mie),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,V.jsxs)(V.Fragment,{children:[e,!t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,V.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,V.jsx)(G,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Fie=()=>{let{toast:e}=_r();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function Iie(){let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(qv())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Lie=()=>{let{status:e,open:t,dismiss:n}=Iie(),{baseUrl:r,fetchWithHeaders:i}=Rs(),{toast:a}=_r(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,V.jsx)(xu,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(io,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,V.jsxs)(Ou,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,V.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,V.jsx)(cg,{className:`pt-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,V.jsx)(G,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]})})]}),u&&(0,V.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,V.jsx)(Jh,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,V.jsx)(G,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},Rie=new mn;function zie(){return(0,V.jsx)(_n,{client:Rie,children:(0,V.jsx)(hp,{children:(0,V.jsx)(yn,{children:(0,V.jsx)(Ls,{children:(0,V.jsx)(Bs,{children:(0,V.jsx)(nr,{children:(0,V.jsx)(ar,{children:(0,V.jsxs)(pt,{children:[(0,V.jsxs)(Pie,{children:[(0,V.jsx)(Fie,{}),(0,V.jsx)(Lie,{}),(0,V.jsxs)(ct,{children:[(0,V.jsx)(ot,{path:`/`,element:(0,V.jsx)(Yv,{})}),(0,V.jsx)(ot,{path:`/teleoperation`,element:(0,V.jsx)(nM,{})}),(0,V.jsx)(ot,{path:`/recording`,element:(0,V.jsx)(Dte,{})}),(0,V.jsx)(ot,{path:`/upload`,element:(0,V.jsx)(kie,{})}),(0,V.jsx)(ot,{path:`/training`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/training/:jobId`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/inference`,element:(0,V.jsx)(Die,{})}),(0,V.jsx)(ot,{path:`/calibration`,element:(0,V.jsx)(bM,{})}),(0,V.jsx)(ot,{path:`/edit-dataset`,element:(0,V.jsx)(Oie,{})}),(0,V.jsx)(ot,{path:`*`,element:(0,V.jsx)(Aie,{})})]})]}),(0,V.jsx)(ys,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(zie,{})); \ No newline at end of file diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 68b7a7ee..d0717022 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -1,20 +1,20 @@ - - - - - - LeLab - - - - - - - - - - - -
- - + + + + + + LeLab + + + + + + + + + + + +
+ + diff --git a/frontend/src/components/training/ConfigurationTab.tsx b/frontend/src/components/training/ConfigurationTab.tsx index 8106bb79..caa0ab8c 100644 --- a/frontend/src/components/training/ConfigurationTab.tsx +++ b/frontend/src/components/training/ConfigurationTab.tsx @@ -1,5 +1,6 @@ import React from 'react'; import EssentialsCard from './config/EssentialsCard'; +import GrootCard from './config/GrootCard'; import AdvancedCard from './config/AdvancedCard'; import TargetCard from './config/TargetCard'; import { ConfigComponentProps } from './types'; @@ -38,6 +39,7 @@ const ConfigurationTab: React.FC = ({ datasets={datasets} datasetsLoading={datasetsLoading} /> + ); diff --git a/frontend/src/components/training/config/EssentialsCard.tsx b/frontend/src/components/training/config/EssentialsCard.tsx index b99397ee..fac6b77d 100644 --- a/frontend/src/components/training/config/EssentialsCard.tsx +++ b/frontend/src/components/training/config/EssentialsCard.tsx @@ -92,6 +92,7 @@ const EssentialsCard: React.FC = ({ config, updateConfig, d Diffusion Policy PI0 SmolVLA + GR00T N1.7 TD-MPC VQ-BeT PI0 Fast diff --git a/frontend/src/components/training/config/GrootCard.tsx b/frontend/src/components/training/config/GrootCard.tsx new file mode 100644 index 00000000..c02fbe9f --- /dev/null +++ b/frontend/src/components/training/config/GrootCard.tsx @@ -0,0 +1,176 @@ +import React, { useEffect } from 'react'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; +import { Input } from '@/components/ui/input'; +import { NumberInput } from '@/components/ui/number-input'; +import { Label } from '@/components/ui/label'; +import { Switch } from '@/components/ui/switch'; +import { ConfigComponentProps } from '../types'; + +// Sensible GR00T N1.7 defaults, seeded the first time the user picks the policy +// so the form matches the canonical fine-tuning command out of the box. +const GROOT_DEFAULTS = { + policy_base_model_path: 'nvidia/GR00T-N1.7-3B', + policy_embodiment_tag: 'new_embodiment', + policy_chunk_size: 16, + policy_n_action_steps: 16, + policy_use_relative_actions: true, + policy_relative_exclude_joints: ['gripper'], + policy_use_bf16: true, + dataset_image_transforms_enable: true, +} as const; + +const GrootCard: React.FC = ({ config, updateConfig }) => { + const isGroot = config.policy_type === 'groot'; + + // Seed defaults once when groot is selected. Each key is only written when + // still undefined, so the effect can't loop and never clobbers user edits. + useEffect(() => { + if (!isGroot) return; + (Object.keys(GROOT_DEFAULTS) as (keyof typeof GROOT_DEFAULTS)[]).forEach((key) => { + if (config[key] === undefined) { + updateConfig(key, GROOT_DEFAULTS[key] as never); + } + }); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [isGroot]); + + if (!isGroot) return null; + + const excludeJoints = (config.policy_relative_exclude_joints ?? []).join(', '); + + return ( + + + GR00T N1.7 + + +
+ + + updateConfig('policy_base_model_path', e.target.value || undefined) + } + placeholder="nvidia/GR00T-N1.7-3B" + className="bg-slate-900 border-slate-600 text-white rounded-lg" + /> +

+ HuggingFace repo of the pretrained GR00T backbone to fine-tune. +

+
+ +
+
+ + + updateConfig('policy_embodiment_tag', e.target.value || undefined) + } + placeholder="new_embodiment" + className="bg-slate-900 border-slate-600 text-white rounded-lg" + /> +
+ +
+ + + updateConfig( + 'policy_relative_exclude_joints', + e.target.value + .split(',') + .map((s) => s.trim()) + .filter(Boolean), + ) + } + placeholder="gripper" + className="bg-slate-900 border-slate-600 text-white rounded-lg" + /> +

+ Comma-separated joints kept absolute when relative actions are on. +

+
+ +
+ + updateConfig('policy_chunk_size', v)} + className="bg-slate-900 border-slate-600 text-white rounded-lg" + /> +
+ +
+ + updateConfig('policy_n_action_steps', v)} + className="bg-slate-900 border-slate-600 text-white rounded-lg" + /> +
+
+ +
+
+ + updateConfig('policy_use_relative_actions', checked) + } + className="data-[state=checked]:bg-green-500" + /> + +
+ +
+ updateConfig('policy_use_bf16', checked)} + className="data-[state=checked]:bg-green-500" + /> + +
+ +
+ + updateConfig('dataset_image_transforms_enable', checked) + } + className="data-[state=checked]:bg-green-500" + /> + +
+
+
+
+ ); +}; + +export default GrootCard; diff --git a/frontend/src/components/training/types.ts b/frontend/src/components/training/types.ts index d0ee5f44..d459a7ef 100644 --- a/frontend/src/components/training/types.ts +++ b/frontend/src/components/training/types.ts @@ -41,6 +41,17 @@ export interface TrainingConfig { // Advanced configuration use_policy_training_preset: boolean; + + // GR00T-specific configuration (only used when policy_type === "groot"). + dataset_image_transforms_enable?: boolean; + eval_steps?: number; + policy_base_model_path?: string; + policy_embodiment_tag?: string; + policy_chunk_size?: number; + policy_n_action_steps?: number; + policy_use_relative_actions?: boolean; + policy_relative_exclude_joints?: string[]; + policy_use_bf16?: boolean; } export interface TrainingStatus { diff --git a/frontend/src/lib/jobsApi.ts b/frontend/src/lib/jobsApi.ts index 088b727b..fa9a262f 100644 --- a/frontend/src/lib/jobsApi.ts +++ b/frontend/src/lib/jobsApi.ts @@ -49,6 +49,17 @@ export interface TrainingRequest { optimizer_weight_decay?: number; optimizer_grad_clip_norm?: number; use_policy_training_preset: boolean; + // GR00T-specific (only sent when policy_type === "groot"); backend ignores + // the policy_* ones for other policies. + dataset_image_transforms_enable?: boolean; + eval_steps?: number; + policy_base_model_path?: string; + policy_embodiment_tag?: string; + policy_chunk_size?: number; + policy_n_action_steps?: number; + policy_use_relative_actions?: boolean; + policy_relative_exclude_joints?: string[]; + policy_use_bf16?: boolean; // Optional target for runner dispatch; omitted ⇒ local. target?: { runner: "local" | "hf_cloud"; flavor?: string }; } diff --git a/frontend/src/pages/Training.tsx b/frontend/src/pages/Training.tsx index a361d042..a74b2ab4 100644 --- a/frontend/src/pages/Training.tsx +++ b/frontend/src/pages/Training.tsx @@ -93,6 +93,21 @@ function configToRequest(c: TrainingConfig): TrainingRequest { optimizer_weight_decay: c.optimizer_weight_decay, optimizer_grad_clip_norm: c.optimizer_grad_clip_norm, use_policy_training_preset: c.use_policy_training_preset, + // GR00T-specific. Only forward the policy_* fields for groot so other + // policies never receive flags their config doesn't define. + dataset_image_transforms_enable: c.dataset_image_transforms_enable, + eval_steps: c.eval_steps, + ...(c.policy_type === "groot" + ? { + policy_base_model_path: c.policy_base_model_path, + policy_embodiment_tag: c.policy_embodiment_tag, + policy_chunk_size: c.policy_chunk_size, + policy_n_action_steps: c.policy_n_action_steps, + policy_use_relative_actions: c.policy_use_relative_actions, + policy_relative_exclude_joints: c.policy_relative_exclude_joints, + policy_use_bf16: c.policy_use_bf16, + } + : {}), }; } From edc28dcece7fc0b64d5633ea739f473bff23eb66 Mon Sep 17 00:00:00 2001 From: Ben Date: Sun, 12 Jul 2026 09:09:49 -0500 Subject: [PATCH 3/5] fix(rollout): use RTC inference for relative actions --- lelab/rollout.py | 54 +++++++++++++++++++++++++++++++++++++++++++ tests/test_rollout.py | 31 +++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/lelab/rollout.py b/lelab/rollout.py index cfff79a8..c117de2d 100644 --- a/lelab/rollout.py +++ b/lelab/rollout.py @@ -24,6 +24,7 @@ from __future__ import annotations import contextlib +import json import logging import os import re @@ -139,6 +140,53 @@ def _resolve_policy_path(policy_ref: str) -> str: raise ValueError(f"Unrecognised policy ref: {policy_ref!r}") +def _read_policy_config(policy_path: str) -> dict[str, Any]: + """Load pretrained_model/config.json if present.""" + config_path = Path(policy_path) / "config.json" + if not config_path.is_file(): + return {} + try: + with open(config_path) as fh: + data = json.load(fh) + return data if isinstance(data, dict) else {} + except Exception as exc: + logger.warning("Failed to read policy config at %s: %s", config_path, exc) + return {} + + +def _rollout_inference_args(policy_path: str) -> list[str]: + """Return extra lerobot-rollout flags for policies that reject sync inference. + + GR00T and other relative-action policies decode action chunks against the + observation state at inference time. The default sync backend calls + ``select_action`` per tick and can re-decode cached relative actions + against newer states, so lerobot requires the RTC/chunked rollout path + instead. + + GR00T also needs tuned RTC queue settings: the lerobot default + ``queue_threshold=30`` makes the background thread replan while a 16-step + chunk is still playing, which replaces the queue mid-motion and feels + like one action then a full recalculation.""" + cfg = _read_policy_config(policy_path) + policy_type = cfg.get("type") + needs_rtc = bool(cfg.get("use_relative_actions")) or policy_type == "groot" + if not needs_rtc: + return [] + + args = ["--inference.type=rtc"] + + n_action_steps = cfg.get("n_action_steps") + if isinstance(n_action_steps, int) and n_action_steps > 0: + args.append(f"--inference.rtc.execution_horizon={n_action_steps}") + elif policy_type == "groot": + args.append("--inference.rtc.execution_horizon=8") + + # Wait until the current chunk is consumed before replanning. GROOT docs + # recommend keeping this at 0 (never > 5) for stable real-robot rollout. + args.append("--inference.queue_threshold=0") + return args + + def _format_cameras_arg(cameras: dict[str, dict[str, Any]]) -> str: """Convert {name: {type, camera_index, width, height, fps}} into lerobot's CLI dict syntax. The frontend key `camera_index` is @@ -211,6 +259,11 @@ def _friendly_hint(error_text: str | None) -> str | None: return "A camera doesn't support the configured resolution — open camera settings and click Auto." if "permission" in low and ("port" in low or "com" in low): return "Couldn't open the serial port — close anything else using it, or run `lelab --stop`." + if "relative-action" in low or "relative chunk actions" in low: + return ( + "This policy was trained with relative actions and needs RTC (chunked) inference. " + "Update lelab and try again — recent versions enable that automatically." + ) return None @@ -286,6 +339,7 @@ def handle_start_inference(request: InferenceRequest) -> dict[str, Any]: f"--robot.id={follower_id}", f"--task={request.task}", f"--duration={request.duration_s}", + *_rollout_inference_args(policy_path), ] if request.cameras: cmd.append(f"--robot.cameras={_format_cameras_arg(request.cameras)}") diff --git a/tests/test_rollout.py b/tests/test_rollout.py index c0bb1f3d..fa2a74e1 100644 --- a/tests/test_rollout.py +++ b/tests/test_rollout.py @@ -21,6 +21,8 @@ from __future__ import annotations +import json + import pytest @@ -280,11 +282,40 @@ def test_classify_outcome_ok_warns_and_fails() -> None: assert _classify_outcome(1, True, "DeviceNotConnectedError: follower is not connected") == "failed" +def test_rollout_inference_args_uses_rtc_for_relative_action_policies(tmp_path) -> None: + from lelab.rollout import _rollout_inference_args + + policy_dir = tmp_path / "pretrained_model" + policy_dir.mkdir() + (policy_dir / "config.json").write_text( + json.dumps({"type": "groot", "use_relative_actions": True, "n_action_steps": 16}), + encoding="utf-8", + ) + assert _rollout_inference_args(str(policy_dir)) == [ + "--inference.type=rtc", + "--inference.rtc.execution_horizon=16", + "--inference.queue_threshold=0", + ] + + +def test_rollout_inference_args_omits_rtc_for_absolute_policies(tmp_path) -> None: + from lelab.rollout import _rollout_inference_args + + policy_dir = tmp_path / "pretrained_model" + policy_dir.mkdir() + (policy_dir / "config.json").write_text( + json.dumps({"type": "act", "use_relative_actions": False}), + encoding="utf-8", + ) + assert _rollout_inference_args(str(policy_dir)) == [] + + def test_friendly_hint_maps_common_failures() -> None: from lelab.rollout import _friendly_hint assert "gripper" in (_friendly_hint("Motor overload detected") or "").lower() assert "connect" in (_friendly_hint("Failed to connect to the follower") or "").lower() + assert "rtc" in (_friendly_hint("GrootPolicy.select_action does not support relative-action policies") or "").lower() assert _friendly_hint("some unrecognised traceback") is None assert _friendly_hint(None) is None From 8fe8bacf16bcb71c97f7fae8b3f1ab7ea5006de1 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 16 Jul 2026 08:55:07 -0500 Subject: [PATCH 4/5] Address GR00T PR review feedback --- frontend/dist/assets/index-CuYRVmdE.js | 3956 +++++++++++++++++ ...{index-C5KQGL1C.css => index-Da-rRmcX.css} | 2 +- frontend/dist/assets/index-Vh3JnQ1R.js | 3956 ----------------- frontend/dist/index.html | 40 +- frontend/src/components/training/types.ts | 1 - frontend/src/lib/jobsApi.ts | 1 - frontend/src/pages/Training.tsx | 1 - lelab/rollout.py | 2 +- lelab/train.py | 2 - tests/test_rollout.py | 16 + tests/test_train.py | 47 + 11 files changed, 4041 insertions(+), 3983 deletions(-) create mode 100644 frontend/dist/assets/index-CuYRVmdE.js rename frontend/dist/assets/{index-C5KQGL1C.css => index-Da-rRmcX.css} (94%) delete mode 100644 frontend/dist/assets/index-Vh3JnQ1R.js diff --git a/frontend/dist/assets/index-CuYRVmdE.js b/frontend/dist/assets/index-CuYRVmdE.js new file mode 100644 index 00000000..3c9d8a43 --- /dev/null +++ b/frontend/dist/assets/index-CuYRVmdE.js @@ -0,0 +1,3956 @@ +var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` +`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ie(e):``}function se(e){switch(e.tag){case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ce(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function L(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fe(e){e._valueTracker||=L(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function R(e,t){var n=t.checked;return ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function he(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function z(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ge(e,t){z(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ve(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ae={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ae).forEach(function(e){je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ae[t]=Ae[e]})});function Me(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ae.hasOwnProperty(e)&&Ae[e]?(``+t).trim():t+`px`}function Ne(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Me(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Pe=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fe(e,t){if(t){if(Pe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ie(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Le=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,Ve=null;function He(e){if(e=zi(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),ze(e.stateNode,e.type,t))}}function Ue(e){Be?Ve?Ve.push(e):Ve=[e]:Be=e}function We(){if(Be){var e=Be,t=Ve;if(Ve=Be=null,He(e),t)for(e=0;e>>=0,e===0?32:31-(Dt(e)/Ot|0)|0}var At=64,jt=4194304;function Mt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Mt(a))):r=Mt(s)}else o=n&~i,o===0?a!==0&&(r=Mt(a)):r=Mt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function B(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Fr(e){var t=Nr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mr(n.ownerDocument.documentElement,n)){if(r!==null&&Pr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=jr(n,a);var o=jr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,U=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||U==null||U!==me(r)||(r=U,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function Ki(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var qi={},Ji=Wi(qi),Yi=Wi(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qi(e){return e=e.childContextTypes,e!=null}function $i(){Gi(Yi),Gi(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));Ki(Ji,t),Ki(Yi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return ne({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qi,Xi=Ji.current,Ki(Ji,e),Ki(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,Gi(Yi),Gi(Ji),Ki(Ji,e)):Gi(Yi),Ki(Yi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=Vt;try{var n=ia;for(Vt=1;e>=o,i-=o,_a=1<<32-Et(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ta&&ya(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ta&&ya(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ta&&ya(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ta&&ya(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&za(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=La(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=iu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ru(i.type,i.key,i.props,null,e.mode,o),o.ref=La(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=su(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ye(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Ra(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=ou(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Va=Ba(!0),Ha=Ba(!1),Ua=Wi(null),Wa=null,Ga=null,Ka=null;function qa(){Ka=Ga=Wa=null}function Ja(e){var t=Ua.current;Gi(Ua),e._currentValue=t}function Ya(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xa(e,t){Wa=e,Ka=Ga=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Za(e){var t=e._currentValue;if(Ka!==e)if(e={context:e,memoizedValue:t,next:null},Ga===null){if(Wa===null)throw Error(r(308));Ga=e,Wa.dependencies={lanes:0,firstContext:e}}else Ga=Ga.next=e;return t}var Qa=null;function $a(e){Qa===null?Qa=[e]:Qa.push(e)}function eo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,$a(t)):(n.next=i.next,i.next=n),t.interleaved=n,to(e,r)}function to(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ao(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,to(e,n)}return i=r.interleaved,i===null?(t.next=t,$a(r)):(t.next=i.next,i.next=t),r.interleaved=t,to(e,n)}function so(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}function co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lo(e,t,n,r){var i=e.updateQueue;no=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=ne({},d,f);break a;case 2:no=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);tl|=o,e.lanes=o,e.memoizedState=d}}function uo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{Vt=n,Eo.transition=r}}function fs(){return Bo().memoizedState}function ps(e,t,n){var r=bl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e))gs(t,n);else if(n=eo(e,t,n,r),n!==null){var i=yl();xl(n,e,r,i),_s(n,t,r)}}function ms(e,t,n){var r=bl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))gs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o)){var c=t.interleaved;c===null?(i.next=i,$a(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=eo(e,t,i,r),n!==null&&(i=yl(),xl(n,e,r,i),_s(n,t,r))}}function hs(e){var t=e.alternate;return e===Oo||t!==null&&t===Oo}function gs(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _s(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var vs={readContext:Za,useCallback:Fo,useContext:Fo,useEffect:Fo,useImperativeHandle:Fo,useInsertionEffect:Fo,useLayoutEffect:Fo,useMemo:Fo,useReducer:Fo,useRef:Fo,useState:Fo,useDebugValue:Fo,useDeferredValue:Fo,useTransition:Fo,useMutableSource:Fo,useSyncExternalStore:Fo,useId:Fo,unstable_isNewReconciler:!1},ys={readContext:Za,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:Za,useEffect:ns,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),es(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){return es(4,2,e,t)},useMemo:function(e,t){var n=zo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ps.bind(null,Oo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:Zo,useDebugValue:cs,useDeferredValue:function(e){return zo().memoizedState=e},useTransition:function(){var e=Zo(!1),t=e[0];return e=ds.bind(null,e[1]),zo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Oo,a=zo();if(Ta){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Jc===null)throw Error(r(349));Do&30||Ko(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Jo.bind(null,i,o,e),[e]),i.flags|=2048,Qo(9,qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=zo(),t=Jc.identifierPrefix;if(Ta){var n=va,r=_a;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=No++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ie(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;osl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=So(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ta)return fc(t),null}else 2*gt()-s.renderingStartTime>sl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=gt(),t.sibling=null,n=xo.current,Ki(xo,i?n&1|2:n&1),t);case 22:case 23:return jl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Zc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Sa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vo(),Gi(Yi),Gi(Ji),wo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bo(t),null;case 13:if(Gi(xo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(xo),null;case 4:return vo(),null;case 10:return Ja(t.type._context),null;case 22:case 23:return jl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Gl(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Gl(e,t,n)}}var bc=!1;function xc(e,t){if(bi=mn,e=Nr(),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},mn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ss(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Gl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var Ac=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount==`function`)try{wt.onCommitFiberUnmount(Ct,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=Ac,i=jc;Ac=null,Mc(e,t,n),Ac=r,jc=i,Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ac.removeChild(n.stateNode));break;case 18:Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),fn(e)):Oi(Ac,n.stateNode));break;case 4:r=Ac,i=jc,Ac=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),Ac=r,jc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Gl(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Mc(e,t,n),gc=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Yl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=gt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10e?16:e,pl===null)var i=!1;else{if(e=pl,pl=null,ml=0,qc&6)throw Error(r(331));var a=qc;for(qc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lgt()-ol?Ml(e,0):rl|=n),Sl(e,t)}function ql(e,t){t===0&&(e.mode&1?(t=jt,jt<<=1,!(jt&130023424)&&(jt=4194304)):t=1);var n=yl();e=to(e,t),e!==null&&(zt(e,t,n),Sl(e,n))}function Jl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ql(e,n)}function Yl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),ql(e,n)}var Xl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Ta&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Xa(t,n),a=Lo(null,t,i,e,a,n);var o=Ro();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ro(t),a.updater=ws,t.stateNode=a,a._reactInternals=t,Os(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,Ta&&o&&xa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=tu(i),e=Ss(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,Ss(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,io(e,t),lo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=ks(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=ks(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(wa=ki(t.stateNode.containerInfo.firstChild),Ca=t,Ta=!0,Ea=null,n=Ha(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Pa(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return yo(t),e===null&&Aa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Aa(t),null;case 13:return Qs(e,t,n);case 4:return _o(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Va(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ua,i._currentValue),i._currentValue=s,o!==null)if(Or(o.value,s)){if(o.children===a.children&&!Yi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ao(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ya(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ya(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Xa(t,n),a=Za(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=Ss(i,t.pendingProps),a=Ss(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),ac(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Xa(t,n),Es(t,i,a),Os(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Zl(e,t){return ft(e,t)}function Ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $l(e,t,n,r){return new Ql(e,t,n,r)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tu(e){if(typeof e==`function`)return+!!eu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function nu(e,t){var n=e.alternate;return n===null?(n=$l(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ru(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)eu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return iu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=$l(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=$l(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=$l(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return au(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=$l(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function iu(e,t,n,r){return e=$l(7,e,r,t),e.lanes=n,e}function au(e,t,n,r){return e=$l(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function ou(e,t,n){return e=$l(6,e,null,t),e.lanes=n,e}function su(e,t,n){return t=$l(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lu(e,t,n,r,i,a,o,s,c){return e=new cu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=$l(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ro(a),e}function uu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d()),v=l(h()),y=g();function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function j(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=x.Pop,c=null,l=u();l??(l=0,o.replaceState(b({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=x.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=x.Push;let r=O(h.location,e,t);n&&n(r,e),l=u()+1;let d=D(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=x.Replace;let r=O(h.location,e,t);n&&n(r,e),l=u();let i=D(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:k(e);return n=n.replace(/ $/,`%20`),w(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var M;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(M||={});function N(e,t,n){return n===void 0&&(n=`/`),P(e,t,n,!1)}function P(e,t,n,r){let i=pe((typeof t==`string`?A(t):t).pathname||`/`,n);if(i==null)return null;let a=F(e);ee(a);let o=null,s=fe(i);for(let e=0;o==null&&e{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(w(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=xe([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),F(e.children,t,c,s)),!(e.path==null&&!e.index)&&t.push({path:s,score:ce(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of I(e.path))i(e,t,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ee(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var te=/^:[\w-]+$/,ne=3,re=2,ie=1,ae=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=re),n.filter(e=>!se(e)).reduce((e,t)=>e+(te.test(t)?ne:t===``?ie:ae),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return i&&!c?e[r]=void 0:e[r]=(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function L(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "`+e+`" will be treated as if it were `+(`"`+e.replace(/\*$/,`/*`)+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+(`please change the route path to "`+e.replace(/\*$/,`/*`)+`".`));let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function pe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var me=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R=e=>me.test(e);function he(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;if(n)if(R(n))a=n;else{if(n.includes(`//`)){let e=n;n=be(n),T(!1,`Pathnames cannot have embedded double slashes - normalizing `+(e+` -> `+n))}a=n.startsWith(`/`)?z(n.substring(1),`/`):z(n,t)}else a=t;return{pathname:a,search:Ce(r),hash:we(i)}}function z(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in and the router will parse it for you.`}function _e(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ve(e,t){let n=_e(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function ye(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=A(e):(i=b({},e),w(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/\/\/+/g,`/`),xe=e=>be(e.join(`/`)),Se=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ce=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,we=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Ee=[`post`,`put`,`patch`,`delete`];new Set(Ee);var De=[`get`,...Ee];new Set(De);function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),_.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=ye(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:xe([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}function Be(){let{matches:e}=_.useContext(Ne),t=e[e.length-1];return t?t.params:{}}function Ve(e,t){return He(e,t)}function He(e,t,n,r){!Fe()&&w(!1);let{navigator:i}=_.useContext(je),{matches:a}=_.useContext(Ne),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=Ie(),u;if(t){let e=typeof t==`string`?A(t):t;!(c===`/`||e.pathname?.startsWith(c))&&w(!1),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=N(e,{pathname:f}),m=qe(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:xe([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:xe([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&m?_.createElement(Me.Provider,{value:{location:Oe({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:x.Pop}},m):m}function Ue(){let e=et(),t=Te(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return _.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var We=_.createElement(Ue,null),Ge=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:_.createElement(Ne.Provider,{value:this.props.routeContext},_.createElement(Pe.Provider,{value:this.state.error,children:this.props.component}))}};function Ke(e){let{routeContext:t,match:n,children:r}=e,i=_.useContext(ke);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),_.createElement(Ne.Provider,{value:t},r)}function qe(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&w(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||We,s&&(c<0&&i===0?(rt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?_.createElement(r.route.Component,null):r.route.element?r.route.element:e,_.createElement(Ke,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?_.createElement(Ge,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var Je=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(Je||{}),Ye=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(Ye||{});function Xe(e){let t=_.useContext(ke);return!t&&w(!1),t}function Ze(e){let t=_.useContext(Ae);return!t&&w(!1),t}function Qe(e){let t=_.useContext(Ne);return!t&&w(!1),t}function $e(e){let t=Qe(e),n=t.matches[t.matches.length-1];return!n.route.id&&w(!1),n.route.id}function et(){let e=_.useContext(Pe),t=Ze(Ye.UseRouteError),n=$e(Ye.UseRouteError);return e===void 0?t.errors?.[n]:e}function tt(){let{router:e}=Xe(Je.UseNavigateStable),t=$e(Ye.UseNavigateStable),n=_.useRef(!1);return Le(()=>{n.current=!0}),_.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,Oe({fromRouteId:t},i)))},[e,t])}var nt={};function rt(e,t,n){!t&&!nt[e]&&(nt[e]=!0)}var it=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function at(e,t){e?.v7_startTransition===void 0&&it(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&it(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&it(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&it(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&it(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&it(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function ot(e){w(!1)}function st(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=x.Pop,navigator:a,static:o=!1,future:s}=e;Fe()&&w(!1);let c=t.replace(/^\/*/,`/`),l=_.useMemo(()=>({basename:c,navigator:a,static:o,future:Oe({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=A(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=_.useMemo(()=>{let e=pe(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:_.createElement(je.Provider,{value:l},_.createElement(Me.Provider,{children:n,value:h}))}function ct(e){let{children:t,location:n}=e;return Ve(ut(t),n)}var lt=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(lt||{});new Promise(()=>{}),_.Component;function ut(e,t){t===void 0&&(t=[]);let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,ut(e.props.children,i));return}e.type!==ot&&w(!1),!(!e.props.index||!e.props.children)&&w(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ut(e.props.children,i)),n.push(a)}),n}var dt=`6`;try{window.__reactRouterVersion=dt}catch{}var ft=_.startTransition;function pt(e){let{basename:t,children:n,future:r,window:i}=e,a=_.useRef();a.current??=C({window:i,v5Compat:!0});let o=a.current,[s,c]=_.useState({action:o.action,location:o.location}),{v7_startTransition:l}=r||{},u=_.useCallback(e=>{l&&ft?ft(()=>c(e)):c(e)},[c,l]);return _.useLayoutEffect(()=>o.listen(u),[o,u]),_.useEffect(()=>at(r),[r]),_.createElement(st,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}typeof window<`u`&&window.document!==void 0&&window.document.createElement;var mt;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(mt||={});var ht;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(ht||={});var gt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_t=new class extends gt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},vt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt=new class{#e=vt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function bt(e){setTimeout(e,0)}var xt=typeof window>`u`||`Deno`in globalThis;function St(){}function Ct(e,t){return typeof e==`function`?e(t):e}function wt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Tt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e==`function`?e(t):e}function Dt(e,t){return typeof e==`function`?e(t):e}function Ot(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==At(o,t.options))return!1}else if(!Mt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function kt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jt(t.options.mutationKey)!==jt(a))return!1}else if(!Mt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function At(e,t){return(t?.queryKeyHashFn||jt)(e)}function jt(e){return JSON.stringify(e,(e,t)=>It(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Mt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Mt(e[n],t[n])):!1}var Nt=Object.prototype.hasOwnProperty;function Pt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ft(e)&&Ft(t);if(!r&&!(It(e)&&It(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{yt.setTimeout(t,e)})}function zt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Pt(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vt=Symbol();function Ht(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Vt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Wt=(()=>{let e=()=>xt;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Kt=bt;function qt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Kt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Jt=qt(),Yt=new class extends gt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xt(e){return Math.min(1e3*2**e,3e4)}function Zt(e){return(e??`online`)===`online`?Yt.isOnline():!0}var Qt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $t(e){let t=!1,n=0,r,i=Gt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_t.isFocused()&&(e.networkMode===`always`||Yt.isOnline())&&e.canRun(),u=()=>Zt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wt.isServer()?0:3),o=e.retryDelay??Xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var en=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wt(this.gcTime)&&(this.#e=yt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(yt.clearTimeout(this.#e),this.#e=void 0)}};function tn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ut(e,()=>t.signal,()=>n=!0)},u=Ht(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Bt:B;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rn:nn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:nn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function nn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var an=class extends en{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=cn(this.options);e.data!==void 0&&(this.setState(sn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=zt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Dt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Et(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Tt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ht(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?tn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=$t({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...on(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...sn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Jt.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function on(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function sn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function cn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ln=class extends en{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||un(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$t({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Jt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function un(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var dn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ln({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=fn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kt(t,e))}findAll(e={}){return this.getAll().filter(t=>kt(e,t))}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Jt.batch(()=>Promise.all(e.map(e=>e.continue().catch(St))))}};function fn(e){return e.options.scope?.id}var pn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??At(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Jt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ot(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ot(e,t)):t}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new pn,this.#t=e.mutationCache||new dn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Yt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Jt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Jt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Jt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Jt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(St).catch(St)}invalidateQueries(e,t={}){return Jt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Jt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(St)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(St)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Yt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(jt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Mt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=At(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Vt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},hn=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=hn()}))(),gn=_.createContext(void 0),_n=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(gn.Provider,{value:e,children:t})),vn=(0,_.createContext)({theme:`system`,setTheme:()=>null});function yn({children:e,defaultTheme:t=`system`,storageKey:n=`vite-ui-theme`,...r}){let[i,a]=(0,_.useState)(()=>localStorage.getItem(n)||t);(0,_.useEffect)(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),i===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(i)},[i]);let o=(0,_.useCallback)(e=>{localStorage.setItem(n,e),a(e)},[n]),s=(0,_.useMemo)(()=>({theme:i,setTheme:o}),[i,o]);return(0,V.jsx)(vn.Provider,{...r,value:s,children:e})}var bn=e=>{switch(e){case`success`:return Cn;case`info`:return Tn;case`warning`:return wn;case`error`:return En;default:return null}},xn=Array(12).fill(0),Sn=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},xn.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Cn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),wn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Tn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),En=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Dn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),On=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},kn=1,An=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:kn++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Mn(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||kn++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},jn=(e,t)=>{let n=t?.id||kn++;return An.addToast({title:e,...t,id:n}),n},Mn=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Nn=Object.assign(jn,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:()=>An.toasts,getToasts:()=>An.getActiveToasts()});function Pn(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Pn(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} +`);function Fn(e){return e.label!==void 0}var In=3,Ln=`32px`,Rn=`16px`,zn=4e3,Bn=356,Vn=14,Hn=20,Un=200;function Wn(...e){return e.filter(Boolean).join(` `)}function Gn(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kn=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,loadingIcon:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`,pauseWhenPageIsHidden:O}=e,[k,A]=_.useState(null),[j,M]=_.useState(null),[N,P]=_.useState(!1),[F,I]=_.useState(!1),[ee,te]=_.useState(!1),[ne,re]=_.useState(!1),[ie,ae]=_.useState(!1),[oe,se]=_.useState(0),[ce,le]=_.useState(0),ue=_.useRef(n.duration||b||zn),de=_.useRef(null),L=_.useRef(null),fe=c===0,pe=c+1<=o,me=n.type,R=n.dismissible!==!1,he=n.className||``,z=n.descriptionClassName||``,ge=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=_.useMemo(()=>n.duration||b||zn,[n.duration,b]),ye=_.useRef(0),be=_.useRef(0),xe=_.useRef(0),Se=_.useRef(null),[Ce,we]=x.split(`-`),Te=_.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=On(),De=n.invert||t,Oe=me===`loading`;be.current=_.useMemo(()=>ge*S+Te,[ge,Te]),_.useEffect(()=>{ue.current=ve},[ve]),_.useEffect(()=>{P(!0)},[]),_.useEffect(()=>{let e=L.current;if(e){let t=e.getBoundingClientRect().height;return le(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!N)return;let e=L.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,le(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id]);let ke=_.useCallback(()=>{I(!0),se(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Un)},[n,d,a,be]);_.useEffect(()=>{if(n.promise&&me===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||O&&Ee?(()=>{if(xe.current{var e;(e=n.onAutoClose)==null||e.call(n,n),ke()},ue.current)),()=>clearTimeout(e)},[u,i,n,me,O,Ee,ke]),_.useEffect(()=>{n.delete&&ke()},[ke,n.delete]);function Ae(){return E!=null&&E.loading?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},E.loading):C?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},C):_.createElement(Sn,{className:Wn(T?.loader,n?.classNames?.loader),visible:me===`loading`})}return _.createElement(`li`,{tabIndex:0,ref:L,className:Wn(v,he,T?.toast,n?.classNames?.toast,T?.default,T?.[me],n?.classNames?.[me]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":ie,"data-removed":F,"data-visible":pe,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":fe,"data-swiping":ee,"data-dismissible":R,"data-type":me,"data-invert":De,"data-swipe-out":ne,"data-swipe-direction":j,"data-expanded":!!(u||w&&N),style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?oe:be.current}px`,"--initial-height":w?`auto`:`${ce}px`,...m,...n.style},onDragEnd:()=>{te(!1),A(null),Se.current=null},onPointerDown:e=>{Oe||!R||(de.current=new Date,se(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e;if(ne||!R)return;Se.current=null;let t=Number(L.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),r=Number(L.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),i=new Date().getTime()-de.current?.getTime(),a=k===`x`?t:r,o=Math.abs(a)/i;if(Math.abs(a)>=Hn||o>.11){se(be.current),(e=n.onDismiss)==null||e.call(n,n),M(k===`x`?t>0?`right`:`left`:r>0?`down`:`up`),ke(),re(!0),ae(!1);return}te(!1),A(null)},onPointerMove:t=>{var n,r;if(!Se.current||!R||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??Gn(x);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0};k===`y`?(o.includes(`top`)||o.includes(`bottom`))&&(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)&&(s.y=i):k===`x`&&(o.includes(`left`)||o.includes(`right`))&&(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)&&(s.x=a),(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ae(!0),(n=L.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=L.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx?_.createElement(`button`,{"aria-label":D,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!R?()=>{}:()=>{var e;ke(),(e=n.onDismiss)==null||e.call(n,n)},className:Wn(T?.closeButton,n?.classNames?.closeButton)},E?.close??Dn):null,n.jsx||(0,_.isValidElement)(n.title)?n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title:_.createElement(_.Fragment,null,me||n.icon||n.promise?_.createElement(`div`,{"data-icon":``,className:Wn(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:n.icon||E?.[me]||bn(me)):null,_.createElement(`div`,{"data-content":``,className:Wn(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Wn(T?.title,n?.classNames?.title)},typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Wn(y,z,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),(0,_.isValidElement)(n.cancel)?n.cancel:n.cancel&&Fn(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{var t,r;Fn(n.cancel)&&R&&((r=(t=n.cancel).onClick)==null||r.call(t,e),ke())},className:Wn(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,(0,_.isValidElement)(n.action)?n.action:n.action&&Fn(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{var t,r;Fn(n.action)&&((r=(t=n.action).onClick)==null||r.call(t,e),!e.defaultPrevented&&ke())},className:Wn(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null))};function qn(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Jn(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Rn:Ln;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}(0,_.forwardRef)(function(e,t){let{invert:n,position:r=`bottom-right`,hotkey:i=[`altKey`,`KeyT`],expand:a,closeButton:o,className:s,offset:c,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:p,visibleToasts:m=In,toastOptions:h,dir:g=qn(),gap:y=Vn,loadingIcon:b,icons:x,containerAriaLabel:S=`Notifications`,pauseWhenPageIsHidden:C}=e,[w,T]=_.useState([]),E=_.useMemo(()=>Array.from(new Set([r].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,r]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=_.useRef(null),I=i.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ee=_.useRef(null),te=_.useRef(!1),ne=_.useCallback(e=>{T(t=>{var n;return(n=t.find(t=>t.id===e.id))!=null&&n.delete||An.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return _.useEffect(()=>An.subscribe(e=>{if(e.dismiss){T(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));return}setTimeout(()=>{v.flushSync(()=>{T(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),_.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),_.useEffect(()=>{w.length<=1&&A(!1)},[w]),_.useEffect(()=>{let e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(A(!0),(t=F.current)==null||t.focus()),e.code===`Escape`&&(document.activeElement===F.current||(n=F.current)!=null&&n.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),_.useEffect(()=>{if(F.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,te.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,r)=>{let[i,u]=t.split(`-`);return w.length?_.createElement(`ol`,{key:t,dir:g===`auto`?qn():g,tabIndex:-1,ref:F,className:s,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":i,"data-lifted":k&&w.length>1&&!a,"data-x-position":u,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Bn}px`,"--gap":`${y}px`,...p,...Jn(c,l)},onBlur:e=>{te.current&&!e.currentTarget.contains(e.relatedTarget)&&(te.current=!1,ee.current&&=(ee.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te.current||(te.current=!0,ee.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},w.filter(e=>!e.position&&r===0||e.position===t).map((r,i)=>_.createElement(Kn,{key:r.id,icons:x,index:i,toast:r,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:n,visibleToasts:m,closeButton:h?.closeButton??o,interacting:j,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:ne,toasts:w.filter(e=>e.position==r.position),heights:D.filter(e=>e.position==r.position),setHeights:O,expandByDefault:a,gap:y,loadingIcon:b,expanded:k,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections}))):null}))});function Yn(e){if(!(e instanceof DataTransfer))throw Error(`Data must be of type "DataTransfer"`);let t={};function n(e){let r=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.file==`function`&&`fullPath`in e,i=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.createReader==`function`;if(r(e)&&e.isFile)return new Promise(n=>{e.file(r=>{t[e.fullPath]=r,n()})});if(i(e)&&!e.isFile){let t=e.createReader();return new Promise(e=>{let r=[];function i(){t.readEntries(t=>{t.length===0?Promise.all(r).then(()=>e()):(t.forEach(e=>{r.push(n(e))}),i())})}i()})}return Promise.resolve()}return new Promise(r=>{let i=e.items&&Array.from(e.items),a=Array.from(e.files);if(i&&i.length&&`webkitGetAsEntry`in i[0]){let e=[];for(let t=0;tr(t))}else a.filter(e=>e.size!==0).forEach(e=>t[`/`+e.name]=e),r(t)})}function Xn(e){return e.replace(/\\/g,`/`).split(/\//g).reduce((e,t)=>(t===`..`?e.pop():t!==`.`&&e.push(t),e),[]).join(`/`)}var Zn={current:``};function Qn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{e.target&&e.target.result?t(e.target.result):n(Error(`Failed to read Urdf file content`))},r.onerror=()=>n(Error(`Error reading Urdf file`)),r.readAsText(e)})}async function $n(e,t){Zn.current=``;let n=await Yn(e),r=Object.keys(n).map(e=>Xn(e)),i=r.filter(e=>/urdf$/i.test(e)),a={};i.forEach(e=>{a[e]=URL.createObjectURL(n[e])});let o=``;if(i.length>0){let e=i[0].match(/^(\/[^/]+\/)/);e&&e[1]&&(o=e[1])}let s=o;return t.setUrlModifierFunc(e=>{s&&(Zn.current=s);let t=Xn(e).split(`/`).pop()||``,i=r.find(e=>e.endsWith(t));if(!i&&t.includes(`.`)){let e=`.`+t.split(`.`).pop();i=r.find(t=>t.endsWith(e))}if(i!=null){let e=i.split(`.`).pop()?.toLowerCase()||``,t=new Blob([n[i]],{type:er(e)}),r=URL.createObjectURL(t)+`#.`+e;return setTimeout(()=>URL.revokeObjectURL(r),5e3),r}return console.warn(`No matching file found for: ${e}`),e}),{files:n,availableModels:i,blobUrls:a}}function er(e){switch(e.toLowerCase()){case`stl`:return`model/stl`;case`obj`:return`model/obj`;case`gltf`:case`glb`:return`model/gltf+json`;case`dae`:return`model/vnd.collada+xml`;case`urdf`:return`application/xml`;default:return`application/octet-stream`}}var tr=(0,_.createContext)(void 0),nr=({children:e})=>{let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!d||p)return;let e=!1;return(async()=>{try{let t=await fetch(`/so-101-urdf/urdf/so101_new_calib.urdf`);if(!t.ok)throw Error(`Failed to fetch default Urdf: ${t.statusText}`);let n=await t.text();e||m(n)}catch(t){e||console.error(`Error loading default Urdf content:`,t)}})(),()=>{e=!0}},[d,p]);let v=(0,_.useRef)([]),y=(0,_.useCallback)(()=>{f(!0),m(null),g(null),Nn.info(`Switched to default model`,{description:`The default ARM100 robot model is now displayed.`})},[]),b=(0,_.useCallback)(e=>(v.current.push(e),()=>{v.current=v.current.filter(t=>t!==e)}),[]),x=(0,_.useCallback)(e=>{n(e)},[]),S=(0,_.useCallback)(e=>{e.hasUrdf?f(!1):y(),v.current.forEach(t=>t(e))},[y]),C=(0,_.useCallback)(async e=>{if(!t)return;let n=Object.values(r).filter(t=>t===e.blobUrl).map(e=>{let t=Object.keys(r).find(t=>r[t]===e);return t?{path:t,url:e}:null}).filter(e=>e!==null);if(n.length===0){console.error(`❌ Could not find file for selected Urdf model`);return}let i=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{let t=n[0]?.path;if(!t||!r[t])throw Error(`File not found in records`);let a=await(await fetch(e.blobUrl)).blob();m(await Qn(new File([a],t.split(`/`).pop()||`model.urdf`,{type:`application/xml`}))),Nn.dismiss(i),f(!1);let o=e.name||e.path.split(`/`).pop()||`Unknown`;Nn.success(`Urdf model loaded successfully`,{description:`Model: ${o}`,duration:3e3}),S({hasUrdf:!0,modelName:o})}catch(e){console.error(`❌ Error processing selected Urdf:`,e),Nn.dismiss(i),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3})}},[r,t,S]),w=(0,_.useCallback)(e=>{if(!t){console.error(`❌ No Urdf processor available`);return}c(!1);let n=e.name||e.path.split(`/`).pop()?.replace(/\.urdf$/i,``)||`Unknown`;t.loadUrdf(e.blobUrl),f(!1),Nn.info(`Loading model: ${n}`,{description:`Preparing 3D visualization`,duration:2e3}),S({hasUrdf:!0,modelName:n}),C(e)},[t,S,C]),T=(0,_.useCallback)(async(e,n)=>{Object.values(r).forEach(URL.revokeObjectURL),i({}),o([]),u([]);try{if(n.length>0&&t){let r={};if(n.forEach(t=>{e[t]&&(r[t]=URL.createObjectURL(e[t]))}),i(r),o(n),u(n.map(e=>{let t=(e.split(`/`).pop()||``).replace(/\.urdf$/i,``);return{path:e,blobUrl:r[e],name:t}})),n.length===1){let i=(n[0].split(`/`).pop()||``).replace(/\.urdf$/i,``),a=r[n[0]];if(a)if(t.loadUrdf(a),f(!1),e[n[0]]){let t=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{m(await Qn(e[n[0]])),Nn.dismiss(t),Nn.success(`Urdf model loaded successfully`,{description:`Model: ${i}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}catch(e){console.error(`Error loading Urdf:`,e),Nn.dismiss(t),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}}else console.error(`Could not find file for Urdf model:`,n[0]),S({hasUrdf:!0,modelName:i});else console.warn(`No blob URL found for ${n[0]}, using path directly`),t.loadUrdf(n[0]),f(!1),S({hasUrdf:!0,modelName:i})}else c(!0),S({hasUrdf:!0,modelName:`Multiple models available`})}else S({hasUrdf:!1}),y(),Nn.error(`No Urdf file found`,{description:`Please upload a folder containing a .urdf file.`,duration:3e3})}catch(e){console.error(`Error processing Urdf files:`,e),Nn.error(`Error processing files`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),y()}},[S,r,t,y]),E=(0,_.useRef)(r);E.current=r,(0,_.useEffect)(()=>()=>{Object.values(E.current).forEach(URL.revokeObjectURL)},[]);let D=(0,_.useMemo)(()=>({urdfProcessor:t,registerUrdfProcessor:x,onUrdfDetected:b,processUrdfFiles:T,urdfBlobUrls:r,alternativeUrdfModels:a,isSelectionModalOpen:s,setIsSelectionModalOpen:c,urdfModelOptions:l,selectUrdfModel:w,isDefaultModel:d,setIsDefaultModel:f,resetToDefaultModel:y,urdfContent:p,currentAnimationConfig:h,setCurrentAnimationConfig:g}),[t,x,b,T,r,a,s,l,w,d,y,p,h]);return(0,V.jsx)(tr.Provider,{value:D,children:e})},rr=()=>{let e=(0,_.useContext)(tr);if(e===void 0)throw Error(`useUrdf must be used within a UrdfProvider`);return e},ir=(0,_.createContext)(void 0),ar=({children:e})=>{let[t,n]=(0,_.useState)(!1),{urdfProcessor:r,processUrdfFiles:i}=rr(),a=e=>{e.preventDefault(),e.stopPropagation()},o=e=>{e.preventDefault(),e.stopPropagation(),n(!0)},s=e=>{e.preventDefault(),e.stopPropagation(),(!e.relatedTarget||!e.relatedTarget.closest(`html`))&&n(!1)},c=(0,_.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),n(!1),!(!e.dataTransfer||!r))try{let{availableModels:t,files:n}=await $n(e.dataTransfer,r);await i(n,t)}catch(e){console.error(`Error in handleDrop:`,e)}},[r,i]);(0,_.useEffect)(()=>(document.addEventListener(`dragover`,a),document.addEventListener(`dragenter`,o),document.addEventListener(`dragleave`,s),document.addEventListener(`drop`,c),()=>{document.removeEventListener(`dragover`,a),document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragleave`,s),document.removeEventListener(`drop`,c)}),[c]);let l=(0,_.useMemo)(()=>({isDragging:t,setIsDragging:n,handleDrop:c}),[t,c]);return(0,V.jsxs)(ir.Provider,{value:l,children:[e,t&&(0,V.jsx)(`div`,{className:`fixed inset-0 bg-primary/10 pointer-events-none z-50 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-background p-8 rounded-lg shadow-lg text-center`,children:[(0,V.jsx)(`div`,{className:`text-3xl font-bold mb-4`,children:`Drop Urdf Files Here`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Release to upload your robot model`})]})})]})},or=1,sr=1e6,cr=0;function lr(){return cr=(cr+1)%(2**53-1),cr.toString()}var ur=new Map,dr=e=>{if(ur.has(e))return;let t=setTimeout(()=>{ur.delete(e),hr({type:`REMOVE_TOAST`,toastId:e})},sr);ur.set(e,t)},fr=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,or)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?dr(n):e.toasts.forEach(e=>{dr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},pr=[],mr={toasts:[]};function hr(e){mr=fr(mr,e),pr.forEach(e=>{e(mr)})}function gr({...e}){let t=lr(),n=e=>hr({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>hr({type:`DISMISS_TOAST`,toastId:t});return hr({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function _r(){let[e,t]=_.useState(mr);return _.useEffect(()=>(pr.push(t),()=>{let e=pr.indexOf(t);e>-1&&pr.splice(e,1)}),[e]),{...e,toast:gr,dismiss:e=>hr({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function vr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function yr(...e){return t=>{let n=!1,r=e.map(e=>{let r=vr(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=_.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Sr(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cr(i,...t)]}function Cr(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function wr(e){let t=Tr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Dr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=kr(n),i=Or(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Er=Symbol(`radix.slottable`);function Dr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Er}function Or(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function kr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ar(e){let t=e+`CollectionProvider`,[n,r]=Sr(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=wr(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,V.jsx)(c,{ref:br(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=wr(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=br(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}function jr(e){let t=Mr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Pr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ir(n),i=Fr(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nr=Symbol(`radix.slottable`);function Pr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Nr}function Fr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ir(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jr(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lr(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}function Rr(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...e)=>t.current?.(...e),[])}function zr(e,t=globalThis?.document){let n=Rr(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Br=`DismissableLayer`,Vr=`dismissableLayer.update`,Hr=`dismissableLayer.pointerDownOutside`,Ur=`dismissableLayer.focusOutside`,Wr,Gr=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kr=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=_.useContext(Gr),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=_.useState({}),m=br(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Yr(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Xr(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zr(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wr=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zr(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wr)}},[u,f,n,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zr())},[u,l]),_.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vr,e),()=>document.removeEventListener(Vr,e)},[]),(0,V.jsx)(U.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,C.onFocusCapture),onBlurCapture:H(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,S.onPointerDownCapture)})});Kr.displayName=Br;var qr=`DismissableLayerBranch`,Jr=_.forwardRef((e,t)=>{let n=_.useContext(Gr),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(U.div,{...e,ref:i})});Jr.displayName=qr;function Yr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qr(Hr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qr(Ur,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zr(){let e=new CustomEvent(Vr);document.dispatchEvent(e)}function Qr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var $r=Kr,ei=Jr,ti=globalThis?.document?_.useLayoutEffect:()=>{},ni=`Portal`,ri=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);ti(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?v.createPortal((0,V.jsx)(U.div,{...r,ref:t}),o):null});ri.displayName=ni;function ii(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var ai=e=>{let{present:t,children:n}=e,r=oi(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=br(r.ref,ci(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};ai.displayName=`Presence`;function oi(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=ii(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=si(r.current);a.current=o===`mounted`?e:`none`},[o]),ti(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=si(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ti(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=si(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=si(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function si(e){return e?.animationName||`none`}function ci(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var li=_.useInsertionEffect||ti;function ui({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=di({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=fi(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function di({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return li(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function fi(e){return typeof e==`function`}var pi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),mi=`VisuallyHidden`,hi=_.forwardRef((e,t)=>(0,V.jsx)(U.span,{...e,ref:t,style:{...pi,...e.style}}));hi.displayName=mi;var gi=hi,_i=`ToastProvider`,[vi,yi,bi]=Ar(`Toast`),[xi,Si]=Sr(`Toast`,[bi]),[Ci,wi]=xi(_i),Ti=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=_.useState(null),[l,u]=_.useState(0),d=_.useRef(!1),f=_.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${_i}\`. Expected non-empty \`string\`.`),(0,V.jsx)(vi.Provider,{scope:t,children:(0,V.jsx)(Ci,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:_.useCallback(()=>u(e=>e+1),[]),onToastRemove:_.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};Ti.displayName=_i;var Ei=`ToastViewport`,Di=[`F8`],Oi=`toast.viewportPause`,ki=`toast.viewportResume`,Ai=_.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=Di,label:i=`Notifications ({hotkey})`,...a}=e,o=wi(Ei,n),s=yi(n),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=br(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;_.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),_.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Oi);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ki);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=_.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...ra(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return _.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);ia(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,V.jsxs)(ei,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,V.jsx)(Mi,{ref:l,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`forwards`}))}}),(0,V.jsx)(vi.Slot,{scope:n,children:(0,V.jsx)(U.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,V.jsx)(Mi,{ref:u,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`backwards`}))}})]})});Ai.displayName=Ei;var ji=`ToastFocusProxy`,Mi=_.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=wi(ji,n);return(0,V.jsx)(hi,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Mi.displayName=ji;var Ni=`Toast`,Pi=`toast.swipeStart`,Fi=`toast.swipeMove`,Ii=`toast.swipeCancel`,Li=`toast.swipeEnd`,Ri=_.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ui({prop:r,defaultProp:i??!0,onChange:a,caller:Ni});return(0,V.jsx)(ai,{present:n||s,children:(0,V.jsx)(Vi,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Rr(e.onPause),onResume:Rr(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ri.displayName=Ni;var[zi,Bi]=xi(Ni,{onClose(){}}),Vi=_.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=wi(Ni,n),[g,y]=_.useState(null),b=br(t,e=>y(e)),x=_.useRef(null),S=_.useRef(null),C=i||h.duration,w=_.useRef(0),T=_.useRef(C),E=_.useRef(0),{onToastAdd:D,onToastRemove:O}=h,k=Rr(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),A=_.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(k,e))},[k]);_.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{A(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(Oi,n),e.addEventListener(ki,t),()=>{e.removeEventListener(Oi,n),e.removeEventListener(ki,t)}}},[h.viewport,C,c,l,A]),_.useEffect(()=>{a&&!h.isClosePausedRef.current&&A(C)},[a,C,h.isClosePausedRef,A]),_.useEffect(()=>(D(),()=>O()),[D,O]);let j=_.useMemo(()=>g?Qi(g):null,[g]);return h.viewport?(0,V.jsxs)(V.Fragment,{children:[j&&(0,V.jsx)(Hi,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:j}),(0,V.jsx)(zi,{scope:n,onClose:k,children:v.createPortal((0,V.jsx)(vi.ItemSlot,{scope:n,children:(0,V.jsx)($r,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||k(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,V.jsx)(U.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(S.current=l,$i(Fi,d,f,{discrete:!1})):ea(l,h.swipeDirection,c)?(S.current=l,$i(Pi,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};ea(t,h.swipeDirection,h.swipeThreshold)?$i(Li,p,r,{discrete:!0}):$i(Ii,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Hi=e=>{let{__scopeToast:t,children:n,...r}=e,i=wi(Ni,t),[a,o]=_.useState(!1),[s,c]=_.useState(!1);return ta(()=>o(!0)),_.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,V.jsx)(ri,{asChild:!0,children:(0,V.jsx)(hi,{...r,children:a&&(0,V.jsxs)(V.Fragment,{children:[i.label,` `,n]})})})},Ui=`ToastTitle`,Wi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Wi.displayName=Ui;var Gi=`ToastDescription`,Ki=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Ki.displayName=Gi;var qi=`ToastAction`,Ji=_.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,V.jsx)(Zi,{altText:n,asChild:!0,children:(0,V.jsx)(Xi,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${qi}\`. Expected non-empty \`string\`.`),null)});Ji.displayName=qi;var Yi=`ToastClose`,Xi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Bi(Yi,n);return(0,V.jsx)(Zi,{asChild:!0,children:(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Xi.displayName=Yi;var Zi=_.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,V.jsx)(U.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Qi(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),na(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Qi(e))}}),t}function $i(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var ea=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ta(e=()=>{}){let t=Rr(e);ti(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function na(e){return e.nodeType===e.ELEMENT_NODE}function ra(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ia(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var aa=Ti,oa=Ai,sa=Ri,ca=Wi,la=Ki,ua=Ji,da=Xi;function fa(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,ha=pa,ga=(e,t)=>n=>{if(t?.variants==null)return ha(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ma(t)||ma(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ha(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},_a=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),va=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ya={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ba=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...ya,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:va(`lucide`,i),...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xa=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(ba,{ref:i,iconNode:t,className:va(`lucide-${_a(e)}`,n),...r}));return n.displayName=`${e}`,n},Sa=xa(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ca=xa(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),wa=xa(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ta=xa(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Ea=xa(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Da=xa(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Oa=xa(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ka=xa(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aa=xa(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ja=xa(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ma=xa(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Na=xa(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pa=xa(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Fa=xa(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ia=xa(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),La=xa(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Ra=xa(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=xa(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ba=xa(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Va=xa(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ha=xa(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ua=xa(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wa=xa(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ga=xa(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=xa(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),qa=xa(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ja=xa(`Lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ya=xa(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Xa=xa(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Za=xa(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Qa=xa(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=xa(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=xa(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),to=xa(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),no=xa(`ShieldQuestion`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ro=xa(`SkipForward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]),io=xa(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ao=xa(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),oo=xa(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),so=xa(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),co=xa(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),lo=xa(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),uo=xa(`VideoOff`,[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),fo=xa(`Volume2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),po=xa(`VolumeX`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),mo=xa(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ho=`-`,go=e=>{let t=bo(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(ho);return n[0]===``&&n.length!==1&&n.shift(),_o(n,t)||yo(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},_o=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?_o(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(ho);return t.validators.find(({validator:e})=>e(a))?.classGroupId},vo=/^\[(.+)\]$/,yo=e=>{if(vo.test(e)){let t=vo.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},bo=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wo(Object.entries(e.classGroups),n).forEach(([e,n])=>{xo(n,r,e,t)}),r},xo=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:So(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Co(e)){xo(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{xo(i,So(t,e),n,r)})})},So=(e,t)=>{let n=e;return t.split(ho).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Co=e=>e.isThemeGetter,wo=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,To=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Eo=`!`,Do=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;ls?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Oo=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},ko=e=>({cache:To(e.cacheSize),parseClassName:Do(e),...go(e)}),Ao=/\s+/,jo=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Ao),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Oo(c).join(`:`),h=l?m+Eo:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Mo(){let e=0,t,n,r=``;for(;e{if(typeof e==`string`)return e;let t,n=``;for(let r=0;rt(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=jo(e,n);return i(e,a),a}return function(){return a(Mo.apply(null,arguments))}}var Fo=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lo=/^\d+\/\d+$/,Ro=new Set([`px`,`full`,`screen`]),zo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ho=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wo=e=>Ko(e)||Ro.has(e)||Lo.test(e),Go=e=>as(e,`length`,os),Ko=e=>!!e&&!Number.isNaN(Number(e)),qo=e=>as(e,`number`,Ko),Jo=e=>!!e&&Number.isInteger(Number(e)),Yo=e=>e.endsWith(`%`)&&Ko(e.slice(0,-1)),Xo=e=>Io.test(e),Zo=e=>zo.test(e),Qo=new Set([`length`,`size`,`percentage`]),$o=e=>as(e,Qo,ss),es=e=>as(e,`position`,ss),ts=new Set([`image`,`url`]),ns=e=>as(e,ts,ls),rs=e=>as(e,``,cs),is=()=>!0,as=(e,t,n)=>{let r=Io.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},os=e=>Bo.test(e)&&!Vo.test(e),ss=()=>!1,cs=e=>Ho.test(e),ls=e=>Uo.test(e),us=Po(()=>{let e=Fo(`colors`),t=Fo(`spacing`),n=Fo(`blur`),r=Fo(`brightness`),i=Fo(`borderColor`),a=Fo(`borderRadius`),o=Fo(`borderSpacing`),s=Fo(`borderWidth`),c=Fo(`contrast`),l=Fo(`grayscale`),u=Fo(`hueRotate`),d=Fo(`invert`),f=Fo(`gap`),p=Fo(`gradientColorStops`),m=Fo(`gradientColorStopPositions`),h=Fo(`inset`),g=Fo(`margin`),_=Fo(`opacity`),v=Fo(`padding`),y=Fo(`saturate`),b=Fo(`scale`),x=Fo(`sepia`),S=Fo(`skew`),C=Fo(`space`),w=Fo(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,Xo,t],O=()=>[Xo,t],k=()=>[``,Wo,Go],A=()=>[`auto`,Ko,Xo],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,Xo],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],ee=()=>[Ko,Xo];return{cacheSize:500,separator:`:`,theme:{colors:[is],spacing:[Wo,Go],blur:[`none`,``,Zo,Xo],brightness:ee(),borderColor:[e],borderRadius:[`none`,``,`full`,Zo,Xo],borderSpacing:O(),borderWidth:k(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Yo,Go],inset:D(),margin:D(),opacity:ee(),padding:O(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,Xo]}],container:[`container`],columns:[{columns:[Zo]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),Xo]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Jo,Xo]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,Xo]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Jo,Xo]}],"grid-cols":[{"grid-cols":[is]}],"col-start-end":[{col:[`auto`,{span:[`full`,Jo,Xo]},Xo]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[is]}],"row-start-end":[{row:[`auto`,{span:[Jo,Xo]},Xo]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,Xo]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,Xo]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,Xo,t]}],"min-w":[{"min-w":[Xo,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[Xo,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Zo]},Zo]}],h:[{h:[Xo,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[Xo,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Zo,Go]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,qo]}],"font-family":[{font:[is]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,Xo]}],"line-clamp":[{"line-clamp":[`none`,Ko,qo]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Wo,Xo]}],"list-image":[{"list-image":[`none`,Xo]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,Xo]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Wo,Go]}],"underline-offset":[{"underline-offset":[`auto`,Wo,Xo]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Xo]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Xo]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),es]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,$o]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ns]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Wo,Xo]}],"outline-w":[{outline:[Wo,Go]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Wo,Go]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Zo,rs]}],"shadow-color":[{shadow:[is]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Zo,Xo]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,Xo]}],duration:[{duration:ee()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,Xo]}],delay:[{delay:ee()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,Xo]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Jo,Xo]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,Xo]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Xo]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Xo]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Wo,Go,qo]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function W(...e){return us(pa(e))}var ds=aa,fs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oa,{ref:n,className:W(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));fs.displayName=oa.displayName;var ps=ga(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),ms=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(sa,{ref:r,className:W(ps({variant:t}),e),...n}));ms.displayName=sa.displayName;var hs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ua,{ref:n,className:W(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));hs.displayName=ua.displayName;var gs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(da,{ref:n,className:W(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,V.jsx)(mo,{className:`h-4 w-4`})}));gs.displayName=da.displayName;var _s=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ca,{ref:n,className:W(`text-sm font-semibold`,e),...t}));_s.displayName=ca.displayName;var vs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(la,{ref:n,className:W(`text-sm opacity-90`,e),...t}));vs.displayName=la.displayName;function ys(){let{toasts:e}=_r();return(0,V.jsxs)(ds,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,V.jsxs)(ms,{...i,children:[(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,V.jsx)(_s,{children:t}),n&&(0,V.jsx)(vs,{children:n})]}),r,(0,V.jsx)(gs,{})]},e)}),(0,V.jsx)(fs,{})]})}var bs=Symbol.for(`react.lazy`),xs=_.use;function Ss(e){return typeof e==`object`&&!!e&&`then`in e}function Cs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===bs&&`_payload`in e&&Ss(e._payload)}function ws(e){let t=Es(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e;Cs(r)&&typeof xs==`function`&&(r=xs(r._payload));let a=_.Children.toArray(r),o=a.find(Os);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ts=ws(`Slot`);function Es(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(Cs(n)&&typeof xs==`function`&&(n=xs(n._payload)),_.isValidElement(n)){let e=As(n),i=ks(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ds=Symbol(`radix.slottable`);function Os(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ds}function ks(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function As(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var js=ga(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),G=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,V.jsx)(r?Ts:`button`,{className:W(js({variant:t,size:n,className:e})),ref:a,...i}));G.displayName=`Button`;var Ms=(0,_.createContext)(void 0),Ns=`lelab.apiBaseUrl`,Ps=`http://localhost:8000`,Fs=e=>e.replace(/^http(s?):/,`ws$1:`),Is=()=>{if(typeof window>`u`)return Ps;let e=new URLSearchParams(window.location.search).get(`api`);if(e)try{new URL(e);let t=e.replace(/\/$/,``);return window.localStorage.setItem(Ns,t),t}catch{console.warn("Invalid `api` query param, ignoring:",e)}return window.localStorage.getItem(Ns)||Ps},Ls=({children:e})=>{let[t]=(0,_.useState)(Is),n=Fs(t),r=(0,_.useCallback)(async(e,t={})=>fetch(e,{...t,headers:{"Content-Type":`application/json`,...t.headers}}),[]),i=(0,_.useMemo)(()=>({baseUrl:t,wsBaseUrl:n,fetchWithHeaders:r}),[t,n,r]);return(0,V.jsx)(Ms.Provider,{value:i,children:e})},Rs=()=>{let e=(0,_.useContext)(Ms);if(e===void 0)throw Error(`useApi must be used within an ApiProvider`);return e},zs=(0,_.createContext)(void 0),Bs=({children:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)({status:`loading`}),a=(0,_.useCallback)(async()=>{i({status:`loading`});try{let e=await(await n(`${t}/hf-auth-status`)).json();e.authenticated?i({status:`authenticated`,username:e.username,orgs:e.orgs??[]}):i({status:`unauthenticated`,loginCommand:e.login_command??`hf auth login`})}catch(e){console.warn(`HF auth status fetch failed:`,e),i({status:`unauthenticated`,loginCommand:`hf auth login`})}},[t,n]);(0,_.useEffect)(()=>{a()},[a]);let o=(0,_.useMemo)(()=>({auth:r,refetch:a}),[r,a]);return(0,V.jsx)(zs.Provider,{value:o,children:e})},Vs=()=>{let e=(0,_.useContext)(zs);if(e===void 0)throw Error(`useHfAuth must be used within an HfAuthProvider`);return e},Hs=_.useId||(()=>void 0),Us=0;function Ws(e){let[t,n]=_.useState(Hs());return ti(()=>{e||n(e=>e??String(Us++))},[e]),e||(t?`radix-${t}`:``)}var Gs=`focusScope.autoFocusOnMount`,Ks=`focusScope.autoFocusOnUnmount`,qs={bubbles:!1,cancelable:!0},Js=`FocusScope`,Ys=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Rr(i),u=Rr(a),d=_.useRef(null),f=br(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:nc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||nc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nc(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){rc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Gs,qs);s.addEventListener(Gs,l),s.dispatchEvent(t),t.defaultPrevented||(Xs(oc(Qs(s)),{select:!0}),document.activeElement===e&&nc(s))}return()=>{s.removeEventListener(Gs,l),setTimeout(()=>{let t=new CustomEvent(Ks,qs);s.addEventListener(Ks,u),s.dispatchEvent(t),t.defaultPrevented||nc(e??document.body,{select:!0}),s.removeEventListener(Ks,u),rc.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Zs(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&nc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&nc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(U.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ys.displayName=Js;function Xs(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nc(r,{select:t}),document.activeElement!==n)return}function Zs(e){let t=Qs(e);return[$s(t,e),$s(t.reverse(),e)]}function Qs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $s(e,t){for(let n of e)if(!ec(n,{upTo:t}))return n}function ec(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function tc(e){return e instanceof HTMLInputElement&&`select`in e}function nc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tc(e)&&t&&e.select()}}var rc=ic();function ic(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ac(e,t),e.unshift(t)},remove(t){e=ac(e,t),e[0]?.resume()}}}function ac(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oc(e){return e.filter(e=>e.tagName!==`A`)}var sc=0;function cc(){_.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??lc()),document.body.insertAdjacentElement(`beforeend`,e[1]??lc()),sc++,()=>{sc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),sc--}},[])}function lc(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var uc=function(){return uc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Lc;var t=zc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Vc=Ic(),Hc=`data-scroll-locked`,Uc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` + .${hc} { + overflow: hidden ${r}; + padding-right: ${s}px ${r}; + } + body[${Hc}] { + overflow: hidden ${r}; + overscroll-behavior: contain; + ${[t&&`position: relative ${r};`,n===`margin`&&` + padding-left: ${i}px; + padding-top: ${a}px; + padding-right: ${o}px; + margin-left:0; + margin-top:0; + margin-right: ${s}px ${r}; + `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} + } + + .${pc} { + right: ${s}px ${r}; + } + + .${mc} { + margin-right: ${s}px ${r}; + } + + .${pc} .${pc} { + right: 0 ${r}; + } + + .${mc} .${mc} { + margin-right: 0 ${r}; + } + + body[${Hc}] { + ${gc}: ${s}px; + } +`},Wc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Gc=function(){_.useEffect(function(){return document.body.setAttribute(Hc,(Wc()+1).toString()),function(){var e=Wc()-1;e<=0?document.body.removeAttribute(Hc):document.body.setAttribute(Hc,e.toString())}},[])},Kc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Gc();var a=_.useMemo(function(){return Bc(i)},[i]);return _.createElement(Vc,{styles:Uc(a,!t,i,n?``:`!important`)})},qc=!1;if(typeof window<`u`)try{var Jc=Object.defineProperty({},"passive",{get:function(){return qc=!0,!0}});window.addEventListener(`test`,Jc,Jc),window.removeEventListener(`test`,Jc,Jc)}catch{qc=!1}var Yc=qc?{passive:!1}:!1,Xc=function(e){return e.tagName===`TEXTAREA`},Zc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xc(e)&&n[t]===`visible`)},Qc=function(e){return Zc(e,`overflowY`)},$c=function(e){return Zc(e,`overflowX`)},el=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rl(e,r)){var i=il(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rl=function(e,t){return e===`v`?Qc(t):$c(t)},il=function(e,t){return e===`v`?tl(t):nl(t)},al=function(e,t){return e===`h`&&t===`rtl`?-1:1},ol=function(e,t,n,r,i){var a=al(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=il(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cl=function(e){return[e.deltaX,e.deltaY]},ll=function(e){return e&&`current`in e?e.current:e},ul=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dl=function(e){return` + .block-interactivity-${e} {pointer-events: none;} + .allow-interactivity-${e} {pointer-events: all;} +`},fl=0,pl=[];function ml(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(fl++)[0],a=_.useState(Ic)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fc([e.lockRef.current],(e.shards||[]).map(ll),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=el(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=el(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ol(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!pl.length||pl[pl.length-1]!==a)){var r=`deltaY`in n?cl(n):sl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ul(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ll).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=sl(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,cl(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,sl(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return pl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yc),document.addEventListener(`touchmove`,c,Yc),document.addEventListener(`touchstart`,u,Yc),function(){pl=pl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yc),document.removeEventListener(`touchmove`,c,Yc),document.removeEventListener(`touchstart`,u,Yc)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:dl(i)}):null,p?_.createElement(Kc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gl=Tc(Ec,ml),_l=_.forwardRef(function(e,t){return _.createElement(Oc,uc({},e,{ref:t,sideCar:gl}))});_l.classNames=Oc.classNames;var vl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},yl=new WeakMap,bl=new WeakMap,xl={},Sl=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},wl=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cl(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Tl=function(e,t,n,r){var i=wl(t,Array.isArray(e)?e:[e]);xl[n]||(xl[n]=new WeakMap);var a=xl[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(yl.get(e)||0)+1,l=(a.get(e)||0)+1;yl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bl.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sl++,function(){o.forEach(function(e){var t=yl.get(e)-1,i=a.get(e)-1;yl.set(e,t),a.set(e,i),t||(bl.has(e)||e.removeAttribute(r),bl.delete(e)),i||e.removeAttribute(n)}),Sl--,Sl||(yl=new WeakMap,yl=new WeakMap,bl=new WeakMap,xl={})}},El=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Tl(r,i,n,`aria-hidden`)):function(){return null}};function Dl(e){let t=Ol(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Al);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ol(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ml(n),i=jl(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kl=Symbol(`radix.slottable`);function Al(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kl}function jl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ml(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Nl=`Dialog`,[Pl,Fl]=Sr(Nl),[Il,Ll]=Pl(Nl),Rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:Nl});return(0,V.jsx)(Il,{scope:t,triggerRef:s,contentRef:c,contentId:Ws(),titleId:Ws(),descriptionId:Ws(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Rl.displayName=Nl;var zl=`DialogTrigger`,Bl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(zl,n),a=br(t,i.triggerRef);return(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ou(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Bl.displayName=zl;var Vl=`DialogPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ll(Vl,t);return(0,V.jsx)(Hl,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:e})}))})};Wl.displayName=Vl;var Gl=`DialogOverlay`,Kl=_.forwardRef((e,t)=>{let n=Ul(Gl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Gl,e.__scopeDialog);return a.modal?(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(Jl,{...i,ref:t})}):null});Kl.displayName=Gl;var ql=Dl(`DialogOverlay.RemoveScroll`),Jl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(Gl,n);return(0,V.jsx)(_l,{as:ql,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(U.div,{"data-state":ou(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Yl=`DialogContent`,Xl=_.forwardRef((e,t)=>{let n=Ul(Yl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Yl,e.__scopeDialog);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(Zl,{...i,ref:t}):(0,V.jsx)(Ql,{...i,ref:t})})});Xl.displayName=Yl;var Zl=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(null),i=br(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)($l,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Ql=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)($l,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$l=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ll(Yl,n),c=_.useRef(null),l=br(t,c);return cc(),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ou(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(uu,{titleId:s.titleId}),(0,V.jsx)(fu,{contentRef:c,descriptionId:s.descriptionId})]})]})}),eu=`DialogTitle`,tu=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(eu,n);return(0,V.jsx)(U.h2,{id:i.titleId,...r,ref:t})});tu.displayName=eu;var nu=`DialogDescription`,ru=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(nu,n);return(0,V.jsx)(U.p,{id:i.descriptionId,...r,ref:t})});ru.displayName=nu;var iu=`DialogClose`,au=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(iu,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});au.displayName=iu;function ou(e){return e?`open`:`closed`}var su=`DialogTitleWarning`,[cu,lu]=xr(su,{contentName:Yl,titleName:eu,docsSlug:`dialog`}),uu=({titleId:e})=>{let t=lu(su),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. + +If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. + +For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},du=`DialogDescriptionWarning`,fu=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lu(du).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},pu=Rl,mu=Bl,hu=Wl,gu=Kl,_u=Xl,vu=tu,yu=ru,bu=au,xu=pu,Su=hu,Cu=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gu,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Cu.displayName=gu.displayName;var wu=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,V.jsxs)(Su,{children:[(0,V.jsx)(Cu,{}),(0,V.jsxs)(_u,{ref:i,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,V.jsxs)(bu,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,V.jsx)(mo,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));wu.displayName=_u.displayName;var Tu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Tu.displayName=`DialogHeader`;var Eu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Eu.displayName=`DialogFooter`;var Du=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vu,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Du.displayName=vu.displayName;var Ou=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yu,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Ou.displayName=yu.displayName;var ku=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Vs(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,V.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,V.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,V.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,V.jsx)(Ea,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,V.jsx)(Qa,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},Au=()=>{let{auth:e}=Vs(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,V.jsx)(qa,{className:`w-3 h-3 animate-spin`}),(0,V.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:e.username})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`HF not configured`})]}),(0,V.jsx)(ku,{open:t,onOpenChange:n})]})},eee=()=>(0,V.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,V.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,V.jsx)(Au,{})]})}),ju=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:Ka},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:wa},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,V.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,V.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],Mu=()=>(0,V.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,V.jsxs)(`span`,{children:[`Powered by`,` `,(0,V.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,V.jsx)(`nav`,{className:`flex items-center gap-4`,children:ju.map(({href:e,label:t,Icon:n})=>(0,V.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,V.jsx)(n,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:t})]},t))})]})}),Nu=[`top`,`right`,`bottom`,`left`],Pu=Math.min,Fu=Math.max,Iu=Math.round,Lu=Math.floor,Ru=e=>({x:e,y:e}),zu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Bu(e,t,n){return Fu(e,Pu(t,n))}function Vu(e,t){return typeof e==`function`?e(t):e}function Hu(e){return e.split(`-`)[0]}function Uu(e){return e.split(`-`)[1]}function Wu(e){return e===`x`?`y`:`x`}function Gu(e){return e===`y`?`height`:`width`}function Ku(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function qu(e){return Wu(Ku(e))}function Ju(e,t,n){n===void 0&&(n=!1);let r=Uu(e),i=qu(e),a=Gu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=rd(o)),[o,rd(o)]}function Yu(e){let t=rd(e);return[Xu(e),t,Xu(t)]}function Xu(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Zu=[`left`,`right`],Qu=[`right`,`left`],$u=[`top`,`bottom`],ed=[`bottom`,`top`];function td(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Qu:Zu:t?Zu:Qu;case`left`:case`right`:return t?$u:ed;default:return[]}}function nd(e,t,n,r){let i=Uu(e),a=td(Hu(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Xu)))),a}function rd(e){let t=Hu(e);return zu[t]+e.slice(t.length)}function id(e){return{top:0,right:0,bottom:0,left:0,...e}}function ad(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:id(e)}function od(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function sd(e,t,n){let{reference:r,floating:i}=e,a=Ku(t),o=qu(t),s=Gu(o),c=Hu(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Uu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function cd(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Vu(t,e),p=ad(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=od(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=od(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ld=50,ud=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:cd},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=sd(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Vu(e,t)||{};if(l==null)return{};let d=ad(u),f={x:n,y:r},p=qu(i),m=Gu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Pu(d[_],T),D=Pu(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Bu(O,A,k),M=!c.arrow&&Uu(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Ku(t))||T.every(e=>Ku(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Ku(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function pd(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function md(e){return Nu.some(t=>e[t]>=0)}var hd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Vu(e,t);switch(i){case`referenceHidden`:{let e=pd(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:md(e)}}}case`escaped`:{let e=pd(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:md(e)}}}default:return{}}}}},gd=new Set([`left`,`top`]);async function tee(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Hu(n),s=Uu(n),c=Ku(n)===`y`,l=gd.has(o)?-1:1,u=a&&c?-1:1,d=Vu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var nee=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await tee(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ree=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Vu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Ku(Hu(i)),p=Wu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Bu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Bu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},iee=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Vu(e,t),u={x:n,y:r},d=Ku(i),f=Wu(d),p=u[f],m=u[d],h=Vu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=gd.has(Hu(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},aee=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Vu(e,t),u=await o.detectOverflow(t,l),d=Hu(i),f=Uu(i),p=Ku(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Pu(h-u[g],v),x=Pu(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Fu(u.left,0),t=Fu(u.right,0),n=Fu(u.top,0),r=Fu(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Fu(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Fu(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function _d(){return typeof window<`u`}function vd(e){return xd(e)?(e.nodeName||``).toLowerCase():`#document`}function yd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function bd(e){return((xd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function xd(e){return _d()?e instanceof Node||e instanceof yd(e).Node:!1}function Sd(e){return _d()?e instanceof Element||e instanceof yd(e).Element:!1}function Cd(e){return _d()?e instanceof HTMLElement||e instanceof yd(e).HTMLElement:!1}function wd(e){return!_d()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof yd(e).ShadowRoot}function Td(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Id(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function Ed(e){return/^(table|td|th)$/.test(vd(e))}function Dd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var Od=/transform|translate|scale|rotate|perspective|filter/,kd=/paint|layout|strict|content/,Ad=e=>!!e&&e!==`none`,jd;function Md(e){let t=Sd(e)?Id(e):e;return Ad(t.transform)||Ad(t.translate)||Ad(t.scale)||Ad(t.rotate)||Ad(t.perspective)||!Pd()&&(Ad(t.backdropFilter)||Ad(t.filter))||Od.test(t.willChange||``)||kd.test(t.contain||``)}function Nd(e){let t=Rd(e);for(;Cd(t)&&!Fd(t);){if(Md(t))return t;if(Dd(t))return null;t=Rd(t)}return null}function Pd(){return jd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),jd}function Fd(e){return/^(html|body|#document)$/.test(vd(e))}function Id(e){return yd(e).getComputedStyle(e)}function Ld(e){return Sd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rd(e){if(vd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||wd(e)&&e.host||bd(e);return wd(t)?t.host:t}function zd(e){let t=Rd(e);return Fd(t)?e.ownerDocument?e.ownerDocument.body:e.body:Cd(t)&&Td(t)?t:zd(t)}function Bd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=zd(e),i=r===e.ownerDocument?.body,a=yd(r);if(i){let e=Vd(a);return t.concat(a,a.visualViewport||[],Td(r)?r:[],e&&n?Bd(e):[])}else return t.concat(r,Bd(r,[],n))}function Vd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Hd(e){let t=Id(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Cd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Iu(n)!==a||Iu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ud(e){return Sd(e)?e:e.contextElement}function Wd(e){let t=Ud(e);if(!Cd(t))return Ru(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Hd(t),o=(a?Iu(n.width):n.width)/r,s=(a?Iu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Gd=Ru(0);function Kd(e){let t=yd(e);return!Pd()||!t.visualViewport?Gd:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function qd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==yd(e)?!1:t}function Jd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ud(e),o=Ru(1);t&&(r?Sd(r)&&(o=Wd(r)):o=Wd(e));let s=qd(a,n,r)?Kd(a):Ru(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=yd(a),t=r&&Sd(r)?yd(r):r,n=e,i=Vd(n);for(;i&&r&&t!==n;){let e=Wd(i),t=i.getBoundingClientRect(),r=Id(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=yd(i),i=Vd(n)}}return od({width:u,height:d,x:c,y:l})}function Yd(e,t){let n=Ld(e).scrollLeft;return t?t.left+n:Jd(bd(e)).left+n}function Xd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Yd(e,n),y:n.top+t.scrollTop}}function Zd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=bd(r),s=t?Dd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Ru(1),u=Ru(0),d=Cd(r);if((d||!d&&!a)&&((vd(r)!==`body`||Td(o))&&(c=Ld(r)),d)){let e=Jd(r);l=Wd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Xd(o,c):Ru(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Qd(e){return Array.from(e.getClientRects())}function $d(e){let t=bd(e),n=Ld(e),r=e.ownerDocument.body,i=Fu(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=Fu(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Yd(e),s=-n.scrollTop;return Id(r).direction===`rtl`&&(o+=Fu(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var ef=25;function tf(e,t){let n=yd(e),r=bd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Pd();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Yd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=ef&&(a-=o)}else l<=ef&&(a+=l);return{width:a,height:o,x:s,y:c}}function nf(e,t){let n=Jd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=Cd(e)?Wd(e):Ru(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function rf(e,t,n){let r;if(t===`viewport`)r=tf(e,n);else if(t===`document`)r=$d(bd(e));else if(Sd(t))r=nf(t,n);else{let n=Kd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return od(r)}function af(e,t){let n=Rd(e);return n===t||!Sd(n)||Fd(n)?!1:Id(n).position===`fixed`||af(n,t)}function oee(e,t){let n=t.get(e);if(n)return n;let r=Bd(e,[],!1).filter(e=>Sd(e)&&vd(e)!==`body`),i=null,a=Id(e).position===`fixed`,o=a?Rd(e):e;for(;Sd(o)&&!Fd(o);){let t=Id(o),n=Md(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Td(o)&&!n&&af(e,o))?r=r.filter(e=>e!==o):i=t,o=Rd(o)}return t.set(e,r),r}function see(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dd(t)?[]:oee(t,this._c):[].concat(n),r],o=rf(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!lf(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function df(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ud(e),u=i||a?[...l?Bd(l):[],...t?Bd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?uf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Jd(e):null;c&&g();function g(){let t=Jd(e);h&&!lf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var ff=nee,pf=ree,mf=fd,hf=aee,gf=hd,_f=dd,vf=iee,yf=(e,t,n)=>{let r=new Map,i={platform:fee,...n},a={...i.platform,_c:r};return ud(e,t,{...i,platform:a})},bf=typeof document<`u`?_.useLayoutEffect:function(){};function xf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xf(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!xf(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Sf(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Cf(e,t){let n=Sf(e);return Math.round(t*n)/n}function wf(e){let t=_.useRef(e);return bf(()=>{t.current=e}),t}function Tf(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);xf(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=wf(c),k=wf(i),A=wf(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),yf(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!xf(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);bf(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);bf(()=>(M.current=!0,()=>{M.current=!1}),[]),bf(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Cf(P.floating,u.x),r=Cf(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Sf(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var Ef=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:_f({element:r.current,padding:i}).fn(n):r?_f({element:r,padding:i}).fn(n):{}}}},Df=(e,t)=>{let n=ff(e);return{name:n.name,fn:n.fn,options:[e,t]}},Of=(e,t)=>{let n=pf(e);return{name:n.name,fn:n.fn,options:[e,t]}},kf=(e,t)=>({fn:vf(e).fn,options:[e,t]}),Af=(e,t)=>{let n=mf(e);return{name:n.name,fn:n.fn,options:[e,t]}},jf=(e,t)=>{let n=hf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Mf=(e,t)=>{let n=gf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nf=(e,t)=>{let n=Ef(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pf=`Arrow`,Ff=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(U.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Ff.displayName=Pf;var If=Ff;function Lf(e){let[t,n]=_.useState(void 0);return ti(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Rf=`Popper`,[zf,Bf]=Sr(Rf),[Vf,Hf]=zf(Rf),Uf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,V.jsx)(Vf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Uf.displayName=Rf;var Wf=`PopperAnchor`,Gf=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Hf(Wf,n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(U.div,{...i,ref:s})});Gf.displayName=Wf;var Kf=`PopperContent`,[qf,Jf]=zf(Kf),Yf=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=Hf(Kf,n),[v,y]=_.useState(null),b=br(t,e=>y(e)),[x,S]=_.useState(null),C=Lf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter($f),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Tf({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>df(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Df({mainAxis:i+T,alignmentAxis:o}),c&&Of({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?kf():void 0,...A}),c&&Af({...A}),jf({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Nf({element:x,padding:s}),ep({arrowWidth:w,arrowHeight:T}),f&&Mf({strategy:`referenceHidden`,...A})]}),[I,ee]=tp(N),te=Rr(m);ti(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=_.useState();return ti(()=>{v&&oe(window.getComputedStyle(v).zIndex)},[v]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(qf,{scope:n,placedSide:I,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,V.jsx)(U.div,{"data-side":I,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Yf.displayName=Kf;var Xf=`PopperArrow`,Zf={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Qf=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Jf(Xf,n),a=Zf[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(If,{...r,ref:t,style:{...r.style,display:`block`}})})});Qf.displayName=Xf;function $f(e){return e!==null}var ep=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function tp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var np=Uf,rp=Gf,ip=Yf,ap=Qf,op=Symbol(`radix.slottable`);function sp(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=op,t}var[cp,pee]=Sr(`Tooltip`,[Bf]),lp=Bf(),up=`TooltipProvider`,dp=700,fp=`tooltip.open`,[pp,mp]=cp(up),hp=e=>{let{__scopeTooltip:t,delayDuration:n=dp,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(pp,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hp.displayName=up;var gp=`Tooltip`,[_p,vp]=cp(gp),yp=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mp(gp,e.__scopeTooltip),l=lp(t),[u,d]=_.useState(null),f=Ws(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=ui({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fp))):c.onClose(),a?.(e)},caller:gp}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(np,{...l,children:(0,V.jsx)(_p,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};yp.displayName=gp;var bp=`TooltipTrigger`,xp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vp(bp,n),a=mp(bp,n),o=lp(n),s=br(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(rp,{asChild:!0,...o,children:(0,V.jsx)(U.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});xp.displayName=bp;var Sp=`TooltipPortal`,[Cp,wp]=cp(Sp,{forceMount:void 0}),Tp=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vp(Sp,t);return(0,V.jsx)(Cp,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};Tp.displayName=Sp;var Ep=`TooltipContent`,Dp=_.forwardRef((e,t)=>{let n=wp(Ep,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vp(Ep,e.__scopeTooltip);return(0,V.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(Mp,{side:i,...a,ref:t}):(0,V.jsx)(Op,{side:i,...a,ref:t})})}),Op=_.forwardRef((e,t)=>{let n=vp(Ep,e.__scopeTooltip),r=mp(Ep,e.__scopeTooltip),i=_.useRef(null),a=br(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ip(r,Fp(r,n.getBoundingClientRect())),a=Lp(t.getBoundingClientRect());s(zp([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rp(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(Mp,{...e,ref:a})}),[kp,Ap]=cp(gp,{isInside:!1}),jp=sp(`TooltipContent`),Mp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vp(Ep,n),l=lp(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(fp,u),()=>document.removeEventListener(fp,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(ip,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(jp,{children:r}),(0,V.jsx)(kp,{scope:n,isInside:!0,children:(0,V.jsx)(gi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dp.displayName=Ep;var Np=`TooltipArrow`,Pp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lp(n);return Ap(Np,n).isInside?null:(0,V.jsx)(ap,{...i,...r,ref:t})});Pp.displayName=Np;function Fp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ip(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zp(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Bp(t)}function Bp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vp=yp,Hp=xp,Up=Dp,Wp=Vp,Gp=Hp,Kp=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(Up,{ref:r,sideOffset:t,className:W(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kp.displayName=Up.displayName;function qp(e){let t=Jp(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Xp);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Jp(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Qp(n),i=Zp(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yp=Symbol(`radix.slottable`);function Xp(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Yp}function Zp(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qp(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $p=`Popover`,[em,mee]=Sr($p,[Bf]),tm=Bf(),[nm,rm]=em($p),im=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tm(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:$p});return(0,V.jsx)(np,{...s,children:(0,V.jsx)(nm,{scope:t,contentId:Ws(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};im.displayName=$p;var am=`PopoverAnchor`,om=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(am,n),a=tm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(rp,{...a,...r,ref:t})});om.displayName=am;var sm=`PopoverTrigger`,cm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(sm,n),a=tm(n),o=br(t,i.triggerRef),s=(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":Cm(i.open),...r,ref:o,onClick:H(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(rp,{asChild:!0,...a,children:s})});cm.displayName=sm;var lm=`PopoverPortal`,[um,dm]=em(lm,{forceMount:void 0}),fm=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=rm(lm,t);return(0,V.jsx)(um,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};fm.displayName=lm;var pm=`PopoverContent`,mm=_.forwardRef((e,t)=>{let n=dm(pm,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=rm(pm,e.__scopePopover);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(gm,{...i,ref:t}):(0,V.jsx)(_m,{...i,ref:t})})});mm.displayName=pm;var hm=qp(`PopoverContent.RemoveScroll`),gm=_.forwardRef((e,t)=>{let n=rm(pm,e.__scopePopover),r=_.useRef(null),i=br(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(_l,{as:hm,allowPinchZoom:!0,children:(0,V.jsx)(vm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),_m=_.forwardRef((e,t)=>{let n=rm(pm,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)(vm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),vm=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=rm(pm,n),p=tm(n);return cc(),(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(ip,{"data-state":Cm(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),ym=`PopoverClose`,bm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=rm(ym,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});bm.displayName=ym;var xm=`PopoverArrow`,Sm=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tm(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});Sm.displayName=xm;function Cm(e){return e?`open`:`closed`}var wm=im,Tm=cm,Em=fm,Dm=mm,Om=wm,km=Tm,Am=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,V.jsx)(Em,{children:(0,V.jsx)(Dm,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));Am.displayName=Dm.displayName;var jm=1,Mm=.9,Nm=.8,Pm=.17,Fm=.1,Im=.999,Lm=.9999,Rm=.99,zm=/[\\\/_+.#"@\[\(\{&]/,Bm=/[\\\/_+.#"@\[\(\{&]/g,Vm=/[\s-]/,Hm=/[\s-]/g;function Um(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?jm:Rm;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=Um(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=jm:zm.test(e.charAt(l-1))?(d*=Nm,p=e.slice(i,l-1).match(Bm),p&&i>0&&(d*=Im**+p.length)):Vm.test(e.charAt(l-1))?(d*=Mm,m=e.slice(i,l-1).match(Hm),m&&i>0&&(d*=Im**+m.length)):(d*=Pm,i>0&&(d*=Im**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Lm)),(dd&&(d=f*Fm)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Wm(e){return e.toLowerCase().replace(Hm,` `)}function Gm(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,Um(e,t,Wm(e),Wm(t),0,0,{})}var Km=`[cmdk-group=""]`,qm=`[cmdk-group-items=""]`,Jm=`[cmdk-group-heading=""]`,Ym=`[cmdk-item=""]`,Xm=`${Ym}:not([aria-disabled="true"])`,Zm=`cmdk-item-select`,Qm=`data-value`,$m=(e,t,n)=>Gm(e,t,n),eh=_.createContext(void 0),th=()=>_.useContext(eh),nh=_.createContext(void 0),rh=()=>_.useContext(nh),ih=_.createContext(void 0),ah=_.forwardRef((e,t)=>{let n=lh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=lh(()=>new Set),i=lh(()=>new Map),a=lh(()=>new Map),o=lh(()=>new Set),s=sh(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Ws(),b=Ws(),x=Ws(),S=_.useRef(null),C=Tee();ch(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),ch(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??$m;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(qm);t?t.appendChild(e.parentElement===t?e:e.closest(`${qm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${qm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Km}[${Qm}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Qm);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Km)?.querySelector(Jm))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Ym}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Xm)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Qm))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Qm))}function F(e){let t=j()?.closest(Km),n;for(;t&&!n;)t=e>0?Cee(t,Km):wee(t,Km),n=t?.querySelector(Xm);n?w.setState(`value`,n.getAttribute(Qm)):P(e)}let I=()=>N(M().length-1),ee=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},te=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(U.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(Zm);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:Dee},c),fh(e,e=>_.createElement(nh.Provider,{value:w},_.createElement(eh.Provider,{value:T},e))))}),hee=_.forwardRef((e,t)=>{let n=Ws(),r=_.useRef(null),i=_.useContext(ih),a=th(),o=sh(e),s=o.current?.forceMount??i?.forceMount;ch(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=dh(n,r,[e.value,e.children,r],e.keywords),l=rh(),u=uh(e=>e.value&&e.value===c.current),d=uh(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(Zm,f),()=>t.removeEventListener(Zm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(U.div,{ref:yr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),gee=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ws(),s=_.useRef(null),c=_.useRef(null),l=Ws(),u=th(),d=uh(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);ch(()=>u.group(o),[]),dh(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(U.div,{ref:yr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),fh(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(ih.Provider,{value:f},e))))}),_ee=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=uh(e=>!e.search);return!n&&!a?null:_.createElement(U.div,{ref:yr(i,t),...r,"cmdk-separator":``,role:`separator`})}),vee=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=rh(),o=uh(e=>e.search),s=uh(e=>e.selectedItemId),c=th();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(U.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),yee=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=uh(e=>e.selectedItemId),c=th();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(U.div,{ref:yr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},fh(e,e=>_.createElement(`div`,{ref:yr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),bee=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(pu,{open:n,onOpenChange:r},_.createElement(hu,{container:o},_.createElement(gu,{"cmdk-overlay":``,className:i}),_.createElement(_u,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(ah,{ref:t,...s}))))}),xee=_.forwardRef((e,t)=>uh(e=>e.filtered.count===0)?_.createElement(U.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),See=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(U.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},fh(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),oh=Object.assign(ah,{List:yee,Item:hee,Input:vee,Group:gee,Separator:_ee,Dialog:bee,Empty:xee,Loading:See});function Cee(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function wee(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function sh(e){let t=_.useRef(e);return ch(()=>{t.current=e}),t}var ch=typeof window>`u`?_.useEffect:_.useLayoutEffect;function lh(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function uh(e){let t=rh(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function dh(e,t,n,r=[]){let i=_.useRef(),a=th();return ch(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Qm,s),i.current=s}),i}var Tee=()=>{let[e,t]=_.useState(),n=lh(()=>new Map);return ch(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function Eee(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function fh({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(Eee(t),{ref:t.ref},n(t.props.children)):n(t)}var Dee={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},ph=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh,{ref:n,className:W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));ph.displayName=oh.displayName;var mh=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,V.jsx)(eo,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,V.jsx)(oh.Input,{ref:n,className:W(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));mh.displayName=oh.Input.displayName;var hh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.List,{ref:n,className:W(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));hh.displayName=oh.List.displayName;var gh=_.forwardRef((e,t)=>(0,V.jsx)(oh.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));gh.displayName=oh.Empty.displayName;var _h=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Group,{ref:n,className:W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));_h.displayName=oh.Group.displayName;var Oee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Separator,{ref:n,className:W(`-mx-1 h-px bg-border`,e),...t}));Oee.displayName=oh.Separator.displayName;var vh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oh.Item,{ref:n,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));vh.displayName=oh.Item.displayName;var kee=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});kee.displayName=`CommandShortcut`;var yh=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,V.jsxs)(Om,{open:a,onOpenChange:o,children:[(0,V.jsx)(km,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,V.jsx)(`span`,{className:W(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(Am,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,V.jsxs)(ph,{className:`bg-gray-800`,children:[(0,V.jsx)(mh,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,V.jsxs)(hh,{children:[t.length===0&&(0,V.jsx)(gh,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,V.jsx)(_h,{heading:`Existing`,children:t.map(t=>(0,V.jsxs)(vh,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),p]})]})})]})},bh=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,V.jsx)(yh,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,V.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,children:(0,V.jsx)(to,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Configure (calibrate)`})]}),(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Delete robot config`})]})]})]}),e&&(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsx)(G,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,V.jsx)(Kp,{children:`Configure the robot first.`})]}),e&&(0,V.jsx)(xu,{open:l,onOpenChange:u,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{children:`Delete robot config?`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,V.jsxs)(Eu,{className:`flex gap-2 justify-end`,children:[(0,V.jsx)(G,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,V.jsx)(G,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},xh=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=Re(),{baseUrl:c,fetchWithHeaders:l}=Rs(),{toast:u}=_r();return(0,V.jsx)(bh,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},Sh=_.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:W(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Sh.displayName=`Input`;var Ch=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,V.jsx)(Sh,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:W(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});Ch.displayName=`NumberInput`;var wh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Th=`Label`,Eh=_.forwardRef((e,t)=>(0,V.jsx)(wh.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));Eh.displayName=Th;var Dh=Eh,Oh=ga(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),kh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Dh,{ref:n,className:W(Oh(),e),...t}));kh.displayName=Dh.displayName;function Ah(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jh=`Checkbox`,[Mh,Aee]=Sr(jh),[Nh,Ph]=Mh(jh);function Fh(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:i??!1,onChange:c,caller:jh}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Wh(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,V.jsx)(Nh,{scope:t,...x,children:Uh(d)?d(x):r})}var Ih=`CheckboxTrigger`,Lh=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Ph(Ih,e),h=br(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(U.button,{type:`button`,role:`checkbox`,"aria-checked":Wh(c)?`mixed`:c,"aria-required":l,"data-state":Gh(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>Wh(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});Lh.displayName=Ih;var Rh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(Fh,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Lh,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Hh,{__scopeCheckbox:n})]})})});Rh.displayName=jh;var zh=`CheckboxIndicator`,Bh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ph(zh,n);return(0,V.jsx)(ai,{present:r||Wh(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{"data-state":Gh(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Bh.displayName=zh;var Vh=`CheckboxBubbleInput`,Hh=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Ph(Vh,e),m=br(n,p),h=Ah(a),g=Lf(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Wh(a),n.call(e,Wh(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(Wh(a)?!1:a);return(0,V.jsx)(U.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Hh.displayName=Vh;function Uh(e){return typeof e==`function`}function Wh(e){return e===`indeterminate`}function Gh(e){return Wh(e)?`indeterminate`:e?`checked`:`unchecked`}var Kh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Rh,{ref:n,className:W(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,V.jsx)(Bh,{className:W(`flex items-center justify-center text-current`),children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}));Kh.displayName=Rh.displayName;var qh=`Collapsible`,[Jh,jee]=Sr(qh),[Yh,Xh]=Jh(qh),Zh=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ui({prop:r,defaultProp:i??!1,onChange:o,caller:qh});return(0,V.jsx)(Yh,{scope:n,disabled:a,contentId:Ws(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,V.jsx)(U.div,{"data-state":rg(c),"data-disabled":a?``:void 0,...s,ref:t})})});Zh.displayName=qh;var Qh=`CollapsibleTrigger`,$h=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Xh(Qh,n);return(0,V.jsx)(U.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":rg(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});$h.displayName=Qh;var eg=`CollapsibleContent`,tg=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Xh(eg,e.__scopeCollapsible);return(0,V.jsx)(ai,{present:n||i.open,children:({present:e})=>(0,V.jsx)(ng,{...r,ref:t,present:e})})});tg.displayName=eg;var ng=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Xh(eg,n),[s,c]=_.useState(r),l=_.useRef(null),u=br(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),ti(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,V.jsx)(U.div,{"data-state":rg(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function rg(e){return e?`open`:`closed`}var ig=Zh,ag=$h,og=tg,sg=ga(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),cg=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(`div`,{ref:r,role:`alert`,className:W(sg({variant:t}),e),...n}));cg.displayName=`Alert`;var lg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h5`,{ref:n,className:W(`mb-1 font-medium leading-none tracking-tight`,e),...t}));lg.displayName=`AlertTitle`;var ug=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`text-sm [&_p]:leading-relaxed`,e),...t}));ug.displayName=`AlertDescription`;function dg(e,[t,n]){return Math.min(n,Math.max(t,e))}var fg=_.createContext(void 0);function pg(e){let t=_.useContext(fg);return e||t||`ltr`}function Mee(e){let t=Nee(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Fee);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Nee(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Lee(n),i=Iee(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Pee=Symbol(`radix.slottable`);function Fee(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Pee}function Iee(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Lee(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],hg=[` `,`Enter`],gg=`Select`,[_g,vg,yg]=Ar(gg),[bg,Ree]=Sr(gg,[yg,Bf]),xg=Bf(),[Sg,Cg]=bg(gg),[wg,Tg]=bg(gg),Eg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=xg(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=pg(l),[w,T]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:gg}),[E,D]=ui({prop:o,defaultProp:s,onChange:c,caller:gg}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,V.jsx)(np,{...h,children:(0,V.jsxs)(Sg,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ws(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,V.jsx)(_g.Provider,{scope:t,children:(0,V.jsx)(wg,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,V.jsxs)(x_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,V.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Eg.displayName=gg;var Dg=`SelectTrigger`,Og=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=xg(n),o=Cg(Dg,n),s=o.disabled||r,c=br(t,o.onTriggerChange),l=vg(n),u=_.useRef(`touch`),[d,f,p]=C_(e=>{let t=l().filter(e=>!e.disabled),n=w_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,V.jsx)(rp,{asChild:!0,...a,children:(0,V.jsx)(U.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":S_(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&mg.includes(e.key)&&(m(),e.preventDefault())})})})});Og.displayName=Dg;var kg=`SelectValue`,Ag=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=Cg(kg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=br(t,c.onValueNodeChange);return ti(()=>{l(u)},[l,u]),(0,V.jsx)(U.span,{...s,ref:d,style:{pointerEvents:`none`},children:S_(c.value)?(0,V.jsx)(V.Fragment,{children:o}):a})});Ag.displayName=kg;var jg=`SelectIcon`,Mg=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(U.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Mg.displayName=jg;var Ng=`SelectPortal`,Pg=e=>(0,V.jsx)(ri,{asChild:!0,...e});Pg.displayName=Ng;var Fg=`SelectContent`,Ig=_.forwardRef((e,t)=>{let n=Cg(Fg,e.__scopeSelect),[r,i]=_.useState();if(ti(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,V.jsx)(Rg,{scope:e.__scopeSelect,children:(0,V.jsx)(_g.Slot,{scope:e.__scopeSelect,children:(0,V.jsx)(`div`,{children:e.children})})}),t):null}return(0,V.jsx)(Hg,{...e,ref:t})});Ig.displayName=Fg;var Lg=10,[Rg,zg]=bg(Fg),Bg=`SelectContentImpl`,Vg=Mee(`SelectContent.RemoveScroll`),Hg=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=Cg(Fg,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=br(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=vg(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return El(b)},[b]),cc();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ee,te]=C_(e=>{let t=k().filter(e=>!e.disabled),n=w_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ne=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),re=_.useCallback(()=>b?.focus(),[b]),ie=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ae=r===`popper`?Kg:Wg,oe=ae===Kg?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,V.jsx)(Rg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ne,selectedItem:T,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:ee,children:(0,V.jsx)(_l,{as:Vg,allowPinchZoom:!0,children:(0,V.jsx)(Ys,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,V.jsx)(ae,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...oe,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:H(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Hg.displayName=Bg;var Ug=`SelectItemAlignedPosition`,Wg=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=Cg(Fg,n),o=zg(Fg,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=br(t,e=>u(e)),f=vg(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Lg,d=dg(a,[Lg,Math.max(Lg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Lg,d=dg(a,[Lg,Math.max(Lg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Lg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Lg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Lg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);ti(()=>b(),[b]);let[x,S]=_.useState();return ti(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,V.jsx)(qg,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(U.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Wg.displayName=Ug;var Gg=`SelectPopperPosition`,Kg=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Lg,...a}=e,o=xg(n);return(0,V.jsx)(ip,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});Kg.displayName=Gg;var[qg,Jg]=bg(Fg,{}),Yg=`SelectViewport`,Xg=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=zg(Yg,n),o=Jg(Yg,n),s=br(t,a.onViewportChange),c=_.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(_g.Slot,{scope:n,children:(0,V.jsx)(U.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Lg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Xg.displayName=Yg;var Zg=`SelectGroup`,[Qg,$g]=bg(Zg),e_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ws();return(0,V.jsx)(Qg,{scope:n,id:i,children:(0,V.jsx)(U.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});e_.displayName=Zg;var t_=`SelectLabel`,n_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=$g(t_,n);return(0,V.jsx)(U.div,{id:i.id,...r,ref:t})});n_.displayName=t_;var r_=`SelectItem`,[i_,a_]=bg(r_),o_=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=Cg(r_,n),c=zg(r_,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=br(t,e=>c.itemRefCallback?.(e,r,i)),h=Ws(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,V.jsx)(i_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(_g.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(U.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(hg.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});o_.displayName=r_;var s_=`SelectItemText`,c_=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=Cg(s_,n),s=zg(s_,n),c=a_(s_,n),l=Tg(s_,n),[u,d]=_.useState(null),f=br(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return ti(()=>(h(m),()=>g(m)),[h,g,m]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(U.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});c_.displayName=s_;var l_=`SelectItemIndicator`,u_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return a_(l_,n).isSelected?(0,V.jsx)(U.span,{"aria-hidden":!0,...r,ref:t}):null});u_.displayName=l_;var d_=`SelectScrollUpButton`,f_=_.forwardRef((e,t)=>{let n=zg(d_,e.__scopeSelect),r=Jg(d_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(h_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});f_.displayName=d_;var p_=`SelectScrollDownButton`,m_=_.forwardRef((e,t)=>{let n=zg(p_,e.__scopeSelect),r=Jg(p_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(h_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});m_.displayName=p_;var h_=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=zg(`SelectScrollButton`,n),o=_.useRef(null),s=vg(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),ti(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(U.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),g_=`SelectSeparator`,__=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,V.jsx)(U.div,{"aria-hidden":!0,...r,ref:t})});__.displayName=g_;var v_=`SelectArrow`,y_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=xg(n),a=Cg(v_,n),o=zg(v_,n);return a.open&&o.position===`popper`?(0,V.jsx)(ap,{...i,...r,ref:t}):null});y_.displayName=v_;var b_=`SelectBubbleInput`,x_=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=br(r,i),o=Ah(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,V.jsx)(U.select,{...n,style:{...pi,...n.style},ref:a,defaultValue:t})});x_.displayName=b_;function S_(e){return e===``||e===void 0}function C_(e){let t=Rr(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function w_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=T_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function T_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var E_=Eg,D_=Og,O_=Ag,k_=Mg,A_=Pg,j_=Ig,M_=Xg,N_=n_,P_=o_,F_=c_,I_=u_,L_=f_,R_=m_,z_=__,B_=E_,V_=O_,H_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(D_,{ref:r,className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,V.jsx)(k_,{asChild:!0,children:(0,V.jsx)(Da,{className:`h-4 w-4 text-slate-400`})})]}));H_.displayName=D_.displayName;var U_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(L_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(ka,{className:`h-4 w-4`})}));U_.displayName=L_.displayName;var W_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(R_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(Da,{className:`h-4 w-4`})}));W_.displayName=R_.displayName;var G_=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(A_,{children:(0,V.jsxs)(j_,{ref:i,className:W(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,V.jsx)(U_,{}),(0,V.jsx)(M_,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,V.jsx)(W_,{})]})}));G_.displayName=j_.displayName;var zee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(N_,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));zee.displayName=N_.displayName;var K_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(P_,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(I_,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),(0,V.jsx)(F_,{children:t})]}));K_.displayName=P_.displayName;var Bee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(z_,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));Bee.displayName=z_.displayName;var q_=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function J_({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=q_(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>q_(e.label)===r)||i.find(e=>q_(e.label).startsWith(r))||i.find(e=>q_(e.label).includes(r)||r.includes(q_(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}function Y_(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null;return i(!1),(async()=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch{i(!0)}})(),()=>{r=!0,a&&a.getTracks().forEach(e=>e.stop())}},[e,t]),{videoRef:n,hasError:r}}var X_=`__auto__`,Z_=`__default__`,Vee=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],Hee=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],Q_=({cameras:e,onCamerasChange:t,releaseStreamsRef:n})=>{let{toast:r}=_r(),{cameras:i,isLoading:a,refresh:o}=J_(),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(i.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=i.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[i]);let d=()=>{if(!s||!l.trim()){r({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(s),a=i.find(e=>e.index===n);if(!a){r({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===a.index||a.deviceId&&e.device_id===a.deviceId)){r({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:l.trim(),type:`opencv`,camera_index:a.index,device_id:a.deviceId,width:640,height:480,fps:30};t([...e,o]),c(``),u(``),r({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},f=n=>{t(e.filter(e=>e.id!==n)),r({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},p=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[m,h]=(0,_.useState)(!1),g=(0,_.useCallback)(()=>{h(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=g)},[n,g]),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Camera Configuration`}),(0,V.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,V.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>o(),disabled:a,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,V.jsx)(Qa,{className:`w-3.5 h-3.5 ${a?`animate-spin`:``}`})})]}),(0,V.jsxs)(B_,{value:s,onValueChange:c,disabled:a,children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,V.jsx)(V_,{placeholder:a?`Loading cameras...`:`Select camera`})}),(0,V.jsx)(G_,{className:`bg-gray-800 border-gray-700`,children:i.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,V.jsx)(K_,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,V.jsx)(Sh,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,V.jsxs)(G,{onClick:d,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!s||!l.trim(),children:[(0,V.jsx)(Za,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,V.jsx)(Uee,{camera:e,paused:m,onRemove:()=>f(e.id),onUpdate:t=>p(e.id,t)},e.id))})]}),e.length===0&&(0,V.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,V.jsx)(Ta,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,V.jsx)(`p`,{children:`No cameras configured. Add a camera to get started.`})]})]})},Uee=({camera:e,paused:t,onRemove:n,onUpdate:r})=>{let{videoRef:i,hasError:a}=Y_(e.device_id,t);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!a?(0,V.jsx)(`video`,{ref:i,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,V.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),(0,V.jsx)(G,{onClick:n,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,V.jsx)(mo,{className:`w-4 h-4`})})]}),(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,V.jsxs)(og,{className:`pt-2 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(Ch,{value:e.width,onChange:e=>{e!==void 0&&r({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,V.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,V.jsx)(Ch,{value:e.height,onChange:e=>{e!==void 0&&r({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,V.jsx)(Ch,{value:e.fps??30,onChange:e=>{e!==void 0&&r({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,V.jsxs)(B_,{value:e.fourcc??X_,onValueChange:e=>r({fourcc:e===X_?void 0:e}),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(K_,{value:X_,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),Vee.map(e=>(0,V.jsx)(K_,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,V.jsxs)(B_,{value:e.backend??Z_,onValueChange:e=>r({backend:e===Z_?void 0:e}),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(K_,{value:Z_,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),Hee.map(e=>(0,V.jsx)(K_,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,V.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},Wee=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Vs(),b=!!n&&n.is_clean;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,V.jsx)(Sh,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,V.jsx)(`code`,{children:`.`}),` `,(0,V.jsx)(`code`,{children:`_`}),` `,(0,V.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,V.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,V.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,V.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,V.jsx)(Sh,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,V.jsx)(Ch,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,V.jsx)(Ch,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,V.jsx)(Ch,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(Q_,{cameras:h,onCamerasChange:g,releaseStreamsRef:v})}),(0,V.jsxs)(ig,{className:`space-y-4 group`,children:[(0,V.jsxs)(ag,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,V.jsx)(`span`,{children:`Advanced Parameters`}),(0,V.jsx)(Da,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,V.jsx)(og,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(Kh,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(kh,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsx)(G,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Gee=/^[\w.\-]+\/[\w.\-]+$/,Kee=/^[A-Za-z0-9._-]+$/,qee=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=Gee.test(u),p=Kee.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,V.jsxs)(vh,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,V.jsxs)(Om,{open:o,onOpenChange:s,children:[(0,V.jsx)(km,{asChild:!0,children:a}),(0,V.jsx)(Am,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,V.jsxs)(ph,{className:`bg-gray-800`,children:[(0,V.jsx)(mh,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,V.jsxs)(hh,{children:[e.length===0&&!m&&!h&&(0,V.jsx)(gh,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,V.jsx)(_h,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,V.jsx)(_h,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,V.jsx)(_h,{heading:`Custom repo`,children:(0,V.jsxs)(vh,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ha,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),v]})]})})]})},Jee=(e,t)=>{let{wsBaseUrl:n}=Rs(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},$_=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function ev(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new $_(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function tv(e,t,n=10,r){return(await ev(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function nv(e,t,n,r){return ev(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function rv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function iv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function av(e,t,n,r){return(await ev(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function ov(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await ev(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof $_&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function sv(e,t,n,r){return ev(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function cv(e,t,n){return ev(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function lv(e,t,n){await ev(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var uv={authenticated:!1,username:null,flavors:[]};async function dv(e,t,n){try{return await ev(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof $_)return uv;throw e}}var fv={authenticated:!1,jobs:[],models:[]};async function pv(e,t,n){try{return await ev(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof $_)return fv;throw e}}var mv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));mv.displayName=`Card`;var hv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex flex-col space-y-1.5 p-6`,e),...t}));hv.displayName=`CardHeader`;var gv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h3`,{ref:n,className:W(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));gv.displayName=`CardTitle`;var _v=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`p`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));_v.displayName=`CardDescription`;var vv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`p-6 pt-0`,e),...t}));vv.displayName=`CardContent`;var yv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex items-center p-6 pt-0`,e),...t}));yv.displayName=`CardFooter`;async function bv(e,t,n,r){return(await ev(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function xv(e,t,n,r,i){return ev(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var Sv=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,V.jsxs)(B_,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,V.jsx)(H_,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(V_,{placeholder:i})}),(0,V.jsx)(G_,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,V.jsx)(K_,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function Cv(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var wv={running:{label:`Running`,color:`text-green-400`,Icon:qa},done:{label:`Done`,color:`text-slate-400`,Icon:Na},failed:{label:`Failed`,color:`text-red-400`,Icon:Fa},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:co}},Tv=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=Re(),{baseUrl:a,fetchWithHeaders:o}=Rs(),s=wv[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${Cv(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${Cv(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return bv(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,V.jsx)(mv,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,V.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,V.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})}):(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,V.jsx)(ao,{className:`w-3.5 h-3.5`}):(0,V.jsx)(mo,{className:`w-3.5 h-3.5`})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,V.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,V.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sv,{checkpoints:g,selectedStep:y,onChange:b}),(0,V.jsx)(G,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,V.jsx)(Xa,{className:`w-4 h-4`})})]}):null]})})};function Ev(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Dv={RUNNING:{label:`Running`,color:`text-green-400`,Icon:qa,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:La},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:La},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:Na},FAILED:{label:`Failed`,color:`text-red-400`,Icon:Fa},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:co},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:co}},Ov=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=Dv[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:Pa},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,V.jsx)(mv,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,V.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,Ev(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,V.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function kv(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Av=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,V.jsx)(mv,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(vv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,V.jsx)(lo,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,V.jsx)(Ja,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,V.jsx)(`span`,{className:`truncate`,children:n})]}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,kv(e.last_modified)]})]})]})})};async function jv(e,t,n){return ev(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function Mv(e,t){return ev(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Nv(e,t,n){return ev(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var Pv=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=Y_(e,t);return t||r||!e?(0,V.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},Fv=30,Iv=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=Rs(),{toast:s}=_r(),c=Re(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=J_({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return bv(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),xv(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:Fv})}try{await jv(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(Xa,{className:`w-4 h-4 text-white`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,V.jsxs)(cg,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`No checkpoints available for this job yet.`})]}):(0,V.jsx)(Sv,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,V.jsx)(Sh,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,V.jsx)(Ch,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,V.jsxs)(cg,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(kh,{className:`text-sm font-medium text-gray-200`,children:e}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,V.jsxs)(B_,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,V.jsx)(H_,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,V.jsx)(V_,{placeholder:`Select a camera`})}),(0,V.jsx)(G_,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,V.jsxs)(K_,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,V.jsx)(Pv,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsxs)(G,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Lv=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=Rs(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,V.jsx)(Ou,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,V.jsx)(Sh,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,V.jsx)(Sh,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,V.jsxs)(cg,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:d})]}):null,(0,V.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,V.jsxs)(G,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await sv(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}):(0,V.jsx)(Ba,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Rv=`lelab.selectedRobot`,zv=()=>{try{let e=localStorage.getItem(Rv);return e&&typeof e==`string`?e:null}catch{return null}},Bv=e=>{try{e?localStorage.setItem(Rv,e):localStorage.removeItem(Rv)}catch{}},Vv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),r=Ie(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>zv()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{Bv(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Hv=10,Uv=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Wv=e=>e.state===`running`||e.checkpoint_count>0,Gv=e=>Uv.has((e.status?.stage??``).toUpperCase()),Kv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Vv(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([tv(e,t,Hv),pv(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),Jee(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await cv(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await lv(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),I=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),ee=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),te=(0,_.useMemo)(()=>M.filter(e=>!ee.has(e.id)),[M,ee]),ne=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),re=(0,_.useMemo)(()=>N.filter(e=>!ne.has(e.repo_id)),[N,ne]),ie=(0,_.useMemo)(()=>P.filter(Wv),[P]),ae=(0,_.useMemo)(()=>P.filter(e=>!Wv(e)),[P]),oe=(0,_.useMemo)(()=>F.filter(Wv),[F]),se=(0,_.useMemo)(()=>F.filter(e=>!Wv(e)),[F]),ce=(0,_.useMemo)(()=>te.filter(Gv),[te]),le=(0,_.useMemo)(()=>te.filter(e=>!Gv(e)),[te]),ue=ae.length+se.length+le.length;return(0,V.jsxs)(`section`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(eo,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,V.jsx)(Sh,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,V.jsx)(Ba,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})})]})]}),d?(0,V.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ie.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:ie.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ie.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),I.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,I.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:I.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(ig,{defaultOpen:!0,children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,oe.length+ce.length+re.length,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:!l&&F.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):oe.length===0&&ce.length===0&&re.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,V.jsx)(Ov,{job:e},e.id)),re.map(e=>(0,V.jsx)(Av,{model:e},e.repo_id))]})})]}),ue>0?(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,ue,`)`]}),(0,V.jsx)(og,{className:`pt-3`,children:(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[ae.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),se.map(e=>(0,V.jsx)(Tv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,V.jsx)(Ov,{job:e},e.id))]})})]}):null,x?(0,V.jsx)(Iv,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,V.jsx)(Lv,{open:y,onOpenChange:b,onImported:T})]})},qv=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,Jv=`http://localhost:8000/`,Yv=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,V.jsx)(xu,{open:e,onOpenChange:n?t:()=>void 0,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,V.jsxs)(Tu,{className:`text-center sm:text-center min-w-0`,children:[(0,V.jsxs)(Du,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,V.jsx)(oo,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,V.jsx)(Ou,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(qv),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,V.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,V.jsx)(`code`,{className:`text-green-400`,children:qv})}),(0,V.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ea,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ra,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,V.jsx)(G,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,V.jsxs)(`a`,{href:Jv,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})};async function Xv(e,t,n){return ev(e,t,`/datasets`,{signal:n,action:`List datasets`})}var Zv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),Xv(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},Qv=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),$v=Qv(),ey=()=>{let[e,t]=(0,_.useState)($v),{auth:n}=Vs(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Vv(),{datasets:u,loading:d}=Zv(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=Re(),{toast:j}=_r();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,V.jsx)(eee,{}),(0,V.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,V.jsx)(xh,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,V.jsx)(qee,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/upload`,{state:{datasetInfo:{dataset_repo_id:e.repo_id,source:e.source}}});return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,V.jsx)(G,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,V.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,V.jsx)(Kv,{})}),(0,V.jsx)(Mu,{}),(0,V.jsx)(Yv,{open:e,onOpenChange:t,dismissible:!$v}),(0,V.jsx)(Wee,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},ty={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},ny={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},ry=`attached`,iy=1e3,ay=1001,oy=1002,sy=1003,cy=1004,ly=1005,uy=1006,dy=1007,fy=1008,py=1009,my=1010,hy=1011,gy=1012,_y=1013,vy=1014,yy=1015,by=1016,xy=1017,Sy=1018,Cy=1020,wy=35902,Ty=1021,Ey=1022,Dy=1023,Oy=1026,ky=1027,Ay=1028,jy=1029,My=1030,Ny=1031,Py=1033,Fy=33776,Iy=33777,Ly=33778,Ry=33779,zy=35840,By=35841,Vy=35842,Hy=35843,Uy=36196,Wy=37492,Gy=37496,Ky=37808,qy=37809,Jy=37810,Yy=37811,Xy=37812,Zy=37813,Qy=37814,$y=37815,eb=37816,tb=37817,nb=37818,rb=37819,ib=37820,ab=37821,ob=36492,sb=36494,cb=36495,lb=36283,ub=36284,db=36285,fb=36286,pb=2300,mb=2301,hb=2302,gb=2400,_b=2401,vb=2402,yb=2500,bb=3200,xb=3201,Sb=`srgb`,Cb=`srgb-linear`,wb=`linear`,Tb=`srgb`,Eb=7680,Db=35044,Ob=2e3,kb=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Ab[e>>16&255]+Ab[e>>24&255]+`-`+Ab[t&255]+Ab[t>>8&255]+`-`+Ab[t>>16&15|64]+Ab[t>>24&255]+`-`+Ab[n&63|128]+Ab[n>>8&255]+`-`+Ab[n>>16&255]+Ab[n>>24&255]+Ab[r&255]+Ab[r>>8&255]+Ab[r>>16&255]+Ab[r>>24&255]).toLowerCase()}function Fb(e,t,n){return Math.max(t,Math.min(n,e))}function Ib(e,t){return(e%t+t)%t}function Lb(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function Rb(e,t,n){return e===t?0:(n-e)/(t-e)}function zb(e,t,n){return(1-n)*e+n*t}function Bb(e,t,n,r){return zb(e,t,1-Math.exp(-n*r))}function Vb(e,t=1){return t-Math.abs(Ib(e,t*2)-t)}function Hb(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function Ub(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function Wb(e,t){return e+Math.floor(Math.random()*(t-e+1))}function Gb(e,t){return e+Math.random()*(t-e)}function Kb(e){return e*(.5-Math.random())}function qb(e){e!==void 0&&(jb=e);let t=jb+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Jb(e){return e*Mb}function Yb(e){return e*Nb}function Xb(e){return(e&e-1)==0&&e!==0}function Zb(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Qb(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function $b(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function ex(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function tx(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var nx={DEG2RAD:Mb,RAD2DEG:Nb,generateUUID:Pb,clamp:Fb,euclideanModulo:Ib,mapLinear:Lb,inverseLerp:Rb,lerp:zb,damp:Bb,pingpong:Vb,smoothstep:Hb,smootherstep:Ub,randInt:Wb,randFloat:Gb,randFloatSpread:Kb,seededRandom:qb,degToRad:Jb,radToDeg:Yb,isPowerOfTwo:Xb,ceilPowerOfTwo:Zb,floorPowerOfTwo:Qb,setQuaternionFromProperEuler:$b,normalize:tx,denormalize:ex},rx=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Fb(this.x,e.x,t.x),this.y=Fb(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Fb(this.x,e,t),this.y=Fb(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Fb(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Fb(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},ix=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Fb(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},q=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(ox.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(ox.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Fb(this.x,e.x,t.x),this.y=Fb(this.y,e.y,t.y),this.z=Fb(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Fb(this.x,e,t),this.y=Fb(this.y,e,t),this.z=Fb(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Fb(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return ax.copy(this).projectOnVector(e),this.sub(ax)}reflect(e){return this.sub(ax.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Fb(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},ax=new q,ox=new ix,sx=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(cx.makeScale(e,t)),this}rotate(e){return this.premultiply(cx.makeRotation(-e)),this}translate(e,t){return this.premultiply(cx.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},cx=new sx;function lx(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function ux(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function dx(){let e=ux(`canvas`);return e.style.display=`block`,e}var fx={};function px(e){e in fx||(fx[e]=!0,console.warn(e))}function mx(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function hx(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function gx(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var _x=new sx().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),vx=new sx().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function yx(){let e={enabled:!0,workingColorSpace:Cb,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=xx(e.r),e.g=xx(e.g),e.b=xx(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=Sx(e.r),e.g=Sx(e.g),e.b=Sx(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?wb:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return px(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return px(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[Cb]:{primaries:t,whitePoint:r,transfer:wb,toXYZ:_x,fromXYZ:vx,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:Sb},outputColorSpaceConfig:{drawingBufferColorSpace:Sb}},[Sb]:{primaries:t,whitePoint:r,transfer:Tb,toXYZ:_x,fromXYZ:vx,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:Sb}}}),e}var bx=yx();function xx(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function Sx(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var Cx,wx=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{Cx===void 0&&(Cx=ux(`canvas`)),Cx.width=e.width,Cx.height=e.height;let t=Cx.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=Cx}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=ux(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(kx).x}get height(){return this.source.getSize(kx).y}get depth(){return this.source.getSize(kx).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case iy:e.x-=Math.floor(e.x);break;case ay:e.x=e.x<0?0:1;break;case oy:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case iy:e.y-=Math.floor(e.y);break;case ay:e.y=e.y<0?0:1;break;case oy:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};Ax.DEFAULT_IMAGE=null,Ax.DEFAULT_MAPPING=300,Ax.DEFAULT_ANISOTROPY=1;var jx=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,Rx),Rx.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Kx),qx.subVectors(this.max,Kx),Bx.subVectors(e.a,Kx),Vx.subVectors(e.b,Kx),Hx.subVectors(e.c,Kx),Ux.subVectors(Vx,Bx),Wx.subVectors(Hx,Vx),Gx.subVectors(Bx,Hx);let t=[0,-Ux.z,Ux.y,0,-Wx.z,Wx.y,0,-Gx.z,Gx.y,Ux.z,0,-Ux.x,Wx.z,0,-Wx.x,Gx.z,0,-Gx.x,-Ux.y,Ux.x,0,-Wx.y,Wx.x,0,-Gx.y,Gx.x,0];return!Xx(t,Bx,Vx,Hx,qx)||(t=[1,0,0,0,1,0,0,0,1],!Xx(t,Bx,Vx,Hx,qx))?!1:(Jx.crossVectors(Ux,Wx),t=[Jx.x,Jx.y,Jx.z],Xx(t,Bx,Vx,Hx,qx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,Rx).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(Rx).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Lx[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Lx[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Lx[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Lx[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Lx[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Lx[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Lx[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Lx[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Lx),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Lx=[new q,new q,new q,new q,new q,new q,new q,new q],Rx=new q,zx=new Ix,Bx=new q,Vx=new q,Hx=new q,Ux=new q,Wx=new q,Gx=new q,Kx=new q,qx=new q,Jx=new q,Yx=new q;function Xx(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Yx.fromArray(e,a);let o=i.x*Math.abs(Yx.x)+i.y*Math.abs(Yx.y)+i.z*Math.abs(Yx.z),s=t.dot(Yx),c=n.dot(Yx),l=r.dot(Yx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Zx=new Ix,Qx=new q,$x=new q,eS=class{constructor(e=new q,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Zx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Qx.subVectors(e,this.center);let t=Qx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Qx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):($x.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Qx.copy(e.center).add($x)),this.expandByPoint(Qx.copy(e.center).sub($x))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},tS=new q,nS=new q,rS=new q,iS=new q,aS=new q,oS=new q,sS=new q,cS=class{constructor(e=new q,t=new q(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,tS)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=tS.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(tS.copy(this.origin).addScaledVector(this.direction,t),tS.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){nS.copy(e).add(t).multiplyScalar(.5),rS.copy(t).sub(e).normalize(),iS.copy(this.origin).sub(nS);let i=e.distanceTo(t)*.5,a=-this.direction.dot(rS),o=iS.dot(this.direction),s=-iS.dot(rS),c=iS.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(nS).addScaledVector(rS,d),f}intersectSphere(e,t){tS.subVectors(e.center,this.origin);let n=tS.dot(this.direction),r=tS.dot(tS)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,tS)!==null}intersectTriangle(e,t,n,r,i){aS.subVectors(t,e),oS.subVectors(n,e),sS.crossVectors(aS,oS);let a=this.direction.dot(sS),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;iS.subVectors(this.origin,e);let s=o*this.direction.dot(oS.crossVectors(iS,oS));if(s<0)return null;let c=o*this.direction.dot(aS.cross(iS));if(c<0||s+c>a)return null;let l=-o*iS.dot(sS);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},J=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/lS.setFromMatrixColumn(e,0).length(),i=1/lS.setFromMatrixColumn(e,1).length(),a=1/lS.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(dS,e,fS)}lookAt(e,t,n){let r=this.elements;return hS.subVectors(e,t),hS.lengthSq()===0&&(hS.z=1),hS.normalize(),pS.crossVectors(n,hS),pS.lengthSq()===0&&(Math.abs(n.z)===1?hS.x+=1e-4:hS.z+=1e-4,hS.normalize(),pS.crossVectors(n,hS)),pS.normalize(),mS.crossVectors(hS,pS),r[0]=pS.x,r[4]=mS.x,r[8]=hS.x,r[1]=pS.y,r[5]=mS.y,r[9]=hS.y,r[2]=pS.z,r[6]=mS.z,r[10]=hS.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=lS.set(r[0],r[1],r[2]).length(),a=lS.set(r[4],r[5],r[6]).length(),o=lS.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],uS.copy(this);let s=1/i,c=1/a,l=1/o;return uS.elements[0]*=s,uS.elements[1]*=s,uS.elements[2]*=s,uS.elements[4]*=c,uS.elements[5]*=c,uS.elements[6]*=c,uS.elements[8]*=l,uS.elements[9]*=l,uS.elements[10]*=l,t.setFromRotationMatrix(uS),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=Ob){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=Ob){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},lS=new q,uS=new J,dS=new q(0,0,0),fS=new q(1,1,1),pS=new q,mS=new q,hS=new q,gS=new J,_S=new ix,vS=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(Fb(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-Fb(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(Fb(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-Fb(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(Fb(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-Fb(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return gS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(gS,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return _S.setFromEuler(this),this.setFromQuaternion(_S,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};vS.DEFAULT_ORDER=`XYZ`;var yS=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){IS.subVectors(r,t),LS.subVectors(n,t),RS.subVectors(e,t);let a=IS.dot(IS),o=IS.dot(LS),s=IS.dot(RS),c=LS.dot(LS),l=LS.dot(RS),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,zS)===null?!1:zS.x>=0&&zS.y>=0&&zS.x+zS.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,zS)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,zS.x),s.addScaledVector(a,zS.y),s.addScaledVector(o,zS.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return KS.setScalar(0),qS.setScalar(0),JS.setScalar(0),KS.fromBufferAttribute(e,t),qS.fromBufferAttribute(e,n),JS.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(KS,i.x),a.addScaledVector(qS,i.y),a.addScaledVector(JS,i.z),a}static isFrontFacing(e,t,n,r){return IS.subVectors(n,t),LS.subVectors(e,t),IS.cross(LS).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return IS.subVectors(this.c,this.b),LS.subVectors(this.a,this.b),IS.cross(LS).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;BS.subVectors(r,n),VS.subVectors(i,n),US.subVectors(e,n);let s=BS.dot(US),c=VS.dot(US);if(s<=0&&c<=0)return t.copy(n);WS.subVectors(e,r);let l=BS.dot(WS),u=VS.dot(WS);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(BS,a);GS.subVectors(e,i);let f=BS.dot(GS),p=VS.dot(GS);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(VS,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return HS.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(HS,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(BS,a).addScaledVector(VS,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},XS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},ZS={h:0,s:0,l:0},QS={h:0,s:0,l:0};function $S(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var Y=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=Sb){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,bx.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=bx.workingColorSpace){return this.r=e,this.g=t,this.b=n,bx.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=bx.workingColorSpace){if(e=Ib(e,1),t=Fb(t,0,1),n=Fb(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=$S(i,r,e+1/3),this.g=$S(i,r,e),this.b=$S(i,r,e-1/3)}return bx.colorSpaceToWorking(this,r),this}setStyle(e,t=Sb){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=Sb){let n=XS[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=xx(e.r),this.g=xx(e.g),this.b=xx(e.b),this}copyLinearToSRGB(e){return this.r=Sx(e.r),this.g=Sx(e.g),this.b=Sx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=Sb){return bx.workingToColorSpace(eC.copy(this),e),Math.round(Fb(eC.r*255,0,255))*65536+Math.round(Fb(eC.g*255,0,255))*256+Math.round(Fb(eC.b*255,0,255))}getHexString(e=Sb){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=bx.workingColorSpace){bx.workingToColorSpace(eC.copy(this),t);let n=eC.r,r=eC.g,i=eC.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},rC=class extends nC{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},iC=new q,aC=new rx,oC=0,sC=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:oC++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=Db,this.updateRanges=[],this.gpuType=yy,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Ix);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new q(-1/0,-1/0,-1/0),new q(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(yC.copy(i).invert(),bC.copy(e.ray).applyMatrix4(yC),!(n.boundingBox!==null&&bC.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,bC)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:kC.clone(),object:e}}function MC(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,CC),e.getVertexPosition(c,wC),e.getVertexPosition(l,TC);let u=jC(e,t,n,r,CC,wC,TC,OC);if(u){let e=new q;YS.getBarycoord(OC,CC,wC,TC,e),i&&(u.uv=YS.getInterpolatedAttribute(i,s,c,l,e,new rx)),a&&(u.uv1=YS.getInterpolatedAttribute(a,s,c,l,e,new rx)),o&&(u.normal=YS.getInterpolatedAttribute(o,s,c,l,e,new q),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new q,materialIndex:0};YS.getNormal(CC,wC,TC,t.normal),u.face=t,u.barycoord=e}return u}var NC=class e extends vC{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new uC(c,3)),this.setAttribute(`normal`,new uC(l,3)),this.setAttribute(`uv`,new uC(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new q;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},HC=class extends FS{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new J,this.projectionMatrix=new J,this.projectionMatrixInverse=new J,this.coordinateSystem=Ob}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},UC=new q,WC=new rx,GC=new rx,KC=class extends HC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Nb*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Mb*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Nb*2*Math.atan(Math.tan(Mb*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){UC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(UC.x,UC.y).multiplyScalar(-e/UC.z),UC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(UC.x,UC.y).multiplyScalar(-e/UC.z)}getViewSize(e,t){return this.getViewBounds(e,WC,GC),t.subVectors(GC,WC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Mb*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},qC=-90,JC=1,YC=class extends FS{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new KC(qC,JC,e,t);r.layers=this.layers,this.add(r);let i=new KC(qC,JC,e,t);i.layers=this.layers,this.add(i);let a=new KC(qC,JC,e,t);a.layers=this.layers,this.add(a);let o=new KC(qC,JC,e,t);o.layers=this.layers,this.add(o);let s=new KC(qC,JC,e,t);s.layers=this.layers,this.add(s);let c=new KC(qC,JC,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},XC=class extends Ax{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},ZC=class extends Nx{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new XC(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` + + varying vec3 vWorldDirection; + + vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); + + } + + void main() { + + vWorldDirection = transformDirection( position, modelMatrix ); + + #include + #include + + } + `,fragmentShader:` + + uniform sampler2D tEquirect; + + varying vec3 vWorldDirection; + + #include + + void main() { + + vec3 direction = normalize( vWorldDirection ); + + vec2 sampleUV = equirectUv( direction ); + + gl_FragColor = texture2D( tEquirect, sampleUV ); + + } + `},r=new NC(5,5,5),i=new VC({name:`CubemapFromEquirect`,uniforms:PC(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new AC(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=uy),new YC(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},QC=class extends FS{constructor(){super(),this.isGroup=!0,this.type=`Group`}},$C={type:`move`},ew=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new QC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new QC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new q,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new q),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new QC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new q,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new q),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent($C)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new QC;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},tw=class extends FS{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new vS,this.environmentIntensity=1,this.environmentRotation=new vS,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},nw=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=Db,this.updateRanges=[],this.version=0,this.uuid=Pb()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||$ee.getNormalMatrix(e),r=this.coplanarPoint(Ew).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},Ow=new eS,kw=new q,Aw=class{constructor(e=new Dw,t=new Dw,n=new Dw,r=new Dw,i=new Dw,a=new Dw){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=Ob){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),Ow.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),Ow.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(Ow)}intersectsSprite(e){return Ow.center.set(0,0,0),Ow.radius=.7071067811865476,Ow.applyMatrix4(e.matrixWorld),this.intersectsSphere(Ow)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,kw.y=r.normal.y>0?e.max.y:e.min.y,kw.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(kw)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},jw=class extends nC{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new Y(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Mw=new q,Nw=new q,Pw=new J,Fw=new cS,Iw=new eS,Lw=new q,Rw=new q,zw=class extends FS{constructor(e=new vC,t=new jw){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Lw.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Lw);if(!(ct.far))return{distance:c,point:Rw.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Vw=new q,Hw=new q,Uw=class extends zw{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Zw=class extends Ax{constructor(e,t,n=vy,r,i,a,o=sy,s=sy,c,l=Oy,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new Ex(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},tte=class e extends vC{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new uC(u,3)),this.setAttribute(`normal`,new uC(d,3)),this.setAttribute(`uv`,new uC(f,2));function _(){let a=new q,_=new q,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new rx,m=new q,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},tT=class extends nC{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new Y(16777215),this.specular=new Y(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new rx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},ite=class extends nC{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new Y(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new Y(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new rx(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new vS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},ate=class extends nC{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=bb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},ote=class extends nC{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function nT(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function ste(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function cte(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function rT(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function iT(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var aT=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&ste(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===hb,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};lT.prototype.ValueTypeName=``,lT.prototype.TimeBufferType=Float32Array,lT.prototype.ValueBufferType=Float32Array,lT.prototype.DefaultInterpolation=mb;var uT=class extends lT{constructor(e,t,n){super(e,t,n)}};uT.prototype.ValueTypeName=`bool`,uT.prototype.ValueBufferType=Array,uT.prototype.DefaultInterpolation=pb,uT.prototype.InterpolantFactoryMethodLinear=void 0,uT.prototype.InterpolantFactoryMethodSmooth=void 0;var dT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};dT.prototype.ValueTypeName=`color`;var fT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};fT.prototype.ValueTypeName=`number`;var pT=class extends aT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)ix.slerpFlat(i,0,a,c-o,a,c,s);return i}},mT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new pT(this.times,this.values,this.getValueSize(),e)}};mT.prototype.ValueTypeName=`quaternion`,mT.prototype.InterpolantFactoryMethodSmooth=void 0;var hT=class extends lT{constructor(e,t,n){super(e,t,n)}};hT.prototype.ValueTypeName=`string`,hT.prototype.ValueBufferType=Array,hT.prototype.DefaultInterpolation=pb,hT.prototype.InterpolantFactoryMethodLinear=void 0,hT.prototype.InterpolantFactoryMethodSmooth=void 0;var gT=class extends lT{constructor(e,t,n,r){super(e,t,n,r)}};gT.prototype.ValueTypeName=`vector`;var _T=class{constructor(e=``,t=-1,n=[],r=yb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Pb(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(yT(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(lT.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];iT(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(wT[e]!==void 0){wT[e].push({onLoad:t,onProgress:n,onError:r});return}wT[e]=[],wT[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=wT[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new TT(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{bT.add(e,t);let n=wT[e];delete wT[e];for(let e=0,r=n.length;e{let n=wT[e];if(n===void 0)throw this.manager.itemError(e),t;delete wT[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},DT=class extends CT{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=bT.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=ux(`img`);function s(){l(),bT.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},OT=class extends CT{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new gw,o=new ET(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?ay:n.wrapS,a.wrapT=n.wrapT===void 0?ay:n.wrapT,a.magFilter=n.magFilter===void 0?uy:n.magFilter,a.minFilter=n.minFilter===void 0?uy:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=fy),n.mipmapCount===1&&(a.minFilter=uy),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},kT=class extends CT{constructor(e){super(e)}load(e,t,n,r){let i=new Ax,a=new DT(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},AT=class extends FS{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new Y(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},jT=class extends AT{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.groundColor=new Y(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},MT=new J,NT=new q,PT=new q,FT=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new rx(512,512),this.mapType=py,this.map=null,this.mapPass=null,this.matrix=new J,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new Aw,this._frameExtents=new rx(1,1),this._viewportCount=1,this._viewports=[new jx(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;NT.setFromMatrixPosition(e.matrixWorld),t.position.copy(NT),PT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(PT),t.updateMatrixWorld(),MT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(MT),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(MT)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},IT=class extends FT{constructor(){super(new KC(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Nb*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},LT=class extends AT{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.target=new FS,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new IT}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},RT=new J,zT=new q,BT=new q,VT=class extends FT{constructor(){super(new KC(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new rx(4,2),this._viewportCount=6,this._viewports=[new jx(2,1,1,1),new jx(0,1,1,1),new jx(3,1,1,1),new jx(1,1,1,1),new jx(3,0,1,1),new jx(1,0,1,1)],this._cubeDirections=[new q(1,0,0),new q(-1,0,0),new q(0,0,1),new q(0,0,-1),new q(0,1,0),new q(0,-1,0)],this._cubeUps=[new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,1,0),new q(0,0,1),new q(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),zT.setFromMatrixPosition(e.matrixWorld),n.position.copy(zT),BT.copy(n.position),BT.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(BT),n.updateMatrixWorld(),r.makeTranslation(-zT.x,-zT.y,-zT.z),RT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(RT)}},HT=class extends AT{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new VT}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},UT=class extends HC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},WT=class extends FT{constructor(){super(new UT(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},GT=class extends AT{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(FS.DEFAULT_UP),this.updateMatrix(),this.target=new FS,this.shadow=new WT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},KT=class extends AT{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},qT=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},JT=new WeakMap,YT=class extends CT{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=bT.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(JT.has(a)===!0)r&&r(JT.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return bT.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),JT.set(s,t),bT.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});bT.add(e,s),i.manager.itemStart(e)}},XT=class extends KC{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},ZT=`\\[\\]\\.:\\/`,QT=RegExp(`[\\[\\]\\.:\\/]`,`g`),$T=`[^\\[\\]\\.:\\/]`,eE=`[^`+ZT.replace(`\\.`,``)+`]`,tE=`((?:WC+[\\/:])*)`.replace(`WC`,$T),nE=`(WCOD+)?`.replace(`WCOD`,eE),rE=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,$T),iE=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,$T),aE=RegExp(`^`+tE+nE+rE+iE+`$`),oE=[`material`,`materials`,`bones`,`map`],sE=class{constructor(e,t,n){let r=n||cE.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},cE=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(QT,``)}static parseTrackName(e){let t=aE.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);oE.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e 0 + vec4 plane; + #ifdef ALPHA_TO_COVERAGE + float distanceToPlane, distanceGradient; + float clipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + if ( clipOpacity == 0.0 ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + float unionClipOpacity = 1.0; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; + distanceGradient = fwidth( distanceToPlane ) / 2.0; + unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); + } + #pragma unroll_loop_end + clipOpacity *= 1.0 - unionClipOpacity; + #endif + diffuseColor.a *= clipOpacity; + if ( diffuseColor.a == 0.0 ) discard; + #else + #pragma unroll_loop_start + for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; + } + #pragma unroll_loop_end + #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES + bool clipped = true; + #pragma unroll_loop_start + for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { + plane = clippingPlanes[ i ]; + clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; + } + #pragma unroll_loop_end + if ( clipped ) discard; + #endif + #endif +#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; + uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; +#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 + varying vec3 vClipPosition; +#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 + vClipPosition = - mvPosition.xyz; +#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) + diffuseColor *= vColor; +#elif defined( USE_COLOR ) + diffuseColor.rgb *= vColor; +#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) + varying vec3 vColor; +#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) + varying vec4 vColor; +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + varying vec3 vColor; +#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) + vColor = vec4( 1.0 ); +#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) + vColor = vec3( 1.0 ); +#endif +#ifdef USE_COLOR + vColor *= color; +#endif +#ifdef USE_INSTANCING_COLOR + vColor.xyz *= instanceColor.xyz; +#endif +#ifdef USE_BATCHING_COLOR + vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); + vColor.xyz *= batchingColor.xyz; +#endif`,common:`#define PI 3.141592653589793 +#define PI2 6.283185307179586 +#define PI_HALF 1.5707963267948966 +#define RECIPROCAL_PI 0.3183098861837907 +#define RECIPROCAL_PI2 0.15915494309189535 +#define EPSILON 1e-6 +#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +#define whiteComplement( a ) ( 1.0 - saturate( a ) ) +float pow2( const in float x ) { return x*x; } +vec3 pow2( const in vec3 x ) { return x*x; } +float pow3( const in float x ) { return x*x*x; } +float pow4( const in float x ) { float x2 = x*x; return x2*x2; } +float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } +float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } +highp float rand( const in vec2 uv ) { + const highp float a = 12.9898, b = 78.233, c = 43758.5453; + highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); + return fract( sin( sn ) * c ); +} +#ifdef HIGH_PRECISION + float precisionSafeLength( vec3 v ) { return length( v ); } +#else + float precisionSafeLength( vec3 v ) { + float maxComponent = max3( abs( v ) ); + return length( v / maxComponent ) * maxComponent; + } +#endif +struct IncidentLight { + vec3 color; + vec3 direction; + bool visible; +}; +struct ReflectedLight { + vec3 directDiffuse; + vec3 directSpecular; + vec3 indirectDiffuse; + vec3 indirectSpecular; +}; +#ifdef USE_ALPHAHASH + varying vec3 vPosition; +#endif +vec3 transformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); +} +vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { + return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); +} +mat3 transposeMat3( const in mat3 m ) { + mat3 tmp; + tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); + tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); + tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); + return tmp; +} +bool isPerspectiveMatrix( mat4 m ) { + return m[ 2 ][ 3 ] == - 1.0; +} +vec2 equirectUv( in vec3 dir ) { + float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; + float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; + return vec2( u, v ); +} +vec3 BRDF_Lambert( const in vec3 diffuseColor ) { + return RECIPROCAL_PI * diffuseColor; +} +vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} +float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { + float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); + return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); +} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV + #define cubeUV_minMipLevel 4.0 + #define cubeUV_minTileSize 16.0 + float getFace( vec3 direction ) { + vec3 absDirection = abs( direction ); + float face = - 1.0; + if ( absDirection.x > absDirection.z ) { + if ( absDirection.x > absDirection.y ) + face = direction.x > 0.0 ? 0.0 : 3.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } else { + if ( absDirection.z > absDirection.y ) + face = direction.z > 0.0 ? 2.0 : 5.0; + else + face = direction.y > 0.0 ? 1.0 : 4.0; + } + return face; + } + vec2 getUV( vec3 direction, float face ) { + vec2 uv; + if ( face == 0.0 ) { + uv = vec2( direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 1.0 ) { + uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); + } else if ( face == 2.0 ) { + uv = vec2( - direction.x, direction.y ) / abs( direction.z ); + } else if ( face == 3.0 ) { + uv = vec2( - direction.z, direction.y ) / abs( direction.x ); + } else if ( face == 4.0 ) { + uv = vec2( - direction.x, direction.z ) / abs( direction.y ); + } else { + uv = vec2( direction.x, direction.y ) / abs( direction.z ); + } + return 0.5 * ( uv + 1.0 ); + } + vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { + float face = getFace( direction ); + float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); + mipInt = max( mipInt, cubeUV_minMipLevel ); + float faceSize = exp2( mipInt ); + highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; + if ( face > 2.0 ) { + uv.y += faceSize; + face -= 3.0; + } + uv.x += face * faceSize; + uv.x += filterInt * 3.0 * cubeUV_minTileSize; + uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); + uv.x *= CUBEUV_TEXEL_WIDTH; + uv.y *= CUBEUV_TEXEL_HEIGHT; + #ifdef texture2DGradEXT + return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; + #else + return texture2D( envMap, uv ).rgb; + #endif + } + #define cubeUV_r0 1.0 + #define cubeUV_m0 - 2.0 + #define cubeUV_r1 0.8 + #define cubeUV_m1 - 1.0 + #define cubeUV_r4 0.4 + #define cubeUV_m4 2.0 + #define cubeUV_r5 0.305 + #define cubeUV_m5 3.0 + #define cubeUV_r6 0.21 + #define cubeUV_m6 4.0 + float roughnessToMip( float roughness ) { + float mip = 0.0; + if ( roughness >= cubeUV_r1 ) { + mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; + } else if ( roughness >= cubeUV_r4 ) { + mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; + } else if ( roughness >= cubeUV_r5 ) { + mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; + } else if ( roughness >= cubeUV_r6 ) { + mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; + } else { + mip = - 2.0 * log2( 1.16 * roughness ); } + return mip; + } + vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { + float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); + float mipF = fract( mip ); + float mipInt = floor( mip ); + vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); + if ( mipF == 0.0 ) { + return vec4( color0, 1.0 ); + } else { + vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); + return vec4( mix( color0, color1, mipF ), 1.0 ); + } + } +#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; +#ifdef USE_TANGENT + vec3 transformedTangent = objectTangent; +#endif +#ifdef USE_BATCHING + mat3 bm = mat3( batchingMatrix ); + transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); + transformedNormal = bm * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = bm * transformedTangent; + #endif +#endif +#ifdef USE_INSTANCING + mat3 im = mat3( instanceMatrix ); + transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); + transformedNormal = im * transformedNormal; + #ifdef USE_TANGENT + transformedTangent = im * transformedTangent; + #endif +#endif +transformedNormal = normalMatrix * transformedNormal; +#ifdef FLIP_SIDED + transformedNormal = - transformedNormal; +#endif +#ifdef USE_TANGENT + transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; + #ifdef FLIP_SIDED + transformedTangent = - transformedTangent; + #endif +#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP + uniform sampler2D displacementMap; + uniform float displacementScale; + uniform float displacementBias; +#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP + transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); +#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP + vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); + #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE + emissiveColor = sRGBTransferEOTF( emissiveColor ); + #endif + totalEmissiveRadiance *= emissiveColor.rgb; +#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP + uniform sampler2D emissiveMap; +#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { + return value; +} +vec4 sRGBTransferEOTF( in vec4 value ) { + return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); +} +vec4 sRGBTransferOETF( in vec4 value ) { + return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); +}`,envmap_fragment:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vec3 cameraToFrag; + if ( isOrthographic ) { + cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToFrag = normalize( vWorldPosition - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vec3 reflectVec = reflect( cameraToFrag, worldNormal ); + #else + vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); + #endif + #else + vec3 reflectVec = vReflect; + #endif + #ifdef ENVMAP_TYPE_CUBE + vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); + #else + vec4 envColor = vec4( 0.0 ); + #endif + #ifdef ENVMAP_BLENDING_MULTIPLY + outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_MIX ) + outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); + #elif defined( ENVMAP_BLENDING_ADD ) + outgoingLight += envColor.xyz * specularStrength * reflectivity; + #endif +#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP + uniform float envMapIntensity; + uniform float flipEnvMap; + uniform mat3 envMapRotation; + #ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; + #else + uniform sampler2D envMap; + #endif + +#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP + uniform float reflectivity; + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + varying vec3 vWorldPosition; + uniform float refractionRatio; + #else + varying vec3 vReflect; + #endif +#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP + #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) + #define ENV_WORLDPOS + #endif + #ifdef ENV_WORLDPOS + + varying vec3 vWorldPosition; + #else + varying vec3 vReflect; + uniform float refractionRatio; + #endif +#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP + vec3 getIBLIrradiance( const in vec3 normal ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); + return PI * envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 reflectVec = reflect( - viewDir, normal ); + reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); + reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); + vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); + return envMapColor.rgb * envMapIntensity; + #else + return vec3( 0.0 ); + #endif + } + #ifdef USE_ANISOTROPY + vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { + #ifdef ENVMAP_TYPE_CUBE_UV + vec3 bentNormal = cross( bitangent, viewDir ); + bentNormal = normalize( cross( bentNormal, bitangent ) ); + bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); + return getIBLRadiance( viewDir, bentNormal, roughness ); + #else + return vec3( 0.0 ); + #endif + } + #endif +#endif`,envmap_vertex:`#ifdef USE_ENVMAP + #ifdef ENV_WORLDPOS + vWorldPosition = worldPosition.xyz; + #else + vec3 cameraToVertex; + if ( isOrthographic ) { + cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); + } else { + cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); + } + vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + #ifdef ENVMAP_MODE_REFLECTION + vReflect = reflect( cameraToVertex, worldNormal ); + #else + vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); + #endif + #endif +#endif`,fog_vertex:`#ifdef USE_FOG + vFogDepth = - mvPosition.z; +#endif`,fog_pars_vertex:`#ifdef USE_FOG + varying float vFogDepth; +#endif`,fog_fragment:`#ifdef USE_FOG + #ifdef FOG_EXP2 + float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); + #else + float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); + #endif + gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); +#endif`,fog_pars_fragment:`#ifdef USE_FOG + uniform vec3 fogColor; + varying float vFogDepth; + #ifdef FOG_EXP2 + uniform float fogDensity; + #else + uniform float fogNear; + uniform float fogFar; + #endif +#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP + uniform sampler2D gradientMap; +#endif +vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { + float dotNL = dot( normal, lightDirection ); + vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); + #ifdef USE_GRADIENTMAP + return vec3( texture2D( gradientMap, coord ).r ); + #else + vec2 fw = fwidth( coord ) * 0.5; + return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); + #endif +}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP + uniform sampler2D lightMap; + uniform float lightMapIntensity; +#endif`,lights_lambert_fragment:`LambertMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; +struct LambertMaterial { + vec3 diffuseColor; + float specularStrength; +}; +void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Lambert +#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; +uniform vec3 ambientLightColor; +#if defined( USE_LIGHT_PROBES ) + uniform vec3 lightProbe[ 9 ]; +#endif +vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { + float x = normal.x, y = normal.y, z = normal.z; + vec3 result = shCoefficients[ 0 ] * 0.886227; + result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; + result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; + result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; + result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; + result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; + result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); + result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; + result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); + return result; +} +vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { + vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); + vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); + return irradiance; +} +vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { + vec3 irradiance = ambientLightColor; + return irradiance; +} +float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { + float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); + if ( cutoffDistance > 0.0 ) { + distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); + } + return distanceFalloff; +} +float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { + return smoothstep( coneCosine, penumbraCosine, angleCosine ); +} +#if NUM_DIR_LIGHTS > 0 + struct DirectionalLight { + vec3 direction; + vec3 color; + }; + uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; + void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { + light.color = directionalLight.color; + light.direction = directionalLight.direction; + light.visible = true; + } +#endif +#if NUM_POINT_LIGHTS > 0 + struct PointLight { + vec3 position; + vec3 color; + float distance; + float decay; + }; + uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; + void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = pointLight.position - geometryPosition; + light.direction = normalize( lVector ); + float lightDistance = length( lVector ); + light.color = pointLight.color; + light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } +#endif +#if NUM_SPOT_LIGHTS > 0 + struct SpotLight { + vec3 position; + vec3 direction; + vec3 color; + float distance; + float decay; + float coneCos; + float penumbraCos; + }; + uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; + void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { + vec3 lVector = spotLight.position - geometryPosition; + light.direction = normalize( lVector ); + float angleCos = dot( light.direction, spotLight.direction ); + float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); + if ( spotAttenuation > 0.0 ) { + float lightDistance = length( lVector ); + light.color = spotLight.color * spotAttenuation; + light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); + light.visible = ( light.color != vec3( 0.0 ) ); + } else { + light.color = vec3( 0.0 ); + light.visible = false; + } + } +#endif +#if NUM_RECT_AREA_LIGHTS > 0 + struct RectAreaLight { + vec3 color; + vec3 position; + vec3 halfWidth; + vec3 halfHeight; + }; + uniform sampler2D ltc_1; uniform sampler2D ltc_2; + uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; +#endif +#if NUM_HEMI_LIGHTS > 0 + struct HemisphereLight { + vec3 direction; + vec3 skyColor; + vec3 groundColor; + }; + uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; + vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { + float dotNL = dot( normal, hemiLight.direction ); + float hemiDiffuseWeight = 0.5 * dotNL + 0.5; + vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); + return irradiance; + } +#endif`,lights_toon_fragment:`ToonMaterial material; +material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; +struct ToonMaterial { + vec3 diffuseColor; +}; +void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_Toon +#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; +material.diffuseColor = diffuseColor.rgb; +material.specularColor = specular; +material.specularShininess = shininess; +material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; +struct BlinnPhongMaterial { + vec3 diffuseColor; + vec3 specularColor; + float specularShininess; + float specularStrength; +}; +void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); + reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; +} +void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +#define RE_Direct RE_Direct_BlinnPhong +#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; +material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); +vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); +float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); +material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; +material.roughness = min( material.roughness, 1.0 ); +#ifdef IOR + material.ior = ior; + #ifdef USE_SPECULAR + float specularIntensityFactor = specularIntensity; + vec3 specularColorFactor = specularColor; + #ifdef USE_SPECULAR_COLORMAP + specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; + #endif + material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); + #else + float specularIntensityFactor = 1.0; + vec3 specularColorFactor = vec3( 1.0 ); + material.specularF90 = 1.0; + #endif + material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); +#else + material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); + material.specularF90 = 1.0; +#endif +#ifdef USE_CLEARCOAT + material.clearcoat = clearcoat; + material.clearcoatRoughness = clearcoatRoughness; + material.clearcoatF0 = vec3( 0.04 ); + material.clearcoatF90 = 1.0; + #ifdef USE_CLEARCOATMAP + material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; + #endif + #ifdef USE_CLEARCOAT_ROUGHNESSMAP + material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; + #endif + material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); + material.clearcoatRoughness += geometryRoughness; + material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); +#endif +#ifdef USE_DISPERSION + material.dispersion = dispersion; +#endif +#ifdef USE_IRIDESCENCE + material.iridescence = iridescence; + material.iridescenceIOR = iridescenceIOR; + #ifdef USE_IRIDESCENCEMAP + material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; + #endif + #ifdef USE_IRIDESCENCE_THICKNESSMAP + material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; + #else + material.iridescenceThickness = iridescenceThicknessMaximum; + #endif +#endif +#ifdef USE_SHEEN + material.sheenColor = sheenColor; + #ifdef USE_SHEEN_COLORMAP + material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; + #endif + material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); + #ifdef USE_SHEEN_ROUGHNESSMAP + material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; + #endif +#endif +#ifdef USE_ANISOTROPY + #ifdef USE_ANISOTROPYMAP + mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); + vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; + vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; + #else + vec2 anisotropyV = anisotropyVector; + #endif + material.anisotropy = length( anisotropyV ); + if( material.anisotropy == 0.0 ) { + anisotropyV = vec2( 1.0, 0.0 ); + } else { + anisotropyV /= material.anisotropy; + material.anisotropy = saturate( material.anisotropy ); + } + material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); + material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; + material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; +#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { + vec3 diffuseColor; + float roughness; + vec3 specularColor; + float specularF90; + float dispersion; + #ifdef USE_CLEARCOAT + float clearcoat; + float clearcoatRoughness; + vec3 clearcoatF0; + float clearcoatF90; + #endif + #ifdef USE_IRIDESCENCE + float iridescence; + float iridescenceIOR; + float iridescenceThickness; + vec3 iridescenceFresnel; + vec3 iridescenceF0; + #endif + #ifdef USE_SHEEN + vec3 sheenColor; + float sheenRoughness; + #endif + #ifdef IOR + float ior; + #endif + #ifdef USE_TRANSMISSION + float transmission; + float transmissionAlpha; + float thickness; + float attenuationDistance; + vec3 attenuationColor; + #endif + #ifdef USE_ANISOTROPY + float anisotropy; + float alphaT; + vec3 anisotropyT; + vec3 anisotropyB; + #endif +}; +vec3 clearcoatSpecularDirect = vec3( 0.0 ); +vec3 clearcoatSpecularIndirect = vec3( 0.0 ); +vec3 sheenSpecularDirect = vec3( 0.0 ); +vec3 sheenSpecularIndirect = vec3(0.0 ); +vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { + float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); + float x2 = x * x; + float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); + return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); +} +float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { + float a2 = pow2( alpha ); + float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); + float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); + return 0.5 / max( gv + gl, EPSILON ); +} +float D_GGX( const in float alpha, const in float dotNH ) { + float a2 = pow2( alpha ); + float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; + return RECIPROCAL_PI * a2 / pow2( denom ); +} +#ifdef USE_ANISOTROPY + float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { + float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); + float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); + float v = 0.5 / ( gv + gl ); + return saturate(v); + } + float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { + float a2 = alphaT * alphaB; + highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); + highp float v2 = dot( v, v ); + float w2 = a2 / v2; + return RECIPROCAL_PI * a2 * pow2 ( w2 ); + } +#endif +#ifdef USE_CLEARCOAT + vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { + vec3 f0 = material.clearcoatF0; + float f90 = material.clearcoatF90; + float roughness = material.clearcoatRoughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + return F * ( V * D ); + } +#endif +vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { + vec3 f0 = material.specularColor; + float f90 = material.specularF90; + float roughness = material.roughness; + float alpha = pow2( roughness ); + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float dotVH = saturate( dot( viewDir, halfDir ) ); + vec3 F = F_Schlick( f0, f90, dotVH ); + #ifdef USE_IRIDESCENCE + F = mix( F, material.iridescenceFresnel, material.iridescence ); + #endif + #ifdef USE_ANISOTROPY + float dotTL = dot( material.anisotropyT, lightDir ); + float dotTV = dot( material.anisotropyT, viewDir ); + float dotTH = dot( material.anisotropyT, halfDir ); + float dotBL = dot( material.anisotropyB, lightDir ); + float dotBV = dot( material.anisotropyB, viewDir ); + float dotBH = dot( material.anisotropyB, halfDir ); + float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); + float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); + #else + float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); + float D = D_GGX( alpha, dotNH ); + #endif + return F * ( V * D ); +} +vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { + const float LUT_SIZE = 64.0; + const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; + const float LUT_BIAS = 0.5 / LUT_SIZE; + float dotNV = saturate( dot( N, V ) ); + vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); + uv = uv * LUT_SCALE + LUT_BIAS; + return uv; +} +float LTC_ClippedSphereFormFactor( const in vec3 f ) { + float l = length( f ); + return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); +} +vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { + float x = dot( v1, v2 ); + float y = abs( x ); + float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; + float b = 3.4175940 + ( 4.1616724 + y ) * y; + float v = a / b; + float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; + return cross( v1, v2 ) * theta_sintheta; +} +vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { + vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; + vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; + vec3 lightNormal = cross( v1, v2 ); + if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); + vec3 T1, T2; + T1 = normalize( V - N * dot( V, N ) ); + T2 = - cross( N, T1 ); + mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); + vec3 coords[ 4 ]; + coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); + coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); + coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); + coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); + coords[ 0 ] = normalize( coords[ 0 ] ); + coords[ 1 ] = normalize( coords[ 1 ] ); + coords[ 2 ] = normalize( coords[ 2 ] ); + coords[ 3 ] = normalize( coords[ 3 ] ); + vec3 vectorFormFactor = vec3( 0.0 ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); + vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); + float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); + return vec3( result ); +} +#if defined( USE_SHEEN ) +float D_Charlie( float roughness, float dotNH ) { + float alpha = pow2( roughness ); + float invAlpha = 1.0 / alpha; + float cos2h = dotNH * dotNH; + float sin2h = max( 1.0 - cos2h, 0.0078125 ); + return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); +} +float V_Neubelt( float dotNV, float dotNL ) { + return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); +} +vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { + vec3 halfDir = normalize( lightDir + viewDir ); + float dotNL = saturate( dot( normal, lightDir ) ); + float dotNV = saturate( dot( normal, viewDir ) ); + float dotNH = saturate( dot( normal, halfDir ) ); + float D = D_Charlie( sheenRoughness, dotNH ); + float V = V_Neubelt( dotNV, dotNL ); + return sheenColor * ( D * V ); +} +#endif +float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + float r2 = roughness * roughness; + float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; + float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; + float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); + return saturate( DG * RECIPROCAL_PI ); +} +vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { + float dotNV = saturate( dot( normal, viewDir ) ); + const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); + const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); + vec4 r = roughness * c0 + c1; + float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; + vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; + return fab; +} +vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { + vec2 fab = DFGApprox( normal, viewDir, roughness ); + return specularColor * fab.x + specularF90 * fab.y; +} +#ifdef USE_IRIDESCENCE +void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#else +void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { +#endif + vec2 fab = DFGApprox( normal, viewDir, roughness ); + #ifdef USE_IRIDESCENCE + vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); + #else + vec3 Fr = specularColor; + #endif + vec3 FssEss = Fr * fab.x + specularF90 * fab.y; + float Ess = fab.x + fab.y; + float Ems = 1.0 - Ess; + vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); + singleScatter += FssEss; + multiScatter += Fms * Ems; +} +#if NUM_RECT_AREA_LIGHTS > 0 + void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + vec3 normal = geometryNormal; + vec3 viewDir = geometryViewDir; + vec3 position = geometryPosition; + vec3 lightPos = rectAreaLight.position; + vec3 halfWidth = rectAreaLight.halfWidth; + vec3 halfHeight = rectAreaLight.halfHeight; + vec3 lightColor = rectAreaLight.color; + float roughness = material.roughness; + vec3 rectCoords[ 4 ]; + rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; + rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; + rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; + vec2 uv = LTC_Uv( normal, viewDir, roughness ); + vec4 t1 = texture2D( ltc_1, uv ); + vec4 t2 = texture2D( ltc_2, uv ); + mat3 mInv = mat3( + vec3( t1.x, 0, t1.y ), + vec3( 0, 1, 0 ), + vec3( t1.z, 0, t1.w ) + ); + vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); + reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); + reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); + } +#endif +void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); + vec3 irradiance = dotNL * directLight.color; + #ifdef USE_CLEARCOAT + float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); + vec3 ccIrradiance = dotNLcc * directLight.color; + clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); + #endif + #ifdef USE_SHEEN + sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); + #endif + reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); + reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { + reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); +} +void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { + #ifdef USE_CLEARCOAT + clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); + #endif + #ifdef USE_SHEEN + sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); + #endif + vec3 singleScattering = vec3( 0.0 ); + vec3 multiScattering = vec3( 0.0 ); + vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; + #ifdef USE_IRIDESCENCE + computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); + #else + computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); + #endif + vec3 totalScattering = singleScattering + multiScattering; + vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); + reflectedLight.indirectSpecular += radiance * singleScattering; + reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; + reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; +} +#define RE_Direct RE_Direct_Physical +#define RE_Direct_RectArea RE_Direct_RectArea_Physical +#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical +#define RE_IndirectSpecular RE_IndirectSpecular_Physical +float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { + return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); +}`,lights_fragment_begin:` +vec3 geometryPosition = - vViewPosition; +vec3 geometryNormal = normal; +vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); +vec3 geometryClearcoatNormal = vec3( 0.0 ); +#ifdef USE_CLEARCOAT + geometryClearcoatNormal = clearcoatNormal; +#endif +#ifdef USE_IRIDESCENCE + float dotNVi = saturate( dot( normal, geometryViewDir ) ); + if ( material.iridescenceThickness == 0.0 ) { + material.iridescence = 0.0; + } else { + material.iridescence = saturate( material.iridescence ); + } + if ( material.iridescence > 0.0 ) { + material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); + material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); + } +#endif +IncidentLight directLight; +#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) + PointLight pointLight; + #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { + pointLight = pointLights[ i ]; + getPointLightInfo( pointLight, geometryPosition, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) + pointLightShadow = pointLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) + SpotLight spotLight; + vec4 spotColor; + vec3 spotLightCoord; + bool inSpotLightMap; + #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { + spotLight = spotLights[ i ]; + getSpotLightInfo( spotLight, geometryPosition, directLight ); + #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX + #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS + #else + #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) + #endif + #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) + spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; + inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); + spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); + directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; + #endif + #undef SPOT_LIGHT_MAP_INDEX + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + spotLightShadow = spotLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) + DirectionalLight directionalLight; + #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLightShadow; + #endif + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { + directionalLight = directionalLights[ i ]; + getDirectionalLightInfo( directionalLight, directLight ); + #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) + directionalLightShadow = directionalLightShadows[ i ]; + directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + #endif + RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) + RectAreaLight rectAreaLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { + rectAreaLight = rectAreaLights[ i ]; + RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); + } + #pragma unroll_loop_end +#endif +#if defined( RE_IndirectDiffuse ) + vec3 iblIrradiance = vec3( 0.0 ); + vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); + #if defined( USE_LIGHT_PROBES ) + irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); + #endif + #if ( NUM_HEMI_LIGHTS > 0 ) + #pragma unroll_loop_start + for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { + irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); + } + #pragma unroll_loop_end + #endif +#endif +#if defined( RE_IndirectSpecular ) + vec3 radiance = vec3( 0.0 ); + vec3 clearcoatRadiance = vec3( 0.0 ); +#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; + irradiance += lightMapIrradiance; + #endif + #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) + iblIrradiance += getIBLIrradiance( geometryNormal ); + #endif +#endif +#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) + #ifdef USE_ANISOTROPY + radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); + #else + radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); + #endif + #ifdef USE_CLEARCOAT + clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); + #endif +#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) + RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif +#if defined( RE_IndirectSpecular ) + RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); +#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) + gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; +#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) + uniform float logDepthBufFC; + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF + varying float vFragDepth; + varying float vIsPerspective; +#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF + vFragDepth = 1.0 + gl_Position.w; + vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); +#endif`,map_fragment:`#ifdef USE_MAP + vec4 sampledDiffuseColor = texture2D( map, vMapUv ); + #ifdef DECODE_VIDEO_TEXTURE + sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); + #endif + diffuseColor *= sampledDiffuseColor; +#endif`,map_pars_fragment:`#ifdef USE_MAP + uniform sampler2D map; +#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + #if defined( USE_POINTS_UV ) + vec2 uv = vUv; + #else + vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; + #endif +#endif +#ifdef USE_MAP + diffuseColor *= texture2D( map, uv ); +#endif +#ifdef USE_ALPHAMAP + diffuseColor.a *= texture2D( alphaMap, uv ).g; +#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) + varying vec2 vUv; +#else + #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) + uniform mat3 uvTransform; + #endif +#endif +#ifdef USE_MAP + uniform sampler2D map; +#endif +#ifdef USE_ALPHAMAP + uniform sampler2D alphaMap; +#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; +#ifdef USE_METALNESSMAP + vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); + metalnessFactor *= texelMetalness.b; +#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP + uniform sampler2D metalnessMap; +#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH + float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; + } +#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) + vColor *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + #if defined( USE_COLOR_ALPHA ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; + #elif defined( USE_COLOR ) + if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; + #endif + } +#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS + objectNormal *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS + #ifndef USE_INSTANCING_MORPH + uniform float morphTargetBaseInfluence; + uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; + #endif + uniform sampler2DArray morphTargetsTexture; + uniform ivec2 morphTargetsTextureSize; + vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { + int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; + int y = texelIndex / morphTargetsTextureSize.x; + int x = texelIndex - y * morphTargetsTextureSize.x; + ivec3 morphUV = ivec3( x, y, morphTargetIndex ); + return texelFetch( morphTargetsTexture, morphUV, 0 ); + } +#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS + transformed *= morphTargetBaseInfluence; + for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { + if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; + } +#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; +#ifdef FLAT_SHADED + vec3 fdx = dFdx( vViewPosition ); + vec3 fdy = dFdy( vViewPosition ); + vec3 normal = normalize( cross( fdx, fdy ) ); +#else + vec3 normal = normalize( vNormal ); + #ifdef DOUBLE_SIDED + normal *= faceDirection; + #endif +#endif +#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) + #ifdef USE_TANGENT + mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn = getTangentFrame( - vViewPosition, normal, + #if defined( USE_NORMALMAP ) + vNormalMapUv + #elif defined( USE_CLEARCOAT_NORMALMAP ) + vClearcoatNormalMapUv + #else + vUv + #endif + ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn[0] *= faceDirection; + tbn[1] *= faceDirection; + #endif +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + #ifdef USE_TANGENT + mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); + #else + mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); + #endif + #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) + tbn2[0] *= faceDirection; + tbn2[1] *= faceDirection; + #endif +#endif +vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE + normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + #ifdef FLIP_SIDED + normal = - normal; + #endif + #ifdef DOUBLE_SIDED + normal = normal * faceDirection; + #endif + normal = normalize( normalMatrix * normal ); +#elif defined( USE_NORMALMAP_TANGENTSPACE ) + vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; + mapN.xy *= normalScale; + normal = normalize( tbn * mapN ); +#elif defined( USE_BUMPMAP ) + normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); +#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED + varying vec3 vNormal; + #ifdef USE_TANGENT + varying vec3 vTangent; + varying vec3 vBitangent; + #endif +#endif`,normal_vertex:`#ifndef FLAT_SHADED + vNormal = normalize( transformedNormal ); + #ifdef USE_TANGENT + vTangent = normalize( transformedTangent ); + vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); + #endif +#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP + uniform sampler2D normalMap; + uniform vec2 normalScale; +#endif +#ifdef USE_NORMALMAP_OBJECTSPACE + uniform mat3 normalMatrix; +#endif +#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) + mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { + vec3 q0 = dFdx( eye_pos.xyz ); + vec3 q1 = dFdy( eye_pos.xyz ); + vec2 st0 = dFdx( uv.st ); + vec2 st1 = dFdy( uv.st ); + vec3 N = surf_norm; + vec3 q1perp = cross( q1, N ); + vec3 q0perp = cross( N, q0 ); + vec3 T = q1perp * st0.x + q0perp * st1.x; + vec3 B = q1perp * st0.y + q0perp * st1.y; + float det = max( dot( T, T ), dot( B, B ) ); + float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); + return mat3( T * scale, B * scale, N ); + } +#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT + vec3 clearcoatNormal = nonPerturbedNormal; +#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP + vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; + clearcoatMapN.xy *= clearcoatNormalScale; + clearcoatNormal = normalize( tbn2 * clearcoatMapN ); +#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP + uniform sampler2D clearcoatMap; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform sampler2D clearcoatNormalMap; + uniform vec2 clearcoatNormalScale; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform sampler2D clearcoatRoughnessMap; +#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP + uniform sampler2D iridescenceMap; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform sampler2D iridescenceThicknessMap; +#endif`,opaque_fragment:`#ifdef OPAQUE +diffuseColor.a = 1.0; +#endif +#ifdef USE_TRANSMISSION +diffuseColor.a *= material.transmissionAlpha; +#endif +gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { + return normalize( normal ) * 0.5 + 0.5; +} +vec3 unpackRGBToNormal( const in vec3 rgb ) { + return 2.0 * rgb.xyz - 1.0; +} +const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; +const float Inv255 = 1. / 255.; +const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); +const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); +const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); +const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); +vec4 packDepthToRGBA( const in float v ) { + if( v <= 0.0 ) + return vec4( 0., 0., 0., 0. ); + if( v >= 1.0 ) + return vec4( 1., 1., 1., 1. ); + float vuf; + float af = modf( v * PackFactors.a, vuf ); + float bf = modf( vuf * ShiftRight8, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); +} +vec3 packDepthToRGB( const in float v ) { + if( v <= 0.0 ) + return vec3( 0., 0., 0. ); + if( v >= 1.0 ) + return vec3( 1., 1., 1. ); + float vuf; + float bf = modf( v * PackFactors.b, vuf ); + float gf = modf( vuf * ShiftRight8, vuf ); + return vec3( vuf * Inv255, gf * PackUpscale, bf ); +} +vec2 packDepthToRG( const in float v ) { + if( v <= 0.0 ) + return vec2( 0., 0. ); + if( v >= 1.0 ) + return vec2( 1., 1. ); + float vuf; + float gf = modf( v * 256., vuf ); + return vec2( vuf * Inv255, gf ); +} +float unpackRGBAToDepth( const in vec4 v ) { + return dot( v, UnpackFactors4 ); +} +float unpackRGBToDepth( const in vec3 v ) { + return dot( v, UnpackFactors3 ); +} +float unpackRGToDepth( const in vec2 v ) { + return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; +} +vec4 pack2HalfToRGBA( const in vec2 v ) { + vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); + return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); +} +vec2 unpackRGBATo2Half( const in vec4 v ) { + return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); +} +float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { + return ( viewZ + near ) / ( near - far ); +} +float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { + return depth * ( near - far ) - near; +} +float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { + return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); +} +float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { + return ( near * far ) / ( ( far - near ) * depth - far ); +}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA + gl_FragColor.rgb *= gl_FragColor.a; +#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); +#ifdef USE_BATCHING + mvPosition = batchingMatrix * mvPosition; +#endif +#ifdef USE_INSTANCING + mvPosition = instanceMatrix * mvPosition; +#endif +mvPosition = modelViewMatrix * mvPosition; +gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING + gl_FragColor.rgb = dithering( gl_FragColor.rgb ); +#endif`,dithering_pars_fragment:`#ifdef DITHERING + vec3 dithering( vec3 color ) { + float grid_position = rand( gl_FragCoord.xy ); + vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); + dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); + return color + dither_shift_RGB; + } +#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; +#ifdef USE_ROUGHNESSMAP + vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); + roughnessFactor *= texelRoughness.g; +#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP + uniform sampler2D roughnessMap; +#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#if NUM_SPOT_LIGHT_MAPS > 0 + uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif + float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { + return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); + } + vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { + return unpackRGBATo2Half( texture2D( shadow, uv ) ); + } + float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ + float occlusion = 1.0; + vec2 distribution = texture2DDistribution( shadow, uv ); + float hard_shadow = step( compare , distribution.x ); + if (hard_shadow != 1.0 ) { + float distance = compare - distribution.x ; + float variance = max( 0.00000, distribution.y * distribution.y ); + float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); + } + return occlusion; + } + float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { + float shadow = 1.0; + shadowCoord.xyz /= shadowCoord.w; + shadowCoord.z += shadowBias; + bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; + bool frustumTest = inFrustum && shadowCoord.z <= 1.0; + if ( frustumTest ) { + #if defined( SHADOWMAP_TYPE_PCF ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx0 = - texelSize.x * shadowRadius; + float dy0 = - texelSize.y * shadowRadius; + float dx1 = + texelSize.x * shadowRadius; + float dy1 = + texelSize.y * shadowRadius; + float dx2 = dx0 / 2.0; + float dy2 = dy0 / 2.0; + float dx3 = dx1 / 2.0; + float dy3 = dy1 / 2.0; + shadow = ( + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + + texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) + ) * ( 1.0 / 17.0 ); + #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) + vec2 texelSize = vec2( 1.0 ) / shadowMapSize; + float dx = texelSize.x; + float dy = texelSize.y; + vec2 uv = shadowCoord.xy; + vec2 f = fract( uv * shadowMapSize + 0.5 ); + uv -= f * texelSize; + shadow = ( + texture2DCompare( shadowMap, uv, shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + + texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), + f.x ) + + mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), + f.y ) + + mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), + f.x ), + mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), + texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), + f.x ), + f.y ) + ) * ( 1.0 / 9.0 ); + #elif defined( SHADOWMAP_TYPE_VSM ) + shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); + #else + shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } + vec2 cubeToUV( vec3 v, float texelSizeY ) { + vec3 absV = abs( v ); + float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); + absV *= scaleToCube; + v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); + vec2 planar = v.xy; + float almostATexel = 1.5 * texelSizeY; + float almostOne = 1.0 - almostATexel; + if ( absV.z >= almostOne ) { + if ( v.z > 0.0 ) + planar.x = 4.0 - v.x; + } else if ( absV.x >= almostOne ) { + float signX = sign( v.x ); + planar.x = v.z * signX + 2.0 * signX; + } else if ( absV.y >= almostOne ) { + float signY = sign( v.y ); + planar.x = v.x + 2.0 * signY + 2.0; + planar.y = v.z * signY - 2.0; + } + return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); + } + float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { + float shadow = 1.0; + vec3 lightToPosition = shadowCoord.xyz; + + float lightToPositionLength = length( lightToPosition ); + if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { + float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; + vec3 bd3D = normalize( lightToPosition ); + vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); + #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) + vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; + shadow = ( + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + + texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) + ) * ( 1.0 / 9.0 ); + #else + shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); + #endif + } + return mix( 1.0, shadow, shadowIntensity ); + } +#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 + uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; + varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; +#endif +#ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; + varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; + struct DirectionalLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + struct SpotLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + }; + uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; + varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; + struct PointLightShadow { + float shadowIntensity; + float shadowBias; + float shadowNormalBias; + float shadowRadius; + vec2 shadowMapSize; + float shadowCameraNear; + float shadowCameraFar; + }; + uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; + #endif +#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) + vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); + vec4 shadowWorldPosition; +#endif +#if defined( USE_SHADOWMAP ) + #if NUM_DIR_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); + vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); + vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end + #endif +#endif +#if NUM_SPOT_LIGHT_COORDS > 0 + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { + shadowWorldPosition = worldPosition; + #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) + shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; + #endif + vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; + } + #pragma unroll_loop_end +#endif`,shadowmask_pars_fragment:`float getShadowMask() { + float shadow = 1.0; + #ifdef USE_SHADOWMAP + #if NUM_DIR_LIGHT_SHADOWS > 0 + DirectionalLightShadow directionalLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { + directionalLight = directionalLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_SPOT_LIGHT_SHADOWS > 0 + SpotLightShadow spotLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { + spotLight = spotLightShadows[ i ]; + shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; + } + #pragma unroll_loop_end + #endif + #if NUM_POINT_LIGHT_SHADOWS > 0 + PointLightShadow pointLight; + #pragma unroll_loop_start + for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { + pointLight = pointLightShadows[ i ]; + shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; + } + #pragma unroll_loop_end + #endif + #endif + return shadow; +}`,skinbase_vertex:`#ifdef USE_SKINNING + mat4 boneMatX = getBoneMatrix( skinIndex.x ); + mat4 boneMatY = getBoneMatrix( skinIndex.y ); + mat4 boneMatZ = getBoneMatrix( skinIndex.z ); + mat4 boneMatW = getBoneMatrix( skinIndex.w ); +#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING + uniform mat4 bindMatrix; + uniform mat4 bindMatrixInverse; + uniform highp sampler2D boneTexture; + mat4 getBoneMatrix( const in float i ) { + int size = textureSize( boneTexture, 0 ).x; + int j = int( i ) * 4; + int x = j % size; + int y = j / size; + vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); + vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); + vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); + vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); + return mat4( v1, v2, v3, v4 ); + } +#endif`,skinning_vertex:`#ifdef USE_SKINNING + vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); + vec4 skinned = vec4( 0.0 ); + skinned += boneMatX * skinVertex * skinWeight.x; + skinned += boneMatY * skinVertex * skinWeight.y; + skinned += boneMatZ * skinVertex * skinWeight.z; + skinned += boneMatW * skinVertex * skinWeight.w; + transformed = ( bindMatrixInverse * skinned ).xyz; +#endif`,skinnormal_vertex:`#ifdef USE_SKINNING + mat4 skinMatrix = mat4( 0.0 ); + skinMatrix += skinWeight.x * boneMatX; + skinMatrix += skinWeight.y * boneMatY; + skinMatrix += skinWeight.z * boneMatZ; + skinMatrix += skinWeight.w * boneMatW; + skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; + objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; + #ifdef USE_TANGENT + objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; + #endif +#endif`,specularmap_fragment:`float specularStrength; +#ifdef USE_SPECULARMAP + vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); + specularStrength = texelSpecular.r; +#else + specularStrength = 1.0; +#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP + uniform sampler2D specularMap; +#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) + gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); +#endif`,tonemapping_pars_fragment:`#ifndef saturate +#define saturate( a ) clamp( a, 0.0, 1.0 ) +#endif +uniform float toneMappingExposure; +vec3 LinearToneMapping( vec3 color ) { + return saturate( toneMappingExposure * color ); +} +vec3 ReinhardToneMapping( vec3 color ) { + color *= toneMappingExposure; + return saturate( color / ( vec3( 1.0 ) + color ) ); +} +vec3 CineonToneMapping( vec3 color ) { + color *= toneMappingExposure; + color = max( vec3( 0.0 ), color - 0.004 ); + return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); +} +vec3 RRTAndODTFit( vec3 v ) { + vec3 a = v * ( v + 0.0245786 ) - 0.000090537; + vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; + return a / b; +} +vec3 ACESFilmicToneMapping( vec3 color ) { + const mat3 ACESInputMat = mat3( + vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), + vec3( 0.04823, 0.01566, 0.83777 ) + ); + const mat3 ACESOutputMat = mat3( + vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), + vec3( -0.07367, -0.00605, 1.07602 ) + ); + color *= toneMappingExposure / 0.6; + color = ACESInputMat * color; + color = RRTAndODTFit( color ); + color = ACESOutputMat * color; + return saturate( color ); +} +const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( + vec3( 1.6605, - 0.1246, - 0.0182 ), + vec3( - 0.5876, 1.1329, - 0.1006 ), + vec3( - 0.0728, - 0.0083, 1.1187 ) +); +const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( + vec3( 0.6274, 0.0691, 0.0164 ), + vec3( 0.3293, 0.9195, 0.0880 ), + vec3( 0.0433, 0.0113, 0.8956 ) +); +vec3 agxDefaultContrastApprox( vec3 x ) { + vec3 x2 = x * x; + vec3 x4 = x2 * x2; + return + 15.5 * x4 * x2 + - 40.14 * x4 * x + + 31.96 * x4 + - 6.868 * x2 * x + + 0.4298 * x2 + + 0.1191 * x + - 0.00232; +} +vec3 AgXToneMapping( vec3 color ) { + const mat3 AgXInsetMatrix = mat3( + vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), + vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), + vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) + ); + const mat3 AgXOutsetMatrix = mat3( + vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), + vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), + vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) + ); + const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; + color *= toneMappingExposure; + color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; + color = AgXInsetMatrix * color; + color = max( color, 1e-10 ); color = log2( color ); + color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); + color = clamp( color, 0.0, 1.0 ); + color = agxDefaultContrastApprox( color ); + color = AgXOutsetMatrix * color; + color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); + color = LINEAR_REC2020_TO_LINEAR_SRGB * color; + color = clamp( color, 0.0, 1.0 ); + return color; +} +vec3 NeutralToneMapping( vec3 color ) { + const float StartCompression = 0.8 - 0.04; + const float Desaturation = 0.15; + color *= toneMappingExposure; + float x = min( color.r, min( color.g, color.b ) ); + float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; + color -= offset; + float peak = max( color.r, max( color.g, color.b ) ); + if ( peak < StartCompression ) return color; + float d = 1. - StartCompression; + float newPeak = 1. - d * d / ( peak + d - StartCompression ); + color *= newPeak / peak; + float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); + return mix( color, vec3( newPeak ), g ); +} +vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION + material.transmission = transmission; + material.transmissionAlpha = 1.0; + material.thickness = thickness; + material.attenuationDistance = attenuationDistance; + material.attenuationColor = attenuationColor; + #ifdef USE_TRANSMISSIONMAP + material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; + #endif + #ifdef USE_THICKNESSMAP + material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; + #endif + vec3 pos = vWorldPosition; + vec3 v = normalize( cameraPosition - pos ); + vec3 n = inverseTransformDirection( normal, viewMatrix ); + vec4 transmitted = getIBLVolumeRefraction( + n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, + pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, + material.attenuationColor, material.attenuationDistance ); + material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); + totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); +#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION + uniform float transmission; + uniform float thickness; + uniform float attenuationDistance; + uniform vec3 attenuationColor; + #ifdef USE_TRANSMISSIONMAP + uniform sampler2D transmissionMap; + #endif + #ifdef USE_THICKNESSMAP + uniform sampler2D thicknessMap; + #endif + uniform vec2 transmissionSamplerSize; + uniform sampler2D transmissionSamplerMap; + uniform mat4 modelMatrix; + uniform mat4 projectionMatrix; + varying vec3 vWorldPosition; + float w0( float a ) { + return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); + } + float w1( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); + } + float w2( float a ){ + return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); + } + float w3( float a ) { + return ( 1.0 / 6.0 ) * ( a * a * a ); + } + float g0( float a ) { + return w0( a ) + w1( a ); + } + float g1( float a ) { + return w2( a ) + w3( a ); + } + float h0( float a ) { + return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); + } + float h1( float a ) { + return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); + } + vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { + uv = uv * texelSize.zw + 0.5; + vec2 iuv = floor( uv ); + vec2 fuv = fract( uv ); + float g0x = g0( fuv.x ); + float g1x = g1( fuv.x ); + float h0x = h0( fuv.x ); + float h1x = h1( fuv.x ); + float h0y = h0( fuv.y ); + float h1y = h1( fuv.y ); + vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; + vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; + return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + + g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); + } + vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { + vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); + vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); + vec2 fLodSizeInv = 1.0 / fLodSize; + vec2 cLodSizeInv = 1.0 / cLodSize; + vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); + vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); + return mix( fSample, cSample, fract( lod ) ); + } + vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { + vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); + vec3 modelScale; + modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); + modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); + modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); + return normalize( refractionVector ) * thickness * modelScale; + } + float applyIorToRoughness( const in float roughness, const in float ior ) { + return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); + } + vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { + float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); + return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); + } + vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { + if ( isinf( attenuationDistance ) ) { + return vec3( 1.0 ); + } else { + vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; + vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; + } + } + vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, + const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, + const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, + const in vec3 attenuationColor, const in float attenuationDistance ) { + vec4 transmittedLight; + vec3 transmittance; + #ifdef USE_DISPERSION + float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; + vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); + for ( int i = 0; i < 3; i ++ ) { + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); + transmittedLight[ i ] = transmissionSample[ i ]; + transmittedLight.a += transmissionSample.a; + transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; + } + transmittedLight.a /= 3.0; + #else + vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); + vec3 refractedRayExit = position + transmissionRay; + vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); + vec2 refractionCoords = ndcPos.xy / ndcPos.w; + refractionCoords += 1.0; + refractionCoords /= 2.0; + transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); + transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); + #endif + vec3 attenuatedColor = transmittance * transmittedLight.rgb; + vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); + float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; + return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); + } +#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + varying vec2 vNormalMapUv; +#endif +#ifdef USE_EMISSIVEMAP + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_SPECULARMAP + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + varying vec2 vUv; +#endif +#ifdef USE_MAP + uniform mat3 mapTransform; + varying vec2 vMapUv; +#endif +#ifdef USE_ALPHAMAP + uniform mat3 alphaMapTransform; + varying vec2 vAlphaMapUv; +#endif +#ifdef USE_LIGHTMAP + uniform mat3 lightMapTransform; + varying vec2 vLightMapUv; +#endif +#ifdef USE_AOMAP + uniform mat3 aoMapTransform; + varying vec2 vAoMapUv; +#endif +#ifdef USE_BUMPMAP + uniform mat3 bumpMapTransform; + varying vec2 vBumpMapUv; +#endif +#ifdef USE_NORMALMAP + uniform mat3 normalMapTransform; + varying vec2 vNormalMapUv; +#endif +#ifdef USE_DISPLACEMENTMAP + uniform mat3 displacementMapTransform; + varying vec2 vDisplacementMapUv; +#endif +#ifdef USE_EMISSIVEMAP + uniform mat3 emissiveMapTransform; + varying vec2 vEmissiveMapUv; +#endif +#ifdef USE_METALNESSMAP + uniform mat3 metalnessMapTransform; + varying vec2 vMetalnessMapUv; +#endif +#ifdef USE_ROUGHNESSMAP + uniform mat3 roughnessMapTransform; + varying vec2 vRoughnessMapUv; +#endif +#ifdef USE_ANISOTROPYMAP + uniform mat3 anisotropyMapTransform; + varying vec2 vAnisotropyMapUv; +#endif +#ifdef USE_CLEARCOATMAP + uniform mat3 clearcoatMapTransform; + varying vec2 vClearcoatMapUv; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + uniform mat3 clearcoatNormalMapTransform; + varying vec2 vClearcoatNormalMapUv; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + uniform mat3 clearcoatRoughnessMapTransform; + varying vec2 vClearcoatRoughnessMapUv; +#endif +#ifdef USE_SHEEN_COLORMAP + uniform mat3 sheenColorMapTransform; + varying vec2 vSheenColorMapUv; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + uniform mat3 sheenRoughnessMapTransform; + varying vec2 vSheenRoughnessMapUv; +#endif +#ifdef USE_IRIDESCENCEMAP + uniform mat3 iridescenceMapTransform; + varying vec2 vIridescenceMapUv; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + uniform mat3 iridescenceThicknessMapTransform; + varying vec2 vIridescenceThicknessMapUv; +#endif +#ifdef USE_SPECULARMAP + uniform mat3 specularMapTransform; + varying vec2 vSpecularMapUv; +#endif +#ifdef USE_SPECULAR_COLORMAP + uniform mat3 specularColorMapTransform; + varying vec2 vSpecularColorMapUv; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + uniform mat3 specularIntensityMapTransform; + varying vec2 vSpecularIntensityMapUv; +#endif +#ifdef USE_TRANSMISSIONMAP + uniform mat3 transmissionMapTransform; + varying vec2 vTransmissionMapUv; +#endif +#ifdef USE_THICKNESSMAP + uniform mat3 thicknessMapTransform; + varying vec2 vThicknessMapUv; +#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) + vUv = vec3( uv, 1 ).xy; +#endif +#ifdef USE_MAP + vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ALPHAMAP + vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_LIGHTMAP + vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_AOMAP + vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_BUMPMAP + vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_NORMALMAP + vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_DISPLACEMENTMAP + vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_EMISSIVEMAP + vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_METALNESSMAP + vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ROUGHNESSMAP + vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_ANISOTROPYMAP + vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOATMAP + vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_NORMALMAP + vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_CLEARCOAT_ROUGHNESSMAP + vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCEMAP + vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_IRIDESCENCE_THICKNESSMAP + vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_COLORMAP + vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SHEEN_ROUGHNESSMAP + vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULARMAP + vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_COLORMAP + vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_SPECULAR_INTENSITYMAP + vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_TRANSMISSIONMAP + vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; +#endif +#ifdef USE_THICKNESSMAP + vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; +#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 + vec4 worldPosition = vec4( transformed, 1.0 ); + #ifdef USE_BATCHING + worldPosition = batchingMatrix * worldPosition; + #endif + #ifdef USE_INSTANCING + worldPosition = instanceMatrix * worldPosition; + #endif + worldPosition = modelMatrix * worldPosition; +#endif`,background_vert:`varying vec2 vUv; +uniform mat3 uvTransform; +void main() { + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + gl_Position = vec4( position.xy, 1.0, 1.0 ); +}`,background_frag:`uniform sampler2D t2D; +uniform float backgroundIntensity; +varying vec2 vUv; +void main() { + vec4 texColor = texture2D( t2D, vUv ); + #ifdef DECODE_VIDEO_TEXTURE + texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,backgroundCube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE + uniform samplerCube envMap; +#elif defined( ENVMAP_TYPE_CUBE_UV ) + uniform sampler2D envMap; +#endif +uniform float flipEnvMap; +uniform float backgroundBlurriness; +uniform float backgroundIntensity; +uniform mat3 backgroundRotation; +varying vec3 vWorldDirection; +#include +void main() { + #ifdef ENVMAP_TYPE_CUBE + vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); + #elif defined( ENVMAP_TYPE_CUBE_UV ) + vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); + #else + vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + #endif + texColor.rgb *= backgroundIntensity; + gl_FragColor = texColor; + #include + #include +}`,cube_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include + gl_Position.z = gl_Position.w; +}`,cube_frag:`uniform samplerCube tCube; +uniform float tFlip; +uniform float opacity; +varying vec3 vWorldDirection; +void main() { + vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); + gl_FragColor = texColor; + gl_FragColor.a *= opacity; + #include + #include +}`,depth_vert:`#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vHighPrecisionZW = gl_Position.zw; +}`,depth_frag:`#if DEPTH_PACKING == 3200 + uniform float opacity; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +varying vec2 vHighPrecisionZW; +void main() { + vec4 diffuseColor = vec4( 1.0 ); + #include + #if DEPTH_PACKING == 3200 + diffuseColor.a = opacity; + #endif + #include + #include + #include + #include + #include + float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; + #if DEPTH_PACKING == 3200 + gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); + #elif DEPTH_PACKING == 3201 + gl_FragColor = packDepthToRGBA( fragCoordZ ); + #elif DEPTH_PACKING == 3202 + gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); + #elif DEPTH_PACKING == 3203 + gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); + #endif +}`,distanceRGBA_vert:`#define DISTANCE +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #ifdef USE_DISPLACEMENTMAP + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + vWorldPosition = worldPosition.xyz; +}`,distanceRGBA_frag:`#define DISTANCE +uniform vec3 referencePosition; +uniform float nearDistance; +uniform float farDistance; +varying vec3 vWorldPosition; +#include +#include +#include +#include +#include +#include +#include +#include +void main () { + vec4 diffuseColor = vec4( 1.0 ); + #include + #include + #include + #include + #include + float dist = length( vWorldPosition - referencePosition ); + dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); + dist = saturate( dist ); + gl_FragColor = packDepthToRGBA( dist ); +}`,equirect_vert:`varying vec3 vWorldDirection; +#include +void main() { + vWorldDirection = transformDirection( position, modelMatrix ); + #include + #include +}`,equirect_frag:`uniform sampler2D tEquirect; +varying vec3 vWorldDirection; +#include +void main() { + vec3 direction = normalize( vWorldDirection ); + vec2 sampleUV = equirectUv( direction ); + gl_FragColor = texture2D( tEquirect, sampleUV ); + #include + #include +}`,linedashed_vert:`uniform float scale; +attribute float lineDistance; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vLineDistance = scale * lineDistance; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,linedashed_frag:`uniform vec3 diffuse; +uniform float opacity; +uniform float dashSize; +uniform float totalSize; +varying float vLineDistance; +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + if ( mod( vLineDistance, totalSize ) > dashSize ) { + discard; + } + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,meshbasic_vert:`#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) + #include + #include + #include + #include + #include + #endif + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,meshbasic_frag:`uniform vec3 diffuse; +uniform float opacity; +#ifndef FLAT_SHADED + varying vec3 vNormal; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + #ifdef USE_LIGHTMAP + vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); + reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; + #else + reflectedLight.indirectDiffuse += vec3( 1.0 ); + #endif + #include + reflectedLight.indirectDiffuse *= diffuseColor.rgb; + vec3 outgoingLight = reflectedLight.indirectDiffuse; + #include + #include + #include + #include + #include + #include + #include +}`,meshlambert_vert:`#define LAMBERT +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshlambert_frag:`#define LAMBERT +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshmatcap_vert:`#define MATCAP +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; +}`,meshmatcap_frag:`#define MATCAP +uniform vec3 diffuse; +uniform float opacity; +uniform sampler2D matcap; +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 viewDir = normalize( vViewPosition ); + vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); + vec3 y = cross( viewDir, x ); + vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; + #ifdef USE_MATCAP + vec4 matcapColor = texture2D( matcap, uv ); + #else + vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); + #endif + vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; + #include + #include + #include + #include + #include + #include +}`,meshnormal_vert:`#define NORMAL +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + vViewPosition = - mvPosition.xyz; +#endif +}`,meshnormal_frag:`#define NORMAL +uniform float opacity; +#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) + varying vec3 vViewPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); + #include + #include + #include + #include + gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); + #ifdef OPAQUE + gl_FragColor.a = 1.0; + #endif +}`,meshphong_vert:`#define PHONG +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include + #include +}`,meshphong_frag:`#define PHONG +uniform vec3 diffuse; +uniform vec3 emissive; +uniform vec3 specular; +uniform float shininess; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include + #include +}`,meshphysical_vert:`#define STANDARD +varying vec3 vViewPosition; +#ifdef USE_TRANSMISSION + varying vec3 vWorldPosition; +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +#ifdef USE_TRANSMISSION + vWorldPosition = worldPosition.xyz; +#endif +}`,meshphysical_frag:`#define STANDARD +#ifdef PHYSICAL + #define IOR + #define USE_SPECULAR +#endif +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float roughness; +uniform float metalness; +uniform float opacity; +#ifdef IOR + uniform float ior; +#endif +#ifdef USE_SPECULAR + uniform float specularIntensity; + uniform vec3 specularColor; + #ifdef USE_SPECULAR_COLORMAP + uniform sampler2D specularColorMap; + #endif + #ifdef USE_SPECULAR_INTENSITYMAP + uniform sampler2D specularIntensityMap; + #endif +#endif +#ifdef USE_CLEARCOAT + uniform float clearcoat; + uniform float clearcoatRoughness; +#endif +#ifdef USE_DISPERSION + uniform float dispersion; +#endif +#ifdef USE_IRIDESCENCE + uniform float iridescence; + uniform float iridescenceIOR; + uniform float iridescenceThicknessMinimum; + uniform float iridescenceThicknessMaximum; +#endif +#ifdef USE_SHEEN + uniform vec3 sheenColor; + uniform float sheenRoughness; + #ifdef USE_SHEEN_COLORMAP + uniform sampler2D sheenColorMap; + #endif + #ifdef USE_SHEEN_ROUGHNESSMAP + uniform sampler2D sheenRoughnessMap; + #endif +#endif +#ifdef USE_ANISOTROPY + uniform vec2 anisotropyVector; + #ifdef USE_ANISOTROPYMAP + uniform sampler2D anisotropyMap; + #endif +#endif +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; + vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; + #include + vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; + #ifdef USE_SHEEN + float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); + outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; + #endif + #ifdef USE_CLEARCOAT + float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); + vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); + outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; + #endif + #include + #include + #include + #include + #include + #include +}`,meshtoon_vert:`#define TOON +varying vec3 vViewPosition; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vViewPosition = - mvPosition.xyz; + #include + #include + #include +}`,meshtoon_frag:`#define TOON +uniform vec3 diffuse; +uniform vec3 emissive; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); + vec3 totalEmissiveRadiance = emissive; + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; + #include + #include + #include + #include + #include + #include +}`,points_vert:`uniform float size; +uniform float scale; +#include +#include +#include +#include +#include +#include +#ifdef USE_POINTS_UV + varying vec2 vUv; + uniform mat3 uvTransform; +#endif +void main() { + #ifdef USE_POINTS_UV + vUv = ( uvTransform * vec3( uv, 1 ) ).xy; + #endif + #include + #include + #include + #include + #include + #include + gl_PointSize = size; + #ifdef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); + #endif + #include + #include + #include + #include +}`,points_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include + #include +}`,shadow_vert:`#include +#include +#include +#include +#include +#include +#include +void main() { + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include +}`,shadow_frag:`uniform vec3 color; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + #include + gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); + #include + #include + #include +}`,sprite_vert:`uniform float rotation; +uniform vec2 center; +#include +#include +#include +#include +#include +void main() { + #include + vec4 mvPosition = modelViewMatrix[ 3 ]; + vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); + #ifndef USE_SIZEATTENUATION + bool isPerspective = isPerspectiveMatrix( projectionMatrix ); + if ( isPerspective ) scale *= - mvPosition.z; + #endif + vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; + vec2 rotatedPosition; + rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; + rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; + mvPosition.xy += rotatedPosition; + gl_Position = projectionMatrix * mvPosition; + #include + #include + #include +}`,sprite_frag:`uniform vec3 diffuse; +uniform float opacity; +#include +#include +#include +#include +#include +#include +#include +#include +#include +void main() { + vec4 diffuseColor = vec4( diffuse, opacity ); + #include + vec3 outgoingLight = vec3( 0.0 ); + #include + #include + #include + #include + #include + outgoingLight = diffuseColor.rgb; + #include + #include + #include + #include +}`},X={common:{diffuse:{value:new Y(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new sx},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new sx}},envmap:{envMap:{value:null},envMapRotation:{value:new sx},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new sx}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new sx}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new sx},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new sx},normalScale:{value:new rx(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new sx},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new sx}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new sx}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new sx}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new Y(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new Y(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0},uvTransform:{value:new sx}},sprite:{diffuse:{value:new Y(16777215)},opacity:{value:1},center:{value:new rx(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new sx},alphaMap:{value:null},alphaMapTransform:{value:new sx},alphaTest:{value:0}}},bE={basic:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.fog]),vertexShader:yE.meshbasic_vert,fragmentShader:yE.meshbasic_frag},lambert:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.fog,X.lights,{emissive:{value:new Y(0)}}]),vertexShader:yE.meshlambert_vert,fragmentShader:yE.meshlambert_frag},phong:{uniforms:FC([X.common,X.specularmap,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.fog,X.lights,{emissive:{value:new Y(0)},specular:{value:new Y(1118481)},shininess:{value:30}}]),vertexShader:yE.meshphong_vert,fragmentShader:yE.meshphong_frag},standard:{uniforms:FC([X.common,X.envmap,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.roughnessmap,X.metalnessmap,X.fog,X.lights,{emissive:{value:new Y(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:yE.meshphysical_vert,fragmentShader:yE.meshphysical_frag},toon:{uniforms:FC([X.common,X.aomap,X.lightmap,X.emissivemap,X.bumpmap,X.normalmap,X.displacementmap,X.gradientmap,X.fog,X.lights,{emissive:{value:new Y(0)}}]),vertexShader:yE.meshtoon_vert,fragmentShader:yE.meshtoon_frag},matcap:{uniforms:FC([X.common,X.bumpmap,X.normalmap,X.displacementmap,X.fog,{matcap:{value:null}}]),vertexShader:yE.meshmatcap_vert,fragmentShader:yE.meshmatcap_frag},points:{uniforms:FC([X.points,X.fog]),vertexShader:yE.points_vert,fragmentShader:yE.points_frag},dashed:{uniforms:FC([X.common,X.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:yE.linedashed_vert,fragmentShader:yE.linedashed_frag},depth:{uniforms:FC([X.common,X.displacementmap]),vertexShader:yE.depth_vert,fragmentShader:yE.depth_frag},normal:{uniforms:FC([X.common,X.bumpmap,X.normalmap,X.displacementmap,{opacity:{value:1}}]),vertexShader:yE.meshnormal_vert,fragmentShader:yE.meshnormal_frag},sprite:{uniforms:FC([X.sprite,X.fog]),vertexShader:yE.sprite_vert,fragmentShader:yE.sprite_frag},background:{uniforms:{uvTransform:{value:new sx},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:yE.background_vert,fragmentShader:yE.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new sx}},vertexShader:yE.backgroundCube_vert,fragmentShader:yE.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:yE.cube_vert,fragmentShader:yE.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:yE.equirect_vert,fragmentShader:yE.equirect_frag},distanceRGBA:{uniforms:FC([X.common,X.displacementmap,{referencePosition:{value:new q},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:yE.distanceRGBA_vert,fragmentShader:yE.distanceRGBA_frag},shadow:{uniforms:FC([X.lights,X.fog,{color:{value:new Y(0)},opacity:{value:1}}]),vertexShader:yE.shadow_vert,fragmentShader:yE.shadow_frag}};bE.physical={uniforms:FC([bE.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new sx},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new sx},clearcoatNormalScale:{value:new rx(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new sx},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new sx},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new sx},sheen:{value:0},sheenColor:{value:new Y(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new sx},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new sx},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new sx},transmissionSamplerSize:{value:new rx},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new sx},attenuationDistance:{value:0},attenuationColor:{value:new Y(0)},specularColor:{value:new Y(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new sx},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new sx},anisotropyVector:{value:new rx},anisotropyMap:{value:null},anisotropyMapTransform:{value:new sx}}]),vertexShader:yE.meshphysical_vert,fragmentShader:yE.meshphysical_frag};var xE={r:0,b:0,g:0},SE=new vS,lte=new J;function ute(e,t,n,r,i,a,o){let s=new Y(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new AC(new NC(1,1,1),new VC({name:`BackgroundCubeMaterial`,uniforms:PC(bE.backgroundCube.uniforms),vertexShader:bE.backgroundCube.vertexShader,fragmentShader:bE.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),SE.copy(n.backgroundRotation),SE.x*=-1,SE.y*=-1,SE.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(SE.y*=-1,SE.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(lte.makeRotationFromEuler(SE)),u.material.toneMapped=bx.getTransfer(r.colorSpace)!==Tb,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new AC(new Qw(2,2),new VC({name:`BackgroundMaterial`,uniforms:PC(bE.background.uniforms),vertexShader:bE.background.vertexShader,fragmentShader:bE.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=bx.getTransfer(r.colorSpace)!==Tb,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(xE,LC(e)),r.buffers.color.setClear(xE.r,xE.g,xE.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function dte(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function TE(e){let t=this,n=null,r=0,i=!1,a=!1,o=new Dw,s=new sx,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new ZC(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var DE=4,OE=[.125,.215,.35,.446,.526,.582],kE=20,AE=new UT,jE=new Y,ME=null,NE=0,PE=0,FE=!1,IE=(1+Math.sqrt(5))/2,LE=1/IE,RE=[new q(-IE,LE,0),new q(IE,LE,0),new q(-LE,0,IE),new q(LE,0,IE),new q(0,IE,-LE),new q(0,IE,LE),new q(-1,1,-1),new q(1,1,-1),new q(-1,1,1),new q(1,1,1)],zE=new q,BE=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=zE}=i;ME=this._renderer.getRenderTarget(),NE=this._renderer.getActiveCubeFace(),PE=this._renderer.getActiveMipmapLevel(),FE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=KE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=GE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=KE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=GE());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new AC(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;UE(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,AE)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;tkE&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${kE}`);let h=[],g=0;for(let e=0;e_-DE?r-_+DE:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,AE)}};function VE(e){let t=[],n=[],r=[],i=e,a=e-DE+1+OE.length;for(let o=0;oe-DE?s=OE[o-e+DE-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new vC;h.setAttribute(`position`,new sC(f,3)),h.setAttribute(`uv`,new sC(p,2)),h.setAttribute(`faceIndex`,new sC(m,1)),t.push(h),i>DE&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function HE(e,t,n){let r=new Nx(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function UE(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function WE(e,t,n){let r=new Float32Array(kE),i=new q(0,1,0);return new VC({name:`SphericalGaussianBlur`,defines:{n:kE,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:qE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + uniform int samples; + uniform float weights[ n ]; + uniform bool latitudinal; + uniform float dTheta; + uniform float mipInt; + uniform vec3 poleAxis; + + #define ENVMAP_TYPE_CUBE_UV + #include + + vec3 getSample( float theta, vec3 axis ) { + + float cosTheta = cos( theta ); + // Rodrigues' axis-angle rotation + vec3 sampleDirection = vOutputDirection * cosTheta + + cross( axis, vOutputDirection ) * sin( theta ) + + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); + + return bilinearCubeUV( envMap, sampleDirection, mipInt ); + + } + + void main() { + + vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); + + if ( all( equal( axis, vec3( 0.0 ) ) ) ) { + + axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); + + } + + axis = normalize( axis ); + + gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); + gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); + + for ( int i = 1; i < n; i++ ) { + + if ( i >= samples ) { + + break; + + } + + float theta = dTheta * float( i ); + gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); + gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); + + } + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function GE(){return new VC({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:qE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + varying vec3 vOutputDirection; + + uniform sampler2D envMap; + + #include + + void main() { + + vec3 outputDirection = normalize( vOutputDirection ); + vec2 uv = equirectUv( outputDirection ); + + gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function KE(){return new VC({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:qE(),fragmentShader:` + + precision mediump float; + precision mediump int; + + uniform float flipEnvMap; + + varying vec3 vOutputDirection; + + uniform samplerCube envMap; + + void main() { + + gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); + + } + `,blending:0,depthTest:!1,depthWrite:!1})}function qE(){return` + + precision mediump float; + precision mediump int; + + attribute float faceIndex; + + varying vec3 vOutputDirection; + + // RH coordinate system; PMREM face-indexing convention + vec3 getDirection( vec2 uv, float face ) { + + uv = 2.0 * uv - 1.0; + + vec3 direction = vec3( uv, 1.0 ); + + if ( face == 0.0 ) { + + direction = direction.zyx; // ( 1, v, u ) pos x + + } else if ( face == 1.0 ) { + + direction = direction.xzy; + direction.xz *= -1.0; // ( -u, 1, -v ) pos y + + } else if ( face == 2.0 ) { + + direction.x *= -1.0; // ( -u, v, 1 ) pos z + + } else if ( face == 3.0 ) { + + direction = direction.zyx; + direction.xz *= -1.0; // ( -1, v, -u ) neg x + + } else if ( face == 4.0 ) { + + direction = direction.xzy; + direction.xy *= -1.0; // ( -u, -1, v ) neg y + + } else if ( face == 5.0 ) { + + direction.z *= -1.0; // ( u, v, -1 ) neg z + + } + + return direction; + + } + + void main() { + + vOutputDirection = getDirection( uv, faceIndex ); + gl_Position = vec4( position, 1.0 ); + + } + `}function JE(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new BE(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new BE(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function YE(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&px(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function XE(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new Px(h,p,m,u);g.type=yy,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=oD[i];if(a===void 0&&(a=new Float32Array(i),oD[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function fD(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` +`)}var fO=new sx;function pO(e){bx._getMatrix(fO,bx.workingColorSpace,e);let t=`mat3( ${fO.elements.map(e=>e.toFixed(4))} )`;switch(bx.getTransfer(e)){case wb:return[t,`LinearTransferOETF`];case Tb:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function mO(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` + +`+i+` + +`+dO(e.getShaderSource(t),r)}else return i}function hO(e,t){let n=pO(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` +`)}function gO(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var _O=new q;function vO(){return bx.getLuminanceCoefficients(_O),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${_O.x.toFixed(4)}, ${_O.y.toFixed(4)}, ${_O.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` +`)}function yO(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(SO).join(` +`)}function bO(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` +`)}function xO(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function EO(e){return e.replace(TO,OO)}var DO=new Map;function OO(e,t){let n=yE[t];if(n===void 0){let e=DO.get(t);if(e!==void 0)n=yE[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return EO(n)}var kO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function AO(e){return e.replace(kO,jO)}function jO(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` +`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(SO).join(` +`),_.length>0&&(_+=` +`)):(g=[MO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` +`].filter(SO).join(` +`),_=[MO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:yE.tonemapping_pars_fragment,n.toneMapping===0?``:gO(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,yE.colorspace_pars_fragment,hO(`linearToOutputTexel`,n.outputColorSpace),vO(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` +`].filter(SO).join(` +`)),o=EO(o),o=CO(o,n),o=wO(o,n),s=EO(s),s=CO(s,n),s=wO(s,n),o=AO(o),s=AO(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es +`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` +`)+` +`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` +`)+` +`+_);let y=v+g+o,b=v+_+s,x=cO(i,i.VERTEX_SHADER,y),S=cO(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=mO(i,x,`vertex`),r=mO(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` + +Material Name: `+t.name+` +Material Type: `+t.type+` + +Program Info Log: `+n+` +`+e+` +`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new sO(i,h),T=xO(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,lO)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=uO++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var zO=0,BO=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new VO(e),t.set(e,n)),n}},VO=class{constructor(e){this.id=zO++,this.code=e,this.usedTimes=0}};function HO(e,t,n,r,i,a,o){let s=new yS,c=new BO,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=bE[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,I=!!a.matcap,ee=!!x,te=!!a.aoMap,ne=!!a.lightMap,re=!!a.bumpMap,ie=!!a.normalMap,ae=!!a.displacementMap,oe=!!a.emissiveMap,se=!!a.metalnessMap,ce=!!a.roughnessMap,le=a.anisotropy>0,ue=a.clearcoat>0,de=a.dispersion>0,L=a.iridescence>0,fe=a.sheen>0,pe=a.transmission>0,me=le&&!!a.anisotropyMap,R=ue&&!!a.clearcoatMap,he=ue&&!!a.clearcoatNormalMap,z=ue&&!!a.clearcoatRoughnessMap,ge=L&&!!a.iridescenceMap,_e=L&&!!a.iridescenceThicknessMap,ve=fe&&!!a.sheenColorMap,ye=fe&&!!a.sheenRoughnessMap,be=!!a.specularMap,xe=!!a.specularColorMap,Se=!!a.specularIntensityMap,Ce=pe&&!!a.transmissionMap,we=pe&&!!a.thicknessMap,Te=!!a.gradientMap,Ee=!!a.alphaMap,De=a.alphaTest>0,Oe=!!a.alphaHash,ke=!!a.extensions,Ae=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ae=e.toneMapping);let je={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:Cb,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:ie,displacementMap:f&&ae,emissiveMap:oe,normalMapObjectSpace:ie&&a.normalMapType===1,normalMapTangentSpace:ie&&a.normalMapType===0,metalnessMap:se,roughnessMap:ce,anisotropy:le,anisotropyMap:me,clearcoat:ue,clearcoatMap:R,clearcoatNormalMap:he,clearcoatRoughnessMap:z,dispersion:de,iridescence:L,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:fe,sheenColorMap:ve,sheenRoughnessMap:ye,specularMap:be,specularColorMap:xe,specularIntensityMap:Se,transmission:pe,transmissionMap:Ce,thicknessMap:we,gradientMap:Te,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:Ee,alphaTest:De,alphaHash:Oe,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:te&&h(a.aoMap.channel),lightMapUv:ne&&h(a.lightMap.channel),bumpMapUv:re&&h(a.bumpMap.channel),normalMapUv:ie&&h(a.normalMap.channel),displacementMapUv:ae&&h(a.displacementMap.channel),emissiveMapUv:oe&&h(a.emissiveMap.channel),metalnessMapUv:se&&h(a.metalnessMap.channel),roughnessMapUv:ce&&h(a.roughnessMap.channel),anisotropyMapUv:me&&h(a.anisotropyMap.channel),clearcoatMapUv:R&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:he&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:z&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ve&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:ye&&h(a.sheenRoughnessMap.channel),specularMapUv:be&&h(a.specularMap.channel),specularColorMapUv:xe&&h(a.specularColorMap.channel),specularIntensityMapUv:Se&&h(a.specularIntensityMap.channel),transmissionMapUv:Ce&&h(a.transmissionMap.channel),thicknessMapUv:we&&h(a.thicknessMap.channel),alphaMapUv:Ee&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ie||le),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||Ee),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ae,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&bx.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:oe&&a.emissiveMap.isVideoTexture===!0&&bx.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ke&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(ke&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return je.vertexUv1s=l.has(1),je.vertexUv2s=l.has(2),je.vertexUv3s=l.has(3),l.clear(),je}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=bE[t];n=RC.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||WO),r.length>1&&r.sort(t||GO),i.length>1&&i.sort(t||GO)}function u(){for(let n=t,r=e.length;n=r.length?(i=new KO,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function JO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new q,color:new Y};break;case`SpotLight`:n={position:new q,direction:new q,color:new Y,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new q,color:new Y,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new q,skyColor:new Y,groundColor:new Y};break;case`RectAreaLight`:n={color:new Y,position:new q,halfWidth:new q,halfHeight:new q};break}return e[t.id]=n,n}}}function YO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new rx,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var XO=0;function ZO(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function QO(e){let t=new JO,n=YO(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new q);let i=new q,a=new J,o=new J;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(ZO);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=X.LTC_FLOAT_1,r.rectAreaLTC2=X.LTC_FLOAT_2):(r.rectAreaLTC1=X.LTC_HALF_1,r.rectAreaLTC2=X.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=XO++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new $O(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var tk=`void main() { + gl_Position = vec4( position, 1.0 ); +}`,nk=`uniform sampler2D shadow_pass; +uniform vec2 resolution; +uniform float radius; +#include +void main() { + const float samples = float( VSM_SAMPLES ); + float mean = 0.0; + float squared_mean = 0.0; + float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); + float uvStart = samples <= 1.0 ? 0.0 : - 1.0; + for ( float i = 0.0; i < samples; i ++ ) { + float uvOffset = uvStart + i * uvStride; + #ifdef HORIZONTAL_PASS + vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); + mean += distribution.x; + squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; + #else + float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); + mean += depth; + squared_mean += depth * depth; + #endif + } + mean = mean / samples; + squared_mean = squared_mean / samples; + float std_dev = sqrt( squared_mean - mean * mean ); + gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); +}`;function rk(e,t,n){let r=new Aw,i=new rx,a=new rx,o=new jx,s=new ate({depthPacking:xb}),c=new ote,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new VC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new rx},radius:{value:4}},vertexShader:tk,fragmentShader:nk}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new vC;m.setAttribute(`position`,new sC(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new AC(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:sy,magFilter:sy};d.map!==null&&d.map.dispose(),d.map=new Nx(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,I={},ee=e.getParameter(e.SCISSOR_BOX),te=e.getParameter(e.VIEWPORT),ne=new jx().fromArray(ee),re=new jx().fromArray(te);function ie(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new rx,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):ux(`canvas`)}function h(e,t,n){let r=1,i=ve(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?wb:bx.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&ge(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{ae(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[iy]:e.REPEAT,[ay]:e.CLAMP_TO_EDGE,[oy]:e.MIRRORED_REPEAT},I={[sy]:e.NEAREST,[cy]:e.NEAREST_MIPMAP_NEAREST,[ly]:e.NEAREST_MIPMAP_LINEAR,[uy]:e.LINEAR,[dy]:e.LINEAR_MIPMAP_NEAREST,[fy]:e.LINEAR_MIPMAP_LINEAR},ee={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function te(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,I[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,I[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ee[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ne(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function re(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ie(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=hE(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=hE(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ve(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ve(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,he(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function ce(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=he(n);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?le(i.__webglFramebuffer[0],t):le(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),ce(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),ce(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function de(t,n,i){let a=r.get(t);n!==void 0&&se(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&ue(t)}function L(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ge(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function _e(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(bx.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ve(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=de,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=R,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=se,this.useMultisampledRTT=z}function sk(e,t){function n(n,r=``){let i,a=bx.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var ck=` +void main() { + + gl_Position = vec4( position, 1.0 ); + +}`,lk=` +uniform sampler2DArray depthColor; +uniform float depthWidth; +uniform float depthHeight; + +void main() { + + vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); + + if ( coord.x >= 1.0 ) { + + gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; + + } else { + + gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; + + } + +}`,uk=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new Ax,i=e.properties.get(r);i.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new VC({vertexShader:ck,fragmentShader:lk,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new AC(new Qw(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},dk=class extends kb{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new uk,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new rx,x=null,S=new KC;S.viewport=new jx;let C=new KC;C.viewport=new jx;let w=[S,C],T=new XT,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new ew,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new q,M=new q;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,fk.copy(o),fk.x*=-1,fk.y*=-1,fk.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(fk.y*=-1,fk.z*=-1),e.envMapRotation.value.setFromMatrix4(pk.makeRotationFromEuler(fk)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function fte(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var pte=class{constructor(e={}){let{canvas:t=dx(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=Sb;let x=0,S=0,C=null,w=-1,T=null,E=new jx,D=new jx,O=null,k=new Y(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,I=new jx(0,0,j,M),ee=new jx(0,0,j,M),te=!1,ne=new Aw,re=!1,ie=!1,ae=new J,oe=new J,se=new q,ce=new jx,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ue=!1;function de(){return C===null?N:1}let L=n;function fe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Le,!1),t.addEventListener(`webglcontextrestored`,Re,!1),t.addEventListener(`webglcontextcreationerror`,ze,!1),L===null){let t=`webgl2`;if(L=fe(t,e),L===null)throw fe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let pe,me,R,he,z,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe;function Fe(){pe=new YE(L),pe.init(),Me=new sk(L,pe),me=new wE(L,pe,e,Me),R=new ak(L,pe),me.reverseDepthBuffer&&d&&R.buffers.depth.setReversed(!0),he=new QE(L),z=new UO,ge=new ok(L,pe,R,z,me,Me,he),_e=new EE(y),ve=new JE(y),ye=new vE(L),Ne=new dte(L,ye),be=new XE(L,ye,he,Ne),xe=new eD(L,be,ye,he),ke=new $E(L,me,ge),Ee=new TE(z),Se=new HO(y,_e,ve,pe,me,Ne,Ee),Ce=new mk(y,z),we=new qO,Te=new ek(pe),Oe=new ute(y,_e,ve,R,xe,f,s),De=new rk(y,xe,me),Pe=new fte(L,he,me,R),Ae=new CE(L,pe,he),je=new ZE(L,pe,he),he.programs=Se.programs,y.capabilities=me,y.extensions=pe,y.properties=z,y.renderLists=we,y.shadowMap=De,y.state=R,y.info=he}Fe();let Ie=new dk(y,L);this.xr=Ie,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Ie.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),R.viewport(E.copy(I).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(ee)},this.setScissor=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),R.scissor(D.copy(ee).multiplyScalar(N).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(e){R.setScissorTest(te=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=Oe.getClearColor(),r=Oe.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,L.clearBufferuiv(L.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,L.clearBufferiv(L.COLOR,0,m))}else r|=L.COLOR_BUFFER_BIT}t&&(r|=L.DEPTH_BUFFER_BIT),n&&(r|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Le,!1),t.removeEventListener(`webglcontextrestored`,Re,!1),t.removeEventListener(`webglcontextcreationerror`,ze,!1),Oe.dispose(),we.dispose(),Te.dispose(),z.dispose(),_e.dispose(),ve.dispose(),xe.dispose(),Ne.dispose(),Pe.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener(`sessionstart`,Ke),Ie.removeEventListener(`sessionend`,qe),Je.stop()};function Le(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function Re(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=he.autoReset,t=De.enabled,n=De.autoUpdate,r=De.needsUpdate,i=De.type;Fe(),he.autoReset=e,De.enabled=t,De.autoUpdate=n,De.needsUpdate=r,De.type=i}function ze(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Be(e){let t=e.target;t.removeEventListener(`dispose`,Be),Ve(t)}function Ve(e){He(e),z.remove(e)}function He(e){let t=z.get(e).programs;t!==void 0&&(t.forEach(function(e){Se.releaseProgram(e)}),e.isShaderMaterial&&Se.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=le);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=rt(e,t,n,r,i);R.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=be.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ne.setup(i,r,s,n,c);let h,g=Ae;if(c!==null&&(h=ye.get(c),g=je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(R.setLineWidth(r.wireframeLinewidth*de()),g.setMode(L.LINES)):g.setMode(L.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),R.setLineWidth(e*de()),i.isLineSegments?g.setMode(L.LINES):i.isLineLoop?g.setMode(L.LINE_LOOP):g.setMode(L.LINE_STRIP)}else i.isPoints?g.setMode(L.POINTS):i.isSprite&&g.setMode(L.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)px(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(pe.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?ye.get(c).bytesPerElement:1,o=z.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){z.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}pe.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let We=null;function Ge(e){We&&We(e)}function Ke(){Je.stop()}function qe(){Je.start()}let Je=new _E;Je.setAnimationLoop(Ge),typeof self<`u`&&Je.setContext(self),this.setAnimationLoop=function(e){We=e,Ie.setAnimationLoop(e),e===null?Je.stop():Je.start()},Ie.addEventListener(`sessionstart`,Ke),Ie.addEventListener(`sessionend`,qe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(t),t=Ie.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Te.get(e,v.length),g.init(t),v.push(g),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ne.setFromProjectionMatrix(oe),ie=this.localClippingEnabled,re=Ee.init(this.clippingPlanes,ie),h=we.get(e,_.length),h.init(),_.push(h),Ie.enabled===!0&&Ie.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Ye(e,t,-1/0,y.sortObjects)}Ye(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),ue=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ue&&Oe.addToRenderList(h,e),this.info.render.frame++,re===!0&&Ee.beginShadows();let n=g.state.shadowsArray;De.render(n,e,t),re===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Ze(r,i,e,t),ue&&Oe.render(e),Xe(h,e,t);C!==null&&S===0&&(ge.updateMultisampleRenderTarget(C),ge.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Ne.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],re===!0&&Ee.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Ye(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ne.intersectsSprite(e)){r&&ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);let t=xe.update(e),i=e.material;i.visible&&h.push(e,t,i,n,ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ne.intersectsObject(e))){let t=xe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ce.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ce.copy(e.boundingSphere.center)),ce.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&Qe(i,t,n),a.length>0&&Qe(a,t,n),o.length>0&&Qe(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function Ze(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new Nx(1,1,{generateMipmaps:!0,type:pe.has(`EXT_color_buffer_half_float`)||pe.has(`EXT_color_buffer_float`)?by:py,minFilter:fy,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:bx.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),ue&&Oe.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),re===!0&&Ee.setGlobalState(y.clippingPlanes,r),Qe(e,n,r),ge.updateMultisampleRenderTarget(a),ge.updateRenderTargetMipmap(a),pe.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=z.get(r),b=g.state.lights;if(re===!0&&(ie===!0||e!==T)){let t=e===T&&r.id===w;Ee.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ee.numPlanes||v.numIntersection!==Ee.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=et(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(R.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){R.buffers.depth.getReversed()?(ae.copy(e.projectionMatrix),hx(ae),gx(ae),k.setValue(L,`projectionMatrix`,ae)):k.setValue(L,`projectionMatrix`,e.projectionMatrix),k.setValue(L,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(L,se.setFromMatrixPosition(e.matrixWorld)),me.logarithmicDepthBuffer&&k.setValue(L,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(L,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(L,i,`bindMatrix`),k.setOptional(L,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(L,`boneTexture`,e.boneTexture,ge))}i.isBatchedMesh&&(k.setOptional(L,i,`batchingTexture`),k.setValue(L,`batchingTexture`,i._matricesTexture,ge),k.setOptional(L,i,`batchingIdTexture`),k.setValue(L,`batchingIdTexture`,i._indirectTexture,ge),k.setOptional(L,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(L,`batchingColorTexture`,i._colorsTexture,ge));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&ke.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(L,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(L,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&it(A,O),a&&r.fog===!0&&Ce.refreshFogUniforms(A,a),Ce.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),sO.upload(L,tt(v),A,ge)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(sO.upload(L,tt(v),A,ge),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(L,`center`,i.center),k.setValue(L,`modelViewMatrix`,i.modelViewMatrix),k.setValue(L,`normalMatrix`,i.normalMatrix),k.setValue(L,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&ge.useMultisampledRTT(e)===!1?z.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(I).multiplyScalar(N).floor(),D.copy(ee).multiplyScalar(N).floor(),O=te;if(n!==0&&(i=ot),R.bindFramebuffer(L.FRAMEBUFFER,i)&&r&&R.drawBuffers(e,i),R.viewport(E),R.scissor(D),R.setScissorTest(O),a){let r=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=z.get(e.texture),i=t;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){R.bindFramebuffer(L.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!me.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!me.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(c),Me.convert(l),a))}finally{let e=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(L.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.bufferData(L.PIXEL_PACK_BUFFER,a.byteLength,L.STREAM_READ),e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(l),Me.convert(u),0);let f=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,f);let p=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await mx(L,p,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,a),L.deleteBuffer(d),L.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;ge.setTexture2D(e,0),L.copyTexSubImage2D(L.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let st=L.createFramebuffer(),ct=L.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:(px(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Me.convert(t.format),_=Me.convert(t.type),v;t.isData3DTexture?(ge.setTexture3D(t,0),v=L.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ge.setTexture2DArray(t,0),v=L.TEXTURE_2D_ARRAY):(ge.setTexture2D(t,0),v=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,t.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,t.unpackAlignment);let y=L.getParameter(L.UNPACK_ROW_LENGTH),b=L.getParameter(L.UNPACK_IMAGE_HEIGHT),x=L.getParameter(L.UNPACK_SKIP_PIXELS),S=L.getParameter(L.UNPACK_SKIP_ROWS),C=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,h.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,h.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,l),L.pixelStorei(L.UNPACK_SKIP_ROWS,u),L.pixelStorei(L.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=z.get(e),r=z.get(t),h=z.get(n.__renderTarget),g=z.get(r.__renderTarget);R.bindFramebuffer(L.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(L.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=xk),r<-Math.PI?r+=xk:r>Math.PI&&(r-=xk),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(bk.setFromSpherical(this._spherical),bk.applyQuaternion(this._quatInverse),t.copy(this.target).add(bk),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=bk.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new q(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new q(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=bk.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(vk.origin.copy(this.object.position),vk.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(vk.direction))Ck||8*(1-this._lastQuaternion.dot(this.object.quaternion))>Ck||this._lastTargetPosition.distanceToSquared(this.target)>Ck?(this.dispatchEvent(hk),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?xk/60/60*this.autoRotateSpeed:xk/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){bk.setFromMatrixColumn(t,0),bk.multiplyScalar(-e),this._panOffset.add(bk)}_panUp(e,t){this.screenSpacePanning===!0?bk.setFromMatrixColumn(t,1):(bk.setFromMatrixColumn(t,0),bk.crossVectors(this.object.up,bk)),bk.multiplyScalar(e),this._panOffset.add(bk)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;bk.copy(r).sub(this.target);let i=bk.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(xk*this._rotateDelta.x/t.clientHeight),this._rotateUp(xk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-xk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(xk*this._rotateDelta.x/t.clientHeight),this._rotateUp(xk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,Sb),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new sC(p,3)),f.setAttribute(`normal`,new sC(m,3)),o&&(f.setAttribute(`color`,new sC(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new vC,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new q,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new uC(c,3)),t.setAttribute(`normal`,new uC(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:fy}}},Nk=class extends CT{load(e,t,n,r){let i=this,a=i.path===``?qT.extractUrlBase(e):i.path,o=new ET(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new gT(r+`.position`,i,a)),o.length>0&&t.push(new mT(r+`.quaternion`,i,o)),s.length>0&&t.push(new gT(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=Ft;break;default:t=Pt}return t}function Se(e){let t=ye(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new tT;break;case`lambert`:r=new ite;break;default:r=new rC;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=oe(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=oe(e.id);if(i!==null){let t=xe(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?iy:ay,r.wrapT=e.wrapV?iy:ay,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=iy,r.wrapT=iy;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,Sb));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,Sb));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,Sb));break}}bx.colorSpaceToWorking(r.color,Sb),r.specular&&bx.colorSpaceToWorking(r.specular,Sb),r.emissive&&bx.colorSpaceToWorking(r.emissive,Sb);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new rx(1,1);break}}}return r}function Ce(e){return m(B.materials[e],Se)}function we(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function ze(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new uC(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new uC(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new uC(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new uC(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new uC(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new uC(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new uC(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function Ue(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Ze(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||te===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),Pk.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(Pk,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],Lk.compose(this.origPosition,this.origQuaternion,zk),Rk.setFromEuler(Fk.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),Bk.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Ik.compose(Bk,Rk,zk),Lk.premultiply(Ik),this.position.setFromMatrixPosition(Lk),this.rotation.setFromRotationMatrix(Lk),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],Lk.compose(this.origPosition,this.origQuaternion,zk),Rk.setFromAxisAngle(this.axis,this.jointValue[2]),Bk.set(this.jointValue[0],this.jointValue[1],0),Ik.compose(Bk,Rk,zk),Lk.premultiply(Ik),this.position.setFromMatrixPosition(Lk),this.rotation.setFromRotationMatrix(Lk),this.matrixWorldNeedsUpdate=!0,!0)}return t}},Kk=class extends Gk{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},qk=class extends Wk{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},Jk=new ix,Yk=new vS;function Xk(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Zk(e,t,n=!1){n||e.rotation.set(0,0,0),Yk.set(t[0],t[1],t[2],`ZYX`),Jk.setFromEuler(Yk),Jk.multiply(e.quaternion),e.quaternion.copy(Jk)}var Qk=class{constructor(e){this.manager=e||ST,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=qT.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new qk;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof Kk&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new Kk,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new Gk,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=Xk(e.getAttribute(`xyz`)),l=Xk(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),Zk(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new q(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new Wk);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=Xk(e.getAttribute(`xyz`)),r.inertial.origin.rpy=Xk(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new tT;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new kT(o),r=u(t);n.map=e.load(r),n.map.colorSpace=Sb}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new tT;let c=n?new Hk:new Uk;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=Xk(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof AC&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new AC;t.geometry=new NC(1,1,1),t.material=a;let n=Xk(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new AC;t.geometry=new nte(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new AC;t.geometry=new tte(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=Xk(e.getAttribute(`xyz`)),n=Xk(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),Zk(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new jk(t).load(e,e=>{n(new AC(e,new tT))},null,e=>n(null,e)):/\.dae$/i.test(e)?new Nk(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},$k=new rx,eA=()=>{},tA=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new tw,t=new jT(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new GT(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new pte({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=Sb;let i=new KC(75,1,.1,1e3);i.position.z=-10;let a=new FS;e.add(a);let o=new AC(new Qw(40,40),new rte({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new hte(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new tT({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` + ${this.tagName} { display: block; } + ${this.tagName} canvas { + width: 100%; + height: 100%; + } + `,document.head.appendChild(e),this.constructor._styletag=e}this.childElementCount===0&&this.appendChild(this.renderer.domElement),this.updateSize(),requestAnimationFrame(()=>this.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize($k);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new Ix;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new q);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new eS).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof rC&&(e=new tT),e.map&&(e.map.colorSpace=Sb),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new xT;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new Qk(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=eA,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function nA(e){return e.isURDFJoint&&e.jointType!==`fixed`}function rA(e){let t=e;for(;t;){if(nA(t))return t;t=t.parent}return t}var iA=new q,aA=new q,oA=new q,sA=new q,cA=new q,lA=new q,uA=new q,dA=new Dw,fA=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new uE,this.initialGrabPoint=new q,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=rA(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return sA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),oA.set(0,0,0).applyMatrix4(e.matrixWorld),dA.setFromNormalAndCoplanarPoint(sA,oA),dA.projectPoint(t,lA),dA.projectPoint(n,uA),lA.sub(oA),uA.sub(oA),sA.crossVectors(lA,uA),Math.sign(sA.dot(dA.normal))*uA.angleTo(lA)}getPrismaticDelta(e,t,n){return sA.subVectors(n,t),dA.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),sA.dot(dA.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,iA),e.at(n,aA);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,iA,aA):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,iA,aA)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},pA=class extends fA{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new uE,i=new rx;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return sA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),oA.set(0,0,0).applyMatrix4(e.matrixWorld),dA.setFromNormalAndCoplanarPoint(sA,oA),sA.copy(r.position).sub(i).normalize(),Math.abs(sA.dot(dA.normal))>.3?super.getRevoluteDelta(e,t,n):(sA.set(0,1,0).transformDirection(r.matrixWorld),dA.projectPoint(t,lA),dA.projectPoint(n,uA),sA.set(0,0,-1).transformDirection(r.matrixWorld),sA.cross(dA.normal),cA.subVectors(n,t),sA.dot(cA))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},mA=class extends tA{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new tT({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},hA=1e3,gA=3e4,_A=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=Rs(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(hA),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=hA,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,gA),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},vA=[`light`,`dark`],yA=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?vA.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&vA.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${yA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function bA(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new _j(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function SA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var CA={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},wA=class{constructor(e){this.parser=e,this.name=CA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},RA=class{constructor(e){this.parser=e,this.name=CA.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},zA=class{constructor(e){this.parser=e,this.name=CA.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},BA=class{constructor(e){this.name=CA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},VA=class{constructor(e){this.name=CA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==QA.TRIANGLES&&e.mode!==QA.TRIANGLE_STRIP&&e.mode!==QA.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new J,n=new q,a=new ix,s=new q(1,1,1),c=new Zee(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var gj=new J,_j=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new SA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new kT(this.options.manager):this.textureLoader=new YT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new ET(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return cj(i,a,r),lj(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=ej[n.magFilter]||1006,t.minFilter=ej[n.minFilter]||1008,t.wrapS=tj[n.wrapS]||1e3,t.wrapT=tj[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new Ax(e);t.needsUpdate=!0,n(t)}),t.load(qT.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),lj(e,a),e.userData.mimeType=a.mimeType||hj(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[CA.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[CA.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[CA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Ww,nC.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new jw,nC.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return $w}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[CA.KHR_MATERIALS_UNLIT]){let e=r[CA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new Y(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],Cb),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,Sb)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||oj.OPAQUE;if(l===oj.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===oj.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==rC&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new rx(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==rC&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==rC){let e=i.emissiveFactor;o.emissive=new Y().setRGB(e[0],e[1],e[2],Cb)}return i.emissiveTexture!==void 0&&a!==rC&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,Sb)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),lj(n,i),t.associations.set(n,{materials:e}),i.extensions&&cj(r,n,i),n})}createUniqueName(e){let t=cE.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[CA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return yj(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&dj(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),lj(d,i),u.extensions&&cj(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new QC:t.length===1?t[0]:new FS,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new QC;n.name&&(i.name=r.createUniqueName(n.name)),lj(i,n),n.extensions&&cj(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof nC||e instanceof Ax)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];ij[i.path]===ij.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(ij[i.path]){case ij.weights:c=fT;break;case ij.rotation:c=mT;break;case ij.translation:case ij.scale:c=gT;break;default:switch(n.itemSize){case 1:c=fT;break;default:c=gT;break}break}let l=r.interpolation===void 0?mb:aj[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;Tj.fromArray(r,e),Ej.fromArray(r,t),Dj.fromArray(r,n),kj.subVectors(Dj,Ej),Oj.subVectors(Tj,Ej),kj.cross(Oj),kj.normalize(),i.push(kj.x,kj.y,kj.z),i.push(kj.x,kj.y,kj.z),i.push(kj.x,kj.y,kj.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n=7?(Aj.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),Sb),t.colors.push(Aj.r,Aj.g,Aj.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(wj),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new QC;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new uC(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new uC(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new uC(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new Ww({size:1,sizeAttenuation:!1}),n=new vC;n.setAttribute(`position`,new uC(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new uC(t.colors,3)),e.vertexColors=!0);let r=new Yw(n,e);i.add(r)}return i}},Nj=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new xA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new Mj(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new Nk(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new jk(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new AC(t,new tT))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new AC(new NC(.05,.05,.05),new tT({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}};function Pj(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),Rj(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new KT(14079702,1);n.scene.add(r);let i=new GT(16777215,.8);return i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i),n}function Fj(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{Nj(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function Ij(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function Lj(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),Nn.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function Rj(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,mA);var zj=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=rr(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=_A({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=Pj(e.current,!0);s.current=t,Fj(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=Lj(t,r,m.current,d,i));let p=Ij(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new Ix().setFromObject(e.robot),n=new q;t.getCenter(n);let r=new q;t.getSize(r);let i=Math.max(r.x,r.y,r.z);e.camera.position.copy(n);let a=new q;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,V.jsxs)(`div`,{className:W(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,V.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,V.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,V.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,V.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),Bj=({className:e,iconOnly:t=!1})=>(0,V.jsxs)(`div`,{className:W(`flex items-center gap-2`,e),children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,V.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),Vj=({onGoBack:e,className:t})=>(0,V.jsx)(`div`,{className:W(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,V.jsx)(Ca,{className:`h-5 w-5`})}),(0,V.jsx)(Bj,{iconOnly:!0}),(0,V.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,V.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,V.jsx)(zj,{})})]})}),Hj=()=>{let e=Re(),{toast:t}=_r(),{baseUrl:n,fetchWithHeaders:r}=Rs(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,V.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,V.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,V.jsx)(Vj,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`})})})},Uj=ga(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function Wj({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{className:W(Uj({variant:t}),e),...n})}var Gj=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Kj=`Separator`,qj=`horizontal`,Jj=[`horizontal`,`vertical`],Yj=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=qj,...i}=e,a=Xj(r)?r:qj,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(Gj.div,{"data-orientation":a,...o,...i,ref:t})});Yj.displayName=Kj;function Xj(e){return Jj.includes(e)}var Zj=Yj,Qj=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(Zj,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));Qj.displayName=Zj.displayName;var $j=`Switch`,[eM,xte]=Sr($j),[tM,nM]=eM($j),rM=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=br(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=ui({prop:i,defaultProp:a??!1,onChange:l,caller:$j});return(0,V.jsxs)(tM,{scope:n,checked:v,disabled:s,children:[(0,V.jsx)(U.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":cM(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,V.jsx)(sM,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});rM.displayName=$j;var iM=`SwitchThumb`,aM=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=nM(iM,n);return(0,V.jsx)(U.span,{"data-state":cM(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});aM.displayName=iM;var oM=`SwitchBubbleInput`,sM=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=br(o,a),c=Ah(n),l=Lf(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,V.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});sM.displayName=oM;function cM(e){return e?`checked`:`unchecked`}var lM=rM,uM=aM,dM=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(lM,{className:W(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,V.jsx)(uM,{className:W(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));dM.displayName=lM.displayName;var fM=({onClick:e,robotType:t,className:n=``})=>(0,V.jsxs)(G,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` + h-8 px-2 + border-gray-600 hover:border-blue-500 + text-gray-400 hover:text-blue-400 + bg-gray-800 hover:bg-gray-700 + transition-all duration-200 + ${n} + `,title:`Find ${t||`robot`} port automatically`,children:[(0,V.jsx)(eo,{className:`w-3 h-3 mr-1`}),`Find`]}),pM=2e3,mM=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=_r(),{baseUrl:m,fetchWithHeaders:h}=Rs(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},pM);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,V.jsxs)(Ou,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,V.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(qa,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,V.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(Ma,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,V.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(ja,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,V.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,V.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,V.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,V.jsx)(G,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},hM={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},gM=.98;function _M(e,t,n){if(!e)return!1;let r=hM[e]?.[t];return r?n>=r*gM:!1}var vM=`Motor discontinuity detected`,yM=()=>{let e=Re(),t=Ie().state?.robot_name??null,{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(vM)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),I=e=>{l(e),F(e)},ee=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,V.jsx)(Sa,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,V.jsx)(Ma,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,V.jsx)(Fa,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,V.jsx)(ao,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(Bj,{iconOnly:!0}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,V.jsxs)(cg,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,V.jsxs)(vv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,V.jsxs)(B_,{value:o,onValueChange:N,children:[(0,V.jsx)(H_,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,V.jsx)(V_,{placeholder:`Select device type`})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,V.jsx)(K_,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,V.jsx)(K_,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(kh,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Sh,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,V.jsx)(fM,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,V.jsxs)(G,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,V.jsxs)(G,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,V.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(Sa,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,V.jsxs)(vv,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,V.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,V.jsxs)(Wj,{className:`${ee.color} text-white rounded-md`,children:[ee.icon,(0,V.jsx)(`span`,{className:`ml-2`,children:ee.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sa,{className:`w-4 h-4 text-purple-400`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,V.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=_M(w.device_type,e,n);return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,V.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,V.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,V.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,V.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,V.jsx)(`span`,{children:t.min}),(0,V.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,V.jsxs)(cg,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>_M(w.device_type,e,t.max-t.min));return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsxs)(G,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,V.jsx)(Ma,{className:`w-4 h-4 mr-2`}):(0,V.jsx)(ja,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,V.jsxs)(cg,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,V.jsx)(Sa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,V.jsxs)(cg,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,V.jsx)(Ma,{className:`h-4 w-4`}),(0,V.jsx)(ug,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(vM)?(0,V.jsxs)(cg,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,V.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,V.jsxs)(cg,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(ug,{children:[(0,V.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,V.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,V.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,V.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,V.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,V.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,V.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,V.jsx)(`br`,{}),(0,V.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,V.jsxs)(mv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,children:[(0,V.jsxs)(hv,{className:`flex-row items-center justify-between space-y-0`,children:[(0,V.jsxs)(gv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(kh,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,V.jsx)(dM,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,V.jsx)(vv,{children:m?(0,V.jsx)(Q_,{cameras:f,onCamerasChange:y}):(0,V.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,V.jsx)(Ta,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,V.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,V.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,V.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,V.jsx)(no,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,V.jsx)(mM,{open:b,onOpenChange:x,robotType:S,onPortDetected:I})]})},bM=`rovingFocusGroup.onEntryFocus`,xM={bubbles:!1,cancelable:!0},SM=`RovingFocusGroup`,[CM,wM,TM]=Ar(SM),[EM,DM]=Sr(SM,[TM]),[OM,kM]=EM(SM),AM=_.forwardRef((e,t)=>(0,V.jsx)(CM.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(CM.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(jM,{...e,ref:t})})}));AM.displayName=SM;var jM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=br(t,f),m=pg(a),[h,g]=ui({prop:o,defaultProp:s??null,onChange:c,caller:SM}),[v,y]=_.useState(!1),b=Rr(l),x=wM(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(bM,b),()=>e.removeEventListener(bM,b)},[b]),(0,V.jsx)(OM,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(U.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{S.current=!0}),onFocus:H(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(bM,xM);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);LM([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:H(e.onBlur,()=>y(!1))})})}),MM=`RovingFocusGroupItem`,NM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ws(),l=a||c,u=kM(MM,n),d=u.currentTabStopId===l,f=wM(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(CM.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(U.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=IM(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?RM(n,r+1):n.slice(r+1)}setTimeout(()=>LM(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});NM.displayName=MM;var PM={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function FM(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function IM(e,t,n){let r=FM(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return PM[r]}function LM(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function RM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var zM=AM,BM=NM;function VM(e){let t=HM(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(WM);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function HM(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=KM(n),i=GM(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var UM=Symbol(`radix.slottable`);function WM(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===UM}function GM(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function KM(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var qM=[`Enter`,` `],JM=[`ArrowDown`,`PageUp`,`Home`],YM=[`ArrowUp`,`PageDown`,`End`],XM=[...JM,...YM],ZM={ltr:[...qM,`ArrowRight`],rtl:[...qM,`ArrowLeft`]},QM={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},$M=`Menu`,[eN,tN,nN]=Ar($M),[rN,iN]=Sr($M,[nN,Bf,DM]),aN=Bf(),oN=DM(),[sN,cN]=rN($M),[lN,uN]=rN($M),dN=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=aN(t),[c,l]=_.useState(null),u=_.useRef(!1),d=Rr(a),f=pg(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,V.jsx)(np,{...s,children:(0,V.jsx)(sN,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(lN,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};dN.displayName=$M;var fN=`MenuAnchor`,pN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=aN(n);return(0,V.jsx)(rp,{...i,...r,ref:t})});pN.displayName=fN;var mN=`MenuPortal`,[hN,gN]=rN(mN,{forceMount:void 0}),_N=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=cN(mN,t);return(0,V.jsx)(hN,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};_N.displayName=mN;var vN=`MenuContent`,[yN,bN]=rN(vN),xN=_.forwardRef((e,t)=>{let n=gN(vN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=cN(vN,e.__scopeMenu),o=uN(vN,e.__scopeMenu);return(0,V.jsx)(eN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(eN.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(SN,{...i,ref:t}):(0,V.jsx)(CN,{...i,ref:t})})})})}),SN=_.forwardRef((e,t)=>{let n=cN(vN,e.__scopeMenu),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(TN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),CN=_.forwardRef((e,t)=>{let n=cN(vN,e.__scopeMenu);return(0,V.jsx)(TN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),wN=VM(`MenuContent.ScrollLock`),TN=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=cN(vN,n),v=uN(vN,n),y=aN(n),b=oN(n),x=tN(n),[S,C]=_.useState(null),w=_.useRef(null),T=br(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?_l:_.Fragment,N=m?{as:wN,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=lP(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),cc();let F=_.useCallback(e=>A.current===k.current?.side&&dP(e,k.current?.area),[]);return(0,V.jsx)(yN,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,V.jsx)(M,{...N,children:(0,V.jsx)(Ys,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(zM,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:H(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(ip,{role:`menu`,"aria-orientation":`vertical`,"data-state":iP(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!XM.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);YM.includes(e.key)&&a.reverse(),sP(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:H(e.onPointerMove,fP(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});xN.displayName=vN;var EN=`MenuGroup`,DN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`group`,...r,ref:t})});DN.displayName=EN;var ON=`MenuLabel`,kN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});kN.displayName=ON;var AN=`MenuItem`,jN=`menu.itemSelect`,MN=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=uN(AN,e.__scopeMenu),s=bN(AN,e.__scopeMenu),c=br(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(jN,{bubbles:!0,cancelable:!0});e.addEventListener(jN,e=>r?.(e),{once:!0}),Lr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(NN,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||qM.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});MN.displayName=AN;var NN=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=bN(AN,n),s=oN(n),c=_.useRef(null),l=br(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(eN.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(BM,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(U.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,fP(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,fP(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),PN=`MenuCheckboxItem`,FN=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(UN,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(MN,{role:`menuitemcheckbox`,"aria-checked":aP(n)?`mixed`:n,...i,ref:t,"data-state":oP(n),onSelect:H(i.onSelect,()=>r?.(aP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});FN.displayName=PN;var IN=`MenuRadioGroup`,[LN,RN]=rN(IN,{value:void 0,onValueChange:()=>{}}),zN=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rr(r);return(0,V.jsx)(LN,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(DN,{...i,ref:t})})});zN.displayName=IN;var BN=`MenuRadioItem`,VN=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=RN(BN,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(UN,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(MN,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":oP(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});VN.displayName=BN;var HN=`MenuItemIndicator`,[UN,WN]=rN(HN,{checked:!1}),GN=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=WN(HN,n);return(0,V.jsx)(ai,{present:r||aP(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{...i,ref:t,"data-state":oP(a.checked)})})});GN.displayName=HN;var KN=`MenuSeparator`,qN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});qN.displayName=KN;var JN=`MenuArrow`,YN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=aN(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});YN.displayName=JN;var XN=`MenuSub`,[ZN,QN]=rN(XN),$N=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=cN(XN,t),o=aN(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Rr(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(np,{...o,children:(0,V.jsx)(sN,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(ZN,{scope:t,contentId:Ws(),triggerId:Ws(),trigger:s,onTriggerChange:c,children:n})})})};$N.displayName=XN;var eP=`MenuSubTrigger`,tP=_.forwardRef((e,t)=>{let n=cN(eP,e.__scopeMenu),r=uN(eP,e.__scopeMenu),i=QN(eP,e.__scopeMenu),a=bN(eP,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,V.jsx)(pN,{asChild:!0,...l,children:(0,V.jsx)(NN,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":iP(n.open),...e,ref:yr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,fP(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,fP(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||ZM[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});tP.displayName=eP;var nP=`MenuSubContent`,rP=_.forwardRef((e,t)=>{let n=gN(vN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=cN(vN,e.__scopeMenu),o=uN(vN,e.__scopeMenu),s=QN(nP,e.__scopeMenu),c=_.useRef(null),l=br(t,c);return(0,V.jsx)(eN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(eN.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(TN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=QM[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});rP.displayName=nP;function iP(e){return e?`open`:`closed`}function aP(e){return e===`indeterminate`}function oP(e){return aP(e)?`indeterminate`:e?`checked`:`unchecked`}function sP(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function cP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function lP(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=cP(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function uP(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function dP(e,t){return t?uP({x:e.clientX,y:e.clientY},t):!1}function fP(e){return t=>t.pointerType===`mouse`?e(t):void 0}var pP=dN,mP=pN,hP=_N,gP=xN,_P=DN,vP=kN,yP=MN,bP=FN,xP=zN,SP=VN,CP=GN,wP=qN,TP=YN,EP=tP,DP=rP,OP=`DropdownMenu`,[kP,Ste]=Sr(OP,[iN]),AP=iN(),[jP,MP]=kP(OP),NP=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=AP(t),l=_.useRef(null),[u,d]=ui({prop:i,defaultProp:a??!1,onChange:o,caller:OP});return(0,V.jsx)(jP,{scope:t,triggerId:Ws(),triggerRef:l,contentId:Ws(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(pP,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};NP.displayName=OP;var PP=`DropdownMenuTrigger`,FP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=MP(PP,n),o=AP(n);return(0,V.jsx)(mP,{asChild:!0,...o,children:(0,V.jsx)(U.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:yr(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});FP.displayName=PP;var IP=`DropdownMenuPortal`,LP=e=>{let{__scopeDropdownMenu:t,...n}=e,r=AP(t);return(0,V.jsx)(hP,{...r,...n})};LP.displayName=IP;var RP=`DropdownMenuContent`,zP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=MP(RP,n),a=AP(n),o=_.useRef(!1);return(0,V.jsx)(gP,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});zP.displayName=RP;var BP=`DropdownMenuGroup`,VP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(_P,{...i,...r,ref:t})});VP.displayName=BP;var HP=`DropdownMenuLabel`,UP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(vP,{...i,...r,ref:t})});UP.displayName=HP;var WP=`DropdownMenuItem`,GP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(yP,{...i,...r,ref:t})});GP.displayName=WP;var KP=`DropdownMenuCheckboxItem`,qP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(bP,{...i,...r,ref:t})});qP.displayName=KP;var JP=`DropdownMenuRadioGroup`,YP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(xP,{...i,...r,ref:t})});YP.displayName=JP;var XP=`DropdownMenuRadioItem`,ZP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(SP,{...i,...r,ref:t})});ZP.displayName=XP;var QP=`DropdownMenuItemIndicator`,$P=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(CP,{...i,...r,ref:t})});$P.displayName=QP;var eF=`DropdownMenuSeparator`,tF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(wP,{...i,...r,ref:t})});tF.displayName=eF;var nF=`DropdownMenuArrow`,rF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(TP,{...i,...r,ref:t})});rF.displayName=nF;var iF=`DropdownMenuSubTrigger`,aF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(EP,{...i,...r,ref:t})});aF.displayName=iF;var oF=`DropdownMenuSubContent`,sF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=AP(n);return(0,V.jsx)(DP,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});sF.displayName=oF;var cF=NP,lF=FP,uF=LP,dF=zP,fF=UP,pF=GP,mF=qP,hF=ZP,gF=$P,_F=tF,vF=aF,yF=sF,bF=cF,xF=lF,SF=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,V.jsxs)(vF,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,V.jsx)(Oa,{className:`ml-auto h-4 w-4`})]}));SF.displayName=vF.displayName;var CF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yF,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));CF.displayName=yF.displayName;var wF=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(uF,{children:(0,V.jsx)(dF,{ref:r,sideOffset:t,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));wF.displayName=dF.displayName;var TF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(pF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));TF.displayName=pF.displayName;var EF=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,V.jsxs)(mF,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(gF,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),t]}));EF.displayName=mF.displayName;var DF=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(hF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(gF,{children:(0,V.jsx)(Ia,{className:`h-2 w-2 fill-current`})})}),t]}));DF.displayName=hF.displayName;var OF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(fF,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));OF.displayName=fF.displayName;var kF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_F,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));kF.displayName=_F.displayName;var AF=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest opacity-60`,e),...t});AF.displayName=`DropdownMenuShortcut`;var jF=`lelab.recording.muted`,MF=null,NF=()=>(MF||=new AudioContext,MF),PF=()=>localStorage.getItem(jF)===`1`,FF=e=>{localStorage.setItem(jF,e?`1`:`0`)},IF=(e,t,n=0)=>{if(PF())return;let r=NF(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},LF=()=>{IF(660,80,0),IF(880,80,90)},RF=()=>{IF(660,80,0),IF(440,80,90)},zF=()=>{IF(880,70,0),IF(880,70,1e3),IF(880,70,2e3)},BF=Symbol(`radix.slottable`);function VF(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=BF,t}var HF=`AlertDialog`,[UF,Cte]=Sr(HF,[Fl]),WF=Fl(),GF=e=>{let{__scopeAlertDialog:t,...n}=e,r=WF(t);return(0,V.jsx)(pu,{...r,...n,modal:!0})};GF.displayName=HF;var KF=`AlertDialogTrigger`,qF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(mu,{...i,...r,ref:t})});qF.displayName=KF;var JF=`AlertDialogPortal`,YF=e=>{let{__scopeAlertDialog:t,...n}=e,r=WF(t);return(0,V.jsx)(hu,{...r,...n})};YF.displayName=JF;var XF=`AlertDialogOverlay`,ZF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(gu,{...i,...r,ref:t})});ZF.displayName=XF;var QF=`AlertDialogContent`,[$F,eI]=UF(QF),tI=VF(`AlertDialogContent`),nI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=WF(n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return(0,V.jsx)(cu,{contentName:QF,titleName:rI,docsSlug:`alert-dialog`,children:(0,V.jsx)($F,{scope:n,cancelRef:c,children:(0,V.jsxs)(_u,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:H(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,V.jsx)(tI,{children:r}),(0,V.jsx)(dI,{contentRef:o})]})})})});nI.displayName=QF;var rI=`AlertDialogTitle`,iI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(vu,{...i,...r,ref:t})});iI.displayName=rI;var aI=`AlertDialogDescription`,oI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(yu,{...i,...r,ref:t})});oI.displayName=aI;var sI=`AlertDialogAction`,cI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=WF(n);return(0,V.jsx)(bu,{...i,...r,ref:t})});cI.displayName=sI;var lI=`AlertDialogCancel`,uI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=eI(lI,n),a=WF(n),o=br(t,i);return(0,V.jsx)(bu,{...a,...r,ref:o})});uI.displayName=lI;var dI=({contentRef:e})=>{let t=`\`${QF}\` requires a description for the component to be accessible for screen reader users. + +You can add a description to the \`${QF}\` by passing a \`${aI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. + +Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${QF}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. + +For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},fI=GF,pI=YF,mI=ZF,hI=nI,gI=cI,_I=uI,vI=iI,yI=oI,bI=fI,xI=pI,SI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(mI,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));SI.displayName=mI.displayName;var CI=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(xI,{children:[(0,V.jsx)(SI,{}),(0,V.jsx)(hI,{ref:n,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));CI.displayName=hI.displayName;var wI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});wI.displayName=`AlertDialogHeader`;var TI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});TI.displayName=`AlertDialogFooter`;var EI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vI,{ref:n,className:W(`text-lg font-semibold`,e),...t}));EI.displayName=vI.displayName;var DI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yI,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));DI.displayName=yI.displayName;var OI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gI,{ref:n,className:W(js(),e),...t}));OI.displayName=gI.displayName;var kI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_I,{ref:n,className:W(js({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));kI.displayName=_I.displayName;var AI=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=Rs(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>PF()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useCallback)(()=>{g(e=>{let t=!e;return FF(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,D())},[o]);let w=(0,_.useRef)(d);w.current=d;let T=(0,_.useRef)(y);T.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let n=await e.json();c(n);let i=w.current;i&&n.current_phase===i&&f(null);let s=n.current_phase,l=v.current;l!==s&&(s===`recording`&&l!==null?LF():s===`resetting`&&RF(),v.current=s,x.current={phase:null,episode:null,tick:0});let u=n.phase_elapsed_seconds||0,d=n.phase_time_limit_s||0,p=d>3&&u>=d-3,m=n.current_episode??null,h=T.current,g=x.current;p&&i===null&&(g.phase!==s||g.episode!==m||g.tick!==h)&&(zF(),x.current={phase:s,episode:m,tick:h}),!n.recording_active&&n.session_ended&&t(`/upload`,{state:{datasetInfo:{dataset_repo_id:n.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:n.saved_episodes||0,session_elapsed_seconds:n.session_elapsed_seconds||0}}})}catch(e){console.error(`Error polling recording status:`,e)}};e();let n=setInterval(e,1e3);return()=>clearInterval(n)},[l,o,t,r,a]);let E=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},D=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},O=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),k=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),A=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),j=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),M=(0,_.useCallback)(async()=>{m(!1),await A()},[A]),N=(0,_.useRef)({handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p});(0,_.useEffect)(()=>{N.current={handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p}});let P=l&&s!==null;if((0,_.useEffect)(()=>{if(!P)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),N.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),N.current.handleRerecordEpisode();else if(e.key===`Escape`){if(N.current.showStopConfirm)return;N.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P]),!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,V.jsx)(G,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let F=s.current_phase,I=d??F,ee=s.current_episode??1,te=s.total_episodes??o.num_episodes,ne=d?0:s.phase_elapsed_seconds||0,re=I===`recording`?o.episode_time_s:I===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,ie=s.session_elapsed_seconds||0,ae=()=>I===`recording`?`RECORDING EPISODE ${ee}`:I===`resetting`?`RESET — GET READY`:I===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,oe=I===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:I===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},se=I===`recording`?`End Episode`:I===`resetting`?`Start Next Episode`:`Advance`,ce=I===`recording`?ro:Xa;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-2xl mx-auto`,children:[(0,V.jsx)(`div`,{className:`mb-8`,children:(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8`,children:[(0,V.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-6 text-sm text-gray-400`,children:[(0,V.jsxs)(`span`,{"aria-label":`Episode ${ee} of ${te}`,children:[`Episode `,(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:ee}),` / `,te]}),(0,V.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${E(ie)}`,children:E(ie)}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:C,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,V.jsx)(po,{className:`w-5 h-5`}):(0,V.jsx)(fo,{className:`w-5 h-5`})}),(0,V.jsxs)(bF,{children:[(0,V.jsx)(xF,{asChild:!0,children:(0,V.jsx)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,V.jsx)(Va,{className:`w-5 h-5`})})}),(0,V.jsxs)(wF,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TF,{onClick:k,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,V.jsx)($a,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,V.jsxs)(TF,{onClick:j,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${oe.pill}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${oe.dot} ${I===`completed`?``:`animate-pulse`}`}),ae()]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${oe.timer}`,children:E(ne)}),(0,V.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,E(re)]})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${oe.bar}`,style:{width:`${Math.min(ne/re*100,100)}%`}})}),(0,V.jsxs)(G,{onClick:O,disabled:!s.available_controls.exit_early||d!==null||I===`completed`,className:`w-full text-white font-semibold py-6 text-lg disabled:opacity-50 ${oe.button}`,children:[(0,V.jsx)(ce,{className:`w-5 h-5 mr-2`}),se,I!==`completed`&&(0,V.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),I===`completed`&&(0,V.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,V.jsx)(bI,{open:p,onOpenChange:m,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Stop recording?`}),(0,V.jsx)(DI,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,V.jsx)(OI,{onClick:M,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},jI=()=>{let e=Re();return(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(Bj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},MI=/^[\w.\-]+\/[\w.\-]+$/,NI=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();MI.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,V.jsxs)(vh,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Sh,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(G,{onClick:u,disabled:!MI.test(c.trim()),children:`Use`}),(0,V.jsx)(G,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,V.jsxs)(Om,{open:i,onOpenChange:a,children:[(0,V.jsx)(km,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(Am,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,V.jsxs)(ph,{className:`bg-gray-800 text-white`,children:[(0,V.jsx)(mh,{placeholder:`Search datasets…`,className:`text-white`}),(0,V.jsxs)(hh,{children:[(0,V.jsx)(gh,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,V.jsx)(_h,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,V.jsx)(_h,{heading:`Hugging Face`,children:f.map(p)}),(0,V.jsx)(_h,{children:(0,V.jsxs)(vh,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ya,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},PI=1500;function FI(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},PI);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function II(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function LI({state:e}){return e===`done`?(0,V.jsx)(Na,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,V.jsx)(Fa,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,V.jsx)(qa,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,V.jsx)(co,{className:`w-6 h-6 text-amber-400`})}var RI=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=_r();return(0,V.jsxs)(V.Fragment,{children:[e===`idle`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsx)(G,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,V.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,V.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,V.jsx)(G,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,V.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,V.jsx)(`div`,{children:e.message},t))})]})},zI=({purpose:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,V.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,V.jsxs)(`li`,{children:[`Press`,` `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,V.jsxs)(`li`,{children:[`Run`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),BI=({open:e,onOpenChange:t,installHint:n})=>{let r=FI(`system/wandb-extra`,e);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:r.state}),II(r.state,`Weights & Biases Not Installed`)]}),(0,V.jsx)(Ou,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`W&B logging`})})})]})})},VI=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=Rs(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsx)(gv,{className:`text-white`,children:`Run Configuration`})}),(0,V.jsxs)(vv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(NI,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,V.jsxs)(B_,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,V.jsx)(H_,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,V.jsx)(K_,{value:`diffusion`,children:`Diffusion Policy`}),(0,V.jsx)(K_,{value:`pi0`,children:`PI0`}),(0,V.jsx)(K_,{value:`smolvla`,children:`SmolVLA`}),(0,V.jsx)(K_,{value:`tdmpc`,children:`TD-MPC`}),(0,V.jsx)(K_,{value:`vqbet`,children:`VQ-BeT`}),(0,V.jsx)(K_,{value:`pi0_fast`,children:`PI0 Fast`}),(0,V.jsx)(K_,{value:`sac`,children:`SAC`}),(0,V.jsx)(K_,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,V.jsx)(Ch,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,V.jsx)(Ch,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)(dM,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(kh,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,V.jsx)(BI,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,V.jsx)(Sh,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},HI=({children:e})=>(0,V.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),wte=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsxs)(hv,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,V.jsx)(Da,{className:`w-4 h-4`}):(0,V.jsx)(Oa,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,V.jsxs)(vv,{className:`space-y-8`,children:[(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Policy`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,V.jsxs)(B_,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,V.jsx)(H_,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`cuda`,children:`CUDA (GPU)`}),(0,V.jsx)(K_,{value:`cpu`,children:`CPU`}),(0,V.jsx)(K_,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)(dM,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,V.jsx)(kh,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Training`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,V.jsx)(Ch,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,V.jsx)(Ch,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Optimizer`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,V.jsxs)(B_,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,V.jsx)(H_,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`adam`,children:`Adam`}),(0,V.jsx)(K_,{value:`adamw`,children:`AdamW`}),(0,V.jsx)(K_,{value:`sgd`,children:`SGD`}),(0,V.jsx)(K_,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,V.jsx)(Ch,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,V.jsx)(Ch,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,V.jsx)(Ch,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Logging & Checkpointing`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,V.jsx)(Ch,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,V.jsx)(Ch,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,V.jsx)(kh,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,V.jsx)(kh,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Weights & Biases`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,V.jsx)(Sh,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,V.jsx)(Sh,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,V.jsxs)(B_,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,V.jsx)(H_,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(V_,{})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`online`,children:`Online`}),(0,V.jsx)(K_,{value:`offline`,children:`Offline`}),(0,V.jsx)(K_,{value:`disabled`,children:`Disabled`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,V.jsx)(kh,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,V.jsx)(Qj,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(HI,{children:`Misc`}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(dM,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,V.jsx)(kh,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},Tte=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,Ete=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${Tte(e.unit_cost_usd,e.unit_label)}`},Dte=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsx)(gv,{className:`text-white`,children:`Compute target`})}),(0,V.jsx)(vv,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{className:`text-slate-300`,children:`Run training on`}),(0,V.jsxs)(B_,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,V.jsx)(H_,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,V.jsx)(V_,{placeholder:i?`Loading…`:`Select target`})}),(0,V.jsxs)(G_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(K_,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,V.jsxs)(K_,{value:`hf:${e.name}`,disabled:!n,children:[Ete(e),!n&&(0,V.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},Ote=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,V.jsx)(Dte,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,V.jsx)(VI,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,V.jsx)(wte,{config:e,updateConfig:t})]}),UI=o(((e,t)=>{t.exports=Array.isArray})),WI=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),GI=o(((e,t)=>{var n=WI(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),KI=o(((e,t)=>{t.exports=GI().Symbol})),kte=o(((e,t)=>{var n=KI(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),Ate=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),qI=o(((e,t)=>{var n=KI(),r=kte(),i=Ate(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),JI=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),YI=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),XI=o(((e,t)=>{var n=UI(),r=YI(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),ZI=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),QI=o(((e,t)=>{var n=qI(),r=ZI(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),jte=o(((e,t)=>{t.exports=GI()[`__core-js_shared__`]})),Mte=o(((e,t)=>{var n=jte(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),$I=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Nte=o(((e,t)=>{var n=QI(),r=Mte(),i=ZI(),a=$I(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Pte=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),eL=o(((e,t)=>{var n=Nte(),r=Pte();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),tL=o(((e,t)=>{t.exports=eL()(Object,`create`)})),Fte=o(((e,t)=>{var n=tL();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Ite=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Lte=o(((e,t)=>{var n=tL(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),Rte=o(((e,t)=>{var n=tL(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),zte=o(((e,t)=>{var n=tL(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Bte=o(((e,t)=>{var n=Fte(),r=Ite(),i=Lte(),a=Rte(),o=zte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),nL=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),rL=o(((e,t)=>{var n=nL();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Hte=o(((e,t)=>{var n=rL(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Ute=o(((e,t)=>{var n=rL();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),Wte=o(((e,t)=>{var n=rL();function r(e){return n(this.__data__,e)>-1}t.exports=r})),Gte=o(((e,t)=>{var n=rL();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),iL=o(((e,t)=>{var n=Vte(),r=Hte(),i=Ute(),a=Wte(),o=Gte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=eL()(GI(),`Map`)})),Kte=o(((e,t)=>{var n=Bte(),r=iL(),i=aL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),qte=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),oL=o(((e,t)=>{var n=qte();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),Jte=o(((e,t)=>{var n=oL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),Yte=o(((e,t)=>{var n=oL();function r(e){return n(this,e).get(e)}t.exports=r})),Xte=o(((e,t)=>{var n=oL();function r(e){return n(this,e).has(e)}t.exports=r})),Zte=o(((e,t)=>{var n=oL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),sL=o(((e,t)=>{var n=Kte(),r=Jte(),i=Yte(),a=Xte(),o=Zte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=sL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),Qte=o(((e,t)=>{var n=cL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),$te=o(((e,t)=>{var n=Qte(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),lL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=KI(),r=lL(),i=UI(),a=YI(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),uL=o(((e,t)=>{var n=ene();function r(e){return e==null?``:n(e)}t.exports=r})),dL=o(((e,t)=>{var n=UI(),r=XI(),i=$te(),a=uL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),fL=o(((e,t)=>{var n=YI(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),pL=o(((e,t)=>{var n=dL(),r=fL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=pL();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),tne=o(((e,t)=>{function n(e){return e==null}t.exports=n})),nne=o(((e,t)=>{var n=qI(),r=UI(),i=JI(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),rne=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),ine=o(((e,t)=>{t.exports=rne()})),hL=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),ane=o(((e,t)=>{var n=hL();function r(e){return n(e)&&e!=+e}t.exports=r})),gL=l(nne()),_L=l(ane()),vL=l(mL()),one=l(hL()),yL=l(tne()),bL=function(e){return e===0?0:e>0?1:-1},xL=function(e){return(0,gL.default)(e)&&e.indexOf(`%`)===e.length-1},Z=function(e){return(0,one.default)(e)&&!(0,_L.default)(e)},sne=function(e){return(0,yL.default)(e)},SL=function(e){return Z(e)||(0,gL.default)(e)},CL=0,wL=function(e){var t=++CL;return`${e||``}${t}`},TL=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Z(e)&&!(0,gL.default)(e))return n;var i;if(xL(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,_L.default)(i)&&(i=n),r&&i>t&&(i=t),i},EL=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},DL=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qL(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function JL(e){"@babel/helpers - typeof";return JL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},JL(e)}var YL={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},XL=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},ZL=null,QL=null,$L=function e(t){if(t===ZL&&Array.isArray(QL))return QL;var n=[];return _.Children.forEach(t,function(t){(0,yL.default)(t)||((0,UL.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),QL=n,ZL=t,n};function eR(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return XL(e)}):[XL(t)],$L(e).forEach(function(e){var t=(0,vL.default)(e,`type.displayName`)||(0,vL.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function tR(e,t){var n=eR(e,t);return n&&n[0]}var nR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Z(n)||n<=0||!Z(r)||r<=0)},rR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),iR=function(e){return e&&e.type&&(0,gL.default)(e.type)&&rR.indexOf(e.type)>=0},aR=function(e){return e&&JL(e)===`object`&&`clipDot`in e},oR=function(e,t,n,r){var i=LL?.[r]??[];return t.startsWith(`data-`)||!(0,HL.default)(e)&&(r&&i.includes(t)||FL.includes(t))||n&&RL.includes(t)},sR=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,ML.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){oR(r?.[e],e,t,n)&&(i[e]=r[e])}),i},cR=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return lR(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function gR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function _R(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=hR(e,pR),u=i||{width:n,height:r,x:0,y:0},d=pa(`recharts-surface`,a);return _.createElement(`svg`,mR({},sR(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var vR=[`children`,`className`];function yR(){return yR=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function xR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var SR=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=bR(e,vR),a=pa(`recharts-layer`,r);return _.createElement(`g`,yR({className:a},sR(i,!0),{ref:t}),n)}),CR=!1,wR=function(e,t){var n=[...arguments].slice(2);if(CR&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},TR=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=TR();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),DR=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),OR=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),kR=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),AR=o(((e,t)=>{var n=OR(),r=DR(),i=kR();function a(e){return r(e)?i(e):n(e)}t.exports=a})),jR=o(((e,t)=>{var n=ER(),r=DR(),i=AR(),a=uL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),MR=o(((e,t)=>{t.exports=jR()(`toUpperCase`)}));function NR(e){return function(){return e}}var PR=Math.cos,FR=Math.sin,IR=Math.sqrt,LR=Math.PI;LR/2;var RR=2*LR,zR=Math.PI,BR=2*zR,VR=1e-6,HR=BR-VR;function UR(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return UR;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tVR)if(!(Math.abs(u*s-c*l)>VR)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((zR-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>VR&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>VR||Math.abs(this._y1-l)>VR)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%BR+BR),d>HR?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>VR&&this._append`A${n},${n},0,${+(d>=zR)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function KR(){return new GR}KR.prototype=GR.prototype;function qR(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new GR(t)}Array.prototype.slice;function JR(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function YR(e){this._context=e}YR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function XR(e){return new YR(e)}function ZR(e){return e[0]}function QR(e){return e[1]}function $R(e,t){var n=NR(!0),r=null,i=XR,a=null,o=qR(s);e=typeof e==`function`?e:e===void 0?ZR:NR(e),t=typeof t==`function`?t:t===void 0?QR:NR(t);function s(s){var c,l=(s=JR(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return $R().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:NR(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:NR(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:NR(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:NR(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:NR(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var tz=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function nz(e){return new tz(e,!0)}function rz(e){return new tz(e,!1)}var iz={draw(e,t){let n=IR(t/LR);e.moveTo(n,0),e.arc(0,0,n,0,RR)}},az={draw(e,t){let n=IR(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},oz=IR(1/3),sz=oz*2,cz={draw(e,t){let n=IR(t/sz),r=n*oz;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},lz={draw(e,t){let n=IR(t),r=-n/2;e.rect(r,r,n,n)}},uz=.8908130915292852,dz=FR(LR/10)/FR(7*LR/10),fz=FR(RR/10)*dz,pz=-PR(RR/10)*dz,mz={draw(e,t){let n=IR(t*uz),r=fz*n,i=pz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=RR*t/5,o=PR(a),s=FR(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},hz=IR(3),gz={draw(e,t){let n=-IR(t/(hz*3));e.moveTo(0,n*2),e.lineTo(-hz*n,-n),e.lineTo(hz*n,-n),e.closePath()}},_z=-.5,vz=IR(3)/2,yz=1/IR(12),bz=(yz/2+1)*3,xz={draw(e,t){let n=IR(t/bz),r=n/2,i=n*yz,a=r,o=n*yz+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(_z*r-vz*i,vz*r+_z*i),e.lineTo(_z*a-vz*o,vz*a+_z*o),e.lineTo(_z*s-vz*c,vz*s+_z*c),e.lineTo(_z*r+vz*i,_z*i-vz*r),e.lineTo(_z*a+vz*o,_z*o-vz*a),e.lineTo(_z*s+vz*c,_z*c-vz*s),e.closePath()}};function Sz(e,t){let n=null,r=qR(i);e=typeof e==`function`?e:NR(e||iz),t=typeof t==`function`?t:NR(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:NR(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:NR(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function Cz(){}function wz(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Tz(e){this._context=e}Tz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:wz(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ez(e){return new Tz(e)}function Dz(e){this._context=e}Dz.prototype={areaStart:Cz,areaEnd:Cz,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Oz(e){return new Dz(e)}function kz(e){this._context=e}kz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:wz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Az(e){return new kz(e)}function jz(e){this._context=e}jz.prototype={areaStart:Cz,areaEnd:Cz,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Mz(e){return new jz(e)}function Nz(e){return e<0?-1:1}function Pz(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(Nz(a)+Nz(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Fz(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Iz(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Lz(e){this._context=e}Lz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Iz(this,this._t0,Fz(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Iz(this,Fz(this,n=Pz(this,e,t)),n);break;default:Iz(this,this._t0,n=Pz(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Rz(e){this._context=new zz(e)}(Rz.prototype=Object.create(Lz.prototype)).point=function(e,t){Lz.prototype.point.call(this,t,e)};function zz(e){this._context=e}zz.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Bz(e){return new Lz(e)}function Vz(e){return new Rz(e)}function Hz(e){this._context=e}Hz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Uz(e),i=Uz(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function Kz(e){return new Gz(e,.5)}function qz(e){return new Gz(e,0)}function Jz(e){return new Gz(e,1)}function Yz(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Zz(e,t){return e[t]}function Qz(e){let t=[];return t.key=e,t}function $z(){var e=NR([]),t=Xz,n=Yz,r=Zz;function i(i){var a=Array.from(e.apply(this,arguments),Qz),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pB(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var mB={symbolCircle:iz,symbolCross:az,symbolDiamond:cz,symbolSquare:lz,symbolStar:mz,symbolTriangle:gz,symbolWye:xz},hB=Math.PI/180,gB=function(e){return mB[`symbol${(0,rB.default)(e)}`]||iz},_B=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*hB;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},vB=function(e,t){mB[`symbol${(0,rB.default)(e)}`]=t},yB=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=cB(cB({},fB(e,aB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=gB(n);return Sz().type(e).size(_B(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=sR(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,oB({},f,{className:pa(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};yB.registerSymbol=vB;function bB(e){"@babel/helpers - typeof";return bB=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bB(e)}function xB(){return xB=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var f=t.inactive?o:t.color;return _.createElement(`li`,xB({className:u,style:c,key:`legend-item-${n}`},VL(e.props,t,n)),_.createElement(_R,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);PB(RB,`displayName`,`Legend`),PB(RB,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var zB=o(((e,t)=>{var n=iL();function r(){this.__data__=new n,this.size=0}t.exports=r})),BB=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),VB=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),HB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),UB=o(((e,t)=>{var n=iL(),r=aL(),i=sL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=iL(),r=zB(),i=BB(),a=VB(),o=HB(),s=UB();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),GB=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),KB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),qB=o(((e,t)=>{var n=sL(),r=GB(),i=KB();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),XB=o(((e,t)=>{var n=qB(),r=JB(),i=YB(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=GI().Uint8Array})),QB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),$B=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),eV=o(((e,t)=>{var n=KI(),r=ZB(),i=nL(),a=XB(),o=QB(),s=$B(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),tV=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=tV(),r=UI();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),rV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),aV=o(((e,t)=>{var n=rV(),r=iV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),oV=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=qI(),r=JI(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),cV=o(((e,t)=>{var n=sV(),r=JI(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),lV=o(((e,t)=>{function n(){return!1}t.exports=n})),uV=o(((e,t)=>{var n=GI(),r=lV(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),dV=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),pV=o(((e,t)=>{var n=qI(),r=fV(),i=JI(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),mV=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),hV=o(((e,t)=>{var n=WI(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),gV=o(((e,t)=>{var n=pV(),r=mV(),i=hV(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),_V=o(((e,t)=>{var n=oV(),r=cV(),i=UI(),a=uV(),o=dV(),s=gV(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),vV=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),yV=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),bV=o(((e,t)=>{t.exports=yV()(Object.keys,Object)})),xV=o(((e,t)=>{var n=vV(),r=bV(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),SV=o(((e,t)=>{var n=QI(),r=fV();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),CV=o(((e,t)=>{var n=_V(),r=xV(),i=SV();function a(e){return i(e)?n(e):r(e)}t.exports=a})),wV=o(((e,t)=>{var n=nV(),r=aV(),i=CV();function a(e){return n(e,i,r)}t.exports=a})),TV=o(((e,t)=>{var n=wV(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=eL()(GI(),`DataView`)})),DV=o(((e,t)=>{t.exports=eL()(GI(),`Promise`)})),OV=o(((e,t)=>{t.exports=eL()(GI(),`Set`)})),kV=o(((e,t)=>{t.exports=eL()(GI(),`WeakMap`)})),AV=o(((e,t)=>{var n=EV(),r=aL(),i=DV(),a=OV(),o=kV(),s=qI(),c=$I(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),jV=o(((e,t)=>{var n=WB(),r=XB(),i=eV(),a=TV(),o=AV(),s=UI(),c=uV(),l=gV(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),MV=o(((e,t)=>{var n=jV(),r=JI();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),NV=o(((e,t)=>{var n=WB(),r=MV(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=ZI();function r(e){return e===e&&!n(e)}t.exports=r})),FV=o(((e,t)=>{var n=PV(),r=CV();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),IV=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),LV=o(((e,t)=>{var n=NV(),r=FV(),i=IV();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),RV=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),zV=o(((e,t)=>{var n=dL(),r=cV(),i=UI(),a=dV(),o=fV(),s=fL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=RV(),r=zV();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),VV=o(((e,t)=>{var n=MV(),r=mL(),i=BV(),a=XI(),o=PV(),s=IV(),c=fL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),HV=o(((e,t)=>{function n(e){return e}t.exports=n})),UV=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),WV=o(((e,t)=>{var n=pL();function r(e){return function(t){return n(t,e)}}t.exports=r})),GV=o(((e,t)=>{var n=UV(),r=WV(),i=XI(),a=fL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),KV=o(((e,t)=>{var n=LV(),r=VV(),i=HV(),a=UI(),o=GV();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),qV=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),YV=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=qV(),r=JV(),i=YV();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),ZV=o(((e,t)=>{var n=XV();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),QV=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),eH=o(((e,t)=>{var n=OV(),r=$V(),i=$B();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),tH=o(((e,t)=>{var n=qB(),r=ZV(),i=QV(),a=YB(),o=eH(),s=$B(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=KV(),r=tH();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function rH(e,t,n){return t===!0?(0,nH.default)(e,n):(0,HL.default)(t)?(0,nH.default)(e,t):e}function iH(e){"@babel/helpers - typeof";return iH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},iH(e)}var aH=[`ref`];function oH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function sH(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function SH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function CH(e){return e.value}function wH(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=xH(t,aH);return _.createElement(RB,n)}var TH=1,EH=function(e){function t(){var e;cH(this,t);var n=[...arguments];return e=dH(this,t,[].concat(n)),vH(e,`lastBoundingBox`,{width:-1,height:-1}),e}return gH(t,e),uH(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>TH||Math.abs(t.height-this.lastBoundingBox.height)>TH)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?sH({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return sH(sH({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=sH(sH({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},wH(n,sH(sH({},this.props),{},{payload:rH(s,o,CH)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=sH(sH({},this.defaultProps),e.props).layout;return n===`vertical`&&Z(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);vH(EH,`displayName`,`Legend`),vH(EH,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var DH=o(((e,t)=>{var n=KI(),r=cV(),i=UI(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),OH=o(((e,t)=>{var n=tV(),r=DH();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),kH=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),AH=o(((e,t)=>{t.exports=kH()()})),jH=o(((e,t)=>{var n=AH(),r=CV();function i(e,t){return e&&n(e,t,r)}t.exports=i})),MH=o(((e,t)=>{var n=SV();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=jH();t.exports=MH()(n)})),PH=o(((e,t)=>{var n=NH(),r=SV();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),FH=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),IH=o(((e,t)=>{var n=YI();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=IH();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),RH=o(((e,t)=>{var n=lL(),r=pL(),i=KV(),a=PH(),o=FH(),s=mV(),c=LH(),l=HV(),u=UI();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),zH=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),BH=o(((e,t)=>{var n=zH(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),HH=o(((e,t)=>{var n=eL();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),UH=o(((e,t)=>{var n=VH(),r=HH(),i=HV();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),WH=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),GH=o(((e,t)=>{var n=UH();t.exports=WH()(n)})),KH=o(((e,t)=>{var n=HV(),r=BH(),i=GH();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),qH=o(((e,t)=>{var n=nL(),r=SV(),i=dV(),a=ZI();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),JH=l(o(((e,t)=>{var n=OH(),r=RH(),i=KH(),a=qH();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function YH(e){"@babel/helpers - typeof";return YH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},YH(e)}function XH(){return XH=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${mU}-left`,Z(n)&&t&&Z(t.x)&&n=t.y),`${mU}-top`,Z(r)&&t&&Z(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function vU(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function yU(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=_U({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=_U({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=vU({translateX:u,translateY:d,useTranslate3d:s})):l=hU,{cssProperties:l,cssClasses:gU({translateX:u,translateY:d,coordinate:n})}}function bU(e){"@babel/helpers - typeof";return bU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},bU(e)}function xU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function SU(e){for(var t=1;tIU||Math.abs(e.height-this.state.lastBoundingBox.height)>IU)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=yU({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=SU(SU({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),RU={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return RU[e]},set:function(e,t){if(typeof e==`string`)RU[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){RU[t]=e[t]})}}};function zU(e){"@babel/helpers - typeof";return zU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},zU(e)}function BU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function VU(e){for(var t=1;t0;return _.createElement(LU,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},nW(o,VU(VU({},this.props),{},{payload:y})))}}])}(_.PureComponent);QU(rW,`displayName`,`Tooltip`),QU(rW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!RU.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var iW=o(((e,t)=>{var n=GI();t.exports=function(){return n.Date.now()}})),aW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),oW=o(((e,t)=>{var n=aW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),sW=o(((e,t)=>{var n=oW(),r=ZI(),i=YI(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),cW=o(((e,t)=>{var n=ZI(),r=iW(),i=sW(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),lW=l(o(((e,t)=>{var n=cW(),r=ZI(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function uW(e){"@babel/helpers - typeof";return uW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},uW(e)}function dW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function fW(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,lW.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;wR(xL(o)||xL(c),`The width(%s) and height(%s) are both fixed numbers, + maybe you don't need to use a ResponsiveContainer.`,o,c),wR(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=xL(o)?e:o,i=xL(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),wR(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, + please check the style of container, or the props width(%s) and height(%s), + or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the + height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&XL(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,fW({width:r,height:i},a?{style:fW({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:pa(`recharts-responsive-container`,v),style:fW(fW({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),CW=function(e){return null};CW.displayName=`Cell`;function wW(e){"@babel/helpers - typeof";return wW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},wW(e)}function TW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function EW(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||RU.isSsr)return{width:0,height:0};var n=PW(t),r=JSON.stringify({text:e,copyStyle:n});if(AW.widthCache[r])return AW.widthCache[r];try{var i=document.getElementById(NW);i||(i=document.createElement(`span`),i.setAttribute(`id`,NW),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=EW(EW({},MW),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return AW.widthCache[r]=s,++AW.cacheCount>jW&&(AW.cacheCount=0,AW.widthCache={}),s}catch{return{width:0,height:0}}},IW=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function LW(e){"@babel/helpers - typeof";return LW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},LW(e)}function RW(e,t){return UW(e)||HW(e,t)||BW(e,t)||zW()}function zW(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function BW(e,t){if(e){if(typeof e==`string`)return VW(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return VW(e,t)}}function VW(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hG(e,t){return bG(e)||yG(e,t)||_G(e,t)||gG()}function gG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _G(e,t){if(e){if(typeof e==`string`)return vG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return vG(e,t)}}function vG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=SG({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=hG(h(b-1),2),S=x[0],C=x[1],w=hG(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},wG=function(e){return[{words:(0,yL.default)(e)?[]:e.toString().split(xG)}]},TG=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!RU.isSsr){var s,c,l=SG({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return wG(r);return CG({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return wG(r)},EG=`#808080`,DG=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?EG:h,v=pG(e,uG),y=(0,_.useMemo)(function(){return TG({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=pG(v,dG);if(!SL(n)||!SL(i))return null;var E=n+(Z(b)?b:0),D=i+(Z(x)?x:0),O;switch(m){case`start`:O=lG(`calc(${c})`);break;case`middle`:O=lG(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=lG(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Z(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,fG({},sR(T,!0),{x:E,y:D,className:pa(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?EG:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function OG(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function kG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function AG(e){let t,n,r;e.length===2?(t=e===OG||e===kG?e:jG,n=e,r=e):(t=OG,n=(t,n)=>OG(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function jG(){return 0}function MG(e){return e===null?NaN:+e}function*NG(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var PG=AG(OG),FG=PG.right;PG.left,AG(MG).center;var IG=class extends Map{constructor(e,t=BG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(LG(this,e))}has(e){return super.has(LG(this,e))}set(e,t){return super.set(RG(this,e),t)}delete(e){return super.delete(zG(this,e))}};function LG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function RG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function zG({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function BG(e){return typeof e==`object`&&e?e.valueOf():e}function VG(e=OG){if(e===OG)return HG;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function HG(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var UG=Math.sqrt(50),WG=Math.sqrt(10),GG=Math.sqrt(2);function KG(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=UG?10:a>=WG?5:a>=GG?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function ZG(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function QG(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?HG:VG(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));QG(e,t,u,d,i)}let a=e[t],o=n,s=r;for($G(e,n,t),i(e[r],a)>0&&$G(e,n,r);o0;)--s}i(e[n],a)===0?$G(e,n,s):(++s,$G(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function $G(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function eK(e,t,n){if(e=Float64Array.from(NG(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return ZG(e);if(t>=1)return XG(e);var r,i=(r-1)*t,a=Math.floor(i),o=XG(QG(e,a).subarray(0,a+1));return o+(ZG(e.subarray(a+1))-o)*(i-a)}}function tK(e,t,n=MG){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function nK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?MK(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?MK(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=yK.exec(e))?new FK(t[1],t[2],t[3],1):(t=bK.exec(e))?new FK(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=xK.exec(e))?MK(t[1],t[2],t[3],t[4]):(t=SK.exec(e))?MK(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=CK.exec(e))?HK(t[1],t[2]/100,t[3]/100,1):(t=wK.exec(e))?HK(t[1],t[2]/100,t[3]/100,t[4]):TK.hasOwnProperty(e)?jK(TK[e]):e===`transparent`?new FK(NaN,NaN,NaN,0):null}function jK(e){return new FK(e>>16&255,e>>8&255,e&255,1)}function MK(e,t,n,r){return r<=0&&(e=t=n=NaN),new FK(e,t,n,r)}function NK(e){return e instanceof fK||(e=AK(e)),e?(e=e.rgb(),new FK(e.r,e.g,e.b,e.opacity)):new FK}function PK(e,t,n,r){return arguments.length===1?NK(e):new FK(e,t,n,r??1)}function FK(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}uK(FK,PK,dK(fK,{brighter(e){return e=e==null?mK:mK**+e,new FK(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?pK:pK**+e,new FK(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new FK(BK(this.r),BK(this.g),BK(this.b),zK(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:IK,formatHex:IK,formatHex8:LK,formatRgb:RK,toString:RK}));function IK(){return`#${VK(this.r)}${VK(this.g)}${VK(this.b)}`}function LK(){return`#${VK(this.r)}${VK(this.g)}${VK(this.b)}${VK((isNaN(this.opacity)?1:this.opacity)*255)}`}function RK(){let e=zK(this.opacity);return`${e===1?`rgb(`:`rgba(`}${BK(this.r)}, ${BK(this.g)}, ${BK(this.b)}${e===1?`)`:`, ${e})`}`}function zK(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function BK(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function VK(e){return e=BK(e),(e<16?`0`:``)+e.toString(16)}function HK(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new GK(e,t,n,r)}function UK(e){if(e instanceof GK)return new GK(e.h,e.s,e.l,e.opacity);if(e instanceof fK||(e=AK(e)),!e)return new GK;if(e instanceof GK)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new GK(o,s,c,e.opacity)}function WK(e,t,n,r){return arguments.length===1?UK(e):new GK(e,t,n,r??1)}function GK(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}uK(GK,WK,dK(fK,{brighter(e){return e=e==null?mK:mK**+e,new GK(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?pK:pK**+e,new GK(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new FK(JK(e>=240?e-240:e+120,i,r),JK(e,i,r),JK(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new GK(KK(this.h),qK(this.s),qK(this.l),zK(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=zK(this.opacity);return`${e===1?`hsl(`:`hsla(`}${KK(this.h)}, ${qK(this.s)*100}%, ${qK(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function KK(e){return e=(e||0)%360,e<0?e+360:e}function qK(e){return Math.max(0,Math.min(1,e||0))}function JK(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var YK=e=>()=>e;function XK(e,t){return function(n){return e+n*t}}function ZK(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function QK(e){return(e=+e)==1?$K:function(t,n){return n-t?ZK(t,n,e):YK(isNaN(t)?n:t)}}function $K(e,t){var n=t-e;return n?XK(e,n):YK(isNaN(e)?t:e)}var eq=(function e(t){var n=QK(t);function r(e,t){var r=n((e=PK(e)).r,(t=PK(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=$K(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function tq(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:aq(r,i)})),n=cq.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function xq(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?Sq:xq,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),aq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,gq),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=pq,u()},d.clamp=function(e){return arguments.length?(o=e?!0:vq,u()):o!==vq},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Tq(){return wq()(vq,vq)}function Eq(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Dq(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Oq(e){return e=Dq(Math.abs(e)),e?e[1]:NaN}function kq(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Aq(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var jq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Mq(e){if(!(t=jq.exec(e)))throw Error(`invalid format: `+e);var t;return new Nq({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Mq.prototype=Nq.prototype;function Nq(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}Nq.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Pq(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Fq;function Iq(e,t){var n=Dq(e,t);if(!n)return Fq=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Fq=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Dq(e,Math.max(0,t+a-1))[0]}function Lq(e,t){var n=Dq(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Rq={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:Eq,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Lq(e*100,t),r:Lq,s:Iq,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function zq(e){return e}var Bq=Array.prototype.map,Vq=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Hq(e){var t=e.grouping===void 0||e.thousands===void 0?zq:kq(Bq.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?zq:Aq(Bq.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Mq(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Rq[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Rq[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Pq(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Fq!==void 0?Vq[8+Fq/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Oq(t)/3)))*3,r=10**-n,i=l((e=Mq(e),e.type=`f`,e),{suffix:Vq[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Uq,Wq,Gq;Kq({thousands:`,`,grouping:[3],currency:[`$`,``]});function Kq(e){return Uq=Hq(e),Wq=Uq.format,Gq=Uq.formatPrefix,Uq}function qq(e){return Math.max(0,-Oq(Math.abs(e)))}function Jq(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Oq(t)/3)))*3-Oq(Math.abs(e)))}function Yq(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Oq(t)-Oq(e))+1}function Xq(e,t,n,r){var i=YG(e,t,n),a;switch(r=Mq(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Jq(i,o))&&(r.precision=a),Gq(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=Yq(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=qq(i))&&(r.precision=a-(r.type===`%`)*2);break}return Wq(r)}function Zq(e){var t=e.domain;return e.ticks=function(e){var n=t();return qG(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Xq(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=JG(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Qq(){var e=Tq();return e.copy=function(){return Cq(e,Qq())},rK.apply(e,arguments),Zq(e)}function $q(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,gq),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return $q(e).unknown(t)},e=arguments.length?Array.from(e,gq):[0,1],Zq(n)}function eJ(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function sJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function cJ(e){return(t,n)=>-e(-t,n)}function lJ(e){let t=e(tJ,nJ),n=t.domain,r=10,i,a;function o(){return i=sJ(r),a=oJ(r),n()[0]<0?(i=cJ(i),a=cJ(a),e(rJ,iJ)):e(tJ,nJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Mq(n)).precision==null&&(n.trim=!0),n=Wq(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(eJ(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function uJ(){let e=lJ(wq()).domain([1,10]);return e.copy=()=>Cq(e,uJ()).base(e.base()),rK.apply(e,arguments),e}function dJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function fJ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function pJ(e){var t=1,n=e(dJ(t),fJ(t));return n.constant=function(n){return arguments.length?e(dJ(t=+n),fJ(t)):t},Zq(n)}function mJ(){var e=pJ(wq());return e.copy=function(){return Cq(e,mJ()).constant(e.constant())},rK.apply(e,arguments)}function hJ(e){return function(t){return t<0?-((-t)**+e):t**+e}}function gJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function _J(e){return e<0?-e*e:e*e}function vJ(e){var t=e(vq,vq),n=1;function r(){return n===1?e(vq,vq):n===.5?e(gJ,_J):e(hJ(n),hJ(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Zq(t)}function yJ(){var e=vJ(wq());return e.copy=function(){return Cq(e,yJ()).exponent(e.exponent())},rK.apply(e,arguments),e}function bJ(){return yJ.apply(null,arguments).exponent(.5)}function xJ(e){return Math.sign(e)*e*e}function SJ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function CJ(){var e=Tq(),t=[0,1],n=!1,r;function i(t){var i=SJ(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(xJ(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,gq)).map(xJ)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return CJ(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},rK.apply(i,arguments),Zq(i)}function wJ(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return TJ().domain([e,t]).range(i).unknown(a)},rK.apply(Zq(o),arguments)}function EJ(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[FG(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return EJ().domain(e).range(t).unknown(n)},rK.apply(i,arguments)}var DJ=new Date,OJ=new Date;function kJ(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(skJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(DJ.setTime(+t),OJ.setTime(+r),e(DJ),e(OJ),Math.floor(n(DJ,OJ))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var AJ=kJ(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);AJ.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?kJ(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):AJ),AJ.range;var jJ=1e3,MJ=jJ*60,NJ=MJ*60,PJ=NJ*24,FJ=PJ*7,IJ=PJ*30,LJ=PJ*365,RJ=kJ(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getUTCSeconds());RJ.range;var zJ=kJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jJ)},(e,t)=>{e.setTime(+e+t*MJ)},(e,t)=>(t-e)/MJ,e=>e.getMinutes());zJ.range;var BJ=kJ(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*MJ)},(e,t)=>(t-e)/MJ,e=>e.getUTCMinutes());BJ.range;var VJ=kJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*jJ-e.getMinutes()*MJ)},(e,t)=>{e.setTime(+e+t*NJ)},(e,t)=>(t-e)/NJ,e=>e.getHours());VJ.range;var HJ=kJ(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*NJ)},(e,t)=>(t-e)/NJ,e=>e.getUTCHours());HJ.range;var UJ=kJ(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*MJ)/PJ,e=>e.getDate()-1);UJ.range;var WJ=kJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/PJ,e=>e.getUTCDate()-1);WJ.range;var GJ=kJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/PJ,e=>Math.floor(e/PJ));GJ.range;function KJ(e){return kJ(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*MJ)/FJ)}var qJ=KJ(0),JJ=KJ(1),YJ=KJ(2),XJ=KJ(3),ZJ=KJ(4),QJ=KJ(5),$J=KJ(6);qJ.range,JJ.range,YJ.range,XJ.range,ZJ.range,QJ.range,$J.range;function eY(e){return kJ(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/FJ)}var tY=eY(0),nY=eY(1),rY=eY(2),iY=eY(3),aY=eY(4),oY=eY(5),sY=eY(6);tY.range,nY.range,rY.range,iY.range,aY.range,oY.range,sY.range;var cY=kJ(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());cY.range;var lY=kJ(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());lY.range;var uY=kJ(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());uY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:kJ(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),uY.range;var dY=kJ(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());dY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:kJ(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),dY.range;function fY(e,t,n,r,i,a){let o=[[RJ,1,jJ],[RJ,5,5*jJ],[RJ,15,15*jJ],[RJ,30,30*jJ],[a,1,MJ],[a,5,5*MJ],[a,15,15*MJ],[a,30,30*MJ],[i,1,NJ],[i,3,3*NJ],[i,6,6*NJ],[i,12,12*NJ],[r,1,PJ],[r,2,2*PJ],[n,1,FJ],[t,1,IJ],[t,3,3*IJ],[e,1,LJ]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(YG(t/LJ,n/LJ,r));if(a===0)return AJ.every(Math.max(YG(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=vY(yY(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?nY.ceil(a):nY(a),a=WJ.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=_Y(yY(r.y,0,1)),o=a.getDay(),a=o>4||o===0?JJ.ceil(a):JJ(a),a=UJ.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?vY(yY(r.y,0,1)).getUTCDay():_Y(yY(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,vY(r)):_Y(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in xY?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function I(e){return s[e.getMonth()]}function ee(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function ne(e){return o[e.getUTCDay()]}function re(e){return a[e.getUTCDay()]}function ie(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var xY={"-":``,_:` `,0:`0`},SY=/^\s*\d+/,CY=/^%/,wY=/[\\^$*+?|[\]().{}]/g;function TY(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function kY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function AY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function jY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function MY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function NY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function PY(e,t,n){var r=SY.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function FY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function IY(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function LY(e,t,n){var r=SY.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function RY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function zY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function BY(e,t,n){var r=SY.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function VY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function HY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function UY(e,t,n){var r=SY.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function WY(e,t,n){var r=SY.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function GY(e,t,n){var r=SY.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function KY(e,t,n){var r=CY.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function qY(e,t,n){var r=SY.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function JY(e,t,n){var r=SY.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function YY(e,t){return TY(e.getDate(),t,2)}function XY(e,t){return TY(e.getHours(),t,2)}function ZY(e,t){return TY(e.getHours()%12||12,t,2)}function QY(e,t){return TY(1+UJ.count(uY(e),e),t,3)}function $Y(e,t){return TY(e.getMilliseconds(),t,3)}function eX(e,t){return $Y(e,t)+`000`}function tX(e,t){return TY(e.getMonth()+1,t,2)}function nX(e,t){return TY(e.getMinutes(),t,2)}function rX(e,t){return TY(e.getSeconds(),t,2)}function iX(e){var t=e.getDay();return t===0?7:t}function aX(e,t){return TY(qJ.count(uY(e)-1,e),t,2)}function oX(e){var t=e.getDay();return t>=4||t===0?ZJ(e):ZJ.ceil(e)}function sX(e,t){return e=oX(e),TY(ZJ.count(uY(e),e)+(uY(e).getDay()===4),t,2)}function cX(e){return e.getDay()}function lX(e,t){return TY(JJ.count(uY(e)-1,e),t,2)}function uX(e,t){return TY(e.getFullYear()%100,t,2)}function dX(e,t){return e=oX(e),TY(e.getFullYear()%100,t,2)}function fX(e,t){return TY(e.getFullYear()%1e4,t,4)}function pX(e,t){var n=e.getDay();return e=n>=4||n===0?ZJ(e):ZJ.ceil(e),TY(e.getFullYear()%1e4,t,4)}function mX(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+TY(t/60|0,`0`,2)+TY(t%60,`0`,2)}function hX(e,t){return TY(e.getUTCDate(),t,2)}function gX(e,t){return TY(e.getUTCHours(),t,2)}function _X(e,t){return TY(e.getUTCHours()%12||12,t,2)}function vX(e,t){return TY(1+WJ.count(dY(e),e),t,3)}function yX(e,t){return TY(e.getUTCMilliseconds(),t,3)}function bX(e,t){return yX(e,t)+`000`}function xX(e,t){return TY(e.getUTCMonth()+1,t,2)}function SX(e,t){return TY(e.getUTCMinutes(),t,2)}function CX(e,t){return TY(e.getUTCSeconds(),t,2)}function wX(e){var t=e.getUTCDay();return t===0?7:t}function TX(e,t){return TY(tY.count(dY(e)-1,e),t,2)}function EX(e){var t=e.getUTCDay();return t>=4||t===0?aY(e):aY.ceil(e)}function DX(e,t){return e=EX(e),TY(aY.count(dY(e),e)+(dY(e).getUTCDay()===4),t,2)}function OX(e){return e.getUTCDay()}function kX(e,t){return TY(nY.count(dY(e)-1,e),t,2)}function AX(e,t){return TY(e.getUTCFullYear()%100,t,2)}function jX(e,t){return e=EX(e),TY(e.getUTCFullYear()%100,t,2)}function MX(e,t){return TY(e.getUTCFullYear()%1e4,t,4)}function NX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?aY(e):aY.ceil(e),TY(e.getUTCFullYear()%1e4,t,4)}function PX(){return`+0000`}function FX(){return`%`}function IX(e){return+e}function LX(e){return Math.floor(e/1e3)}var RX,zX,BX;VX({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function VX(e){return RX=bY(e),zX=RX.format,RX.parse,BX=RX.utcFormat,RX.utcParse,RX}function HX(e){return new Date(e)}function UX(e){return e instanceof Date?+e:+new Date(+e)}function WX(e,t,n,r,i,a,o,s,c,l){var u=Tq(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>eK(e,r/t))},n.copy=function(){return eZ(t).domain(e)},iK.apply(n,arguments)}function tZ(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=vq,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*esK,scaleDiverging:()=>nZ,scaleDivergingLog:()=>rZ,scaleDivergingPow:()=>aZ,scaleDivergingSqrt:()=>oZ,scaleDivergingSymlog:()=>iZ,scaleIdentity:()=>$q,scaleImplicit:()=>aK,scaleLinear:()=>Qq,scaleLog:()=>uJ,scaleOrdinal:()=>oK,scalePoint:()=>lK,scalePow:()=>yJ,scaleQuantile:()=>wJ,scaleQuantize:()=>TJ,scaleRadial:()=>CJ,scaleSequential:()=>YX,scaleSequentialLog:()=>XX,scaleSequentialPow:()=>QX,scaleSequentialQuantile:()=>eZ,scaleSequentialSqrt:()=>$X,scaleSequentialSymlog:()=>ZX,scaleSqrt:()=>bJ,scaleSymlog:()=>mJ,scaleThreshold:()=>EJ,scaleTime:()=>GX,scaleUtc:()=>KX,tickFormat:()=>Xq}),cZ=o(((e,t)=>{var n=YI();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),uZ=o(((e,t)=>{var n=cZ(),r=lZ(),i=HV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),dZ=o(((e,t)=>{function n(e,t){return e{var n=cZ(),r=dZ(),i=HV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),pZ=o(((e,t)=>{var n=lL(),r=KV(),i=PH(),a=UI();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),mZ=o(((e,t)=>{var n=OH(),r=pZ();function i(e,t){return n(r(e,t),1)}t.exports=i})),hZ=o(((e,t)=>{var n=MV();function r(e,t){return n(e,t)}t.exports=r})),gZ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function _Z(e){return xZ(e)||bZ(e)||yZ(e)||vZ()}function vZ(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function yZ(e,t){if(e){if(typeof e==`string`)return SZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return SZ(e,t)}}function bZ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function xZ(e){if(Array.isArray(e))return SZ(e)}function SZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,EZ(function(){var e=[...arguments],t=r.map(function(t){return TZ(t)?e.shift():t});return n.apply(void 0,_Z(t).concat(e))}))})},OZ=function(e){return DZ(e.length,e)},kZ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function qZ(e){if(Array.isArray(e))return e}function JZ(e){var t=HZ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function YZ(e,t,n){if(e.lte(0))return new PZ.default(0);var r=LZ.getDigitCount(e.toNumber()),i=new PZ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new PZ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new PZ.default(Math.ceil(s))}function XZ(e,t,n){var r=1,i=new PZ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new PZ.default(10).pow(LZ.getDigitCount(e)-1),i=new PZ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new PZ.default(Math.floor(e)))}else e===0?i=new PZ.default(Math.floor((t-1)/2)):n||(i=new PZ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return jZ(AZ(function(e){return i.add(new PZ.default(e-o).mul(r)).toNumber()}),kZ)(0,t)}function ZZ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new PZ.default(0),tickMin:new PZ.default(0),tickMax:new PZ.default(0)};var a=YZ(new PZ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new PZ.default(0):(o=new PZ.default(e).add(t).div(2),o=o.sub(new PZ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new PZ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?ZZ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new PZ.default(s).mul(a)),tickMax:o.add(new PZ.default(c).mul(a))})}function QZ(e){var t=HZ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=HZ(JZ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(RZ(kZ(0,i-1).map(function(){return 1/0}))):[].concat(RZ(kZ(0,i-1).map(function(){return-1/0})),[l]);return n>r?MZ(u):u}if(c===l)return XZ(c,i,a);var d=ZZ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=LZ.rangeStep(p,m.add(new PZ.default(.1).mul(f)),f);return n>r?MZ(h):h}function $Z(e,t){var n=HZ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=HZ(JZ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=YZ(new PZ.default(c).sub(s).div(l-1),a,0),d=[].concat(RZ(LZ.rangeStep(new PZ.default(s),new PZ.default(c).sub(new PZ.default(.99).mul(u)),u)),[c]);return r>i?MZ(d):d}var eQ=NZ(QZ),tQ=NZ($Z),nQ=!0,rQ=`Invariant failed`;function iQ(e,t){if(!e){if(nQ)throw Error(rQ);var n=typeof t==`function`?t():t,r=n?`${rQ}: ${n}`:rQ;throw Error(r)}}var aQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function oQ(e){"@babel/helpers - typeof";return oQ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},oQ(e)}function sQ(){return sQ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function hQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function gQ(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function _Q(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(bL(l-c)!==bL(u-l)){var f=[];if(bL(u-l)===bL(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},n$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?YQ(YQ({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},r$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:YQ(YQ({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,yL.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,yL.default)(x)?void 0:TL(x,n,0)})}}return a},i$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=TL(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(HQ(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=TL(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(HQ(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},a$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=IQ({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Z(e[d]))return YQ(YQ({},e),{},XQ({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Z(e[f]))return YQ(YQ({},e),{},XQ({},f,e[f]+(u||0)))}return e},o$=function(e,t,n){return(0,yL.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},s$=function(e,t,n,r,i){var a=t.props.children,o=eR(a,kQ).filter(function(e){return o$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=$Q(t,n);if((0,yL.default)(r))return e;var i=Array.isArray(r)?[(0,RQ.default)(r),(0,LQ.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=$Q(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},c$=function(e,t,n,r,i){var a=t.map(function(t){return s$(e,t,n,i,r)}).filter(function(e){return!(0,yL.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},l$=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&s$(e,t,a,r)||e$(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?bL(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,_L.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},f$=new WeakMap,p$=function(e,t){if(typeof t!=`function`)return e;f$.has(e)||f$.set(e,new WeakMap);var n=f$.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},m$=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:sK(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:Qq(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:lK(),realScaleType:`point`}:i===`category`?{scale:sK(),realScaleType:`band`}:{scale:Qq(),realScaleType:`linear`};if((0,gL.default)(r)){var s=`scale${(0,rB.default)(r)}`;return{scale:(sZ[s]||lK)(),realScaleType:sZ[s]?s:`point`}}return(0,HL.default)(r)?{scale:r}:{scale:lK(),realScaleType:`point`}},h$=1e-4,g$=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-h$,a=Math.max(r[0],r[1])+h$,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},_$=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:eB,none:Yz,silhouette:tB,wiggle:nB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},b$=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=y$[n];return $z().keys(r).value(function(e,t){return+$Q(e,t,0)}).order(Xz).offset(i)(e)},x$=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?YQ(YQ({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(SL(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[wL(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return YQ(YQ({},e),{},XQ({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return YQ(YQ({},t),{},XQ({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:b$(e,o.items,i)}))},{})),YQ(YQ({},t),{},XQ({},a,s))},{})},S$=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=eQ(c,i,o);return e.domain([(0,RQ.default)(l),(0,LQ.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:tQ(e.domain(),i,o)}:null};function C$(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,yL.default)(i[t.dataKey])){var s=kL(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=$Q(i,(0,yL.default)(o)?t.dataKey:o);return(0,yL.default)(c)?null:t.scale(c)}var w$=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=$Q(a,t.dataKey,t.domain[o]);return(0,yL.default)(s)?null:t.scale(s)-i/2+r},T$=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},E$=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?YQ(YQ({},e.type.defaultProps),e.props):e.props).stackId;if(SL(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},D$=function(e){return e.reduce(function(e,t){return[(0,RQ.default)(t.concat([e[0]]).filter(Z)),(0,LQ.default)(t.concat([e[1]]).filter(Z))]},[1/0,-1/0])},O$=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=D$(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},k$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,A$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,j$=function(e,t,n){if((0,HL.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Z(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(k$.test(e[0])){var i=+k$.exec(e[0])[1];r[0]=t[0]-i}else (0,HL.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Z(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(A$.test(e[1])){var a=+A$.exec(e[1])[1];r[1]=t[1]+a}else (0,HL.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},M$=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,JH.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:H$(c),angleInRadian:c}},K$=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},q$=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},J$=function(e,t){var n=e.x,r=e.y,i=G$({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=K$(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?L$(L$({},t),{},{radius:a,angle:q$(f,t)}):null};function Y$(e){"@babel/helpers - typeof";return Y$=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Y$(e)}var cne=[`offset`];function X$(e){return e1(e)||$$(e)||Q$(e)||Z$()}function Z$(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Q$(e,t){if(e){if(typeof e==`string`)return t1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t1(e,t)}}function $$(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function e1(e){if(Array.isArray(e))return t1(e)}function t1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function r1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function i1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function a1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=U$(c,l,h,y),S=U$(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} + A${h},${h},0,1,${+!b}, + ${S.x},${S.y}`,w=(0,yL.default)(e.id)?wL(`recharts-radial-line-`):e.id;return _.createElement(`text`,l1({},n,{dominantBaseline:`central`,className:pa(`recharts-radial-bar-label`,o)}),_.createElement(`defs`,null,_.createElement(`path`,{id:w,d:C})),_.createElement(`textPath`,{xlinkHref:`#${w}`},t))},p1=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=U$(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=U$(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},m1=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return a1(a1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return a1(a1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return a1(a1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return a1(a1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?a1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?a1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?a1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?a1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?a1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?a1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?a1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?a1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,ML.default)(i)&&(Z(i.x)||xL(i.x))&&(Z(i.y)||xL(i.y))?a1({x:o+TL(i.x,c),y:s+TL(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):a1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},h1=function(e){return`cx`in e&&Z(e.cx)};function g1(e){var t=e.offset,n=t===void 0?5:t,r=n1(e,cne),i=a1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,yL.default)(s)&&(0,yL.default)(c)&&!(0,_.isValidElement)(l)&&!(0,HL.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,HL.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=u1(i);var m=h1(a),h=sR(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return f1(i,p,h);var g=m?p1(i):m1(i);return _.createElement(DG,l1({className:pa(`recharts-label`,d)},h,g,{breakAll:f}),p)}g1.displayName=`Label`;var _1=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Z(m)&&Z(h)){if(Z(u)&&Z(d))return{x:u,y:d,width:m,height:h};if(Z(f)&&Z(p))return{x:f,y:p,width:m,height:h}}return Z(u)&&Z(d)?{x:u,y:d,width:0,height:0}:Z(t)&&Z(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},v1=function(e,t){return e?e===!0?_.createElement(g1,{key:`label-implicit`,viewBox:t}):SL(e)?_.createElement(g1,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===g1?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(g1,{key:`label-implicit`,content:e,viewBox:t}):(0,HL.default)(e)?_.createElement(g1,{key:`label-implicit`,content:e,viewBox:t}):(0,ML.default)(e)?_.createElement(g1,l1({viewBox:t},e,{key:`label-implicit`})):null:null};g1.parseViewBox=_1,g1.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=_1(e),a=eR(r,g1).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[v1(e.label,t||i)].concat(X$(a)):a};var y1=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function b1(e){"@babel/helpers - typeof";return b1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b1(e)}var x1=[`valueAccessor`],S1=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function C1(e){return D1(e)||E1(e)||T1(e)||w1()}function w1(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function T1(e,t){if(e){if(typeof e==`string`)return O1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O1(e,t)}}function E1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function D1(e){if(Array.isArray(e))return O1(e)}function O1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function I1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var L1=function(e){return Array.isArray(e.value)?(0,y1.default)(e.value):e.value};function R1(e){var t=e.valueAccessor,n=t===void 0?L1:t,r=F1(e,x1),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=F1(r,S1);return!i||!i.length?null:_.createElement(SR,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,yL.default)(a)?n(e,t):$Q(e&&e.payload,a),i=(0,yL.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(g1,k1({},sR(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:g1.parseViewBox((0,yL.default)(o)?e:j1(j1({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}R1.displayName=`LabelList`;function z1(e,t){return e?e===!0?_.createElement(R1,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,HL.default)(e)?_.createElement(R1,{key:`labelList-implicit`,data:t,content:e}):(0,ML.default)(e)?_.createElement(R1,k1({data:t},e,{key:`labelList-implicit`})):null:null}function B1(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=eR(r,R1).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[z1(e.label,t)].concat(C1(i)):i}R1.renderCallByParent=B1;function V1(e){"@babel/helpers - typeof";return V1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},V1(e)}function H1(){return H1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)}, + ${u.x},${u.y} + `;if(r>0){var f=U$(t,n,r,a),p=U$(t,n,r,c);d+=`L ${p.x},${p.y} + A ${r},${r},0, + ${+(Math.abs(s)>180)},${+(a<=c)}, + ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},Z1=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=bL(l-c),d=Y1({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=Y1({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} + a${a},${a},0,0,1,${a*2},0 + a${a},${a},0,0,1,${-a*2},0 + `:X1({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} + A${a},${a},0,0,${+(u<0)},${f.x},${f.y} + A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y} + A${a},${a},0,0,${+(u<0)},${_.x},${_.y} + `;if(r>0){var x=Y1({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=Y1({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} + A${a},${a},0,0,${+(u<0)},${E.x},${E.y} + A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y} + A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},Q1={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},$1=function(e){var t=W1(W1({},Q1),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?Z1({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):X1({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,H1({},sR(t,!0),{className:f,d:h,role:`img`}))};function e0(e){"@babel/helpers - typeof";return e0=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},e0(e)}function t0(){return t0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),h0=o(((e,t)=>{var n=m0();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),g0=o(((e,t)=>{t.exports=h0()()})),{getOwnPropertyNames:_0,getOwnPropertySymbols:v0}=Object,{hasOwnProperty:y0}=Object.prototype;function b0(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function x0(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function S0(e){return e?.[Symbol.toStringTag]}function C0(e){return _0(e).concat(v0(e))}var w0=Object.hasOwn||((e,t)=>y0.call(e,t));function T0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var E0=`__v`,D0=`__o`,O0=`_owner`,{getOwnPropertyDescriptor:k0,keys:A0}=Object;function j0(e,t){return e.byteLength===t.byteLength&&W0(new Uint8Array(e),new Uint8Array(t))}function M0(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function N0(e,t){return e.byteLength===t.byteLength&&W0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function P0(e,t){return T0(e.getTime(),t.getTime())}function F0(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function I0(e,t){return e===t}function L0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var R0=T0;function z0(e,t,n){let r=A0(e),i=r.length;if(A0(t).length!==i)return!1;for(;i-- >0;)if(!K0(e,t,n,r[i]))return!1;return!0}function B0(e,t,n){let r=C0(e),i=r.length;if(C0(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!K0(e,t,n,a)||(o=k0(e,a),s=k0(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function V0(e,t){return T0(e.valueOf(),t.valueOf())}function H0(e,t){return e.source===t.source&&e.flags===t.flags}function U0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function W0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function G0(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function K0(e,t,n,r){return(r===O0||r===D0||r===E0)&&(e.$$typeof||t.$$typeof)?!0:w0(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var q0=`[object ArrayBuffer]`,J0=`[object Arguments]`,Y0=`[object Boolean]`,X0=`[object DataView]`,Z0=`[object Date]`,Q0=`[object Error]`,$0=`[object Map]`,e2=`[object Number]`,t2=`[object Object]`,n2=`[object RegExp]`,r2=`[object Set]`,i2=`[object String]`,a2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},o2=`[object URL]`,s2=Object.prototype.toString;function c2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=s2.call(h);if(b===Z0)return r(h,g,_);if(b===n2)return u(h,g,_);if(b===$0)return o(h,g,_);if(b===r2)return d(h,g,_);if(b===t2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===o2)return p(h,g,_);if(b===Q0)return i(h,g,_);if(b===J0)return c(h,g,_);if(a2[b])return f(h,g,_);if(b===q0)return e(h,g,_);if(b===X0)return n(h,g,_);if(b===Y0||b===e2||b===i2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=S0(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function l2({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:j0,areArraysEqual:n?B0:M0,areDataViewsEqual:N0,areDatesEqual:P0,areErrorsEqual:F0,areFunctionsEqual:I0,areMapsEqual:n?b0(L0,B0):L0,areNumbersEqual:R0,areObjectsEqual:n?B0:z0,arePrimitiveWrappersEqual:V0,areRegExpsEqual:H0,areSetsEqual:n?b0(U0,B0):U0,areTypedArraysEqual:n?b0(W0,B0):W0,areUrlsEqual:G0,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=x0(r.areArraysEqual),t=x0(r.areMapsEqual),n=x0(r.areObjectsEqual),i=x0(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function u2(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function d2({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var f2=p2();p2({strict:!0}),p2({circular:!0}),p2({circular:!0,strict:!0}),p2({createInternalComparator:()=>T0}),p2({strict:!0,createInternalComparator:()=>T0}),p2({circular:!0,createInternalComparator:()=>T0}),p2({circular:!0,createInternalComparator:()=>T0,strict:!0});function p2(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=c2(l2(e));return d2({circular:t,comparator:a,createState:r,equals:n?n(a):u2(a),strict:i})}function m2(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function h2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):m2(r)})}function g2(e){"@babel/helpers - typeof";return g2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},g2(e)}function _2(e){return S2(e)||x2(e)||y2(e)||v2()}function v2(){throw TypeError(`Invalid attempt to destructure non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function y2(e,t){if(e){if(typeof e==`string`)return b2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b2(e,t)}}function b2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=X2(t,r),c=X2(n,i),l=Z2(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function T4(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function E4(e){return A4(e)||k4(e)||O4(e)||D4()}function D4(){throw TypeError(`Invalid attempt to spread non-iterable instance. +In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function O4(e,t){if(e){if(typeof e==`string`)return j4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return j4(e,t)}}function k4(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function A4(e){if(Array.isArray(e))return j4(e)}function j4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function K4(e){return K4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},K4(e)}var q4=function(e){B4(n,e);var t=H4(n);function n(e,r){var i;F4(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(W4(i)),i.changeStyle=i.changeStyle.bind(W4(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),U4(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},U4(i);i.state={style:s?P4({},s,c):c}}else i.state={style:{}};return i}return L4(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?P4({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(f2(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?P4({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(N4(N4({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=b4(n,r,e4(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(E4(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(E4(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=P2(f,a,s),m=N4(N4(N4({},d.style),c),{},{transition:p});return[].concat(E4(e),[m,a,u]).filter(j2)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=C2();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?P4({},r,i):i,f=P2(Object.keys(d),n,a);u.start([o,t,N4(N4({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=w4(e,C4),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,N4(N4({},i),{},{style:N4(N4({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);q4.displayName=`Animate`,q4.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},q4.propTypes={from:x4.default.oneOfType([x4.default.object,x4.default.string]),to:x4.default.oneOfType([x4.default.object,x4.default.string]),attributeName:x4.default.string,duration:x4.default.number,begin:x4.default.number,easing:x4.default.oneOfType([x4.default.string,x4.default.func]),steps:x4.default.arrayOf(x4.default.shape({duration:x4.default.number.isRequired,style:x4.default.object.isRequired,easing:x4.default.oneOfType([x4.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),x4.default.func]),properties:x4.default.arrayOf(`string`),onAnimationEnd:x4.default.func})),children:x4.default.oneOfType([x4.default.node,x4.default.func]),isActive:x4.default.bool,canBegin:x4.default.bool,onAnimationEnd:x4.default.func,shouldReAnimate:x4.default.bool,onAnimationStart:x4.default.func,onAnimationReStart:x4.default.func};var J4=q4;function Y4(e){"@babel/helpers - typeof";return Y4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},Y4(e)}function X4(){return X4=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, + ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c}, + ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c}, + ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p} + A ${p},${p},0,0,${c},${e+s*p},${t} + L ${e+n-s*p},${t} + A ${p},${p},0,0,${c},${e+n},${t+o*p} + L ${e+n},${t+r-o*p} + A ${p},${p},0,0,${c},${e+n-s*p},${t+r} + L ${e+s*p},${t+r} + A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},l3=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},u3={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},d3=function(e){var t=i3(i3({},u3),e),n=(0,_.useRef)(),r=Z4((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=pa(`recharts-rectangle`,d);return g?_.createElement(J4,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(J4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,X4({},sR(t,!0),{className:v,d:c3(o,s,r,a,u),ref:n})))}):_.createElement(`path`,X4({},sR(t,!0),{className:v,d:c3(o,s,c,l,u)}))};function f3(){return f3=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function C3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var w3=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},T3=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=S3(e,h3),h=v3({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Z(n)||!Z(i)||!Z(u)||!Z(f)||!Z(o)||!Z(c)?null:_.createElement(`path`,g3({},sR(h,!0),{className:pa(`recharts-cross`,p),d:w3(n,i,u,f,o,c)}))},E3=o(((e,t)=>{t.exports=yV()(Object.getPrototypeOf,Object)})),D3=o(((e,t)=>{var n=qI(),r=E3(),i=JI(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),O3=o(((e,t)=>{var n=qI(),r=JI(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function k3(e){"@babel/helpers - typeof";return k3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k3(e)}function A3(){return A3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(J4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,A3({},sR(t,!0),{className:g,d:H3(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,A3({},sR(t,!0),{className:g,d:H3(o,s,c,l,u)})))},G3=l(D3()),K3=l(O3()),q3=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function J3(e){"@babel/helpers - typeof";return J3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},J3(e)}function Y3(e,t){if(e==null)return{};var n=X3(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function X3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Z3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Q3(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),v6=o(((e,t)=>{var n=sW(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),y6=o(((e,t)=>{var n=_6(),r=qH(),i=v6();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=y6()()}));function x6(e){"@babel/helpers - typeof";return x6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x6(e)}function S6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C6(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),W6(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),W6(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),W6(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),W6(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),W6(n,`handleSlideDragStart`,function(e){var t=J6(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return H6(t,e),I6(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=$Q(n[e],i,e);return(0,HL.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=J6(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(W6(W6({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(W6({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=N6(N6({},sR(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(SR,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(SR,{className:`recharts-brush-texts`},_.createElement(DG,j6({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(DG,j6({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Z(i)||!Z(a)||!Z(o)||!Z(s)||o<=0||s<=0)return null;var g=pa(`recharts-brush`,n),v=_.Children.count(r)===1,y=O6(`userSelect`,`none`);return _.createElement(SR,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,HL.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return N6({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?q6({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);W6(Y6,`displayName`,`Brush`),W6(Y6,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var X6=o(((e,t)=>{var n=NH();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),Z6=o(((e,t)=>{var n=JB(),r=KV(),i=X6(),a=UI(),o=qH();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),Q6=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},$6=o(((e,t)=>{var n=HH();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),e8=o(((e,t)=>{var n=$6(),r=jH(),i=KV();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),t8=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=NH();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),r8=o(((e,t)=>{var n=t8(),r=n8(),i=KV(),a=UI(),o=qH();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),i8=[`x`,`y`];function a8(e){"@babel/helpers - typeof";return a8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},a8(e)}function o8(){return o8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function p8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function m8(e,t){var n=e.x,r=e.y,i=f8(e,i8),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return c8(c8(c8(c8(c8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function h8(e){return _.createElement(o6,o8({shapeType:`rectangle`,propTransformer:m8,activeClassName:`recharts-active-bar`},e))}var g8=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Z(n)||sne(n);return i?e(n,r):(!i&&iQ(!1),t)}},_8=[`value`,`background`],v8;function y8(e){"@babel/helpers - typeof";return y8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y8(e)}function b8(e,t){if(e==null)return{};var n=x8(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function x8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function S8(){return S8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=TL(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=m$(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),g$(j);var N=S$(j,K8(K8({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=K8(K8(K8({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=M$(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),K8(K8({},a),{},q8({},o,P))},{})},Z8=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},Q8=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return Z8({x:t,y:n},{x:r,y:i})},$8=function(){function e(t){H8(this,e),this.scale=t}return W8(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();q8($8,`EPS`,1e-4);var e5=function(e){var t=Object.keys(e).reduce(function(t,n){return K8(K8({},t),{},q8({},n,$8.create(e[n])))},{});return K8(K8({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,z8.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,B8.default)(e,function(e,n){return t[n].isInRange(e)})}})};function t5(e){return(e%180+180)%180}var n5=function(e){var t=e.width,n=e.height,r=t5(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=KV(),r=SV(),i=CV();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),i5=o(((e,t)=>{var n=v6();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),a5=o(((e,t)=>{var n=qV(),r=KV(),i=i5(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),o5=o(((e,t)=>{t.exports=r5()(a5())})),s5=(0,l(cL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});o5();var c5=(0,_.createContext)(void 0),l5=(0,_.createContext)(void 0),u5=(0,_.createContext)(void 0),d5=(0,_.createContext)({}),f5=(0,_.createContext)(void 0),p5=(0,_.createContext)(0),m5=(0,_.createContext)(0),h5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=s5(i);return _.createElement(c5.Provider,{value:n},_.createElement(l5.Provider,{value:r},_.createElement(d5.Provider,{value:i},_.createElement(u5.Provider,{value:l},_.createElement(f5.Provider,{value:a},_.createElement(p5.Provider,{value:c},_.createElement(m5.Provider,{value:s},o)))))))},g5=function(){return(0,_.useContext)(f5)},_5=function(e){var t=(0,_.useContext)(c5);t??iQ(!1);var n=t[e];return n??iQ(!1),n},v5=function(e){var t=(0,_.useContext)(l5);t??iQ(!1);var n=t[e];return n??iQ(!1),n},y5=function(){return(0,_.useContext)(u5)},b5=function(){return(0,_.useContext)(m5)},x5=function(){return(0,_.useContext)(p5)},S5=l(Z6());function C5(e){"@babel/helpers - typeof";return C5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C5(e)}function w5(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function T5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Ene(e,t){return y7(e,t+1)}function Dne(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:y7(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||b7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function x7(e){"@babel/helpers - typeof";return x7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},x7(e)}function S7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function C7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=C7(C7({},r),{},{tickCoord:r.coordinate});b7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=C7(C7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function Mne(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=C7(C7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),b7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=C7(C7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=C7(C7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=C7(C7({},r),{},{tickCoord:r.coordinate});b7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=C7(C7({},r),{},{isShow:!0}))},h=0;h=2?bL(i[1].coordinate-i[0].coordinate):1,_=Tne(a,g,p);return c===`equidistantPreserveStart`?Dne(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?Mne(g,_,h,i,o,c===`preserveStartEnd`):jne(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var Pne=[`viewBox`],Fne=[`viewBox`],Ine=[`ticks`];function w7(e){"@babel/helpers - typeof";return w7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},w7(e)}function T7(){return T7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Lne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Rne(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function k7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(SR,{className:pa(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),g1.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=pa(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,D7(D7({},t),{},{className:i})):(0,HL.default)(e)?e(D7(D7({},t),{},{className:i})):_.createElement(DG,T7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);N7(F7,`displayName`,`CartesianAxis`),N7(F7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var Gne=[`type`,`layout`,`connectNulls`,`ref`],Kne=[`key`];function I7(e){"@babel/helpers - typeof";return I7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},I7(e)}function L7(e,t){if(e==null)return{};var n=qne(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function qne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function R7(){return R7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(V7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(V7(t.repeat(i,o)),V7(l),f).map(function(e){return`${e}px`}).join(`, `)}),q7(e,`id`,wL(`recharts-line-`)),q7(e,`pathRef`,function(t){e.mainCurve=t}),q7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),q7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return rre(t,e),$ne(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=eR(s,kQ);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:$Q(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(SR,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=sR(this.props,!1),l=sR(a,!0),u=o.map(function(e,n){var r=B7(B7(B7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(SR,R7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=B7(B7(B7({},sR(L7(i,Gne),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(p0,R7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(J4,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=OL(r.x,e.x),a=OL(r.y,e.y);return B7(B7({},e),{},{x:i(o),y:a(o)})}if(d){var c=OL(f*2,e.x),l=OL(p/2,e.y);return B7(B7({},e),{},{x:c(o),y:l(o)})}return B7(B7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=OL(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,BQ.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=pa(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,yL.default)(f)?this.id:f,x=sR(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(aR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(SR,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&R1.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(V7(e),[0]),r=[],i=0;ie.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Vre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Hre(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function j9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Z(r)&&Z(i)?e.slice(r,i+1):[]};function U9(e){return e===`number`?[0,`auto`]:void 0}var W9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=H9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?kL(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(F9(i),[P$(s,l)]):i},[])},G9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=eie(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=t$(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:W9(e,t,l,u),activeCoordinate:tie(n,o,l,i)}}return null},nie=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=u$(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=H9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;kre(p.domain,g,m)&&(w=j$(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=e$(S,h,`category`)));var D=U9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=e$(S,h,m),m===`category`&&f){var k=DL(w);_&&k?(T=w,w=(0,k6.default)(0,C)):_||(w=N$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(F9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,yL.default)(e)}):N$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,yL.default)(t)?e:[].concat(F9(e),[t])},[]);else if(m===`number`){var A=c$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=e$(S,h,`category`))}else w=f?(0,k6.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:O$(o[x].stackGroups,s,c):l$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=g9(u,w,x,i,y),O&&(w=j$(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return Q(Q({},t),{},$({},x,Q(Q({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},rie=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=H9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=u$(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:Q(Q({},t.type.defaultProps),t.props))[a],g=U9(`number`);if(!e[h]){m++;var _;return p?_=(0,k6.default)(0,f):o&&o[h]&&o[h].hasStack?(_=O$(o[h].stackGroups,s,c),_=g9(u,_,h,i)):(_=j$(g,l$(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=g9(u,_,h,i)),Q(Q({},e),{},$({},h,Q(Q({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,vL.default)(Qre,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},iie=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=eR(l,i),f={};return d&&d.length?f=nie(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=rie(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},aie=function(e){var t=EL(e),n=d$(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,JH.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:M$(t,n)}},K9=function(e){var t=e.children,n=e.defaultShowTooltip,r=tR(t,Y6),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},oie=function(e){return!e||!e.length?!1:e.some(function(e){var t=XL(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},q9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},sie=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=tR(u,Y6),p=tR(u,EH),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=Q(Q({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?Q(Q({},e),{},$({},r,(0,vL.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||Y6.defaultProps.height),p&&t&&(h=a$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return Q(Q({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},cie=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},J9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=q9(u),h=m.numericAxisName,g=m.cateAxisName,_=oie(n),v=[];return n.forEach(function(n,m){var y=H9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:Q(Q({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&iQ(!1);var a=r[i];return Q(Q({},e),{},$($({},n.axisType,a),`${n.axisType}Ticks`,d$(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&E$(n,r[C].stackGroups),k=XL(n.type).indexOf(`Bar`)>=0,A=M$(E,D),j=[],M=_&&r$({barSize:l,stackGroups:r,totalSize:cie(T,g)});if(k){var N=(0,yL.default)(S)?p:S,P=M$(E,D,!0)??N??0;j=i$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return Q(Q({},e),{},{position:Q(Q({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:Q(Q({},F(Q(Q({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},$($($({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:fR(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!nR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=q9(f),_=g.numericAxisName,v=g.cateAxisName,y=eR(u,n),b=x$(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return Q(Q({},e),{},$({},n,iie(i,Q(Q({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=sie(Q(Q({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=aie(C);return Q(Q({formattedGraphicalItems:d(i,Q(Q({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return Hre(this,n),r=Wre(this,n,[e]),$(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),$(r,`accessibilityManager`,new Ore),$(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState(Q({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},Q(Q({},r.state),{},{legendBBox:e}))))}}),$(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),$(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return Q({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),$(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,HL.default)(i)&&i(n,e)}}),$(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?Q(Q({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,HL.default)(i)&&i(n,e)}),$(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),$(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),$(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),$(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,HL.default)(n)&&n(t,e)}),$(r,`handleOuterEvent`,function(e){var t=dR(e),n=(0,vL.default)(r.props,`${t}`);t&&(0,HL.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),$(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=Q(Q({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,HL.default)(i)&&i(n,e)}}),$(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),$(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),$(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),$(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,HL.default)(t)&&t(r.getMouseInfo(e),e)}),$(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&_9.emit(v9,r.props.syncId,e,r.eventEmitterSymbol)}),$(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState(Q({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=kL(m,k,u),O=h&&g&&kL(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,Q(Q(Q({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,yL.default)(D))return[T].concat(F9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,Q(Q(Q({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),$(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,Q(Q({key:`recharts-customized-${n}`},r.props),r.state))}),$(r,`renderMap`,{CartesianGrid:{handler:V9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:V9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:V9},YAxis:{handler:V9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??wL(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,lW.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return qre(n,e),Ure(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=tR(t,rW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=W9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=Q(Q({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){cR([tR(e.children,rW)],[tR(this.props.children,rW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=tR(this.props.children,rW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=IW(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=G9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=EL(c).scale,p=EL(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return Q(Q({},i),{},{xValue:m,yValue:h},d)}return d?Q(Q({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=EL(c);return J$({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=tR(e,rW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),Q(Q({},zL(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){_9.on(v9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){_9.removeListener(v9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=Rs();(0,_.useEffect)(()=>{let t=!1;return av(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,V.jsxs)(vv,{className:`p-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,V.jsx)(Sa,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,V.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,V.jsx)(La,{className:`w-4 h-4 text-purple-400`}),(0,V.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,V.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,V.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{className:`pb-2`,children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,V.jsx)(Ma,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Loss`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,V.jsx)(vv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(SW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(J9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(i9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(p9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,V.jsx)(rW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,V.jsx)(Y7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{className:`pb-2`,children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,V.jsx)(Sa,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,V.jsx)(vv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(SW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(J9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(i9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(p9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,V.jsx)(rW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,V.jsx)(Y7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},uie=({logs:e,logContainerRef:t})=>(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,V.jsx)(Ga,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,V.jsx)(vv,{children:(0,V.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,V.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,V.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,V.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),die=({installHint:e})=>{let t=FI(`system/training-extra`);return(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,V.jsxs)(mv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(hv,{children:(0,V.jsxs)(gv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:t.state}),II(t.state,`Training Extra Not Installed`)]})}),(0,V.jsx)(vv,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`training`})})})]})})},fie=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=FI(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(LI,{state:o.state}),II(o.state,s)]}),(0,V.jsxs)(Ou,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(RI,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training a `,(0,V.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,V.jsx)(zI,{purpose:`${n} training`})})})]})})},pie=()=>{let{auth:e,refetch:t}=Vs(),{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,V.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,V.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,V.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,V.jsx)(Ha,{className:`w-3 h-3`})]}),` `,`with `,(0,V.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,V.jsx)(Sh,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,V.jsx)(G,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,V.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},mie=1e3,Y9=5e3;function hie(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function gie(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset}}var _ie=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{auth:n}=Vs(),{toast:r}=_r(),i=Re(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:Ie().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),Xv(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{tv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),dv(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await ov(e,t,gie(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),tv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(die,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(pie,{}),(0,V.jsx)(Ote,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,V.jsx)(G,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`span`,{tabIndex:0,children:e})}),(0,V.jsx)(Kp,{children:P})]}):e})()})]}),b&&(0,V.jsx)(fie,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},vie=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),i=Re(),{selectedRecord:a}=Vv(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return iv(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{bv(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await nv(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await rv(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>Y9?t.slice(t.length-Y9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},mie);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await cv(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await lv(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,V.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,V.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,V.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,V.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,V.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,V.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,V.jsxs)(G,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,V.jsxs)(G,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(so,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,V.jsx)(lie,{jobId:e,trainingStatus:hie(o,!1),getProgressPercentage:S,formatTime:x}),(0,V.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,V.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Sv,{checkpoints:p,selectedStep:h,onChange:g}),(0,V.jsxs)(G,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,V.jsx)(Xa,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,V.jsx)(Iv,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,V.jsx)(uie,{logs:u,logContainerRef:f})]})})},X9=()=>{let{jobId:e}=Be();return e?(0,V.jsx)(vie,{jobId:e}):(0,V.jsx)(_ie,{})},yie=1e3;function Z9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var bie=()=>{let e=Re(),{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await Mv(t,n)}catch{}},s=async()=>{try{let s=await Nv(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,yie);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await Mv(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(Bj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:Z9(h?f:d)}),(0,V.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${Z9(p)}`})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,V.jsxs)(G,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,V.jsx)(bI,{open:o,onOpenChange:s,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Stop inference?`}),(0,V.jsx)(DI,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,V.jsx)(OI,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},xie=()=>(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col items-center justify-center p-4`,children:[(0,V.jsx)(`h1`,{className:`text-5xl font-bold tracking-tight`,children:`Edit Dataset`}),(0,V.jsx)(`p`,{className:`mt-4 text-xl text-gray-400`,children:`This page is under construction.`})]}),Sie=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,V.jsxs)(`span`,{children:[a.message||e,` `,(0,V.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,V.jsx)(G,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,V.jsx)(Ma,{className:`w-8 h-8 text-green-500`}):(0,V.jsx)(za,{className:`w-8 h-8 text-blue-500`}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,V.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,V.jsx)(Ma,{className:`w-6 h-6 text-green-500`}),(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,V.jsxs)(G,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,V.jsx)(G,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,V.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,V.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,V.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,V.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(kh,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,V.jsx)(Sh,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(Kh,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,V.jsx)(Ua,{className:`w-4 h-4 text-gray-400`}):(0,V.jsx)(Wa,{className:`w-4 h-4 text-gray-400`}),(0,V.jsx)(kh,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,V.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,V.jsxs)(G,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,V.jsx)(Ha,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(G,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lo,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,V.jsx)(G,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,V.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,V.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,V.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,V.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,V.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,V.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,V.jsx)(bI,{open:y,onOpenChange:b,children:(0,V.jsxs)(CI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(wI,{children:[(0,V.jsx)(EI,{children:`Delete dataset from disk?`}),(0,V.jsxs)(DI,{className:`text-gray-400`,children:[`This permanently removes `,(0,V.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,V.jsxs)(TI,{children:[(0,V.jsx)(kI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,V.jsx)(OI,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Cie=()=>{let e=Ie();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,V.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,V.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},wie=`lelab-tabs-v1`,Tie=1e3,Eie=3e3,Die=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Eie;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(wie);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Tie),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,V.jsxs)(V.Fragment,{children:[e,!t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,V.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,V.jsx)(G,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Oie=()=>{let{toast:e}=_r();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function kie(){let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(Qv())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Aie=()=>{let{status:e,open:t,dismiss:n}=kie(),{baseUrl:r,fetchWithHeaders:i}=Rs(),{toast:a}=_r(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,V.jsx)(xu,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(io,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,V.jsxs)(Ou,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,V.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(ig,{children:[(0,V.jsxs)(ag,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,V.jsx)(og,{className:`pt-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,V.jsx)(G,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]})})]}),u&&(0,V.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,V.jsx)(Kh,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,V.jsx)(G,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},jie=new mn;function Mie(){return(0,V.jsx)(_n,{client:jie,children:(0,V.jsx)(hp,{children:(0,V.jsx)(yn,{children:(0,V.jsx)(Ls,{children:(0,V.jsx)(Bs,{children:(0,V.jsx)(nr,{children:(0,V.jsx)(ar,{children:(0,V.jsxs)(pt,{children:[(0,V.jsxs)(Die,{children:[(0,V.jsx)(Oie,{}),(0,V.jsx)(Aie,{}),(0,V.jsxs)(ct,{children:[(0,V.jsx)(ot,{path:`/`,element:(0,V.jsx)(ey,{})}),(0,V.jsx)(ot,{path:`/teleoperation`,element:(0,V.jsx)(Hj,{})}),(0,V.jsx)(ot,{path:`/recording`,element:(0,V.jsx)(AI,{})}),(0,V.jsx)(ot,{path:`/upload`,element:(0,V.jsx)(Sie,{})}),(0,V.jsx)(ot,{path:`/training`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/training/:jobId`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/inference`,element:(0,V.jsx)(bie,{})}),(0,V.jsx)(ot,{path:`/calibration`,element:(0,V.jsx)(yM,{})}),(0,V.jsx)(ot,{path:`/edit-dataset`,element:(0,V.jsx)(xie,{})}),(0,V.jsx)(ot,{path:`*`,element:(0,V.jsx)(Cie,{})})]})]}),(0,V.jsx)(ys,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(Mie,{})); \ No newline at end of file diff --git a/frontend/dist/assets/index-C5KQGL1C.css b/frontend/dist/assets/index-Da-rRmcX.css similarity index 94% rename from frontend/dist/assets/index-C5KQGL1C.css rename to frontend/dist/assets/index-Da-rRmcX.css index cb4dbd7e..be9077f5 100644 --- a/frontend/dist/assets/index-C5KQGL1C.css +++ b/frontend/dist/assets/index-Da-rRmcX.css @@ -1 +1 @@ -*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-96{width:24rem}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} +*,:before,:after,::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border:0 solid #e5e7eb}:before,:after{--tw-content:""}html,:host{-webkit-text-size-adjust:100%;tab-size:4;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;line-height:1.5}body{line-height:inherit;margin:0}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-feature-settings:normal;font-variation-settings:normal;font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-feature-settings:inherit;font-variation-settings:inherit;font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:#0000;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{margin:0;padding:0;list-style:none}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder{opacity:1;color:#9ca3af}textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background:0 0% 100%;--foreground:222.2 84% 4.9%;--card:0 0% 100%;--card-foreground:222.2 84% 4.9%;--popover:0 0% 100%;--popover-foreground:222.2 84% 4.9%;--primary:222.2 47.4% 11.2%;--primary-foreground:210 40% 98%;--secondary:210 40% 96.1%;--secondary-foreground:222.2 47.4% 11.2%;--muted:210 40% 96.1%;--muted-foreground:215.4 16.3% 46.9%;--accent:210 40% 96.1%;--accent-foreground:222.2 47.4% 11.2%;--destructive:0 84.2% 60.2%;--destructive-foreground:210 40% 98%;--border:214.3 31.8% 91.4%;--input:214.3 31.8% 91.4%;--ring:222.2 84% 4.9%;--radius:.5rem;--sidebar-background:0 0% 98%;--sidebar-foreground:240 5.3% 26.1%;--sidebar-primary:240 5.9% 10%;--sidebar-primary-foreground:0 0% 98%;--sidebar-accent:240 4.8% 95.9%;--sidebar-accent-foreground:240 5.9% 10%;--sidebar-border:220 13% 91%;--sidebar-ring:217.2 91.2% 59.8%}.dark{--background:222.2 84% 4.9%;--foreground:210 40% 98%;--card:222.2 84% 4.9%;--card-foreground:210 40% 98%;--popover:222.2 84% 4.9%;--popover-foreground:210 40% 98%;--primary:210 40% 98%;--primary-foreground:222.2 47.4% 11.2%;--secondary:217.2 32.6% 17.5%;--secondary-foreground:210 40% 98%;--muted:217.2 32.6% 17.5%;--muted-foreground:215 20.2% 65.1%;--accent:217.2 32.6% 17.5%;--accent-foreground:210 40% 98%;--destructive:0 62.8% 30.6%;--destructive-foreground:210 40% 98%;--border:217.2 32.6% 17.5%;--input:217.2 32.6% 17.5%;--ring:212.7 26.8% 83.9%;--sidebar-background:240 5.9% 10%;--sidebar-foreground:240 4.8% 95.9%;--sidebar-primary:224.3 76.3% 48%;--sidebar-primary-foreground:0 0% 100%;--sidebar-accent:240 3.7% 15.9%;--sidebar-accent-foreground:240 4.8% 95.9%;--sidebar-border:240 3.7% 15.9%;--sidebar-ring:217.2 91.2% 59.8%}*{border-color:hsl(var(--border))}body{background-color:hsl(var(--background));color:hsl(var(--foreground))}.container{width:100%;margin-left:auto;margin-right:auto;padding-left:2rem;padding-right:2rem}@media (width>=1400px){.container{max-width:1400px}}.sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.pointer-events-none{pointer-events:none}.pointer-events-auto{pointer-events:auto}.visible{visibility:visible}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.sticky{position:sticky}.inset-0{inset:0}.inset-x-0{left:0;right:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-2{left:.5rem}.left-2\.5{left:.625rem}.left-\[50\%\]{left:50%}.right-2{right:.5rem}.right-4{right:1rem}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:.5rem}.top-4{top:1rem}.top-\[50\%\]{top:50%}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-\[100\]{z-index:100}.z-\[9999\]{z-index:9999}.-mx-1{margin-left:-.25rem;margin-right:-.25rem}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-1{margin-top:.25rem;margin-bottom:.25rem}.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}.ml-2{margin-left:.5rem}.ml-3{margin-left:.75rem}.ml-6{margin-left:1.5rem}.ml-auto{margin-left:auto}.mr-1{margin-right:.25rem}.mr-1\.5{margin-right:.375rem}.mr-2{margin-right:.5rem}.mr-3{margin-right:.75rem}.mt-0\.5{margin-top:.125rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}.block{display:block}.inline-block{display:inline-block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.contents{display:contents}.hidden{display:none}.aspect-\[4\/3\]{aspect-ratio:4/3}.h-1\.5{height:.375rem}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-16{height:4rem}.h-2{height:.5rem}.h-24{height:6rem}.h-3{height:.75rem}.h-3\.5{height:.875rem}.h-4{height:1rem}.h-40{height:10rem}.h-48{height:12rem}.h-5{height:1.25rem}.h-6{height:1.5rem}.h-64{height:16rem}.h-7{height:1.75rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-96{height:24rem}.h-\[1px\]{height:1px}.h-\[95vh\]{height:95vh}.h-\[var\(--radix-select-trigger-height\)\]{height:var(--radix-select-trigger-height)}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-40{max-height:10rem}.max-h-96{max-height:24rem}.max-h-\[300px\]{max-height:300px}.max-h-\[90vh\]{max-height:90vh}.max-h-screen{max-height:100vh}.min-h-\[120px\]{min-height:120px}.min-h-\[50vh\]{min-height:50vh}.min-h-screen{min-height:100vh}.w-1{width:.25rem}.w-1\.5{width:.375rem}.w-10{width:2.5rem}.w-11{width:2.75rem}.w-12{width:3rem}.w-16{width:4rem}.w-2{width:.5rem}.w-28{width:7rem}.w-3{width:.75rem}.w-3\.5{width:.875rem}.w-32{width:8rem}.w-4{width:1rem}.w-48{width:12rem}.w-5{width:1.25rem}.w-56{width:14rem}.w-6{width:1.5rem}.w-7{width:1.75rem}.w-72{width:18rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[--radix-popover-trigger-width\]{width:var(--radix-popover-trigger-width)}.w-\[1px\]{width:1px}.w-\[320px\]{width:320px}.w-auto{width:auto}.w-full{width:100%}.w-px{width:1px}.min-w-0{min-width:0}.min-w-\[110px\]{min-width:110px}.min-w-\[8rem\]{min-width:8rem}.min-w-\[var\(--radix-select-trigger-width\)\]{min-width:var(--radix-select-trigger-width)}.max-w-2xl{max-width:42rem}.max-w-3xl{max-width:48rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-lg{max-width:32rem}.max-w-md{max-width:28rem}.max-w-xl{max-width:36rem}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.-translate-y-1\/2{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-x-\[-50\%\]{--tw-translate-x:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y:-50%;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:2s cubic-bezier(.4,0,.6,1) infinite pulse}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:1s linear infinite spin}.cursor-default{cursor:default}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;user-select:none}.list-inside{list-style-position:inside}.list-decimal{list-style-type:decimal}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.flex-wrap{flex-wrap:wrap}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.items-baseline{align-items:baseline}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-1\.5{gap:.375rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-px{gap:1px}.space-x-3>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.75rem * var(--tw-space-x-reverse));margin-left:calc(.75rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.space-y-1>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.25rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.25rem * var(--tw-space-y-reverse))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-3>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(.75rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.75rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.self-stretch{align-self:stretch}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overflow-x-hidden{overflow-x:hidden}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.rounded{border-radius:.25rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-2{border-width:2px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-t{border-top-width:1px}.border-amber-700{--tw-border-opacity:1;border-color:rgb(180 83 9/var(--tw-border-opacity,1))}.border-amber-700\/60{border-color:#b4530999}.border-blue-500{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.border-blue-600{--tw-border-opacity:1;border-color:rgb(37 99 235/var(--tw-border-opacity,1))}.border-destructive{border-color:hsl(var(--destructive))}.border-destructive\/50{border-color:hsl(var(--destructive) / .5)}.border-gray-500{--tw-border-opacity:1;border-color:rgb(107 114 128/var(--tw-border-opacity,1))}.border-gray-600{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.border-gray-700{--tw-border-opacity:1;border-color:rgb(55 65 81/var(--tw-border-opacity,1))}.border-gray-800{--tw-border-opacity:1;border-color:rgb(31 41 55/var(--tw-border-opacity,1))}.border-green-600{--tw-border-opacity:1;border-color:rgb(22 163 74/var(--tw-border-opacity,1))}.border-green-700{--tw-border-opacity:1;border-color:rgb(21 128 61/var(--tw-border-opacity,1))}.border-input{border-color:hsl(var(--input))}.border-primary{border-color:hsl(var(--primary))}.border-purple-700{--tw-border-opacity:1;border-color:rgb(126 34 206/var(--tw-border-opacity,1))}.border-red-500{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.border-red-500\/40{border-color:#ef444466}.border-red-700{--tw-border-opacity:1;border-color:rgb(185 28 28/var(--tw-border-opacity,1))}.border-red-800{--tw-border-opacity:1;border-color:rgb(153 27 27/var(--tw-border-opacity,1))}.border-slate-300{--tw-border-opacity:1;border-color:rgb(203 213 225/var(--tw-border-opacity,1))}.border-slate-600{--tw-border-opacity:1;border-color:rgb(71 85 105/var(--tw-border-opacity,1))}.border-slate-700{--tw-border-opacity:1;border-color:rgb(51 65 85/var(--tw-border-opacity,1))}.border-transparent{border-color:#0000}.border-yellow-700{--tw-border-opacity:1;border-color:rgb(161 98 7/var(--tw-border-opacity,1))}.bg-accent{background-color:hsl(var(--accent))}.bg-amber-400{--tw-bg-opacity:1;background-color:rgb(251 191 36/var(--tw-bg-opacity,1))}.bg-amber-500{--tw-bg-opacity:1;background-color:rgb(245 158 11/var(--tw-bg-opacity,1))}.bg-amber-500\/15{background-color:#f59e0b26}.bg-amber-500\/40{background-color:#f59e0b66}.bg-amber-600{--tw-bg-opacity:1;background-color:rgb(217 119 6/var(--tw-bg-opacity,1))}.bg-amber-900\/40{background-color:#78350f66}.bg-amber-950\/40{background-color:#451a0366}.bg-background{background-color:hsl(var(--background))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity,1))}.bg-black\/30{background-color:#0000004d}.bg-black\/70{background-color:#000000b3}.bg-black\/80{background-color:#000c}.bg-black\/95{background-color:#000000f2}.bg-blue-500{--tw-bg-opacity:1;background-color:rgb(59 130 246/var(--tw-bg-opacity,1))}.bg-blue-500\/20{background-color:#3b82f633}.bg-blue-600{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.bg-blue-900\/20{background-color:#1e3a8a33}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-emerald-400{--tw-bg-opacity:1;background-color:rgb(52 211 153/var(--tw-bg-opacity,1))}.bg-gray-100{--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity,1))}.bg-gray-500{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.bg-gray-500\/15{background-color:#6b728026}.bg-gray-600{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.bg-gray-800{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.bg-gray-800\/50{background-color:#1f293780}.bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity,1))}.bg-gray-900\/60{background-color:#11182799}.bg-gray-900\/80{background-color:#111827cc}.bg-gray-950{--tw-bg-opacity:1;background-color:rgb(3 7 18/var(--tw-bg-opacity,1))}.bg-green-400{--tw-bg-opacity:1;background-color:rgb(74 222 128/var(--tw-bg-opacity,1))}.bg-green-500{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.bg-green-500\/15{background-color:#22c55e26}.bg-green-500\/20{background-color:#22c55e33}.bg-green-600{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.bg-green-900\/20{background-color:#14532d33}.bg-green-900\/50{background-color:#14532d80}.bg-green-900\/70{background-color:#14532db3}.bg-muted{background-color:hsl(var(--muted))}.bg-orange-500{--tw-bg-opacity:1;background-color:rgb(249 115 22/var(--tw-bg-opacity,1))}.bg-orange-500\/15{background-color:#f9731626}.bg-orange-500\/20{background-color:#f9731633}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:hsl(var(--primary))}.bg-primary\/10{background-color:hsl(var(--primary) / .1)}.bg-purple-500{--tw-bg-opacity:1;background-color:rgb(168 85 247/var(--tw-bg-opacity,1))}.bg-purple-900\/50{background-color:#581c8780}.bg-red-400{--tw-bg-opacity:1;background-color:rgb(248 113 113/var(--tw-bg-opacity,1))}.bg-red-500{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.bg-red-500\/15{background-color:#ef444426}.bg-red-500\/30{background-color:#ef44444d}.bg-red-600{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.bg-red-900\/20{background-color:#7f1d1d33}.bg-red-900\/40{background-color:#7f1d1d66}.bg-red-900\/50{background-color:#7f1d1d80}.bg-red-900\/70{background-color:#7f1d1db3}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-500{--tw-bg-opacity:1;background-color:rgb(100 116 139/var(--tw-bg-opacity,1))}.bg-slate-600{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.bg-slate-700{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.bg-slate-800{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.bg-slate-800\/40{background-color:#1e293b66}.bg-slate-800\/50{background-color:#1e293b80}.bg-slate-800\/60{background-color:#1e293b99}.bg-slate-900{--tw-bg-opacity:1;background-color:rgb(15 23 42/var(--tw-bg-opacity,1))}.bg-slate-900\/40{background-color:#0f172a66}.bg-slate-900\/50{background-color:#0f172a80}.bg-transparent{background-color:#0000}.bg-yellow-400{--tw-bg-opacity:1;background-color:rgb(250 204 21/var(--tw-bg-opacity,1))}.bg-yellow-500{--tw-bg-opacity:1;background-color:rgb(234 179 8/var(--tw-bg-opacity,1))}.bg-yellow-900\/50{background-color:#713f1280}.bg-zinc-900{--tw-bg-opacity:1;background-color:rgb(24 24 27/var(--tw-bg-opacity,1))}.bg-gradient-to-br{background-image:linear-gradient(to bottom right, var(--tw-gradient-stops))}.bg-gradient-to-r{background-image:linear-gradient(to right, var(--tw-gradient-stops))}.from-blue-500{--tw-gradient-from:#3b82f6 var(--tw-gradient-from-position);--tw-gradient-to:#3b82f600 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.from-gray-900{--tw-gradient-from:#111827 var(--tw-gradient-from-position);--tw-gradient-to:#11182700 var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to)}.to-gray-800{--tw-gradient-to:#1f2937 var(--tw-gradient-to-position)}.to-sky-400{--tw-gradient-to:#38bdf8 var(--tw-gradient-to-position)}.fill-current{fill:currentColor}.object-contain{-o-object-fit:contain;object-fit:contain}.object-cover{-o-object-fit:cover;object-fit:cover}.p-0{padding:0}.p-1{padding:.25rem}.p-2{padding:.5rem}.p-3{padding:.75rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-2{padding-left:.5rem;padding-right:.5rem}.px-2\.5{padding-left:.625rem;padding-right:.625rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-6{padding-left:1.5rem;padding-right:1.5rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-24{padding-top:6rem;padding-bottom:6rem}.py-3{padding-top:.75rem;padding-bottom:.75rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-16{padding-bottom:4rem}.pb-2{padding-bottom:.5rem}.pl-1{padding-left:.25rem}.pl-8{padding-left:2rem}.pr-12{padding-right:3rem}.pr-2{padding-right:.5rem}.pr-8{padding-right:2rem}.pt-0{padding-top:0}.pt-1{padding-top:.25rem}.pt-2{padding-top:.5rem}.pt-3{padding-top:.75rem}.pt-4{padding-top:1rem}.pt-6{padding-top:1.5rem}.text-left{text-align:left}.text-center{text-align:center}.font-mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace}.text-2xl{font-size:1.5rem;line-height:2rem}.text-3xl{font-size:1.875rem;line-height:2.25rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-5xl{font-size:3rem;line-height:1}.text-7xl{font-size:4.5rem;line-height:1}.text-\[10px\]{font-size:10px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal) var(--tw-slashed-zero) var(--tw-numeric-figure) var(--tw-numeric-spacing) var(--tw-numeric-fraction)}.leading-none{line-height:1}.leading-relaxed{line-height:1.625}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.tracking-wide{letter-spacing:.025em}.tracking-wider{letter-spacing:.05em}.tracking-widest{letter-spacing:.1em}.text-amber-100{--tw-text-opacity:1;color:rgb(254 243 199/var(--tw-text-opacity,1))}.text-amber-200{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.text-amber-200\/80{color:#fde68acc}.text-amber-300{--tw-text-opacity:1;color:rgb(252 211 77/var(--tw-text-opacity,1))}.text-amber-400{--tw-text-opacity:1;color:rgb(251 191 36/var(--tw-text-opacity,1))}.text-amber-400\/80{color:#fbbf24cc}.text-blue-400{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.text-blue-500{--tw-text-opacity:1;color:rgb(59 130 246/var(--tw-text-opacity,1))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-current{color:currentColor}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-foreground\/50{color:hsl(var(--foreground) / .5)}.text-gray-200{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity,1))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.text-gray-500{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity,1))}.text-green-200{--tw-text-opacity:1;color:rgb(187 247 208/var(--tw-text-opacity,1))}.text-green-300{--tw-text-opacity:1;color:rgb(134 239 172/var(--tw-text-opacity,1))}.text-green-400{--tw-text-opacity:1;color:rgb(74 222 128/var(--tw-text-opacity,1))}.text-green-500{--tw-text-opacity:1;color:rgb(34 197 94/var(--tw-text-opacity,1))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-orange-300{--tw-text-opacity:1;color:rgb(253 186 116/var(--tw-text-opacity,1))}.text-orange-400{--tw-text-opacity:1;color:rgb(251 146 60/var(--tw-text-opacity,1))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-purple-200{--tw-text-opacity:1;color:rgb(233 213 255/var(--tw-text-opacity,1))}.text-purple-300{--tw-text-opacity:1;color:rgb(216 180 254/var(--tw-text-opacity,1))}.text-purple-400{--tw-text-opacity:1;color:rgb(192 132 252/var(--tw-text-opacity,1))}.text-red-100{--tw-text-opacity:1;color:rgb(254 226 226/var(--tw-text-opacity,1))}.text-red-200{--tw-text-opacity:1;color:rgb(254 202 202/var(--tw-text-opacity,1))}.text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.text-red-400{--tw-text-opacity:1;color:rgb(248 113 113/var(--tw-text-opacity,1))}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity,1))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-sky-300{--tw-text-opacity:1;color:rgb(125 211 252/var(--tw-text-opacity,1))}.text-sky-400{--tw-text-opacity:1;color:rgb(56 189 248/var(--tw-text-opacity,1))}.text-slate-200{--tw-text-opacity:1;color:rgb(226 232 240/var(--tw-text-opacity,1))}.text-slate-300{--tw-text-opacity:1;color:rgb(203 213 225/var(--tw-text-opacity,1))}.text-slate-400{--tw-text-opacity:1;color:rgb(148 163 184/var(--tw-text-opacity,1))}.text-slate-500{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.text-teal-400{--tw-text-opacity:1;color:rgb(45 212 191/var(--tw-text-opacity,1))}.text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.text-white\/70{color:#ffffffb3}.text-yellow-200{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.text-yellow-300{--tw-text-opacity:1;color:rgb(253 224 71/var(--tw-text-opacity,1))}.text-zinc-400{--tw-text-opacity:1;color:rgb(161 161 170/var(--tw-text-opacity,1))}.text-zinc-500{--tw-text-opacity:1;color:rgb(113 113 122/var(--tw-text-opacity,1))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.placeholder-gray-400::placeholder{--tw-placeholder-opacity:1;color:rgb(156 163 175/var(--tw-placeholder-opacity,1))}.opacity-0{opacity:0}.opacity-100{opacity:1}.opacity-50{opacity:.5}.opacity-60{opacity:.6}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px #0000001a, 0 2px 4px -2px #0000001a;--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 2px 0 #0000000d;--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.shadow-red-500\/30{--tw-shadow-color:#ef44444d;--tw-shadow:var(--tw-shadow-colored)}.outline-none{outline-offset:2px;outline:2px solid #0000}.outline{outline-style:solid}.ring-0{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.ring-offset-background{--tw-ring-offset-color:hsl(var(--background))}.drop-shadow{--tw-drop-shadow:drop-shadow(0 1px 2px #0000001a) drop-shadow(0 1px 1px #0000000f);filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur:blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter,backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-\[width\]{transition-property:width;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-all{transition-property:all;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-opacity{transition-property:opacity;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.transition-transform{transition-property:transform;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.duration-100{transition-duration:.1s}.duration-200{transition-duration:.2s}.duration-300{transition-duration:.3s}.duration-500{transition-duration:.5s}.duration-75{transition-duration:75ms}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity,1);transform:translate3d(var(--tw-enter-translate-x,0), var(--tw-enter-translate-y,0), 0) scale3d(var(--tw-enter-scale,1), var(--tw-enter-scale,1), var(--tw-enter-scale,1)) rotate(var(--tw-enter-rotate,0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity,1);transform:translate3d(var(--tw-exit-translate-x,0), var(--tw-exit-translate-y,0), 0) scale3d(var(--tw-exit-scale,1), var(--tw-exit-scale,1), var(--tw-exit-scale,1)) rotate(var(--tw-exit-rotate,0))}}.animate-in{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.fade-in-0{--tw-enter-opacity:0}.zoom-in-95{--tw-enter-scale:.95}.duration-100{animation-duration:.1s}.duration-200{animation-duration:.2s}.duration-300{animation-duration:.3s}.duration-500{animation-duration:.5s}.duration-75{animation-duration:75ms}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}.running{animation-play-state:running}.\!paused{animation-play-state:paused!important}.paused{animation-play-state:paused}.\[appearance\:textfield\]{appearance:textfield}.file\:border-0::file-selector-button{border-width:0}.file\:bg-transparent::file-selector-button{background-color:#0000}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.file\:text-foreground::file-selector-button{color:hsl(var(--foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-slate-500::placeholder{--tw-text-opacity:1;color:rgb(100 116 139/var(--tw-text-opacity,1))}.hover\:border-blue-500:hover{--tw-border-opacity:1;border-color:rgb(59 130 246/var(--tw-border-opacity,1))}.hover\:border-gray-200:hover{--tw-border-opacity:1;border-color:rgb(229 231 235/var(--tw-border-opacity,1))}.hover\:border-gray-600:hover{--tw-border-opacity:1;border-color:rgb(75 85 99/var(--tw-border-opacity,1))}.hover\:border-red-400:hover{--tw-border-opacity:1;border-color:rgb(248 113 113/var(--tw-border-opacity,1))}.hover\:border-slate-500:hover{--tw-border-opacity:1;border-color:rgb(100 116 139/var(--tw-border-opacity,1))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-amber-700:hover{--tw-bg-opacity:1;background-color:rgb(180 83 9/var(--tw-bg-opacity,1))}.hover\:bg-amber-900\/40:hover{background-color:#78350f66}.hover\:bg-blue-600:hover{--tw-bg-opacity:1;background-color:rgb(37 99 235/var(--tw-bg-opacity,1))}.hover\:bg-blue-700:hover{--tw-bg-opacity:1;background-color:rgb(29 78 216/var(--tw-bg-opacity,1))}.hover\:bg-destructive\/80:hover{background-color:hsl(var(--destructive) / .8)}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-500:hover{--tw-bg-opacity:1;background-color:rgb(107 114 128/var(--tw-bg-opacity,1))}.hover\:bg-gray-600:hover{--tw-bg-opacity:1;background-color:rgb(75 85 99/var(--tw-bg-opacity,1))}.hover\:bg-gray-700:hover{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.hover\:bg-green-600:hover{--tw-bg-opacity:1;background-color:rgb(22 163 74/var(--tw-bg-opacity,1))}.hover\:bg-green-700:hover{--tw-bg-opacity:1;background-color:rgb(21 128 61/var(--tw-bg-opacity,1))}.hover\:bg-orange-600:hover{--tw-bg-opacity:1;background-color:rgb(234 88 12/var(--tw-bg-opacity,1))}.hover\:bg-primary\/80:hover{background-color:hsl(var(--primary) / .8)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-purple-600:hover{--tw-bg-opacity:1;background-color:rgb(147 51 234/var(--tw-bg-opacity,1))}.hover\:bg-red-500\/10:hover{background-color:#ef44441a}.hover\:bg-red-500\/30:hover{background-color:#ef44444d}.hover\:bg-red-600:hover{--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity,1))}.hover\:bg-red-700:hover{--tw-bg-opacity:1;background-color:rgb(185 28 28/var(--tw-bg-opacity,1))}.hover\:bg-red-900\/20:hover{background-color:#7f1d1d33}.hover\:bg-secondary:hover{background-color:hsl(var(--secondary))}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:bg-slate-600:hover{--tw-bg-opacity:1;background-color:rgb(71 85 105/var(--tw-bg-opacity,1))}.hover\:bg-slate-700:hover{--tw-bg-opacity:1;background-color:rgb(51 65 85/var(--tw-bg-opacity,1))}.hover\:bg-slate-800:hover{--tw-bg-opacity:1;background-color:rgb(30 41 59/var(--tw-bg-opacity,1))}.hover\:bg-yellow-600:hover{--tw-bg-opacity:1;background-color:rgb(202 138 4/var(--tw-bg-opacity,1))}.hover\:bg-zinc-800:hover{--tw-bg-opacity:1;background-color:rgb(39 39 42/var(--tw-bg-opacity,1))}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:text-amber-200:hover{--tw-text-opacity:1;color:rgb(253 230 138/var(--tw-text-opacity,1))}.hover\:text-amber-50:hover{--tw-text-opacity:1;color:rgb(255 251 235/var(--tw-text-opacity,1))}.hover\:text-blue-300:hover{--tw-text-opacity:1;color:rgb(147 197 253/var(--tw-text-opacity,1))}.hover\:text-blue-400:hover{--tw-text-opacity:1;color:rgb(96 165 250/var(--tw-text-opacity,1))}.hover\:text-blue-700:hover{--tw-text-opacity:1;color:rgb(29 78 216/var(--tw-text-opacity,1))}.hover\:text-foreground:hover{color:hsl(var(--foreground))}.hover\:text-gray-200:hover{--tw-text-opacity:1;color:rgb(229 231 235/var(--tw-text-opacity,1))}.hover\:text-red-300:hover{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.hover\:text-sky-200:hover{--tw-text-opacity:1;color:rgb(186 230 253/var(--tw-text-opacity,1))}.hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.hover\:text-yellow-200:hover{--tw-text-opacity:1;color:rgb(254 240 138/var(--tw-text-opacity,1))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.hover\:shadow-lg:hover{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.hover\:shadow-red-500\/40:hover{--tw-shadow-color:#ef444466;--tw-shadow:var(--tw-shadow-colored)}.focus\:bg-accent:focus{background-color:hsl(var(--accent))}.focus\:bg-gray-800:focus{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity,1))}.focus\:text-accent-foreground:focus{color:hsl(var(--accent-foreground))}.focus\:text-red-300:focus{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.focus\:text-white:focus{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.focus\:opacity-100:focus{opacity:1}.focus\:outline-none:focus{outline-offset:2px;outline:2px solid #0000}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color:hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width:2px}.focus-visible\:outline-none:focus-visible{outline-offset:2px;outline:2px solid #0000}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow,0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color:hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width:2px}.focus-visible\:ring-offset-background:focus-visible{--tw-ring-offset-color:hsl(var(--background))}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:text-gray-500:disabled{--tw-text-opacity:1;color:rgb(107 114 128/var(--tw-text-opacity,1))}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}.disabled\:hover\:bg-transparent:hover:disabled{background-color:#0000}.group:hover .group-hover\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity,1))}.group:hover .group-hover\:opacity-100{opacity:1}.group.destructive .group-\[\.destructive\]\:border-muted\/40{border-color:hsl(var(--muted) / .4)}.group.toaster .group-\[\.toaster\]\:border-border{border-color:hsl(var(--border))}.group.toast .group-\[\.toast\]\:bg-muted{background-color:hsl(var(--muted))}.group.toast .group-\[\.toast\]\:bg-primary{background-color:hsl(var(--primary))}.group.toaster .group-\[\.toaster\]\:bg-background{background-color:hsl(var(--background))}.group.destructive .group-\[\.destructive\]\:text-red-300{--tw-text-opacity:1;color:rgb(252 165 165/var(--tw-text-opacity,1))}.group.toast .group-\[\.toast\]\:text-muted-foreground{color:hsl(var(--muted-foreground))}.group.toast .group-\[\.toast\]\:text-primary-foreground{color:hsl(var(--primary-foreground))}.group.toaster .group-\[\.toaster\]\:text-foreground{color:hsl(var(--foreground))}.group.toaster .group-\[\.toaster\]\:shadow-lg{--tw-shadow:0 10px 15px -3px #0000001a, 0 4px 6px -4px #0000001a;--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000), var(--tw-ring-shadow,0 0 #0000), var(--tw-shadow)}.group.destructive .group-\[\.destructive\]\:hover\:border-destructive\/30:hover{border-color:hsl(var(--destructive) / .3)}.group.destructive .group-\[\.destructive\]\:hover\:bg-destructive:hover{background-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:hover\:text-destructive-foreground:hover{color:hsl(var(--destructive-foreground))}.group.destructive .group-\[\.destructive\]\:hover\:text-red-50:hover{--tw-text-opacity:1;color:rgb(254 242 242/var(--tw-text-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-destructive:focus{--tw-ring-color:hsl(var(--destructive))}.group.destructive .group-\[\.destructive\]\:focus\:ring-red-400:focus{--tw-ring-opacity:1;--tw-ring-color:rgb(248 113 113/var(--tw-ring-opacity,1))}.group.destructive .group-\[\.destructive\]\:focus\:ring-offset-red-600:focus{--tw-ring-offset-color:#dc2626}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.aria-selected\:bg-gray-700[aria-selected=true]{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity,1))}.data-\[disabled\=true\]\:pointer-events-none[data-disabled=true],.data-\[disabled\]\:pointer-events-none[data-disabled]{pointer-events:none}.data-\[side\=bottom\]\:translate-y-1[data-side=bottom]{--tw-translate-y:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=left\]\:-translate-x-1[data-side=left]{--tw-translate-x:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=right\]\:translate-x-1[data-side=right]{--tw-translate-x:.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[side\=top\]\:-translate-y-1[data-side=top]{--tw-translate-y:-.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:translate-x-5[data-state=checked]{--tw-translate-x:1.25rem;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=unchecked\]\:translate-x-0[data-state=unchecked],.data-\[swipe\=cancel\]\:translate-x-0[data-swipe=cancel]{--tw-translate-x:0px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=end\]\:translate-x-\[var\(--radix-toast-swipe-end-x\)\][data-swipe=end]{--tw-translate-x:var(--radix-toast-swipe-end-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[swipe\=move\]\:translate-x-\[var\(--radix-toast-swipe-move-x\)\][data-swipe=move]{--tw-translate-x:var(--radix-toast-swipe-move-x);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-\[state\=checked\]\:border-red-500[data-state=checked]{--tw-border-opacity:1;border-color:rgb(239 68 68/var(--tw-border-opacity,1))}.data-\[selected\=\'true\'\]\:bg-accent[data-selected=true]{background-color:hsl(var(--accent))}.data-\[state\=checked\]\:bg-green-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(34 197 94/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-primary[data-state=checked]{background-color:hsl(var(--primary))}.data-\[state\=checked\]\:bg-red-500[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(239 68 68/var(--tw-bg-opacity,1))}.data-\[state\=checked\]\:bg-slate-300[data-state=checked]{--tw-bg-opacity:1;background-color:rgb(203 213 225/var(--tw-bg-opacity,1))}.data-\[state\=open\]\:bg-accent[data-state=open]{background-color:hsl(var(--accent))}.data-\[state\=unchecked\]\:bg-input[data-state=unchecked]{background-color:hsl(var(--input))}.data-\[selected\=true\]\:text-accent-foreground[data-selected=true]{color:hsl(var(--accent-foreground))}.data-\[state\=checked\]\:text-primary-foreground[data-state=checked]{color:hsl(var(--primary-foreground))}.data-\[state\=checked\]\:text-slate-900[data-state=checked]{--tw-text-opacity:1;color:rgb(15 23 42/var(--tw-text-opacity,1))}.data-\[state\=open\]\:text-muted-foreground[data-state=open]{color:hsl(var(--muted-foreground))}.data-\[disabled\=true\]\:opacity-50[data-disabled=true],.data-\[disabled\]\:opacity-50[data-disabled]{opacity:.5}.data-\[swipe\=move\]\:transition-none[data-swipe=move]{transition-property:none}.data-\[state\=open\]\:animate-in[data-state=open]{--tw-enter-opacity:initial;--tw-enter-scale:initial;--tw-enter-rotate:initial;--tw-enter-translate-x:initial;--tw-enter-translate-y:initial;animation-name:enter;animation-duration:.15s}.data-\[state\=closed\]\:animate-out[data-state=closed],.data-\[swipe\=end\]\:animate-out[data-swipe=end]{--tw-exit-opacity:initial;--tw-exit-scale:initial;--tw-exit-rotate:initial;--tw-exit-translate-x:initial;--tw-exit-translate-y:initial;animation-name:exit;animation-duration:.15s}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity:0}.data-\[state\=closed\]\:fade-out-80[data-state=closed]{--tw-exit-opacity:.8}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity:0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale:.95}.data-\[state\=open\]\:zoom-in-95[data-state=open]{--tw-enter-scale:.95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y:-.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x:.5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x:-.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y:.5rem}.data-\[state\=closed\]\:slide-out-to-left-1\/2[data-state=closed]{--tw-exit-translate-x:-50%}.data-\[state\=closed\]\:slide-out-to-right-full[data-state=closed]{--tw-exit-translate-x:100%}.data-\[state\=closed\]\:slide-out-to-top-\[48\%\][data-state=closed]{--tw-exit-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-left-1\/2[data-state=open]{--tw-enter-translate-x:-50%}.data-\[state\=open\]\:slide-in-from-top-\[48\%\][data-state=open]{--tw-enter-translate-y:-48%}.data-\[state\=open\]\:slide-in-from-top-full[data-state=open]{--tw-enter-translate-y:-100%}.group[data-state=open] .group-data-\[state\=open\]\:rotate-180{--tw-rotate:180deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.group[data-state=open] .group-data-\[state\=open\]\:rotate-90{--tw-rotate:90deg;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@supports ((-webkit-backdrop-filter:var(--tw)) or (backdrop-filter:var(--tw))){.supports-\[backdrop-filter\]\:bg-black\/70{background-color:#000000b3}}.dark\:border-destructive:is(.dark *){border-color:hsl(var(--destructive))}@media (width>=640px){.sm\:bottom-0{bottom:0}.sm\:right-0{right:0}.sm\:top-auto{top:auto}.sm\:mt-0{margin-top:0}.sm\:w-60{width:15rem}.sm\:w-auto{width:auto}.sm\:max-w-\[500px\]{max-width:500px}.sm\:max-w-\[520px\]{max-width:520px}.sm\:max-w-\[600px\]{max-width:600px}.sm\:max-w-xl{max-width:36rem}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:flex-col{flex-direction:column}.sm\:justify-end{justify-content:flex-end}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:self-auto{align-self:auto}.sm\:rounded-lg{border-radius:var(--radius)}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:text-left{text-align:left}.sm\:text-center{text-align:center}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.data-\[state\=open\]\:sm\:slide-in-from-bottom-full[data-state=open]{--tw-enter-translate-y:100%}}@media (width>=768px){.md\:max-w-\[420px\]{max-width:420px}.md\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.md\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}@media (width>=1024px){.lg\:min-h-0{min-height:0}.lg\:w-1\/2{width:50%}.lg\:w-full{width:100%}.lg\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.lg\:grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.lg\:grid-cols-\[1\.2fr_2fr\]{grid-template-columns:1.2fr 2fr}.lg\:flex-row{flex-direction:row}.lg\:space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse:0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.lg\:space-y-0>:not([hidden])~:not([hidden]){--tw-space-y-reverse:0;margin-top:calc(0px * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(0px * var(--tw-space-y-reverse))}.lg\:p-8{padding:2rem}}.\[\&\:\:-webkit-inner-spin-button\]\:m-0::-webkit-inner-spin-button{margin:0}.\[\&\:\:-webkit-inner-spin-button\]\:appearance-none::-webkit-inner-spin-button{appearance:none}.\[\&\:\:-webkit-outer-spin-button\]\:m-0::-webkit-outer-spin-button{margin:0}.\[\&\:\:-webkit-outer-spin-button\]\:appearance-none::-webkit-outer-spin-button{appearance:none}.\[\&\>span\]\:line-clamp-1>span{-webkit-line-clamp:1;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.\[\&\>svg\+div\]\:translate-y-\[-3px\]>svg+div{--tw-translate-y:-3px;transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.\[\&\>svg\]\:absolute>svg{position:absolute}.\[\&\>svg\]\:left-4>svg{left:1rem}.\[\&\>svg\]\:top-4>svg{top:1rem}.\[\&\>svg\]\:text-destructive>svg{color:hsl(var(--destructive))}.\[\&\>svg\]\:text-foreground>svg{color:hsl(var(--foreground))}.\[\&\>svg\~\*\]\:pl-7>svg~*{padding-left:1.75rem}.\[\&_\[cmdk-group-heading\]\]\:px-2 [cmdk-group-heading]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-group-heading\]\]\:py-1\.5 [cmdk-group-heading]{padding-top:.375rem;padding-bottom:.375rem}.\[\&_\[cmdk-group-heading\]\]\:text-xs [cmdk-group-heading]{font-size:.75rem;line-height:1rem}.\[\&_\[cmdk-group-heading\]\]\:font-medium [cmdk-group-heading]{font-weight:500}.\[\&_\[cmdk-group-heading\]\]\:text-muted-foreground [cmdk-group-heading]{color:hsl(var(--muted-foreground))}.\[\&_\[cmdk-group\]\:not\(\[hidden\]\)_\~\[cmdk-group\]\]\:pt-0 [cmdk-group]:not([hidden])~[cmdk-group]{padding-top:0}.\[\&_\[cmdk-group\]\]\:px-2 [cmdk-group]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:h-5 [cmdk-input-wrapper] svg{height:1.25rem}.\[\&_\[cmdk-input-wrapper\]_svg\]\:w-5 [cmdk-input-wrapper] svg{width:1.25rem}.\[\&_\[cmdk-input\]\]\:h-12 [cmdk-input]{height:3rem}.\[\&_\[cmdk-item\]\]\:px-2 [cmdk-item]{padding-left:.5rem;padding-right:.5rem}.\[\&_\[cmdk-item\]\]\:py-3 [cmdk-item]{padding-top:.75rem;padding-bottom:.75rem}.\[\&_\[cmdk-item\]_svg\]\:h-5 [cmdk-item] svg{height:1.25rem}.\[\&_\[cmdk-item\]_svg\]\:w-5 [cmdk-item] svg{width:1.25rem}.\[\&_p\]\:leading-relaxed p{line-height:1.625}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/frontend/dist/assets/index-Vh3JnQ1R.js b/frontend/dist/assets/index-Vh3JnQ1R.js deleted file mode 100644 index 1ff7d107..00000000 --- a/frontend/dist/assets/index-Vh3JnQ1R.js +++ /dev/null @@ -1,3956 +0,0 @@ -var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.forward_ref`),l=Symbol.for(`react.suspense`),u=Symbol.for(`react.memo`),d=Symbol.for(`react.lazy`),f=Symbol.iterator;function p(e){return typeof e!=`object`||!e?null:(e=f&&e[f]||e[`@@iterator`],typeof e==`function`?e:null)}var m={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},h=Object.assign,g={};function _(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}_.prototype.isReactComponent={},_.prototype.setState=function(e,t){if(typeof e!=`object`&&typeof e!=`function`&&e!=null)throw Error(`setState(...): takes an object of state variables to update or a function which returns an object of state variables.`);this.updater.enqueueSetState(this,e,t,`setState`)},_.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,`forceUpdate`)};function v(){}v.prototype=_.prototype;function y(e,t,n){this.props=e,this.context=t,this.refs=g,this.updater=n||m}var b=y.prototype=new v;b.constructor=y,h(b,_.prototype),b.isPureReactComponent=!0;var x=Array.isArray,S=Object.prototype.hasOwnProperty,C={current:null},w={key:!0,ref:!0,__self:!0,__source:!0};function T(e,n,r){var i,a={},o=null,s=null;if(n!=null)for(i in n.ref!==void 0&&(s=n.ref),n.key!==void 0&&(o=``+n.key),n)S.call(n,i)&&!w.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(c===1)a.children=r;else if(1{t.exports=u()})),f=o((e=>{function t(e,t){var n=e.length;e.push(t);a:for(;0>>1,a=e[r];if(0>>1;ri(c,n))li(u,c)?(e[r]=u,e[l]=n,r=l):(e[r]=c,e[s]=n,r=s);else if(li(u,n))e[r]=u,e[l]=n,r=l;else break a}}return t}function i(e,t){var n=e.sortIndex-t.sortIndex;return n===0?e.id-t.id:n}if(typeof performance==`object`&&typeof performance.now==`function`){var a=performance;e.unstable_now=function(){return a.now()}}else{var o=Date,s=o.now();e.unstable_now=function(){return o.now()-s}}var c=[],l=[],u=1,d=null,f=3,p=!1,m=!1,h=!1,g=typeof setTimeout==`function`?setTimeout:null,_=typeof clearTimeout==`function`?clearTimeout:null,v=typeof setImmediate<`u`?setImmediate:null;typeof navigator<`u`&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function y(e){for(var i=n(l);i!==null;){if(i.callback===null)r(l);else if(i.startTime<=e)r(l),i.sortIndex=i.expirationTime,t(c,i);else break;i=n(l)}}function b(e){if(h=!1,y(e),!m)if(n(c)!==null)m=!0,M(x);else{var t=n(l);t!==null&&N(b,t.startTime-e)}}function x(t,i){m=!1,h&&(h=!1,_(w),w=-1),p=!0;var a=f;try{for(y(i),d=n(c);d!==null&&(!(d.expirationTime>i)||t&&!D());){var o=d.callback;if(typeof o==`function`){d.callback=null,f=d.priorityLevel;var s=o(d.expirationTime<=i);i=e.unstable_now(),typeof s==`function`?d.callback=s:d===n(c)&&r(c),y(i)}else r(c);d=n(c)}if(d!==null)var u=!0;else{var g=n(l);g!==null&&N(b,g.startTime-i),u=!1}return u}finally{d=null,f=a,p=!1}}var S=!1,C=null,w=-1,T=5,E=-1;function D(){return!(e.unstable_now()-Ee||125o?(r.sortIndex=a,t(l,r),n(c)===null&&r===n(l)&&(h?(_(w),w=-1):h=!0,N(b,a-o))):(r.sortIndex=s,t(c,r),m||p||(m=!0,M(x))),r},e.unstable_shouldYield=D,e.unstable_wrapCallback=function(e){var t=f;return function(){var n=f;f=t;try{return e.apply(this,arguments)}finally{f=n}}}})),p=o(((e,t)=>{t.exports=f()})),m=o((e=>{var t=d(),n=p();function r(e){for(var t=`https://reactjs.org/docs/error-decoder.html?invariant=`+e,n=1;n`u`||window.document===void 0||window.document.createElement===void 0),l=Object.prototype.hasOwnProperty,u=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f={},m={};function h(e){return l.call(m,e)?!0:l.call(f,e)?!1:u.test(e)?m[e]=!0:(f[e]=!0,!1)}function g(e,t,n,r){if(n!==null&&n.type===0)return!1;switch(typeof t){case`function`:case`symbol`:return!0;case`boolean`:return r?!1:n===null?(e=e.toLowerCase().slice(0,5),e!==`data-`&&e!==`aria-`):!n.acceptsBooleans;default:return!1}}function _(e,t,n,r){if(t==null||g(e,t,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return!1===t;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function v(e,t,n,r,i,a,o){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=a,this.removeEmptyString=o}var y={};`children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style`.split(` `).forEach(function(e){y[e]=new v(e,0,!1,e,null,!1,!1)}),[[`acceptCharset`,`accept-charset`],[`className`,`class`],[`htmlFor`,`for`],[`httpEquiv`,`http-equiv`]].forEach(function(e){var t=e[0];y[t]=new v(t,1,!1,e[1],null,!1,!1)}),[`contentEditable`,`draggable`,`spellCheck`,`value`].forEach(function(e){y[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)}),[`autoReverse`,`externalResourcesRequired`,`focusable`,`preserveAlpha`].forEach(function(e){y[e]=new v(e,2,!1,e,null,!1,!1)}),`allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope`.split(` `).forEach(function(e){y[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)}),[`checked`,`multiple`,`muted`,`selected`].forEach(function(e){y[e]=new v(e,3,!0,e,null,!1,!1)}),[`capture`,`download`].forEach(function(e){y[e]=new v(e,4,!1,e,null,!1,!1)}),[`cols`,`rows`,`size`,`span`].forEach(function(e){y[e]=new v(e,6,!1,e,null,!1,!1)}),[`rowSpan`,`start`].forEach(function(e){y[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var b=/[\-:]([a-z])/g;function x(e){return e[1].toUpperCase()}`accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,null,!1,!1)}),`xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type`.split(` `).forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/1999/xlink`,!1,!1)}),[`xml:base`,`xml:lang`,`xml:space`].forEach(function(e){var t=e.replace(b,x);y[t]=new v(t,1,!1,e,`http://www.w3.org/XML/1998/namespace`,!1,!1)}),[`tabIndex`,`crossOrigin`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)}),y.xlinkHref=new v(`xlinkHref`,1,!1,`xlink:href`,`http://www.w3.org/1999/xlink`,!0,!1),[`src`,`href`,`action`,`formAction`].forEach(function(e){y[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function S(e,t,n,r){var i=y.hasOwnProperty(t)?y[t]:null;(i===null?r||!(2s||i[o]!==a[s]){var c=` -`+i[o].replace(` at new `,` at `);return e.displayName&&c.includes(``)&&(c=c.replace(``,e.displayName)),c}while(1<=o&&0<=s);break}}}finally{ae=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:``)?ie(e):``}function se(e){switch(e.tag){case 5:return ie(e.type);case 16:return ie(`Lazy`);case 13:return ie(`Suspense`);case 19:return ie(`SuspenseList`);case 0:case 2:case 15:return e=oe(e.type,!1),e;case 11:return e=oe(e.type.render,!1),e;case 1:return e=oe(e.type,!0),e;default:return``}}function ce(e){if(e==null)return null;if(typeof e==`function`)return e.displayName||e.name||null;if(typeof e==`string`)return e;switch(e){case E:return`Fragment`;case T:return`Portal`;case O:return`Profiler`;case D:return`StrictMode`;case M:return`Suspense`;case N:return`SuspenseList`}if(typeof e==`object`)switch(e.$$typeof){case A:return(e.displayName||`Context`)+`.Consumer`;case k:return(e._context.displayName||`Context`)+`.Provider`;case j:var t=e.render;return e=e.displayName,e||=(e=t.displayName||t.name||``,e===``?`ForwardRef`:`ForwardRef(`+e+`)`),e;case P:return t=e.displayName||null,t===null?ce(e.type)||`Memo`:t;case F:t=e._payload,e=e._init;try{return ce(e(t))}catch{}}return null}function le(e){var t=e.type;switch(e.tag){case 24:return`Cache`;case 9:return(t.displayName||`Context`)+`.Consumer`;case 10:return(t._context.displayName||`Context`)+`.Provider`;case 18:return`DehydratedFragment`;case 11:return e=t.render,e=e.displayName||e.name||``,t.displayName||(e===``?`ForwardRef`:`ForwardRef(`+e+`)`);case 7:return`Fragment`;case 5:return t;case 4:return`Portal`;case 3:return`Root`;case 6:return`Text`;case 16:return ce(t);case 8:return t===D?`StrictMode`:`Mode`;case 22:return`Offscreen`;case 12:return`Profiler`;case 21:return`Scope`;case 13:return`Suspense`;case 19:return`SuspenseList`;case 25:return`TracingMarker`;case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t==`function`)return t.displayName||t.name||null;if(typeof t==`string`)return t}return null}function ue(e){switch(typeof e){case`boolean`:case`number`:case`string`:case`undefined`:return e;case`object`:return e;default:return``}}function de(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()===`input`&&(t===`checkbox`||t===`radio`)}function L(e){var t=de(e)?`checked`:`value`,n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=``+e[t];if(!e.hasOwnProperty(t)&&n!==void 0&&typeof n.get==`function`&&typeof n.set==`function`){var i=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return i.call(this)},set:function(e){r=``+e,a.call(this,e)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(e){r=``+e},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function fe(e){e._valueTracker||=L(e)}function pe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r=``;return e&&(r=de(e)?e.checked?`true`:`false`:e.value),e=r,e===n?!1:(t.setValue(e),!0)}function me(e){if(e||=typeof document<`u`?document:void 0,e===void 0)return null;try{return e.activeElement||e.body}catch{return e.body}}function R(e,t){var n=t.checked;return ne({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function he(e,t){var n=t.defaultValue==null?``:t.defaultValue,r=t.checked==null?t.defaultChecked:t.checked;n=ue(t.value==null?n:t.value),e._wrapperState={initialChecked:r,initialValue:n,controlled:t.type===`checkbox`||t.type===`radio`?t.checked!=null:t.value!=null}}function z(e,t){t=t.checked,t!=null&&S(e,`checked`,t,!1)}function ge(e,t){z(e,t);var n=ue(t.value),r=t.type;if(n!=null)r===`number`?(n===0&&e.value===``||e.value!=n)&&(e.value=``+n):e.value!==``+n&&(e.value=``+n);else if(r===`submit`||r===`reset`){e.removeAttribute(`value`);return}t.hasOwnProperty(`value`)?ve(e,t.type,n):t.hasOwnProperty(`defaultValue`)&&ve(e,t.type,ue(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function _e(e,t,n){if(t.hasOwnProperty(`value`)||t.hasOwnProperty(`defaultValue`)){var r=t.type;if(!(r!==`submit`&&r!==`reset`||t.value!==void 0&&t.value!==null))return;t=``+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==``&&(e.name=``),e.defaultChecked=!!e._wrapperState.initialChecked,n!==``&&(e.name=n)}function ve(e,t,n){(t!==`number`||me(e.ownerDocument)!==e)&&(n==null?e.defaultValue=``+e._wrapperState.initialValue:e.defaultValue!==``+n&&(e.defaultValue=``+n))}var ye=Array.isArray;function be(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i`+t.valueOf().toString()+``,t=De.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function ke(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var Ae={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},je=[`Webkit`,`ms`,`Moz`,`O`];Object.keys(Ae).forEach(function(e){je.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),Ae[t]=Ae[e]})});function Me(e,t,n){return t==null||typeof t==`boolean`||t===``?``:n||typeof t!=`number`||t===0||Ae.hasOwnProperty(e)&&Ae[e]?(``+t).trim():t+`px`}function Ne(e,t){for(var n in e=e.style,t)if(t.hasOwnProperty(n)){var r=n.indexOf(`--`)===0,i=Me(n,t[n],r);n===`float`&&(n=`cssFloat`),r?e.setProperty(n,i):e[n]=i}}var Pe=ne({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function Fe(e,t){if(t){if(Pe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(r(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(r(60));if(typeof t.dangerouslySetInnerHTML!=`object`||!(`__html`in t.dangerouslySetInnerHTML))throw Error(r(61))}if(t.style!=null&&typeof t.style!=`object`)throw Error(r(62))}}function Ie(e,t){if(e.indexOf(`-`)===-1)return typeof t.is==`string`;switch(e){case`annotation-xml`:case`color-profile`:case`font-face`:case`font-face-src`:case`font-face-uri`:case`font-face-format`:case`font-face-name`:case`missing-glyph`:return!1;default:return!0}}var Le=null;function Re(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ze=null,Be=null,Ve=null;function He(e){if(e=zi(e)){if(typeof ze!=`function`)throw Error(r(280));var t=e.stateNode;t&&(t=Vi(t),ze(e.stateNode,e.type,t))}}function Ue(e){Be?Ve?Ve.push(e):Ve=[e]:Be=e}function We(){if(Be){var e=Be,t=Ve;if(Ve=Be=null,He(e),t)for(e=0;e>>=0,e===0?32:31-(Dt(e)/Ot|0)|0}var At=64,jt=4194304;function Mt(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function Nt(e,t){var n=e.pendingLanes;if(n===0)return 0;var r=0,i=e.suspendedLanes,a=e.pingedLanes,o=n&268435455;if(o!==0){var s=o&~i;s===0?(a&=o,a!==0&&(r=Mt(a))):r=Mt(s)}else o=n&~i,o===0?a!==0&&(r=Mt(a)):r=Mt(o);if(r===0)return 0;if(t!==0&&t!==r&&(t&i)===0&&(i=r&-r,a=t&-t,i>=a||i===16&&a&4194240))return t;if(r&4&&(r|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=r;0n;n++)t.push(e);return t}function zt(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-Et(t),e[t]=n}function B(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var r=e.eventTimes;for(e=e.expirationTimes;0=er),rr=` `,ir=!1;function ar(e,t){switch(e){case`keyup`:return Qn.indexOf(t.keyCode)!==-1;case`keydown`:return t.keyCode!==229;case`keypress`:case`mousedown`:case`focusout`:return!0;default:return!1}}function or(e){return e=e.detail,typeof e==`object`&&`data`in e?e.data:null}var sr=!1;function cr(e,t){switch(e){case`compositionend`:return or(t);case`keypress`:return t.which===32?(ir=!0,rr):null;case`textInput`:return e=t.data,e===rr&&ir?null:e;default:return null}}function lr(e,t){if(sr)return e===`compositionend`||!$n&&ar(e,t)?(e=Cn(),Sn=xn=bn=null,sr=!1,e):null;switch(e){case`paste`:return null;case`keypress`:if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}a:{for(;n;){if(n.nextSibling){n=n.nextSibling;break a}n=n.parentNode}n=void 0}n=Ar(n)}}function Mr(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Mr(e,t.parentNode):`contains`in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Nr(){for(var e=window,t=me();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href==`string`}catch{n=!1}if(n)e=t.contentWindow;else break;t=me(e.document)}return t}function Pr(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t===`input`&&(e.type===`text`||e.type===`search`||e.type===`tel`||e.type===`url`||e.type===`password`)||t===`textarea`||e.contentEditable===`true`)}function Fr(e){var t=Nr(),n=e.focusedElem,r=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&Mr(n.ownerDocument.documentElement,n)){if(r!==null&&Pr(n)){if(t=r.start,e=r.end,e===void 0&&(e=t),`selectionStart`in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var i=n.textContent.length,a=Math.min(r.start,i);r=r.end===void 0?a:Math.min(r.end,i),!e.extend&&a>r&&(i=r,r=a,a=i),i=jr(n,a);var o=jr(n,r);i&&o&&(e.rangeCount!==1||e.anchorNode!==i.node||e.anchorOffset!==i.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&(t=t.createRange(),t.setStart(i.node,i.offset),e.removeAllRanges(),a>r?(e.addRange(t),e.extend(o.node,o.offset)):(t.setEnd(o.node,o.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus==`function`&&n.focus(),n=0;n=document.documentMode,U=null,Lr=null,Rr=null,zr=!1;function Br(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;zr||U==null||U!==me(r)||(r=U,`selectionStart`in r&&Pr(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Rr&&kr(Rr,r)||(Rr=r,r=fi(Lr,`onSelect`),0Ui||(e.current=Hi[Ui],Hi[Ui]=null,Ui--)}function Ki(e,t){Ui++,Hi[Ui]=e.current,e.current=t}var qi={},Ji=Wi(qi),Yi=Wi(!1),Xi=qi;function Zi(e,t){var n=e.type.contextTypes;if(!n)return qi;var r=e.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===t)return r.__reactInternalMemoizedMaskedChildContext;var i={},a;for(a in n)i[a]=t[a];return r&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=i),i}function Qi(e){return e=e.childContextTypes,e!=null}function $i(){Gi(Yi),Gi(Ji)}function ea(e,t,n){if(Ji.current!==qi)throw Error(r(168));Ki(Ji,t),Ki(Yi,n)}function ta(e,t,n){var i=e.stateNode;if(t=t.childContextTypes,typeof i.getChildContext!=`function`)return n;for(var a in i=i.getChildContext(),i)if(!(a in t))throw Error(r(108,le(e)||`Unknown`,a));return ne({},n,i)}function na(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||qi,Xi=Ji.current,Ki(Ji,e),Ki(Yi,Yi.current),!0}function ra(e,t,n){var i=e.stateNode;if(!i)throw Error(r(169));n?(e=ta(e,t,Xi),i.__reactInternalMemoizedMergedChildContext=e,Gi(Yi),Gi(Ji),Ki(Ji,e)):Gi(Yi),Ki(Yi,n)}var ia=null,aa=!1,oa=!1;function sa(e){ia===null?ia=[e]:ia.push(e)}function ca(e){aa=!0,sa(e)}function la(){if(!oa&&ia!==null){oa=!0;var e=0,t=Vt;try{var n=ia;for(Vt=1;e>=o,i-=o,_a=1<<32-Et(t)+i|n<h?(g=d,d=null):g=d.sibling;var _=p(r,d,s[h],c);if(_===null){d===null&&(d=g);break}e&&d&&_.alternate===null&&t(r,d),a=o(_,a,h),u===null?l=_:u.sibling=_,u=_,d=g}if(h===s.length)return n(r,d),Ta&&ya(r,h),l;if(d===null){for(;hg?(_=h,h=null):_=h.sibling;var y=p(a,h,v.value,l);if(y===null){h===null&&(h=_);break}e&&h&&y.alternate===null&&t(a,h),s=o(y,s,g),d===null?u=y:d.sibling=y,d=y,h=_}if(v.done)return n(a,h),Ta&&ya(a,g),u;if(h===null){for(;!v.done;g++,v=c.next())v=f(a,v.value,l),v!==null&&(s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return Ta&&ya(a,g),u}for(h=i(a,h);!v.done;g++,v=c.next())v=m(h,a,g,v.value,l),v!==null&&(e&&v.alternate!==null&&h.delete(v.key===null?g:v.key),s=o(v,s,g),d===null?u=v:d.sibling=v,d=v);return e&&h.forEach(function(e){return t(a,e)}),Ta&&ya(a,g),u}function _(e,r,i,o){if(typeof i==`object`&&i&&i.type===E&&i.key===null&&(i=i.props.children),typeof i==`object`&&i){switch(i.$$typeof){case w:a:{for(var c=i.key,l=r;l!==null;){if(l.key===c){if(c=i.type,c===E){if(l.tag===7){n(e,l.sibling),r=a(l,i.props.children),r.return=e,e=r;break a}}else if(l.elementType===c||typeof c==`object`&&c&&c.$$typeof===F&&za(c)===l.type){n(e,l.sibling),r=a(l,i.props),r.ref=La(e,l,i),r.return=e,e=r;break a}n(e,l);break}else t(e,l);l=l.sibling}i.type===E?(r=iu(i.props.children,e.mode,o,i.key),r.return=e,e=r):(o=ru(i.type,i.key,i.props,null,e.mode,o),o.ref=La(e,r,i),o.return=e,e=o)}return s(e);case T:a:{for(l=i.key;r!==null;){if(r.key===l)if(r.tag===4&&r.stateNode.containerInfo===i.containerInfo&&r.stateNode.implementation===i.implementation){n(e,r.sibling),r=a(r,i.children||[]),r.return=e,e=r;break a}else{n(e,r);break}else t(e,r);r=r.sibling}r=su(i,e.mode,o),r.return=e,e=r}return s(e);case F:return l=i._init,_(e,r,l(i._payload),o)}if(ye(i))return h(e,r,i,o);if(te(i))return g(e,r,i,o);Ra(e,i)}return typeof i==`string`&&i!==``||typeof i==`number`?(i=``+i,r!==null&&r.tag===6?(n(e,r.sibling),r=a(r,i),r.return=e,e=r):(n(e,r),r=ou(i,e.mode,o),r.return=e,e=r),s(e)):n(e,r)}return _}var Va=Ba(!0),Ha=Ba(!1),Ua=Wi(null),Wa=null,Ga=null,Ka=null;function qa(){Ka=Ga=Wa=null}function Ja(e){var t=Ua.current;Gi(Ua),e._currentValue=t}function Ya(e,t,n){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)===t?r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t):(e.childLanes|=t,r!==null&&(r.childLanes|=t)),e===n)break;e=e.return}}function Xa(e,t){Wa=e,Ka=Ga=null,e=e.dependencies,e!==null&&e.firstContext!==null&&((e.lanes&t)!==0&&(Rs=!0),e.firstContext=null)}function Za(e){var t=e._currentValue;if(Ka!==e)if(e={context:e,memoizedValue:t,next:null},Ga===null){if(Wa===null)throw Error(r(308));Ga=e,Wa.dependencies={lanes:0,firstContext:e}}else Ga=Ga.next=e;return t}var Qa=null;function $a(e){Qa===null?Qa=[e]:Qa.push(e)}function eo(e,t,n,r){var i=t.interleaved;return i===null?(n.next=n,$a(t)):(n.next=i.next,i.next=n),t.interleaved=n,to(e,r)}function to(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var no=!1;function ro(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function io(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function ao(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function oo(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,qc&2){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,to(e,n)}return i=r.interleaved,i===null?(t.next=t,$a(r)):(t.next=i.next,i.next=t),r.interleaved=t,to(e,n)}function so(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,n&4194240)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}function co(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,effects:r.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function lo(e,t,n,r){var i=e.updateQueue;no=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var c=s,l=c.next;c.next=null,o===null?a=l:o.next=l,o=c;var u=e.alternate;u!==null&&(u=u.updateQueue,s=u.lastBaseUpdate,s!==o&&(s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=c))}if(a!==null){var d=i.baseState;o=0,u=l=c=null,s=a;do{var f=s.lane,p=s.eventTime;if((r&f)===f){u!==null&&(u=u.next={eventTime:p,lane:0,tag:s.tag,payload:s.payload,callback:s.callback,next:null});a:{var m=e,h=s;switch(f=t,p=n,h.tag){case 1:if(m=h.payload,typeof m==`function`){d=m.call(p,d,f);break a}d=m;break a;case 3:m.flags=m.flags&-65537|128;case 0:if(m=h.payload,f=typeof m==`function`?m.call(p,d,f):m,f==null)break a;d=ne({},d,f);break a;case 2:no=!0}}s.callback!==null&&s.lane!==0&&(e.flags|=64,f=i.effects,f===null?i.effects=[s]:f.push(s))}else p={eventTime:p,lane:f,tag:s.tag,payload:s.payload,callback:s.callback,next:null},u===null?(l=u=p,c=d):u=u.next=p,o|=f;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;f=s,s=f.next,f.next=null,i.lastBaseUpdate=f,i.shared.pending=null}}while(1);if(u===null&&(c=d),i.baseState=c,i.firstBaseUpdate=l,i.lastBaseUpdate=u,t=i.shared.interleaved,t!==null){i=t;do o|=i.lane,i=i.next;while(i!==t)}else a===null&&(i.shared.lanes=0);tl|=o,e.lanes=o,e.memoizedState=d}}function uo(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var r=Eo.transition;Eo.transition={};try{e(!1),t()}finally{Vt=n,Eo.transition=r}}function fs(){return Bo().memoizedState}function ps(e,t,n){var r=bl(e);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},hs(e))gs(t,n);else if(n=eo(e,t,n,r),n!==null){var i=yl();xl(n,e,r,i),_s(n,t,r)}}function ms(e,t,n){var r=bl(e),i={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(hs(e))gs(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,Or(s,o)){var c=t.interleaved;c===null?(i.next=i,$a(t)):(i.next=c.next,c.next=i),t.interleaved=i;return}}catch{}n=eo(e,t,i,r),n!==null&&(i=yl(),xl(n,e,r,i),_s(n,t,r))}}function hs(e){var t=e.alternate;return e===Oo||t!==null&&t===Oo}function gs(e,t){Mo=jo=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function _s(e,t,n){if(n&4194240){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Bt(e,n)}}var vs={readContext:Za,useCallback:Fo,useContext:Fo,useEffect:Fo,useImperativeHandle:Fo,useInsertionEffect:Fo,useLayoutEffect:Fo,useMemo:Fo,useReducer:Fo,useRef:Fo,useState:Fo,useDebugValue:Fo,useDeferredValue:Fo,useTransition:Fo,useMutableSource:Fo,useSyncExternalStore:Fo,useId:Fo,unstable_isNewReconciler:!1},ys={readContext:Za,useCallback:function(e,t){return zo().memoizedState=[e,t===void 0?null:t],e},useContext:Za,useEffect:ns,useImperativeHandle:function(e,t,n){return n=n==null?null:n.concat([e]),es(4194308,4,os.bind(null,t,e),n)},useLayoutEffect:function(e,t){return es(4194308,4,e,t)},useInsertionEffect:function(e,t){return es(4,2,e,t)},useMemo:function(e,t){var n=zo();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var r=zo();return t=n===void 0?t:n(t),r.memoizedState=r.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},r.queue=e,e=e.dispatch=ps.bind(null,Oo,e),[r.memoizedState,e]},useRef:function(e){var t=zo();return e={current:e},t.memoizedState=e},useState:Zo,useDebugValue:cs,useDeferredValue:function(e){return zo().memoizedState=e},useTransition:function(){var e=Zo(!1),t=e[0];return e=ds.bind(null,e[1]),zo().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var i=Oo,a=zo();if(Ta){if(n===void 0)throw Error(r(407));n=n()}else{if(n=t(),Jc===null)throw Error(r(349));Do&30||Ko(i,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,ns(Jo.bind(null,i,o,e),[e]),i.flags|=2048,Qo(9,qo.bind(null,i,o,n,t),void 0,null),n},useId:function(){var e=zo(),t=Jc.identifierPrefix;if(Ta){var n=va,r=_a;n=(r&~(1<<32-Et(r)-1)).toString(32)+n,t=`:`+t+`R`+n,n=No++,0<\/script>`,e=e.removeChild(e.firstChild)):typeof i.is==`string`?e=c.createElement(n,{is:i.is}):(e=c.createElement(n),n===`select`&&(c=e,i.multiple?c.multiple=!0:i.size&&(c.size=i.size))):e=c.createElementNS(e,n),e[Mi]=t,e[Ni]=i,cc(e,t,!1,!1),t.stateNode=e;a:{switch(c=Ie(n,i),n){case`dialog`:ai(`cancel`,e),ai(`close`,e),o=i;break;case`iframe`:case`object`:case`embed`:ai(`load`,e),o=i;break;case`video`:case`audio`:for(o=0;osl&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304)}else{if(!i)if(e=So(c),e!==null){if(t.flags|=128,i=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),dc(s,!0),s.tail===null&&s.tailMode===`hidden`&&!c.alternate&&!Ta)return fc(t),null}else 2*gt()-s.renderingStartTime>sl&&n!==1073741824&&(t.flags|=128,i=!0,dc(s,!1),t.lanes=4194304);s.isBackwards?(c.sibling=t.child,t.child=c):(n=s.last,n===null?t.child=c:n.sibling=c,s.last=c)}return s.tail===null?(fc(t),null):(t=s.tail,s.rendering=t,s.tail=t.sibling,s.renderingStartTime=gt(),t.sibling=null,n=xo.current,Ki(xo,i?n&1|2:n&1),t);case 22:case 23:return jl(),i=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==i&&(t.flags|=8192),i&&t.mode&1?Zc&1073741824&&(fc(t),t.subtreeFlags&6&&(t.flags|=8192)):fc(t),null;case 24:return null;case 25:return null}throw Error(r(156,t.tag))}function mc(e,t){switch(Sa(t),t.tag){case 1:return Qi(t.type)&&$i(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return vo(),Gi(Yi),Gi(Ji),wo(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return bo(t),null;case 13:if(Gi(xo),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(r(340));Pa()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Gi(xo),null;case 4:return vo(),null;case 10:return Ja(t.type._context),null;case 22:case 23:return jl(),null;case 24:return null;default:return null}}var hc=!1,gc=!1,_c=typeof WeakSet==`function`?WeakSet:Set,K=null;function vc(e,t){var n=e.ref;if(n!==null)if(typeof n==`function`)try{n(null)}catch(n){Gl(e,t,n)}else n.current=null}function yc(e,t,n){try{n()}catch(n){Gl(e,t,n)}}var bc=!1;function xc(e,t){if(bi=mn,e=Nr(),Pr(e)){if(`selectionStart`in e)var n={start:e.selectionStart,end:e.selectionEnd};else a:{n=(n=e.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,o=i.focusNode;i=i.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break a}var s=0,c=-1,l=-1,u=0,d=0,f=e,p=null;b:for(;;){for(var m;f!==n||a!==0&&f.nodeType!==3||(c=s+a),f!==o||i!==0&&f.nodeType!==3||(l=s+i),f.nodeType===3&&(s+=f.nodeValue.length),(m=f.firstChild)!==null;)p=f,f=m;for(;;){if(f===e)break b;if(p===n&&++u===a&&(c=s),p===o&&++d===i&&(l=s),(m=f.nextSibling)!==null)break;f=p,p=f.parentNode}f=m}n=c===-1||l===-1?null:{start:c,end:l}}else n=null}n||={start:0,end:0}}else n=null;for(xi={focusedElem:e,selectionRange:n},mn=!1,K=t;K!==null;)if(t=K,e=t.child,t.subtreeFlags&1028&&e!==null)e.return=t,K=e;else for(;K!==null;){t=K;try{var h=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(h!==null){var g=h.memoizedProps,_=h.memoizedState,v=t.stateNode;v.__reactInternalSnapshotBeforeUpdate=v.getSnapshotBeforeUpdate(t.elementType===t.type?g:Ss(t.type,g),_)}break;case 3:var y=t.stateNode.containerInfo;y.nodeType===1?y.textContent=``:y.nodeType===9&&y.documentElement&&y.removeChild(y.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(r(163))}}catch(e){Gl(t,t.return,e)}if(e=t.sibling,e!==null){e.return=t.return,K=e;break}K=t.return}return h=bc,bc=!1,h}function Sc(e,t,n){var r=t.updateQueue;if(r=r===null?null:r.lastEffect,r!==null){var i=r=r.next;do{if((i.tag&e)===e){var a=i.destroy;i.destroy=void 0,a!==void 0&&yc(t,n,a)}i=i.next}while(i!==r)}}function Cc(e,t){if(t=t.updateQueue,t=t===null?null:t.lastEffect,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var r=n.create;n.destroy=r()}n=n.next}while(n!==t)}}function wc(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t==`function`?t(e):t.current=e}}function Tc(e){var t=e.alternate;t!==null&&(e.alternate=null,Tc(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[Mi],delete t[Ni],delete t[Fi],delete t[Ii],delete t[Li])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Ec(e){return e.tag===5||e.tag===3||e.tag===4}function Dc(e){a:for(;;){for(;e.sibling===null;){if(e.return===null||Ec(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue a;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Oc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=yi));else if(r!==4&&(e=e.child,e!==null))for(Oc(e,t,n),e=e.sibling;e!==null;)Oc(e,t,n),e=e.sibling}function kc(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(e=e.child,e!==null))for(kc(e,t,n),e=e.sibling;e!==null;)kc(e,t,n),e=e.sibling}var Ac=null,jc=!1;function Mc(e,t,n){for(n=n.child;n!==null;)Nc(e,t,n),n=n.sibling}function Nc(e,t,n){if(wt&&typeof wt.onCommitFiberUnmount==`function`)try{wt.onCommitFiberUnmount(Ct,n)}catch{}switch(n.tag){case 5:gc||vc(n,t);case 6:var r=Ac,i=jc;Ac=null,Mc(e,t,n),Ac=r,jc=i,Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Ac.removeChild(n.stateNode));break;case 18:Ac!==null&&(jc?(e=Ac,n=n.stateNode,e.nodeType===8?Oi(e.parentNode,n):e.nodeType===1&&Oi(e,n),fn(e)):Oi(Ac,n.stateNode));break;case 4:r=Ac,i=jc,Ac=n.stateNode.containerInfo,jc=!0,Mc(e,t,n),Ac=r,jc=i;break;case 0:case 11:case 14:case 15:if(!gc&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){i=r=r.next;do{var a=i,o=a.destroy;a=a.tag,o!==void 0&&(a&2||a&4)&&yc(n,t,o),i=i.next}while(i!==r)}Mc(e,t,n);break;case 1:if(!gc&&(vc(n,t),r=n.stateNode,typeof r.componentWillUnmount==`function`))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(e){Gl(n,t,e)}Mc(e,t,n);break;case 21:Mc(e,t,n);break;case 22:n.mode&1?(gc=(r=gc)||n.memoizedState!==null,Mc(e,t,n),gc=r):Mc(e,t,n);break;default:Mc(e,t,n)}}function Pc(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new _c),t.forEach(function(t){var r=Yl.bind(null,e,t);n.has(t)||(n.add(t),t.then(r,r))})}}function Fc(e,t){var n=t.deletions;if(n!==null)for(var i=0;ia&&(a=s),i&=~o}if(i=a,i=gt()-i,i=(120>i?120:480>i?480:1080>i?1080:1920>i?1920:3e3>i?3e3:4320>i?4320:1960*Uc(i/1960))-i,10e?16:e,pl===null)var i=!1;else{if(e=pl,pl=null,ml=0,qc&6)throw Error(r(331));var a=qc;for(qc|=4,K=e.current;K!==null;){var o=K,s=o.child;if(K.flags&16){var c=o.deletions;if(c!==null){for(var l=0;lgt()-ol?Ml(e,0):rl|=n),Sl(e,t)}function ql(e,t){t===0&&(e.mode&1?(t=jt,jt<<=1,!(jt&130023424)&&(jt=4194304)):t=1);var n=yl();e=to(e,t),e!==null&&(zt(e,t,n),Sl(e,n))}function Jl(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),ql(e,n)}function Yl(e,t){var n=0;switch(e.tag){case 13:var i=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=e.stateNode;break;default:throw Error(r(314))}i!==null&&i.delete(t),ql(e,n)}var Xl=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Yi.current)Rs=!0;else{if((e.lanes&n)===0&&!(t.flags&128))return Rs=!1,sc(e,t,n);Rs=!!(e.flags&131072)}else Rs=!1,Ta&&t.flags&1048576&&ba(t,pa,t.index);switch(t.lanes=0,t.tag){case 2:var i=t.type;ac(e,t),e=t.pendingProps;var a=Zi(t,Ji.current);Xa(t,n),a=Lo(null,t,i,e,a,n);var o=Ro();return t.flags|=1,typeof a==`object`&&a&&typeof a.render==`function`&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Qi(i)?(o=!0,na(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,ro(t),a.updater=ws,t.stateNode=a,a._reactInternals=t,Os(t,i,e,n),t=qs(null,t,i,!0,o,n)):(t.tag=0,Ta&&o&&xa(t),zs(null,t,a,n),t=t.child),t;case 16:i=t.elementType;a:{switch(ac(e,t),e=t.pendingProps,a=i._init,i=a(i._payload),t.type=i,a=t.tag=tu(i),e=Ss(i,e),a){case 0:t=Gs(null,t,i,e,n);break a;case 1:t=Ks(null,t,i,e,n);break a;case 11:t=Bs(null,t,i,e,n);break a;case 14:t=Vs(null,t,i,Ss(i.type,e),n);break a}throw Error(r(306,i,``))}return t;case 0:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Gs(e,t,i,a,n);case 1:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Ks(e,t,i,a,n);case 3:a:{if(Js(t),e===null)throw Error(r(387));i=t.pendingProps,o=t.memoizedState,a=o.element,io(e,t),lo(t,i,null,n);var s=t.memoizedState;if(i=s.element,o.isDehydrated)if(o={element:i,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=ks(Error(r(423)),t),t=Ys(e,t,i,n,a);break a}else if(i!==a){a=ks(Error(r(424)),t),t=Ys(e,t,i,n,a);break a}else for(wa=ki(t.stateNode.containerInfo.firstChild),Ca=t,Ta=!0,Ea=null,n=Ha(t,null,i,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(Pa(),i===a){t=oc(e,t,n);break a}zs(e,t,i,n)}t=t.child}return t;case 5:return yo(t),e===null&&Aa(t),i=t.type,a=t.pendingProps,o=e===null?null:e.memoizedProps,s=a.children,Si(i,a)?s=null:o!==null&&Si(i,o)&&(t.flags|=32),Ws(e,t),zs(e,t,s,n),t.child;case 6:return e===null&&Aa(t),null;case 13:return Qs(e,t,n);case 4:return _o(t,t.stateNode.containerInfo),i=t.pendingProps,e===null?t.child=Va(t,null,i,n):zs(e,t,i,n),t.child;case 11:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),Bs(e,t,i,a,n);case 7:return zs(e,t,t.pendingProps,n),t.child;case 8:return zs(e,t,t.pendingProps.children,n),t.child;case 12:return zs(e,t,t.pendingProps.children,n),t.child;case 10:a:{if(i=t.type._context,a=t.pendingProps,o=t.memoizedProps,s=a.value,Ki(Ua,i._currentValue),i._currentValue=s,o!==null)if(Or(o.value,s)){if(o.children===a.children&&!Yi.current){t=oc(e,t,n);break a}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var c=o.dependencies;if(c!==null){s=o.child;for(var l=c.firstContext;l!==null;){if(l.context===i){if(o.tag===1){l=ao(-1,n&-n),l.tag=2;var u=o.updateQueue;if(u!==null){u=u.shared;var d=u.pending;d===null?l.next=l:(l.next=d.next,d.next=l),u.pending=l}}o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Ya(o.return,n,t),c.lanes|=n;break}l=l.next}}else if(o.tag===10)s=o.type===t.type?null:o.child;else if(o.tag===18){if(s=o.return,s===null)throw Error(r(341));s.lanes|=n,c=s.alternate,c!==null&&(c.lanes|=n),Ya(s,n,t),s=o.sibling}else s=o.child;if(s!==null)s.return=o;else for(s=o;s!==null;){if(s===t){s=null;break}if(o=s.sibling,o!==null){o.return=s.return,s=o;break}s=s.return}o=s}zs(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,i=t.pendingProps.children,Xa(t,n),a=Za(a),i=i(a),t.flags|=1,zs(e,t,i,n),t.child;case 14:return i=t.type,a=Ss(i,t.pendingProps),a=Ss(i.type,a),Vs(e,t,i,a,n);case 15:return Hs(e,t,t.type,t.pendingProps,n);case 17:return i=t.type,a=t.pendingProps,a=t.elementType===i?a:Ss(i,a),ac(e,t),t.tag=1,Qi(i)?(e=!0,na(t)):e=!1,Xa(t,n),Es(t,i,a),Os(t,i,a,n),qs(null,t,i,!0,e,n);case 19:return ic(e,t,n);case 22:return Us(e,t,n)}throw Error(r(156,t.tag))};function Zl(e,t){return ft(e,t)}function Ql(e,t,n,r){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function $l(e,t,n,r){return new Ql(e,t,n,r)}function eu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function tu(e){if(typeof e==`function`)return+!!eu(e);if(e!=null){if(e=e.$$typeof,e===j)return 11;if(e===P)return 14}return 2}function nu(e,t){var n=e.alternate;return n===null?(n=$l(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function ru(e,t,n,i,a,o){var s=2;if(i=e,typeof e==`function`)eu(e)&&(s=1);else if(typeof e==`string`)s=5;else a:switch(e){case E:return iu(n.children,a,o,t);case D:s=8,a|=8;break;case O:return e=$l(12,n,t,a|2),e.elementType=O,e.lanes=o,e;case M:return e=$l(13,n,t,a),e.elementType=M,e.lanes=o,e;case N:return e=$l(19,n,t,a),e.elementType=N,e.lanes=o,e;case I:return au(n,a,o,t);default:if(typeof e==`object`&&e)switch(e.$$typeof){case k:s=10;break a;case A:s=9;break a;case j:s=11;break a;case P:s=14;break a;case F:s=16,i=null;break a}throw Error(r(130,e==null?e:typeof e,``))}return t=$l(s,n,t,a),t.elementType=e,t.type=i,t.lanes=o,t}function iu(e,t,n,r){return e=$l(7,e,r,t),e.lanes=n,e}function au(e,t,n,r){return e=$l(22,e,r,t),e.elementType=I,e.lanes=n,e.stateNode={isHidden:!1},e}function ou(e,t,n){return e=$l(6,e,null,t),e.lanes=n,e}function su(e,t,n){return t=$l(4,e.children===null?[]:e.children,e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function cu(e,t,n,r,i){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Rt(0),this.expirationTimes=Rt(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Rt(0),this.identifierPrefix=r,this.onRecoverableError=i,this.mutableSourceEagerHydrationData=null}function lu(e,t,n,r,i,a,o,s,c){return e=new cu(e,t,n,s,c),t===1?(t=1,!0===a&&(t|=8)):t=0,a=$l(3,null,null,t),e.current=a,a.stateNode=e,a.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ro(a),e}function uu(e,t,n){var r=3{function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>`u`||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!=`function`))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}n(),t.exports=m()})),g=o((e=>{var t=h();e.createRoot=t.createRoot,e.hydrateRoot=t.hydrateRoot})),_=l(d()),v=l(h()),y=g();function b(){return b=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0&&(t.hash=e.substr(n),e=e.substr(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substr(r),e=e.substr(0,r)),e&&(t.pathname=e)}return t}function j(e,t,n,r){r===void 0&&(r={});let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=x.Pop,c=null,l=u();l??(l=0,o.replaceState(b({},o.state,{idx:l}),``));function u(){return(o.state||{idx:null}).idx}function d(){s=x.Pop;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=x.Push;let r=O(h.location,e,t);n&&n(r,e),l=u()+1;let d=D(r,l),f=h.createHref(r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=x.Replace;let r=O(h.location,e,t);n&&n(r,e),l=u();let i=D(r,l),d=h.createHref(r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){let t=i.location.origin===`null`?i.location.href:i.location.origin,n=typeof e==`string`?e:k(e);return n=n.replace(/ $/,`%20`),w(t,`No window.location.(origin|href) available to create URL for href: `+n),new URL(n,t)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(S,d),c=e,()=>{i.removeEventListener(S,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}var M;(function(e){e.data=`data`,e.deferred=`deferred`,e.redirect=`redirect`,e.error=`error`})(M||={});function N(e,t,n){return n===void 0&&(n=`/`),P(e,t,n,!1)}function P(e,t,n,r){let i=pe((typeof t==`string`?A(t):t).pathname||`/`,n);if(i==null)return null;let a=F(e);ee(a);let o=null,s=fe(i);for(let e=0;o==null&&e{let o={relativePath:a===void 0?e.path||``:a,caseSensitive:e.caseSensitive===!0,childrenIndex:i,route:e};o.relativePath.startsWith(`/`)&&(w(o.relativePath.startsWith(r),`Absolute route path "`+o.relativePath+`" nested under path `+(`"`+r+`" is not valid. An absolute child route path `)+`must start with the combined path of all its parent routes.`),o.relativePath=o.relativePath.slice(r.length));let s=xe([r,o.relativePath]),c=n.concat(o);e.children&&e.children.length>0&&(w(e.index!==!0,`Index routes must not have child routes. Please remove `+(`all child routes from route path "`+s+`".`)),F(e.children,t,c,s)),!(e.path==null&&!e.index)&&t.push({path:s,score:ce(s,e.index),routesMeta:c})};return e.forEach((e,t)=>{var n;if(e.path===``||!((n=e.path)!=null&&n.includes(`?`)))i(e,t);else for(let n of I(e.path))i(e,t,n)}),t}function I(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=I(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function ee(e){e.sort((e,t)=>e.score===t.score?le(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var te=/^:[\w-]+$/,ne=3,re=2,ie=1,ae=10,oe=-2,se=e=>e===`*`;function ce(e,t){let n=e.split(`/`),r=n.length;return n.some(se)&&(r+=oe),t&&(r+=re),n.filter(e=>!se(e)).reduce((e,t)=>e+(te.test(t)?ne:t===``?ie:ae),r)}function le(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function ue(e,t,n){n===void 0&&(n=!1);let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e{let{paramName:r,isOptional:i}=t;if(r===`*`){let e=s[n]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let c=s[n];return i&&!c?e[r]=void 0:e[r]=(c||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function L(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),T(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "`+e+`" will be treated as if it were `+(`"`+e.replace(/\*$/,`/*`)+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+(`please change the route path to "`+e.replace(/\*$/,`/*`)+`".`));let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n)=>(r.push({paramName:t,isOptional:n!=null}),n?`/?([^\\/]+)?`:`/([^\\/]+)`));return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function fe(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return T(!1,`The URL path "`+e+`" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent `+(`encoding (`+t+`).`)),e}}function pe(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}var me=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,R=e=>me.test(e);function he(e,t){t===void 0&&(t=`/`);let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?A(e):e,a;if(n)if(R(n))a=n;else{if(n.includes(`//`)){let e=n;n=be(n),T(!1,`Pathnames cannot have embedded double slashes - normalizing `+(e+` -> `+n))}a=n.startsWith(`/`)?z(n.substring(1),`/`):z(n,t)}else a=t;return{pathname:a,search:Ce(r),hash:we(i)}}function z(e,t){let n=t.replace(/\/+$/,``).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function ge(e,t,n,r){return`Cannot include a '`+e+`' character in a manually specified `+("`to."+t+"` field ["+JSON.stringify(r)+`]. Please separate it out to the `)+("`to."+n+"` field. Alternatively you may provide the full path as ")+`a string in and the router will parse it for you.`}function _e(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function ve(e,t){let n=_e(e);return t?n.map((e,t)=>t===n.length-1?e.pathname:e.pathnameBase):n.map(e=>e.pathnameBase)}function ye(e,t,n,r){r===void 0&&(r=!1);let i;typeof e==`string`?i=A(e):(i=b({},e),w(!i.pathname||!i.pathname.includes(`?`),ge(`?`,`pathname`,`search`,i)),w(!i.pathname||!i.pathname.includes(`#`),ge(`#`,`pathname`,`hash`,i)),w(!i.search||!i.search.includes(`#`),ge(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=he(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var be=e=>e.replace(/\/\/+/g,`/`),xe=e=>be(e.join(`/`)),Se=e=>e.replace(/\/+$/,``).replace(/^\/*/,`/`),Ce=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,we=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e;function Te(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}var Ee=[`post`,`put`,`patch`,`delete`];new Set(Ee);var De=[`get`,...Ee];new Set(De);function Oe(){return Oe=Object.assign?Object.assign.bind():function(e){for(var t=1;t{s.current=!0}),_.useCallback(function(n,i){if(i===void 0&&(i={}),!s.current)return;if(typeof n==`number`){r.go(n);return}let c=ye(n,JSON.parse(o),a,i.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:xe([t,c.pathname])),(i.replace?r.replace:r.push)(c,i.state,i)},[t,r,o,a,e])}function Be(){let{matches:e}=_.useContext(Ne),t=e[e.length-1];return t?t.params:{}}function Ve(e,t){return He(e,t)}function He(e,t,n,r){!Fe()&&w(!1);let{navigator:i}=_.useContext(je),{matches:a}=_.useContext(Ne),o=a[a.length-1],s=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:`/`;o&&o.route;let l=Ie(),u;if(t){let e=typeof t==`string`?A(t):t;!(c===`/`||e.pathname?.startsWith(c))&&w(!1),u=e}else u=l;let d=u.pathname||`/`,f=d;if(c!==`/`){let e=c.replace(/^\//,``).split(`/`);f=`/`+d.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let p=N(e,{pathname:f}),m=qe(p&&p.map(e=>Object.assign({},e,{params:Object.assign({},s,e.params),pathname:xe([c,i.encodeLocation?i.encodeLocation(e.pathname).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?c:xe([c,i.encodeLocation?i.encodeLocation(e.pathnameBase).pathname:e.pathnameBase])})),a,n,r);return t&&m?_.createElement(Me.Provider,{value:{location:Oe({pathname:`/`,search:``,hash:``,state:null,key:`default`},u),navigationType:x.Pop}},m):m}function Ue(){let e=et(),t=Te(e)?e.status+` `+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return _.createElement(_.Fragment,null,_.createElement(`h2`,null,`Unexpected Application Error!`),_.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?_.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var We=_.createElement(Ue,null),Ge=class extends _.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error(`React Router caught the following error during render`,e,t)}render(){return this.state.error===void 0?this.props.children:_.createElement(Ne.Provider,{value:this.props.routeContext},_.createElement(Pe.Provider,{value:this.state.error,children:this.props.component}))}};function Ke(e){let{routeContext:t,match:n,children:r}=e,i=_.useContext(ke);return i&&i.static&&i.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=n.route.id),_.createElement(Ne.Provider,{value:t},r)}function qe(e,t,n,r){if(t===void 0&&(t=[]),n===void 0&&(n=null),r===void 0&&(r=null),e==null){var i;if(!n)return null;if(n.errors)e=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let a=e,o=n?.errors;if(o!=null){let e=a.findIndex(e=>e.route.id&&o?.[e.route.id]!==void 0);!(e>=0)&&w(!1),a=a.slice(0,Math.min(a.length,e+1))}let s=!1,c=-1;if(n&&r&&r.v7_partialHydration)for(let e=0;e=0?a.slice(0,c+1):[a[0]];break}}}return a.reduceRight((e,r,i)=>{let l,u=!1,d=null,f=null;n&&(l=o&&r.route.id?o[r.route.id]:void 0,d=r.route.errorElement||We,s&&(c<0&&i===0?(rt(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),u=!0,f=null):c===i&&(u=!0,f=r.route.hydrateFallbackElement||null)));let p=t.concat(a.slice(0,i+1)),m=()=>{let t;return t=l?d:u?f:r.route.Component?_.createElement(r.route.Component,null):r.route.element?r.route.element:e,_.createElement(Ke,{match:r,routeContext:{outlet:e,matches:p,isDataRoute:n!=null},children:t})};return n&&(r.route.ErrorBoundary||r.route.errorElement||i===0)?_.createElement(Ge,{location:n.location,revalidation:n.revalidation,component:d,error:l,children:m(),routeContext:{outlet:null,matches:p,isDataRoute:!0}}):m()},null)}var Je=function(e){return e.UseBlocker=`useBlocker`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e}(Je||{}),Ye=function(e){return e.UseBlocker=`useBlocker`,e.UseLoaderData=`useLoaderData`,e.UseActionData=`useActionData`,e.UseRouteError=`useRouteError`,e.UseNavigation=`useNavigation`,e.UseRouteLoaderData=`useRouteLoaderData`,e.UseMatches=`useMatches`,e.UseRevalidator=`useRevalidator`,e.UseNavigateStable=`useNavigate`,e.UseRouteId=`useRouteId`,e}(Ye||{});function Xe(e){let t=_.useContext(ke);return!t&&w(!1),t}function Ze(e){let t=_.useContext(Ae);return!t&&w(!1),t}function Qe(e){let t=_.useContext(Ne);return!t&&w(!1),t}function $e(e){let t=Qe(e),n=t.matches[t.matches.length-1];return!n.route.id&&w(!1),n.route.id}function et(){let e=_.useContext(Pe),t=Ze(Ye.UseRouteError),n=$e(Ye.UseRouteError);return e===void 0?t.errors?.[n]:e}function tt(){let{router:e}=Xe(Je.UseNavigateStable),t=$e(Ye.UseNavigateStable),n=_.useRef(!1);return Le(()=>{n.current=!0}),_.useCallback(function(r,i){i===void 0&&(i={}),n.current&&(typeof r==`number`?e.navigate(r):e.navigate(r,Oe({fromRouteId:t},i)))},[e,t])}var nt={};function rt(e,t,n){!t&&!nt[e]&&(nt[e]=!0)}var it=(e,t,n)=>(``+t+("You can use the `"+e+"` future flag to opt-in early. ")+(`For more information, see `+n+`.`),void 0);function at(e,t){e?.v7_startTransition===void 0&&it(`v7_startTransition`,"React Router will begin wrapping state updates in `React.startTransition` in v7",`https://reactrouter.com/v6/upgrading/future#v7_starttransition`),e?.v7_relativeSplatPath===void 0&&(!t||t.v7_relativeSplatPath===void 0)&&it(`v7_relativeSplatPath`,`Relative route resolution within Splat routes is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_relativesplatpath`),t&&(t.v7_fetcherPersist===void 0&&it(`v7_fetcherPersist`,`The persistence behavior of fetchers is changing in v7`,`https://reactrouter.com/v6/upgrading/future#v7_fetcherpersist`),t.v7_normalizeFormMethod===void 0&&it(`v7_normalizeFormMethod`,"Casing of `formMethod` fields is being normalized to uppercase in v7",`https://reactrouter.com/v6/upgrading/future#v7_normalizeformmethod`),t.v7_partialHydration===void 0&&it(`v7_partialHydration`,"`RouterProvider` hydration behavior is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_partialhydration`),t.v7_skipActionErrorRevalidation===void 0&&it(`v7_skipActionErrorRevalidation`,"The revalidation behavior after 4xx/5xx `action` responses is changing in v7",`https://reactrouter.com/v6/upgrading/future#v7_skipactionerrorrevalidation`))}function ot(e){w(!1)}function st(e){let{basename:t=`/`,children:n=null,location:r,navigationType:i=x.Pop,navigator:a,static:o=!1,future:s}=e;Fe()&&w(!1);let c=t.replace(/^\/*/,`/`),l=_.useMemo(()=>({basename:c,navigator:a,static:o,future:Oe({v7_relativeSplatPath:!1},s)}),[c,s,a,o]);typeof r==`string`&&(r=A(r));let{pathname:u=`/`,search:d=``,hash:f=``,state:p=null,key:m=`default`}=r,h=_.useMemo(()=>{let e=pe(u,c);return e==null?null:{location:{pathname:e,search:d,hash:f,state:p,key:m},navigationType:i}},[c,u,d,f,p,m,i]);return h==null?null:_.createElement(je.Provider,{value:l},_.createElement(Me.Provider,{children:n,value:h}))}function ct(e){let{children:t,location:n}=e;return Ve(ut(t),n)}var lt=function(e){return e[e.pending=0]=`pending`,e[e.success=1]=`success`,e[e.error=2]=`error`,e}(lt||{});new Promise(()=>{}),_.Component;function ut(e,t){t===void 0&&(t=[]);let n=[];return _.Children.forEach(e,(e,r)=>{if(!_.isValidElement(e))return;let i=[...t,r];if(e.type===_.Fragment){n.push.apply(n,ut(e.props.children,i));return}e.type!==ot&&w(!1),!(!e.props.index||!e.props.children)&&w(!1);let a={id:e.props.id||i.join(`-`),caseSensitive:e.props.caseSensitive,element:e.props.element,Component:e.props.Component,index:e.props.index,path:e.props.path,loader:e.props.loader,action:e.props.action,errorElement:e.props.errorElement,ErrorBoundary:e.props.ErrorBoundary,hasErrorBoundary:e.props.ErrorBoundary!=null||e.props.errorElement!=null,shouldRevalidate:e.props.shouldRevalidate,handle:e.props.handle,lazy:e.props.lazy};e.props.children&&(a.children=ut(e.props.children,i)),n.push(a)}),n}var dt=`6`;try{window.__reactRouterVersion=dt}catch{}var ft=_.startTransition;function pt(e){let{basename:t,children:n,future:r,window:i}=e,a=_.useRef();a.current??=C({window:i,v5Compat:!0});let o=a.current,[s,c]=_.useState({action:o.action,location:o.location}),{v7_startTransition:l}=r||{},u=_.useCallback(e=>{l&&ft?ft(()=>c(e)):c(e)},[c,l]);return _.useLayoutEffect(()=>o.listen(u),[o,u]),_.useEffect(()=>at(r),[r]),_.createElement(st,{basename:t,children:n,location:s.location,navigationType:s.action,navigator:o,future:r})}typeof window<`u`&&window.document!==void 0&&window.document.createElement;var mt;(function(e){e.UseScrollRestoration=`useScrollRestoration`,e.UseSubmit=`useSubmit`,e.UseSubmitFetcher=`useSubmitFetcher`,e.UseFetcher=`useFetcher`,e.useViewTransitionState=`useViewTransitionState`})(mt||={});var ht;(function(e){e.UseFetcher=`useFetcher`,e.UseFetchers=`useFetchers`,e.UseScrollRestoration=`useScrollRestoration`})(ht||={});var gt=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},_t=new class extends gt{#e;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e();return window.addEventListener(`visibilitychange`,t,!1),()=>{window.removeEventListener(`visibilitychange`,t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(e=>{typeof e==`boolean`?this.setFocused(e):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){let e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e==`boolean`?this.#e:globalThis.document?.visibilityState!==`hidden`}},vt={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},yt=new class{#e=vt;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}};function bt(e){setTimeout(e,0)}var xt=typeof window>`u`||`Deno`in globalThis;function St(){}function Ct(e,t){return typeof e==`function`?e(t):e}function wt(e){return typeof e==`number`&&e>=0&&e!==1/0}function Tt(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Et(e,t){return typeof e==`function`?e(t):e}function Dt(e,t){return typeof e==`function`?e(t):e}function Ot(e,t){let{type:n=`all`,exact:r,fetchStatus:i,predicate:a,queryKey:o,stale:s}=e;if(o){if(r){if(t.queryHash!==At(o,t.options))return!1}else if(!Mt(t.queryKey,o))return!1}if(n!==`all`){let e=t.isActive();if(n===`active`&&!e||n===`inactive`&&e)return!1}return!(typeof s==`boolean`&&t.isStale()!==s||i&&i!==t.state.fetchStatus||a&&!a(t))}function kt(e,t){let{exact:n,status:r,predicate:i,mutationKey:a}=e;if(a){if(!t.options.mutationKey)return!1;if(n){if(jt(t.options.mutationKey)!==jt(a))return!1}else if(!Mt(t.options.mutationKey,a))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function At(e,t){return(t?.queryKeyHashFn||jt)(e)}function jt(e){return JSON.stringify(e,(e,t)=>It(t)?Object.keys(t).sort().reduce((e,n)=>(e[n]=t[n],e),{}):t)}function Mt(e,t){return e===t?!0:typeof e==typeof t&&e&&t&&typeof e==`object`&&typeof t==`object`?Object.keys(t).every(n=>Mt(e[n],t[n])):!1}var Nt=Object.prototype.hasOwnProperty;function Pt(e,t,n=0){if(e===t)return e;if(n>500)return t;let r=Ft(e)&&Ft(t);if(!r&&!(It(e)&&It(t)))return t;let i=(r?e:Object.keys(e)).length,a=r?t:Object.keys(t),o=a.length,s=r?Array(o):{},c=0;for(let l=0;l{yt.setTimeout(t,e)})}function zt(e,t,n){return typeof n.structuralSharing==`function`?n.structuralSharing(e,t):n.structuralSharing===!1?t:Pt(e,t)}function B(e,t,n=0){let r=[...e,t];return n&&r.length>n?r.slice(1):r}function Bt(e,t,n=0){let r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var Vt=Symbol();function Ht(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===Vt?()=>Promise.reject(Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Ut(e,t,n){let r=!1,i;return Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(i??=t(),r?i:(r=!0,i.aborted?n():i.addEventListener(`abort`,n,{once:!0}),i))}),e}var Wt=(()=>{let e=()=>xt;return{isServer(){return e()},setIsServer(t){e=t}}})();function Gt(){let e,t,n=new Promise((n,r)=>{e=n,t=r});n.status=`pending`,n.catch(()=>{});function r(e){Object.assign(n,e),delete n.resolve,delete n.reject}return n.resolve=t=>{r({status:`fulfilled`,value:t}),e(t)},n.reject=e=>{r({status:`rejected`,reason:e}),t(e)},n}var Kt=bt;function qt(){let e=[],t=0,n=e=>{e()},r=e=>{e()},i=Kt,a=r=>{t?e.push(r):i(()=>{n(r)})},o=()=>{let t=e;e=[],t.length&&i(()=>{r(()=>{t.forEach(e=>{n(e)})})})};return{batch:e=>{let n;t++;try{n=e()}finally{t--,t||o()}return n},batchCalls:e=>(...t)=>{a(()=>{e(...t)})},schedule:a,setNotifyFunction:e=>{n=e},setBatchNotifyFunction:e=>{r=e},setScheduler:e=>{i=e}}}var Jt=qt(),Yt=new class extends gt{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(typeof window<`u`&&window.addEventListener){let t=()=>e(!0),n=()=>e(!1);return window.addEventListener(`online`,t,!1),window.addEventListener(`offline`,n,!1),()=>{window.removeEventListener(`online`,t),window.removeEventListener(`offline`,n)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(t=>{t(e)}))}isOnline(){return this.#e}};function Xt(e){return Math.min(1e3*2**e,3e4)}function Zt(e){return(e??`online`)===`online`?Yt.isOnline():!0}var Qt=class extends Error{constructor(e){super(`CancelledError`),this.revert=e?.revert,this.silent=e?.silent}};function $t(e){let t=!1,n=0,r,i=Gt(),a=()=>i.status!==`pending`,o=t=>{if(!a()){let n=new Qt(t);f(n),e.onCancel?.(n)}},s=()=>{t=!0},c=()=>{t=!1},l=()=>_t.isFocused()&&(e.networkMode===`always`||Yt.isOnline())&&e.canRun(),u=()=>Zt(e.networkMode)&&e.canRun(),d=e=>{a()||(r?.(),i.resolve(e))},f=e=>{a()||(r?.(),i.reject(e))},p=()=>new Promise(t=>{r=e=>{(a()||l())&&t(e)},e.onPause?.()}).then(()=>{r=void 0,a()||e.onContinue?.()}),m=()=>{if(a())return;let r,i=n===0?e.initialPromise:void 0;try{r=i??e.fn()}catch(e){r=Promise.reject(e)}Promise.resolve(r).then(d).catch(r=>{if(a())return;let i=e.retry??(Wt.isServer()?0:3),o=e.retryDelay??Xt,s=typeof o==`function`?o(n,r):o,c=i===!0||typeof i==`number`&&nl()?void 0:p()).then(()=>{t?f(r):m()})})};return{promise:i,status:()=>i.status,cancel:o,continue:()=>(r?.(),i),cancelRetry:s,continueRetry:c,canStart:u,start:()=>(u()?m():p().then(m),i)}}var en=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),wt(this.gcTime)&&(this.#e=yt.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Wt.isServer()?1/0:300*1e3))}clearGcTimeout(){this.#e!==void 0&&(yt.clearTimeout(this.#e),this.#e=void 0)}};function tn(e){return{onFetch:(t,n)=>{let r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,a=t.state.data?.pages||[],o=t.state.data?.pageParams||[],s={pages:[],pageParams:[]},c=0,l=async()=>{let n=!1,l=e=>{Ut(e,()=>t.signal,()=>n=!0)},u=Ht(t.options,t.fetchOptions),d=async(e,r,i)=>{if(n)return Promise.reject(t.signal.reason);if(r==null&&e.pages.length)return Promise.resolve(e);let a=await u((()=>{let e={client:t.client,queryKey:t.queryKey,pageParam:r,direction:i?`backward`:`forward`,meta:t.options.meta};return l(e),e})()),{maxPages:o}=t.options,s=i?Bt:B;return{pages:s(e.pages,a,o),pageParams:s(e.pageParams,r,o)}};if(i&&a.length){let e=i===`backward`,t=e?rn:nn,n={pages:a,pageParams:o};s=await d(n,t(r,n),e)}else{let t=e??a.length;do{let e=c===0?o[0]??r.initialPageParam:nn(r,s);if(c>0&&e==null)break;s=await d(s,e),c++}while(ct.options.persister?.(l,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=l}}}function nn(e,{pages:t,pageParams:n}){let r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function rn(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var an=class extends en{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e){super(),this.#s=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#i=e.client,this.#r=this.#i.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=cn(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get queryType(){return this.#e}get promise(){return this.#a?.promise}setOptions(e){if(this.options={...this.#o,...e},e?._type&&(this.#e=e._type),this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){let e=cn(this.options);e.data!==void 0&&(this.setState(sn(e.data,e.dataUpdatedAt)),this.#t=e)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus===`idle`&&this.#r.remove(this)}setData(e,t){let n=zt(this.state.data,e,this.options);return this.#l({data:n,type:`success`,dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e){this.#l({type:`setState`,state:e})}cancel(e){let t=this.#a?.promise;return this.#a?.cancel(e),t?t.then(St).catch(St):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}get resetState(){return this.#t}reset(){this.destroy(),this.setState(this.resetState)}isActive(){return this.observers.some(e=>Dt(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Vt||!this.isFetched()}isFetched(){return this.state.dataUpdateCount+this.state.errorUpdateCount>0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Et(e.options.staleTime,this)===`static`):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e===`static`?!1:this.state.isInvalidated?!0:!Tt(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(e=>e.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#a?.continue()}onOnline(){this.observers.find(e=>e.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#a?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#r.notify({type:`observerAdded`,query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#a&&(this.#s||this.#c()?this.#a.cancel({revert:!0}):this.#a.cancelRetry()),this.scheduleGc()),this.#r.notify({type:`observerRemoved`,query:this,observer:e}))}getObserversCount(){return this.observers.length}#c(){return this.state.fetchStatus===`paused`&&this.state.status===`pending`}invalidate(){this.state.isInvalidated||this.#l({type:`invalidate`})}async fetch(e,t){if(this.state.fetchStatus!==`idle`&&this.#a?.status()!==`rejected`){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#a)return this.#a.continueRetry(),this.#a.promise}if(e&&this.setOptions(e),!this.options.queryFn){let e=this.observers.find(e=>e.options.queryFn);e&&this.setOptions(e.options)}let n=new AbortController,r=e=>{Object.defineProperty(e,"signal",{enumerable:!0,get:()=>(this.#s=!0,n.signal)})},i=()=>{let e=Ht(this.options,t),n=(()=>{let e={client:this.#i,queryKey:this.queryKey,meta:this.meta};return r(e),e})();return this.#s=!1,this.options.persister?this.options.persister(e,n,this):e(n)},a=(()=>{let e={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#i,state:this.state,fetchFn:i};return r(e),e})();(this.#e===`infinite`?tn(this.options.pages):this.options.behavior)?.onFetch(a,this),this.#n=this.state,(this.state.fetchStatus===`idle`||this.state.fetchMeta!==a.fetchOptions?.meta)&&this.#l({type:`fetch`,meta:a.fetchOptions?.meta}),this.#a=$t({initialPromise:t?.initialPromise,fn:a.fetchFn,onCancel:e=>{e instanceof Qt&&e.revert&&this.setState({...this.#n,fetchStatus:`idle`}),n.abort()},onFail:(e,t)=>{this.#l({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#l({type:`pause`})},onContinue:()=>{this.#l({type:`continue`})},retry:a.options.retry,retryDelay:a.options.retryDelay,networkMode:a.options.networkMode,canRun:()=>!0});try{let e=await this.#a.start();if(e===void 0)throw Error(`${this.queryHash} data is undefined`);return this.setData(e),this.#r.config.onSuccess?.(e,this),this.#r.config.onSettled?.(e,this.state.error,this),e}catch(e){if(e instanceof Qt){if(e.silent)return this.#a.promise;if(e.revert){if(this.state.data===void 0)throw e;return this.state.data}}throw this.#l({type:`error`,error:e}),this.#r.config.onError?.(e,this),this.#r.config.onSettled?.(this.state.data,e,this),e}finally{this.scheduleGc()}}#l(e){let t=t=>{switch(e.type){case`failed`:return{...t,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case`pause`:return{...t,fetchStatus:`paused`};case`continue`:return{...t,fetchStatus:`fetching`};case`fetch`:return{...t,...on(t.data,this.options),fetchMeta:e.meta??null};case`success`:let n={...t,...sn(e.data,e.dataUpdatedAt),dataUpdateCount:t.dataUpdateCount+1,...!e.manual&&{fetchStatus:`idle`,fetchFailureCount:0,fetchFailureReason:null}};return this.#n=e.manual?n:void 0,n;case`error`:let r=e.error;return{...t,error:r,errorUpdateCount:t.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:t.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:`idle`,status:`error`,isInvalidated:!0};case`invalidate`:return{...t,isInvalidated:!0};case`setState`:return{...t,...e.state}}};this.state=t(this.state),Jt.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#r.notify({query:this,type:`updated`,action:e})})}};function on(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zt(t.networkMode)?`fetching`:`paused`,...e===void 0&&{error:null,status:`pending`}}}function sn(e,t){return{data:e,dataUpdatedAt:t??Date.now(),error:null,isInvalidated:!1,status:`success`}}function cn(e){let t=typeof e.initialData==`function`?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt==`function`?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?`success`:`pending`,fetchStatus:`idle`}}var ln=class extends en{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||un(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=$t({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),Jt.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function un(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var dn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){let r=new ln({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:`added`,mutation:e})}remove(e){if(this.#e.delete(e)){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t);if(n)if(n.length>1){let t=n.indexOf(e);t!==-1&&n.splice(t,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:`removed`,mutation:e})}canRun(e){let t=fn(e);if(typeof t==`string`){let n=this.#t.get(t)?.find(e=>e.state.status===`pending`);return!n||n===e}else return!0}runNext(e){let t=fn(e);return typeof t==`string`?(this.#t.get(t)?.find(t=>t!==e&&t.state.isPaused))?.continue()??Promise.resolve():Promise.resolve()}clear(){Jt.batch(()=>{this.#e.forEach(e=>{this.notify({type:`removed`,mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){let t={exact:!0,...e};return this.getAll().find(e=>kt(t,e))}findAll(e={}){return this.getAll().filter(t=>kt(e,t))}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){let e=this.getAll().filter(e=>e.state.isPaused);return Jt.batch(()=>Promise.all(e.map(e=>e.continue().catch(St))))}};function fn(e){return e.options.scope?.id}var pn=class extends gt{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){let r=t.queryKey,i=t.queryHash??At(r,t),a=this.get(i);return a||(a=new an({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(a)),a}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:`added`,query:e}))}remove(e){let t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:`removed`,query:e}))}clear(){Jt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){let t={exact:!0,...e};return this.getAll().find(e=>Ot(t,e))}findAll(e={}){let t=this.getAll();return Object.keys(e).length>0?t.filter(t=>Ot(e,t)):t}notify(e){Jt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Jt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},mn=class{#e;#t;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#e=e.queryCache||new pn,this.#t=e.mutationCache||new dn,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=_t.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#s=Yt.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:`fetching`}).length}isMutating(e){return this.#t.findAll({...e,status:`pending`}).length}getQueryData(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){let t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Et(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:e,state:t})=>[e,t.data])}setQueryData(e,t,n){let r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,a=Ct(t,i);if(a!==void 0)return this.#e.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return Jt.batch(()=>this.#e.findAll(e).map(({queryKey:e})=>[e,this.setQueryData(e,t,n)]))}getQueryState(e){let t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){let t=this.#e;Jt.batch(()=>{t.findAll(e).forEach(e=>{t.remove(e)})})}resetQueries(e,t){let n=this.#e;return Jt.batch(()=>(n.findAll(e).forEach(e=>{e.reset()}),this.refetchQueries({type:`active`,...e},t)))}cancelQueries(e,t={}){let n={revert:!0,...t},r=Jt.batch(()=>this.#e.findAll(e).map(e=>e.cancel(n)));return Promise.all(r).then(St).catch(St)}invalidateQueries(e,t={}){return Jt.batch(()=>(this.#e.findAll(e).forEach(e=>{e.invalidate()}),e?.refetchType===`none`?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??`active`},t)))}refetchQueries(e,t={}){let n={...t,cancelRefetch:t.cancelRefetch??!0},r=Jt.batch(()=>this.#e.findAll(e).filter(e=>!e.isDisabled()&&!e.isStatic()).map(e=>{let t=e.fetch(void 0,n);return n.throwOnError||(t=t.catch(St)),e.state.fetchStatus===`paused`?Promise.resolve():t}));return Promise.all(r).then(St)}fetchQuery(e){let t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);let n=this.#e.build(this,t);return n.isStaleByTime(Et(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(St).catch(St)}fetchInfiniteQuery(e){return e._type=`infinite`,this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(St).catch(St)}ensureInfiniteQueryData(e){return e._type=`infinite`,this.ensureQueryData(e)}resumePausedMutations(){return Yt.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(jt(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){let t=[...this.#r.values()],n={};return t.forEach(t=>{Mt(e,t.queryKey)&&Object.assign(n,t.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(jt(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){let t=[...this.#i.values()],n={};return t.forEach(t=>{Mt(e,t.mutationKey)&&Object.assign(n,t.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;let t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||=At(t.queryKey,t),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!==`always`),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode=`offlineFirst`),t.queryFn===Vt&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},hn=o((e=>{var t=d(),n=Symbol.for(`react.element`),r=Symbol.for(`react.fragment`),i=Object.prototype.hasOwnProperty,a=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,o={key:!0,ref:!0,__self:!0,__source:!0};function s(e,t,r){var s,c={},l=null,u=null;for(s in r!==void 0&&(l=``+r),t.key!==void 0&&(l=``+t.key),t.ref!==void 0&&(u=t.ref),t)i.call(t,s)&&!o.hasOwnProperty(s)&&(c[s]=t[s]);if(e&&e.defaultProps)for(s in t=e.defaultProps,t)c[s]===void 0&&(c[s]=t[s]);return{$$typeof:n,type:e,key:l,ref:u,props:c,_owner:a.current}}e.Fragment=r,e.jsx=s,e.jsxs=s})),V=o(((e,t)=>{t.exports=hn()}))(),gn=_.createContext(void 0),_n=({client:e,children:t})=>(_.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,V.jsx)(gn.Provider,{value:e,children:t})),vn=(0,_.createContext)({theme:`system`,setTheme:()=>null});function yn({children:e,defaultTheme:t=`system`,storageKey:n=`vite-ui-theme`,...r}){let[i,a]=(0,_.useState)(()=>localStorage.getItem(n)||t);(0,_.useEffect)(()=>{let e=window.document.documentElement;if(e.classList.remove(`light`,`dark`),i===`system`){let t=window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`;e.classList.add(t);return}e.classList.add(i)},[i]);let o=(0,_.useCallback)(e=>{localStorage.setItem(n,e),a(e)},[n]),s=(0,_.useMemo)(()=>({theme:i,setTheme:o}),[i,o]);return(0,V.jsx)(vn.Provider,{...r,value:s,children:e})}var bn=e=>{switch(e){case`success`:return Cn;case`info`:return Tn;case`warning`:return wn;case`error`:return En;default:return null}},xn=Array(12).fill(0),Sn=({visible:e,className:t})=>_.createElement(`div`,{className:[`sonner-loading-wrapper`,t].filter(Boolean).join(` `),"data-visible":e},_.createElement(`div`,{className:`sonner-spinner`},xn.map((e,t)=>_.createElement(`div`,{className:`sonner-loading-bar`,key:`spinner-bar-${t}`})))),Cn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z`,clipRule:`evenodd`})),wn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z`,clipRule:`evenodd`})),Tn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z`,clipRule:`evenodd`})),En=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 20 20`,fill:`currentColor`,height:`20`,width:`20`},_.createElement(`path`,{fillRule:`evenodd`,d:`M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z`,clipRule:`evenodd`})),Dn=_.createElement(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`},_.createElement(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),_.createElement(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})),On=()=>{let[e,t]=_.useState(document.hidden);return _.useEffect(()=>{let e=()=>{t(document.hidden)};return document.addEventListener(`visibilitychange`,e),()=>window.removeEventListener(`visibilitychange`,e)},[]),e},kn=1,An=new class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{let{message:t,...n}=e,r=typeof e?.id==`number`||e.id?.length>0?e.id:kn++,i=this.toasts.find(e=>e.id===r),a=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(r)&&this.dismissedToasts.delete(r),i?this.toasts=this.toasts.map(n=>n.id===r?(this.publish({...n,...e,id:r,title:t}),{...n,...e,id:r,dismissible:a,title:t}):n):this.addToast({title:t,...n,dismissible:a,id:r}),r},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(e=>{this.subscribers.forEach(t=>t({id:e.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:`error`}),this.success=(e,t)=>this.create({...t,type:`success`,message:e}),this.info=(e,t)=>this.create({...t,type:`info`,message:e}),this.warning=(e,t)=>this.create({...t,type:`warning`,message:e}),this.loading=(e,t)=>this.create({...t,type:`loading`,message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:`loading`,message:t.loading,description:typeof t.description==`function`?void 0:t.description}));let r=e instanceof Promise?e:e(),i=n!==void 0,a,o=r.then(async e=>{if(a=[`resolve`,e],_.isValidElement(e))i=!1,this.create({id:n,type:`default`,message:e});else if(Mn(e)&&!e.ok){i=!1;let r=typeof t.error==`function`?await t.error(`HTTP error! status: ${e.status}`):t.error,a=typeof t.description==`function`?await t.description(`HTTP error! status: ${e.status}`):t.description;this.create({id:n,type:`error`,message:r,description:a})}else if(t.success!==void 0){i=!1;let r=typeof t.success==`function`?await t.success(e):t.success,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`success`,message:r,description:a})}}).catch(async e=>{if(a=[`reject`,e],t.error!==void 0){i=!1;let r=typeof t.error==`function`?await t.error(e):t.error,a=typeof t.description==`function`?await t.description(e):t.description;this.create({id:n,type:`error`,message:r,description:a})}}).finally(()=>{var e;i&&(this.dismiss(n),n=void 0),(e=t.finally)==null||e.call(t)}),s=()=>new Promise((e,t)=>o.then(()=>a[0]===`reject`?t(a[1]):e(a[1])).catch(t));return typeof n!=`string`&&typeof n!=`number`?{unwrap:s}:Object.assign(n,{unwrap:s})},this.custom=(e,t)=>{let n=t?.id||kn++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},jn=(e,t)=>{let n=t?.id||kn++;return An.addToast({title:e,...t,id:n}),n},Mn=e=>e&&typeof e==`object`&&`ok`in e&&typeof e.ok==`boolean`&&`status`in e&&typeof e.status==`number`,Nn=Object.assign(jn,{success:An.success,info:An.info,warning:An.warning,error:An.error,custom:An.custom,message:An.message,promise:An.promise,dismiss:An.dismiss,loading:An.loading},{getHistory:()=>An.toasts,getToasts:()=>An.getActiveToasts()});function Pn(e,{insertAt:t}={}){if(!e||typeof document>`u`)return;let n=document.head||document.getElementsByTagName(`head`)[0],r=document.createElement(`style`);r.type=`text/css`,t===`top`&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=e:r.appendChild(document.createTextNode(e))}Pn(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)} -`);function Fn(e){return e.label!==void 0}var In=3,Ln=`32px`,Rn=`16px`,zn=4e3,Bn=356,Vn=14,Hn=20,Un=200;function Wn(...e){return e.filter(Boolean).join(` `)}function Gn(e){let[t,n]=e.split(`-`),r=[];return t&&r.push(t),n&&r.push(n),r}var Kn=e=>{let{invert:t,toast:n,unstyled:r,interacting:i,setHeights:a,visibleToasts:o,heights:s,index:c,toasts:l,expanded:u,removeToast:d,defaultRichColors:f,closeButton:p,style:m,cancelButtonStyle:h,actionButtonStyle:g,className:v=``,descriptionClassName:y=``,duration:b,position:x,gap:S,loadingIcon:C,expandByDefault:w,classNames:T,icons:E,closeButtonAriaLabel:D=`Close toast`,pauseWhenPageIsHidden:O}=e,[k,A]=_.useState(null),[j,M]=_.useState(null),[N,P]=_.useState(!1),[F,I]=_.useState(!1),[ee,te]=_.useState(!1),[ne,re]=_.useState(!1),[ie,ae]=_.useState(!1),[oe,se]=_.useState(0),[ce,le]=_.useState(0),ue=_.useRef(n.duration||b||zn),de=_.useRef(null),L=_.useRef(null),fe=c===0,pe=c+1<=o,me=n.type,R=n.dismissible!==!1,he=n.className||``,z=n.descriptionClassName||``,ge=_.useMemo(()=>s.findIndex(e=>e.toastId===n.id)||0,[s,n.id]),_e=_.useMemo(()=>n.closeButton??p,[n.closeButton,p]),ve=_.useMemo(()=>n.duration||b||zn,[n.duration,b]),ye=_.useRef(0),be=_.useRef(0),xe=_.useRef(0),Se=_.useRef(null),[Ce,we]=x.split(`-`),Te=_.useMemo(()=>s.reduce((e,t,n)=>n>=ge?e:e+t.height,0),[s,ge]),Ee=On(),De=n.invert||t,Oe=me===`loading`;be.current=_.useMemo(()=>ge*S+Te,[ge,Te]),_.useEffect(()=>{ue.current=ve},[ve]),_.useEffect(()=>{P(!0)},[]),_.useEffect(()=>{let e=L.current;if(e){let t=e.getBoundingClientRect().height;return le(t),a(e=>[{toastId:n.id,height:t,position:n.position},...e]),()=>a(e=>e.filter(e=>e.toastId!==n.id))}},[a,n.id]),_.useLayoutEffect(()=>{if(!N)return;let e=L.current,t=e.style.height;e.style.height=`auto`;let r=e.getBoundingClientRect().height;e.style.height=t,le(r),a(e=>e.find(e=>e.toastId===n.id)?e.map(e=>e.toastId===n.id?{...e,height:r}:e):[{toastId:n.id,height:r,position:n.position},...e])},[N,n.title,n.description,a,n.id]);let ke=_.useCallback(()=>{I(!0),se(be.current),a(e=>e.filter(e=>e.toastId!==n.id)),setTimeout(()=>{d(n)},Un)},[n,d,a,be]);_.useEffect(()=>{if(n.promise&&me===`loading`||n.duration===1/0||n.type===`loading`)return;let e;return u||i||O&&Ee?(()=>{if(xe.current{var e;(e=n.onAutoClose)==null||e.call(n,n),ke()},ue.current)),()=>clearTimeout(e)},[u,i,n,me,O,Ee,ke]),_.useEffect(()=>{n.delete&&ke()},[ke,n.delete]);function Ae(){return E!=null&&E.loading?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},E.loading):C?_.createElement(`div`,{className:Wn(T?.loader,n?.classNames?.loader,`sonner-loader`),"data-visible":me===`loading`},C):_.createElement(Sn,{className:Wn(T?.loader,n?.classNames?.loader),visible:me===`loading`})}return _.createElement(`li`,{tabIndex:0,ref:L,className:Wn(v,he,T?.toast,n?.classNames?.toast,T?.default,T?.[me],n?.classNames?.[me]),"data-sonner-toast":``,"data-rich-colors":n.richColors??f,"data-styled":!(n.jsx||n.unstyled||r),"data-mounted":N,"data-promise":!!n.promise,"data-swiped":ie,"data-removed":F,"data-visible":pe,"data-y-position":Ce,"data-x-position":we,"data-index":c,"data-front":fe,"data-swiping":ee,"data-dismissible":R,"data-type":me,"data-invert":De,"data-swipe-out":ne,"data-swipe-direction":j,"data-expanded":!!(u||w&&N),style:{"--index":c,"--toasts-before":c,"--z-index":l.length-c,"--offset":`${F?oe:be.current}px`,"--initial-height":w?`auto`:`${ce}px`,...m,...n.style},onDragEnd:()=>{te(!1),A(null),Se.current=null},onPointerDown:e=>{Oe||!R||(de.current=new Date,se(be.current),e.target.setPointerCapture(e.pointerId),e.target.tagName!==`BUTTON`&&(te(!0),Se.current={x:e.clientX,y:e.clientY}))},onPointerUp:()=>{var e;if(ne||!R)return;Se.current=null;let t=Number(L.current?.style.getPropertyValue(`--swipe-amount-x`).replace(`px`,``)||0),r=Number(L.current?.style.getPropertyValue(`--swipe-amount-y`).replace(`px`,``)||0),i=new Date().getTime()-de.current?.getTime(),a=k===`x`?t:r,o=Math.abs(a)/i;if(Math.abs(a)>=Hn||o>.11){se(be.current),(e=n.onDismiss)==null||e.call(n,n),M(k===`x`?t>0?`right`:`left`:r>0?`down`:`up`),ke(),re(!0),ae(!1);return}te(!1),A(null)},onPointerMove:t=>{var n,r;if(!Se.current||!R||window.getSelection()?.toString().length>0)return;let i=t.clientY-Se.current.y,a=t.clientX-Se.current.x,o=e.swipeDirections??Gn(x);!k&&(Math.abs(a)>1||Math.abs(i)>1)&&A(Math.abs(a)>Math.abs(i)?`x`:`y`);let s={x:0,y:0};k===`y`?(o.includes(`top`)||o.includes(`bottom`))&&(o.includes(`top`)&&i<0||o.includes(`bottom`)&&i>0)&&(s.y=i):k===`x`&&(o.includes(`left`)||o.includes(`right`))&&(o.includes(`left`)&&a<0||o.includes(`right`)&&a>0)&&(s.x=a),(Math.abs(s.x)>0||Math.abs(s.y)>0)&&ae(!0),(n=L.current)==null||n.style.setProperty(`--swipe-amount-x`,`${s.x}px`),(r=L.current)==null||r.style.setProperty(`--swipe-amount-y`,`${s.y}px`)}},_e&&!n.jsx?_.createElement(`button`,{"aria-label":D,"data-disabled":Oe,"data-close-button":!0,onClick:Oe||!R?()=>{}:()=>{var e;ke(),(e=n.onDismiss)==null||e.call(n,n)},className:Wn(T?.closeButton,n?.classNames?.closeButton)},E?.close??Dn):null,n.jsx||(0,_.isValidElement)(n.title)?n.jsx?n.jsx:typeof n.title==`function`?n.title():n.title:_.createElement(_.Fragment,null,me||n.icon||n.promise?_.createElement(`div`,{"data-icon":``,className:Wn(T?.icon,n?.classNames?.icon)},n.promise||n.type===`loading`&&!n.icon?n.icon||Ae():null,n.type===`loading`?null:n.icon||E?.[me]||bn(me)):null,_.createElement(`div`,{"data-content":``,className:Wn(T?.content,n?.classNames?.content)},_.createElement(`div`,{"data-title":``,className:Wn(T?.title,n?.classNames?.title)},typeof n.title==`function`?n.title():n.title),n.description?_.createElement(`div`,{"data-description":``,className:Wn(y,z,T?.description,n?.classNames?.description)},typeof n.description==`function`?n.description():n.description):null),(0,_.isValidElement)(n.cancel)?n.cancel:n.cancel&&Fn(n.cancel)?_.createElement(`button`,{"data-button":!0,"data-cancel":!0,style:n.cancelButtonStyle||h,onClick:e=>{var t,r;Fn(n.cancel)&&R&&((r=(t=n.cancel).onClick)==null||r.call(t,e),ke())},className:Wn(T?.cancelButton,n?.classNames?.cancelButton)},n.cancel.label):null,(0,_.isValidElement)(n.action)?n.action:n.action&&Fn(n.action)?_.createElement(`button`,{"data-button":!0,"data-action":!0,style:n.actionButtonStyle||g,onClick:e=>{var t,r;Fn(n.action)&&((r=(t=n.action).onClick)==null||r.call(t,e),!e.defaultPrevented&&ke())},className:Wn(T?.actionButton,n?.classNames?.actionButton)},n.action.label):null))};function qn(){if(typeof window>`u`||typeof document>`u`)return`ltr`;let e=document.documentElement.getAttribute(`dir`);return e===`auto`||!e?window.getComputedStyle(document.documentElement).direction:e}function Jn(e,t){let n={};return[e,t].forEach((e,t)=>{let r=t===1,i=r?`--mobile-offset`:`--offset`,a=r?Rn:Ln;function o(e){[`top`,`right`,`bottom`,`left`].forEach(t=>{n[`${i}-${t}`]=typeof e==`number`?`${e}px`:e})}typeof e==`number`||typeof e==`string`?o(e):typeof e==`object`?[`top`,`right`,`bottom`,`left`].forEach(t=>{e[t]===void 0?n[`${i}-${t}`]=a:n[`${i}-${t}`]=typeof e[t]==`number`?`${e[t]}px`:e[t]}):o(a)}),n}(0,_.forwardRef)(function(e,t){let{invert:n,position:r=`bottom-right`,hotkey:i=[`altKey`,`KeyT`],expand:a,closeButton:o,className:s,offset:c,mobileOffset:l,theme:u=`light`,richColors:d,duration:f,style:p,visibleToasts:m=In,toastOptions:h,dir:g=qn(),gap:y=Vn,loadingIcon:b,icons:x,containerAriaLabel:S=`Notifications`,pauseWhenPageIsHidden:C}=e,[w,T]=_.useState([]),E=_.useMemo(()=>Array.from(new Set([r].concat(w.filter(e=>e.position).map(e=>e.position)))),[w,r]),[D,O]=_.useState([]),[k,A]=_.useState(!1),[j,M]=_.useState(!1),[N,P]=_.useState(u===`system`?typeof window<`u`&&window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`:u),F=_.useRef(null),I=i.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),ee=_.useRef(null),te=_.useRef(!1),ne=_.useCallback(e=>{T(t=>{var n;return(n=t.find(t=>t.id===e.id))!=null&&n.delete||An.dismiss(e.id),t.filter(({id:t})=>t!==e.id)})},[]);return _.useEffect(()=>An.subscribe(e=>{if(e.dismiss){T(t=>t.map(t=>t.id===e.id?{...t,delete:!0}:t));return}setTimeout(()=>{v.flushSync(()=>{T(t=>{let n=t.findIndex(t=>t.id===e.id);return n===-1?[e,...t]:[...t.slice(0,n),{...t[n],...e},...t.slice(n+1)]})})})}),[]),_.useEffect(()=>{if(u!==`system`){P(u);return}if(u===`system`&&(window.matchMedia&&window.matchMedia(`(prefers-color-scheme: dark)`).matches?P(`dark`):P(`light`)),typeof window>`u`)return;let e=window.matchMedia(`(prefers-color-scheme: dark)`);try{e.addEventListener(`change`,({matches:e})=>{P(e?`dark`:`light`)})}catch{e.addListener(({matches:e})=>{try{P(e?`dark`:`light`)}catch(e){console.error(e)}})}},[u]),_.useEffect(()=>{w.length<=1&&A(!1)},[w]),_.useEffect(()=>{let e=e=>{var t,n;i.every(t=>e[t]||e.code===t)&&(A(!0),(t=F.current)==null||t.focus()),e.code===`Escape`&&(document.activeElement===F.current||(n=F.current)!=null&&n.contains(document.activeElement))&&A(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[i]),_.useEffect(()=>{if(F.current)return()=>{ee.current&&(ee.current.focus({preventScroll:!0}),ee.current=null,te.current=!1)}},[F.current]),_.createElement(`section`,{ref:t,"aria-label":`${S} ${I}`,tabIndex:-1,"aria-live":`polite`,"aria-relevant":`additions text`,"aria-atomic":`false`,suppressHydrationWarning:!0},E.map((t,r)=>{let[i,u]=t.split(`-`);return w.length?_.createElement(`ol`,{key:t,dir:g===`auto`?qn():g,tabIndex:-1,ref:F,className:s,"data-sonner-toaster":!0,"data-theme":N,"data-y-position":i,"data-lifted":k&&w.length>1&&!a,"data-x-position":u,style:{"--front-toast-height":`${D[0]?.height||0}px`,"--width":`${Bn}px`,"--gap":`${y}px`,...p,...Jn(c,l)},onBlur:e=>{te.current&&!e.currentTarget.contains(e.relatedTarget)&&(te.current=!1,ee.current&&=(ee.current.focus({preventScroll:!0}),null))},onFocus:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||te.current||(te.current=!0,ee.current=e.relatedTarget)},onMouseEnter:()=>A(!0),onMouseMove:()=>A(!0),onMouseLeave:()=>{j||A(!1)},onDragEnd:()=>A(!1),onPointerDown:e=>{e.target instanceof HTMLElement&&e.target.dataset.dismissible===`false`||M(!0)},onPointerUp:()=>M(!1)},w.filter(e=>!e.position&&r===0||e.position===t).map((r,i)=>_.createElement(Kn,{key:r.id,icons:x,index:i,toast:r,defaultRichColors:d,duration:h?.duration??f,className:h?.className,descriptionClassName:h?.descriptionClassName,invert:n,visibleToasts:m,closeButton:h?.closeButton??o,interacting:j,position:t,style:h?.style,unstyled:h?.unstyled,classNames:h?.classNames,cancelButtonStyle:h?.cancelButtonStyle,actionButtonStyle:h?.actionButtonStyle,removeToast:ne,toasts:w.filter(e=>e.position==r.position),heights:D.filter(e=>e.position==r.position),setHeights:O,expandByDefault:a,gap:y,loadingIcon:b,expanded:k,pauseWhenPageIsHidden:C,swipeDirections:e.swipeDirections}))):null}))});function Yn(e){if(!(e instanceof DataTransfer))throw Error(`Data must be of type "DataTransfer"`);let t={};function n(e){let r=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.file==`function`&&`fullPath`in e,i=e=>typeof e==`object`&&!!e&&`isFile`in e&&typeof e.createReader==`function`;if(r(e)&&e.isFile)return new Promise(n=>{e.file(r=>{t[e.fullPath]=r,n()})});if(i(e)&&!e.isFile){let t=e.createReader();return new Promise(e=>{let r=[];function i(){t.readEntries(t=>{t.length===0?Promise.all(r).then(()=>e()):(t.forEach(e=>{r.push(n(e))}),i())})}i()})}return Promise.resolve()}return new Promise(r=>{let i=e.items&&Array.from(e.items),a=Array.from(e.files);if(i&&i.length&&`webkitGetAsEntry`in i[0]){let e=[];for(let t=0;tr(t))}else a.filter(e=>e.size!==0).forEach(e=>t[`/`+e.name]=e),r(t)})}function Xn(e){return e.replace(/\\/g,`/`).split(/\//g).reduce((e,t)=>(t===`..`?e.pop():t!==`.`&&e.push(t),e),[]).join(`/`)}var Zn={current:``};function Qn(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=e=>{e.target&&e.target.result?t(e.target.result):n(Error(`Failed to read Urdf file content`))},r.onerror=()=>n(Error(`Error reading Urdf file`)),r.readAsText(e)})}async function $n(e,t){Zn.current=``;let n=await Yn(e),r=Object.keys(n).map(e=>Xn(e)),i=r.filter(e=>/urdf$/i.test(e)),a={};i.forEach(e=>{a[e]=URL.createObjectURL(n[e])});let o=``;if(i.length>0){let e=i[0].match(/^(\/[^/]+\/)/);e&&e[1]&&(o=e[1])}let s=o;return t.setUrlModifierFunc(e=>{s&&(Zn.current=s);let t=Xn(e).split(`/`).pop()||``,i=r.find(e=>e.endsWith(t));if(!i&&t.includes(`.`)){let e=`.`+t.split(`.`).pop();i=r.find(t=>t.endsWith(e))}if(i!=null){let e=i.split(`.`).pop()?.toLowerCase()||``,t=new Blob([n[i]],{type:er(e)}),r=URL.createObjectURL(t)+`#.`+e;return setTimeout(()=>URL.revokeObjectURL(r),5e3),r}return console.warn(`No matching file found for: ${e}`),e}),{files:n,availableModels:i,blobUrls:a}}function er(e){switch(e.toLowerCase()){case`stl`:return`model/stl`;case`obj`:return`model/obj`;case`gltf`:case`glb`:return`model/gltf+json`;case`dae`:return`model/vnd.collada+xml`;case`urdf`:return`application/xml`;default:return`application/octet-stream`}}var tr=(0,_.createContext)(void 0),nr=({children:e})=>{let[t,n]=(0,_.useState)(null),[r,i]=(0,_.useState)({}),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)(!1),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(!0),[p,m]=(0,_.useState)(null),[h,g]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!d||p)return;let e=!1;return(async()=>{try{let t=await fetch(`/so-101-urdf/urdf/so101_new_calib.urdf`);if(!t.ok)throw Error(`Failed to fetch default Urdf: ${t.statusText}`);let n=await t.text();e||m(n)}catch(t){e||console.error(`Error loading default Urdf content:`,t)}})(),()=>{e=!0}},[d,p]);let v=(0,_.useRef)([]),y=(0,_.useCallback)(()=>{f(!0),m(null),g(null),Nn.info(`Switched to default model`,{description:`The default ARM100 robot model is now displayed.`})},[]),b=(0,_.useCallback)(e=>(v.current.push(e),()=>{v.current=v.current.filter(t=>t!==e)}),[]),x=(0,_.useCallback)(e=>{n(e)},[]),S=(0,_.useCallback)(e=>{e.hasUrdf?f(!1):y(),v.current.forEach(t=>t(e))},[y]),C=(0,_.useCallback)(async e=>{if(!t)return;let n=Object.values(r).filter(t=>t===e.blobUrl).map(e=>{let t=Object.keys(r).find(t=>r[t]===e);return t?{path:t,url:e}:null}).filter(e=>e!==null);if(n.length===0){console.error(`❌ Could not find file for selected Urdf model`);return}let i=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{let t=n[0]?.path;if(!t||!r[t])throw Error(`File not found in records`);let a=await(await fetch(e.blobUrl)).blob();m(await Qn(new File([a],t.split(`/`).pop()||`model.urdf`,{type:`application/xml`}))),Nn.dismiss(i),f(!1);let o=e.name||e.path.split(`/`).pop()||`Unknown`;Nn.success(`Urdf model loaded successfully`,{description:`Model: ${o}`,duration:3e3}),S({hasUrdf:!0,modelName:o})}catch(e){console.error(`❌ Error processing selected Urdf:`,e),Nn.dismiss(i),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3})}},[r,t,S]),w=(0,_.useCallback)(e=>{if(!t){console.error(`❌ No Urdf processor available`);return}c(!1);let n=e.name||e.path.split(`/`).pop()?.replace(/\.urdf$/i,``)||`Unknown`;t.loadUrdf(e.blobUrl),f(!1),Nn.info(`Loading model: ${n}`,{description:`Preparing 3D visualization`,duration:2e3}),S({hasUrdf:!0,modelName:n}),C(e)},[t,S,C]),T=(0,_.useCallback)(async(e,n)=>{Object.values(r).forEach(URL.revokeObjectURL),i({}),o([]),u([]);try{if(n.length>0&&t){let r={};if(n.forEach(t=>{e[t]&&(r[t]=URL.createObjectURL(e[t]))}),i(r),o(n),u(n.map(e=>{let t=(e.split(`/`).pop()||``).replace(/\.urdf$/i,``);return{path:e,blobUrl:r[e],name:t}})),n.length===1){let i=(n[0].split(`/`).pop()||``).replace(/\.urdf$/i,``),a=r[n[0]];if(a)if(t.loadUrdf(a),f(!1),e[n[0]]){let t=Nn.loading(`Loading Urdf model...`,{description:`Preparing 3D visualization`,duration:5e3});try{m(await Qn(e[n[0]])),Nn.dismiss(t),Nn.success(`Urdf model loaded successfully`,{description:`Model: ${i}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}catch(e){console.error(`Error loading Urdf:`,e),Nn.dismiss(t),Nn.error(`Error loading Urdf`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),S({hasUrdf:!0,modelName:i})}}else console.error(`Could not find file for Urdf model:`,n[0]),S({hasUrdf:!0,modelName:i});else console.warn(`No blob URL found for ${n[0]}, using path directly`),t.loadUrdf(n[0]),f(!1),S({hasUrdf:!0,modelName:i})}else c(!0),S({hasUrdf:!0,modelName:`Multiple models available`})}else S({hasUrdf:!1}),y(),Nn.error(`No Urdf file found`,{description:`Please upload a folder containing a .urdf file.`,duration:3e3})}catch(e){console.error(`Error processing Urdf files:`,e),Nn.error(`Error processing files`,{description:`Error: ${e instanceof Error?e.message:String(e)}`,duration:3e3}),y()}},[S,r,t,y]),E=(0,_.useRef)(r);E.current=r,(0,_.useEffect)(()=>()=>{Object.values(E.current).forEach(URL.revokeObjectURL)},[]);let D=(0,_.useMemo)(()=>({urdfProcessor:t,registerUrdfProcessor:x,onUrdfDetected:b,processUrdfFiles:T,urdfBlobUrls:r,alternativeUrdfModels:a,isSelectionModalOpen:s,setIsSelectionModalOpen:c,urdfModelOptions:l,selectUrdfModel:w,isDefaultModel:d,setIsDefaultModel:f,resetToDefaultModel:y,urdfContent:p,currentAnimationConfig:h,setCurrentAnimationConfig:g}),[t,x,b,T,r,a,s,l,w,d,y,p,h]);return(0,V.jsx)(tr.Provider,{value:D,children:e})},rr=()=>{let e=(0,_.useContext)(tr);if(e===void 0)throw Error(`useUrdf must be used within a UrdfProvider`);return e},ir=(0,_.createContext)(void 0),ar=({children:e})=>{let[t,n]=(0,_.useState)(!1),{urdfProcessor:r,processUrdfFiles:i}=rr(),a=e=>{e.preventDefault(),e.stopPropagation()},o=e=>{e.preventDefault(),e.stopPropagation(),n(!0)},s=e=>{e.preventDefault(),e.stopPropagation(),(!e.relatedTarget||!e.relatedTarget.closest(`html`))&&n(!1)},c=(0,_.useCallback)(async e=>{if(e.preventDefault(),e.stopPropagation(),n(!1),!(!e.dataTransfer||!r))try{let{availableModels:t,files:n}=await $n(e.dataTransfer,r);await i(n,t)}catch(e){console.error(`Error in handleDrop:`,e)}},[r,i]);(0,_.useEffect)(()=>(document.addEventListener(`dragover`,a),document.addEventListener(`dragenter`,o),document.addEventListener(`dragleave`,s),document.addEventListener(`drop`,c),()=>{document.removeEventListener(`dragover`,a),document.removeEventListener(`dragenter`,o),document.removeEventListener(`dragleave`,s),document.removeEventListener(`drop`,c)}),[c]);let l=(0,_.useMemo)(()=>({isDragging:t,setIsDragging:n,handleDrop:c}),[t,c]);return(0,V.jsxs)(ir.Provider,{value:l,children:[e,t&&(0,V.jsx)(`div`,{className:`fixed inset-0 bg-primary/10 pointer-events-none z-50 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-background p-8 rounded-lg shadow-lg text-center`,children:[(0,V.jsx)(`div`,{className:`text-3xl font-bold mb-4`,children:`Drop Urdf Files Here`}),(0,V.jsx)(`p`,{className:`text-muted-foreground`,children:`Release to upload your robot model`})]})})]})},or=1,sr=1e6,cr=0;function lr(){return cr=(cr+1)%(2**53-1),cr.toString()}var ur=new Map,dr=e=>{if(ur.has(e))return;let t=setTimeout(()=>{ur.delete(e),hr({type:`REMOVE_TOAST`,toastId:e})},sr);ur.set(e,t)},fr=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,or)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?dr(n):e.toasts.forEach(e=>{dr(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},pr=[],mr={toasts:[]};function hr(e){mr=fr(mr,e),pr.forEach(e=>{e(mr)})}function gr({...e}){let t=lr(),n=e=>hr({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>hr({type:`DISMISS_TOAST`,toastId:t});return hr({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function _r(){let[e,t]=_.useState(mr);return _.useEffect(()=>(pr.push(t),()=>{let e=pr.indexOf(t);e>-1&&pr.splice(e,1)}),[e]),{...e,toast:gr,dismiss:e=>hr({type:`DISMISS_TOAST`,toastId:e})}}typeof window<`u`&&window.document&&window.document.createElement;function H(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function vr(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function yr(...e){return t=>{let n=!1,r=e.map(e=>{let r=vr(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t{let{children:t,...r}=e,i=_.useMemo(()=>r,Object.values(r));return(0,V.jsx)(n.Provider,{value:i,children:t})};r.displayName=e+`Provider`;function i(r){let i=_.useContext(n);if(i)return i;if(t!==void 0)return t;throw Error(`\`${r}\` must be used within \`${e}\``)}return[r,i]}function Sr(e,t=[]){let n=[];function r(t,r){let i=_.createContext(r),a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=_.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=_.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>_.createContext(e));return function(n){let r=n?.[e]||t;return _.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,Cr(i,...t)]}function Cr(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return _.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}function wr(e){let t=Tr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Dr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Tr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=kr(n),i=Or(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Er=Symbol(`radix.slottable`);function Dr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Er}function Or(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function kr(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Ar(e){let t=e+`CollectionProvider`,[n,r]=Sr(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=_.useRef(null),a=_.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=wr(s),l=_.forwardRef((e,t)=>{let{scope:n,children:r}=e;return(0,V.jsx)(c,{ref:br(t,a(s,n).collectionRef),children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=wr(u),p=_.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=_.useRef(null),s=br(t,o),c=a(u,n);return _.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return _.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}function jr(e){let t=Mr(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Pr);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Mr(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ir(n),i=Fr(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Nr=Symbol(`radix.slottable`);function Pr(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Nr}function Fr(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ir(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var U=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=jr(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function Lr(e,t){e&&v.flushSync(()=>e.dispatchEvent(t))}function Rr(e){let t=_.useRef(e);return _.useEffect(()=>{t.current=e}),_.useMemo(()=>(...e)=>t.current?.(...e),[])}function zr(e,t=globalThis?.document){let n=Rr(e);_.useEffect(()=>{let e=e=>{e.key===`Escape`&&n(e)};return t.addEventListener(`keydown`,e,{capture:!0}),()=>t.removeEventListener(`keydown`,e,{capture:!0})},[n,t])}var Br=`DismissableLayer`,Vr=`dismissableLayer.update`,Hr=`dismissableLayer.pointerDownOutside`,Ur=`dismissableLayer.focusOutside`,Wr,Gr=_.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Kr=_.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=_.useContext(Gr),[u,d]=_.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=_.useState({}),m=br(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),v=h.indexOf(g),y=u?h.indexOf(u):-1,b=l.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=Yr(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!x||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),C=Xr(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return zr(e=>{y===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),_.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(Wr=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),Zr(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=Wr)}},[u,f,n,l]),_.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),Zr())},[u,l]),_.useEffect(()=>{let e=()=>p({});return document.addEventListener(Vr,e),()=>document.removeEventListener(Vr,e)},[]),(0,V.jsx)(U.div,{...c,ref:m,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:H(e.onFocusCapture,C.onFocusCapture),onBlurCapture:H(e.onBlurCapture,C.onBlurCapture),onPointerDownCapture:H(e.onPointerDownCapture,S.onPointerDownCapture)})});Kr.displayName=Br;var qr=`DismissableLayerBranch`,Jr=_.forwardRef((e,t)=>{let n=_.useContext(Gr),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(U.div,{...e,ref:i})});Jr.displayName=qr;function Yr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1),i=_.useRef(()=>{});return _.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){Qr(Hr,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Xr(e,t=globalThis?.document){let n=Rr(e),r=_.useRef(!1);return _.useEffect(()=>{let e=e=>{e.target&&!r.current&&Qr(Ur,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Zr(){let e=new CustomEvent(Vr);document.dispatchEvent(e)}function Qr(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var $r=Kr,ei=Jr,ti=globalThis?.document?_.useLayoutEffect:()=>{},ni=`Portal`,ri=_.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=_.useState(!1);ti(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?v.createPortal((0,V.jsx)(U.div,{...r,ref:t}),o):null});ri.displayName=ni;function ii(e,t){return _.useReducer((e,n)=>t[e][n]??e,e)}var ai=e=>{let{present:t,children:n}=e,r=oi(t),i=typeof n==`function`?n({present:r.isPresent}):_.Children.only(n),a=br(r.ref,ci(i));return typeof n==`function`||r.isPresent?_.cloneElement(i,{ref:a}):null};ai.displayName=`Presence`;function oi(e){let[t,n]=_.useState(),r=_.useRef(null),i=_.useRef(e),a=_.useRef(`none`),[o,s]=ii(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return _.useEffect(()=>{let e=si(r.current);a.current=o===`mounted`?e:`none`},[o]),ti(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=si(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),ti(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=si(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=si(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:_.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function si(e){return e?.animationName||`none`}function ci(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var li=_.useInsertionEffect||ti;function ui({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=di({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=_.useRef(e!==void 0);_.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,_.useCallback(t=>{if(s){let n=fi(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function di({defaultProp:e,onChange:t}){let[n,r]=_.useState(e),i=_.useRef(n),a=_.useRef(t);return li(()=>{a.current=t},[t]),_.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function fi(e){return typeof e==`function`}var pi=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),mi=`VisuallyHidden`,hi=_.forwardRef((e,t)=>(0,V.jsx)(U.span,{...e,ref:t,style:{...pi,...e.style}}));hi.displayName=mi;var gi=hi,_i=`ToastProvider`,[vi,yi,bi]=Ar(`Toast`),[xi,Si]=Sr(`Toast`,[bi]),[Ci,wi]=xi(_i),Ti=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=_.useState(null),[l,u]=_.useState(0),d=_.useRef(!1),f=_.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${_i}\`. Expected non-empty \`string\`.`),(0,V.jsx)(vi.Provider,{scope:t,children:(0,V.jsx)(Ci,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:_.useCallback(()=>u(e=>e+1),[]),onToastRemove:_.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};Ti.displayName=_i;var Ei=`ToastViewport`,Di=[`F8`],Oi=`toast.viewportPause`,ki=`toast.viewportResume`,Ai=_.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=Di,label:i=`Notifications ({hotkey})`,...a}=e,o=wi(Ei,n),s=yi(n),c=_.useRef(null),l=_.useRef(null),u=_.useRef(null),d=_.useRef(null),f=br(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;_.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),_.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Oi);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(ki);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=_.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...ra(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return _.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);ia(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,V.jsxs)(ei,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,V.jsx)(Mi,{ref:l,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`forwards`}))}}),(0,V.jsx)(vi.Slot,{scope:n,children:(0,V.jsx)(U.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,V.jsx)(Mi,{ref:u,onFocusFromOutsideViewport:()=>{ia(h({tabbingDirection:`backwards`}))}})]})});Ai.displayName=Ei;var ji=`ToastFocusProxy`,Mi=_.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=wi(ji,n);return(0,V.jsx)(hi,{tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});Mi.displayName=ji;var Ni=`Toast`,Pi=`toast.swipeStart`,Fi=`toast.swipeMove`,Ii=`toast.swipeCancel`,Li=`toast.swipeEnd`,Ri=_.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ui({prop:r,defaultProp:i??!0,onChange:a,caller:Ni});return(0,V.jsx)(ai,{present:n||s,children:(0,V.jsx)(Vi,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:Rr(e.onPause),onResume:Rr(e.onResume),onSwipeStart:H(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:H(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:H(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:H(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Ri.displayName=Ni;var[zi,Bi]=xi(Ni,{onClose(){}}),Vi=_.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=wi(Ni,n),[g,y]=_.useState(null),b=br(t,e=>y(e)),x=_.useRef(null),S=_.useRef(null),C=i||h.duration,w=_.useRef(0),T=_.useRef(C),E=_.useRef(0),{onToastAdd:D,onToastRemove:O}=h,k=Rr(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),A=_.useCallback(e=>{!e||e===1/0||(window.clearTimeout(E.current),w.current=new Date().getTime(),E.current=window.setTimeout(k,e))},[k]);_.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{A(T.current),l?.()},n=()=>{let e=new Date().getTime()-w.current;T.current-=e,window.clearTimeout(E.current),c?.()};return e.addEventListener(Oi,n),e.addEventListener(ki,t),()=>{e.removeEventListener(Oi,n),e.removeEventListener(ki,t)}}},[h.viewport,C,c,l,A]),_.useEffect(()=>{a&&!h.isClosePausedRef.current&&A(C)},[a,C,h.isClosePausedRef,A]),_.useEffect(()=>(D(),()=>O()),[D,O]);let j=_.useMemo(()=>g?Qi(g):null,[g]);return h.viewport?(0,V.jsxs)(V.Fragment,{children:[j&&(0,V.jsx)(Hi,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,children:j}),(0,V.jsx)(zi,{scope:n,onClose:k,children:v.createPortal((0,V.jsx)(vi.ItemSlot,{scope:n,children:(0,V.jsx)($r,{asChild:!0,onEscapeKeyDown:H(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||k(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,V.jsx)(U.li,{tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:b,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:H(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,k()))}),onPointerDown:H(e.onPointerDown,e=>{e.button===0&&(x.current={x:e.clientX,y:e.clientY})}),onPointerMove:H(e.onPointerMove,e=>{if(!x.current)return;let t=e.clientX-x.current.x,n=e.clientY-x.current.y,r=!!S.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(S.current=l,$i(Fi,d,f,{discrete:!1})):ea(l,h.swipeDirection,c)?(S.current=l,$i(Pi,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(x.current=null)}),onPointerUp:H(e.onPointerUp,e=>{let t=S.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),S.current=null,x.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};ea(t,h.swipeDirection,h.swipeThreshold)?$i(Li,p,r,{discrete:!0}):$i(Ii,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Hi=e=>{let{__scopeToast:t,children:n,...r}=e,i=wi(Ni,t),[a,o]=_.useState(!1),[s,c]=_.useState(!1);return ta(()=>o(!0)),_.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,V.jsx)(ri,{asChild:!0,children:(0,V.jsx)(hi,{...r,children:a&&(0,V.jsxs)(V.Fragment,{children:[i.label,` `,n]})})})},Ui=`ToastTitle`,Wi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Wi.displayName=Ui;var Gi=`ToastDescription`,Ki=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});Ki.displayName=Gi;var qi=`ToastAction`,Ji=_.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,V.jsx)(Zi,{altText:n,asChild:!0,children:(0,V.jsx)(Xi,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${qi}\`. Expected non-empty \`string\`.`),null)});Ji.displayName=qi;var Yi=`ToastClose`,Xi=_.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Bi(Yi,n);return(0,V.jsx)(Zi,{asChild:!0,children:(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,i.onClose)})})});Xi.displayName=Yi;var Zi=_.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,V.jsx)(U.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function Qi(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),na(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...Qi(e))}}),t}function $i(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?Lr(i,a):i.dispatchEvent(a)}var ea=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ta(e=()=>{}){let t=Rr(e);ti(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function na(e){return e.nodeType===e.ELEMENT_NODE}function ra(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ia(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var aa=Ti,oa=Ai,sa=Ri,ca=Wi,la=Ki,ua=Ji,da=Xi;function fa(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;ttypeof e==`boolean`?`${e}`:e===0?`0`:e,ha=pa,ga=(e,t)=>n=>{if(t?.variants==null)return ha(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=ma(t)||ma(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return ha(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},_a=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),va=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),ya={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},ba=(0,_.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,_.createElement)(`svg`,{ref:c,...ya,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:va(`lucide`,i),...s},[...o.map(([e,t])=>(0,_.createElement)(e,t)),...Array.isArray(a)?a:[a]])),xa=(e,t)=>{let n=(0,_.forwardRef)(({className:n,...r},i)=>(0,_.createElement)(ba,{ref:i,iconNode:t,className:va(`lucide-${_a(e)}`,n),...r}));return n.displayName=`${e}`,n},Sa=xa(`Activity`,[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]),Ca=xa(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),wa=xa(`BookOpen`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),Ta=xa(`Camera`,[[`path`,{d:`M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z`,key:`1tc9qg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]),Ea=xa(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),Da=xa(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),Oa=xa(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),ka=xa(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),Aa=xa(`ChevronsUpDown`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),ja=xa(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),Ma=xa(`CircleCheckBig`,[[`path`,{d:`M21.801 10A10 10 0 1 1 17 3.335`,key:`yps3ct`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Na=xa(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Pa=xa(`CircleHelp`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Fa=xa(`CircleX`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),Ia=xa(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),La=xa(`Clock`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`polyline`,{points:`12 6 12 12 16 14`,key:`68esgv`}]]),Ra=xa(`Copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),za=xa(`Database`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 5V19A9 3 0 0 0 21 19V5`,key:`1wlel7`}],[`path`,{d:`M3 12A9 3 0 0 0 21 12`,key:`mv7ke4`}]]),Ba=xa(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),Va=xa(`Ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),Ha=xa(`ExternalLink`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),Ua=xa(`EyeOff`,[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Wa=xa(`Eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),Ga=xa(`FileText`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),Ka=xa(`Github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),qa=xa(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Ja=xa(`Lock`,[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`,key:`1w4ew1`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`,key:`fwvmzm`}]]),Ya=xa(`Pencil`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]),Xa=xa(`Play`,[[`polygon`,{points:`6 3 20 12 6 21 6 3`,key:`1oa8hb`}]]),Za=xa(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),Qa=xa(`RefreshCw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),$a=xa(`RotateCcw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),eo=xa(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),to=xa(`Settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),no=xa(`ShieldQuestion`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),ro=xa(`SkipForward`,[[`polygon`,{points:`5 4 15 12 5 20 5 4`,key:`16p6eg`}],[`line`,{x1:`19`,x2:`19`,y1:`5`,y2:`19`,key:`futhcm`}]]),io=xa(`Sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),ao=xa(`Square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),oo=xa(`Terminal`,[[`polyline`,{points:`4 17 10 11 4 5`,key:`akl6gq`}],[`line`,{x1:`12`,x2:`20`,y1:`19`,y2:`19`,key:`q2wloq`}]]),so=xa(`Trash2`,[[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6`,key:`4alrt4`}],[`path`,{d:`M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2`,key:`v07s0e`}],[`line`,{x1:`10`,x2:`10`,y1:`11`,y2:`17`,key:`1uufr5`}],[`line`,{x1:`14`,x2:`14`,y1:`11`,y2:`17`,key:`xtxkd`}]]),co=xa(`TriangleAlert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),lo=xa(`Upload`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`17 8 12 3 7 8`,key:`t8dd8p`}],[`line`,{x1:`12`,x2:`12`,y1:`3`,y2:`15`,key:`widbto`}]]),uo=xa(`VideoOff`,[[`path`,{d:`M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196`,key:`w8jjjt`}],[`path`,{d:`M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2`,key:`1xawa7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),fo=xa(`Volume2`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`path`,{d:`M16 9a5 5 0 0 1 0 6`,key:`1q6k2b`}],[`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`,key:`ijwkga`}]]),po=xa(`VolumeX`,[[`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`,key:`uqj9uw`}],[`line`,{x1:`22`,x2:`16`,y1:`9`,y2:`15`,key:`1ewh16`}],[`line`,{x1:`16`,x2:`22`,y1:`9`,y2:`15`,key:`5ykzw1`}]]),mo=xa(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]),ho=`-`,go=e=>{let t=bo(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(ho);return n[0]===``&&n.length!==1&&n.shift(),_o(n,t)||yo(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},_o=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?_o(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(ho);return t.validators.find(({validator:e})=>e(a))?.classGroupId},vo=/^\[(.+)\]$/,yo=e=>{if(vo.test(e)){let t=vo.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},bo=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wo(Object.entries(e.classGroups),n).forEach(([e,n])=>{xo(n,r,e,t)}),r},xo=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:So(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(Co(e)){xo(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{xo(i,So(t,e),n,r)})})},So=(e,t)=>{let n=e;return t.split(ho).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},Co=e=>e.isThemeGetter,wo=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,To=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},Eo=`!`,Do=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;ls?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},Oo=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},ko=e=>({cache:To(e.cacheSize),parseClassName:Do(e),...go(e)}),Ao=/\s+/,jo=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(Ao),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=Oo(c).join(`:`),h=l?m+Eo:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function Mo(){let e=0,t,n,r=``;for(;e{if(typeof e==`string`)return e;let t,n=``;for(let r=0;rt(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=jo(e,n);return i(e,a),a}return function(){return a(Mo.apply(null,arguments))}}var Fo=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Io=/^\[(?:([a-z-]+):)?(.+)\]$/i,Lo=/^\d+\/\d+$/,Ro=new Set([`px`,`full`,`screen`]),zo=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Bo=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Vo=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Ho=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Uo=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Wo=e=>Ko(e)||Ro.has(e)||Lo.test(e),Go=e=>as(e,`length`,os),Ko=e=>!!e&&!Number.isNaN(Number(e)),qo=e=>as(e,`number`,Ko),Jo=e=>!!e&&Number.isInteger(Number(e)),Yo=e=>e.endsWith(`%`)&&Ko(e.slice(0,-1)),Xo=e=>Io.test(e),Zo=e=>zo.test(e),Qo=new Set([`length`,`size`,`percentage`]),$o=e=>as(e,Qo,ss),es=e=>as(e,`position`,ss),ts=new Set([`image`,`url`]),ns=e=>as(e,ts,ls),rs=e=>as(e,``,cs),is=()=>!0,as=(e,t,n)=>{let r=Io.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},os=e=>Bo.test(e)&&!Vo.test(e),ss=()=>!1,cs=e=>Ho.test(e),ls=e=>Uo.test(e),us=Po(()=>{let e=Fo(`colors`),t=Fo(`spacing`),n=Fo(`blur`),r=Fo(`brightness`),i=Fo(`borderColor`),a=Fo(`borderRadius`),o=Fo(`borderSpacing`),s=Fo(`borderWidth`),c=Fo(`contrast`),l=Fo(`grayscale`),u=Fo(`hueRotate`),d=Fo(`invert`),f=Fo(`gap`),p=Fo(`gradientColorStops`),m=Fo(`gradientColorStopPositions`),h=Fo(`inset`),g=Fo(`margin`),_=Fo(`opacity`),v=Fo(`padding`),y=Fo(`saturate`),b=Fo(`scale`),x=Fo(`sepia`),S=Fo(`skew`),C=Fo(`space`),w=Fo(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,Xo,t],O=()=>[Xo,t],k=()=>[``,Wo,Go],A=()=>[`auto`,Ko,Xo],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,Xo],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],ee=()=>[Ko,Xo];return{cacheSize:500,separator:`:`,theme:{colors:[is],spacing:[Wo,Go],blur:[`none`,``,Zo,Xo],brightness:ee(),borderColor:[e],borderRadius:[`none`,``,`full`,Zo,Xo],borderSpacing:O(),borderWidth:k(),contrast:ee(),grayscale:F(),hueRotate:ee(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Yo,Go],inset:D(),margin:D(),opacity:ee(),padding:O(),saturate:ee(),scale:ee(),sepia:F(),skew:ee(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,Xo]}],container:[`container`],columns:[{columns:[Zo]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:[...j(),Xo]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Jo,Xo]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,Xo]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Jo,Xo]}],"grid-cols":[{"grid-cols":[is]}],"col-start-end":[{col:[`auto`,{span:[`full`,Jo,Xo]},Xo]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[is]}],"row-start-end":[{row:[`auto`,{span:[Jo,Xo]},Xo]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,Xo]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,Xo]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,Xo,t]}],"min-w":[{"min-w":[Xo,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[Xo,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Zo]},Zo]}],h:[{h:[Xo,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[Xo,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[Xo,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Zo,Go]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,qo]}],"font-family":[{font:[is]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,Xo]}],"line-clamp":[{"line-clamp":[`none`,Ko,qo]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Wo,Xo]}],"list-image":[{"list-image":[`none`,Xo]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,Xo]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Wo,Go]}],"underline-offset":[{"underline-offset":[`auto`,Wo,Xo]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,Xo]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,Xo]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),es]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,$o]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},ns]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Wo,Xo]}],"outline-w":[{outline:[Wo,Go]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Wo,Go]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Zo,rs]}],"shadow-color":[{shadow:[is]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Zo,Xo]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,Xo]}],duration:[{duration:ee()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,Xo]}],delay:[{delay:ee()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,Xo]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Jo,Xo]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,Xo]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,Xo]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,Xo]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Wo,Go,qo]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-s`,`border-w-e`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-s`,`border-color-e`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]}}});function W(...e){return us(pa(e))}var ds=aa,fs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(oa,{ref:n,className:W(`fixed top-0 z-[100] flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px]`,e),...t}));fs.displayName=oa.displayName;var ps=ga(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`}},defaultVariants:{variant:`default`}}),ms=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(sa,{ref:r,className:W(ps({variant:t}),e),...n}));ms.displayName=sa.displayName;var hs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ua,{ref:n,className:W(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));hs.displayName=ua.displayName;var gs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(da,{ref:n,className:W(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600`,e),"toast-close":``,...t,children:(0,V.jsx)(mo,{className:`h-4 w-4`})}));gs.displayName=da.displayName;var _s=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(ca,{ref:n,className:W(`text-sm font-semibold`,e),...t}));_s.displayName=ca.displayName;var vs=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(la,{ref:n,className:W(`text-sm opacity-90`,e),...t}));vs.displayName=la.displayName;function ys(){let{toasts:e}=_r();return(0,V.jsxs)(ds,{children:[e.map(function({id:e,title:t,description:n,action:r,...i}){return(0,V.jsxs)(ms,{...i,children:[(0,V.jsxs)(`div`,{className:`grid gap-1`,children:[t&&(0,V.jsx)(_s,{children:t}),n&&(0,V.jsx)(vs,{children:n})]}),r,(0,V.jsx)(gs,{})]},e)}),(0,V.jsx)(fs,{})]})}var bs=Symbol.for(`react.lazy`),xs=_.use;function Ss(e){return typeof e==`object`&&!!e&&`then`in e}function Cs(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===bs&&`_payload`in e&&Ss(e._payload)}function ws(e){let t=Es(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e;Cs(r)&&typeof xs==`function`&&(r=xs(r._payload));let a=_.Children.toArray(r),o=a.find(Os);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}var Ts=ws(`Slot`);function Es(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(Cs(n)&&typeof xs==`function`&&(n=xs(n._payload)),_.isValidElement(n)){let e=As(n),i=ks(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Ds=Symbol(`radix.slottable`);function Os(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Ds}function ks(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function As(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var js=ga(`inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,{variants:{variant:{default:`bg-primary text-primary-foreground hover:bg-primary/90`,destructive:`bg-destructive text-destructive-foreground hover:bg-destructive/90`,outline:`border border-input bg-background hover:bg-accent hover:text-accent-foreground`,secondary:`bg-secondary text-secondary-foreground hover:bg-secondary/80`,ghost:`hover:bg-accent hover:text-accent-foreground`,link:`text-primary underline-offset-4 hover:underline`},size:{default:`h-10 px-4 py-2`,sm:`h-9 rounded-md px-3`,lg:`h-11 rounded-md px-8`,icon:`h-10 w-10`}},defaultVariants:{variant:`default`,size:`default`}}),G=_.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...i},a)=>(0,V.jsx)(r?Ts:`button`,{className:W(js({variant:t,size:n,className:e})),ref:a,...i}));G.displayName=`Button`;var Ms=(0,_.createContext)(void 0),Ns=`lelab.apiBaseUrl`,Ps=`http://localhost:8000`,Fs=e=>e.replace(/^http(s?):/,`ws$1:`),Is=()=>{if(typeof window>`u`)return Ps;let e=new URLSearchParams(window.location.search).get(`api`);if(e)try{new URL(e);let t=e.replace(/\/$/,``);return window.localStorage.setItem(Ns,t),t}catch{console.warn("Invalid `api` query param, ignoring:",e)}return window.localStorage.getItem(Ns)||Ps},Ls=({children:e})=>{let[t]=(0,_.useState)(Is),n=Fs(t),r=(0,_.useCallback)(async(e,t={})=>fetch(e,{...t,headers:{"Content-Type":`application/json`,...t.headers}}),[]),i=(0,_.useMemo)(()=>({baseUrl:t,wsBaseUrl:n,fetchWithHeaders:r}),[t,n,r]);return(0,V.jsx)(Ms.Provider,{value:i,children:e})},Rs=()=>{let e=(0,_.useContext)(Ms);if(e===void 0)throw Error(`useApi must be used within an ApiProvider`);return e},zs=(0,_.createContext)(void 0),Bs=({children:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)({status:`loading`}),a=(0,_.useCallback)(async()=>{i({status:`loading`});try{let e=await(await n(`${t}/hf-auth-status`)).json();e.authenticated?i({status:`authenticated`,username:e.username,orgs:e.orgs??[]}):i({status:`unauthenticated`,loginCommand:e.login_command??`hf auth login`})}catch(e){console.warn(`HF auth status fetch failed:`,e),i({status:`unauthenticated`,loginCommand:`hf auth login`})}},[t,n]);(0,_.useEffect)(()=>{a()},[a]);let o=(0,_.useMemo)(()=>({auth:r,refetch:a}),[r,a]);return(0,V.jsx)(zs.Provider,{value:o,children:e})},Vs=()=>{let e=(0,_.useContext)(zs);if(e===void 0)throw Error(`useHfAuth must be used within an HfAuthProvider`);return e},Hs=_.useId||(()=>void 0),Us=0;function Ws(e){let[t,n]=_.useState(Hs());return ti(()=>{e||n(e=>e??String(Us++))},[e]),e||(t?`radix-${t}`:``)}var Gs=`focusScope.autoFocusOnMount`,Ks=`focusScope.autoFocusOnUnmount`,qs={bubbles:!1,cancelable:!0},Js=`FocusScope`,Ys=_.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=_.useState(null),l=Rr(i),u=Rr(a),d=_.useRef(null),f=br(t,e=>c(e)),p=_.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;_.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:nc(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||nc(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&nc(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),_.useEffect(()=>{if(s){rc.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(Gs,qs);s.addEventListener(Gs,l),s.dispatchEvent(t),t.defaultPrevented||(Xs(oc(Qs(s)),{select:!0}),document.activeElement===e&&nc(s))}return()=>{s.removeEventListener(Gs,l),setTimeout(()=>{let t=new CustomEvent(Ks,qs);s.addEventListener(Ks,u),s.dispatchEvent(t),t.defaultPrevented||nc(e??document.body,{select:!0}),s.removeEventListener(Ks,u),rc.remove(p)},0)}}},[s,l,u,p]);let m=_.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=Zs(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&nc(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&nc(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(U.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});Ys.displayName=Js;function Xs(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(nc(r,{select:t}),document.activeElement!==n)return}function Zs(e){let t=Qs(e);return[$s(t,e),$s(t.reverse(),e)]}function Qs(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function $s(e,t){for(let n of e)if(!ec(n,{upTo:t}))return n}function ec(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function tc(e){return e instanceof HTMLInputElement&&`select`in e}function nc(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&tc(e)&&t&&e.select()}}var rc=ic();function ic(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=ac(e,t),e.unshift(t)},remove(t){e=ac(e,t),e[0]?.resume()}}}function ac(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function oc(e){return e.filter(e=>e.tagName!==`A`)}var sc=0;function cc(){_.useEffect(()=>{let e=document.querySelectorAll(`[data-radix-focus-guard]`);return document.body.insertAdjacentElement(`afterbegin`,e[0]??lc()),document.body.insertAdjacentElement(`beforeend`,e[1]??lc()),sc++,()=>{sc===1&&document.querySelectorAll(`[data-radix-focus-guard]`).forEach(e=>e.remove()),sc--}},[])}function lc(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var uc=function(){return uc=Object.assign||function(e){for(var t,n=1,r=arguments.length;n`u`)return Lc;var t=zc(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Vc=Ic(),Hc=`data-scroll-locked`,Uc=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),` - .${hc} { - overflow: hidden ${r}; - padding-right: ${s}px ${r}; - } - body[${Hc}] { - overflow: hidden ${r}; - overscroll-behavior: contain; - ${[t&&`position: relative ${r};`,n===`margin`&&` - padding-left: ${i}px; - padding-top: ${a}px; - padding-right: ${o}px; - margin-left:0; - margin-top:0; - margin-right: ${s}px ${r}; - `,n===`padding`&&`padding-right: ${s}px ${r};`].filter(Boolean).join(``)} - } - - .${pc} { - right: ${s}px ${r}; - } - - .${mc} { - margin-right: ${s}px ${r}; - } - - .${pc} .${pc} { - right: 0 ${r}; - } - - .${mc} .${mc} { - margin-right: 0 ${r}; - } - - body[${Hc}] { - ${gc}: ${s}px; - } -`},Wc=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},Gc=function(){_.useEffect(function(){return document.body.setAttribute(Hc,(Wc()+1).toString()),function(){var e=Wc()-1;e<=0?document.body.removeAttribute(Hc):document.body.setAttribute(Hc,e.toString())}},[])},Kc=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;Gc();var a=_.useMemo(function(){return Bc(i)},[i]);return _.createElement(Vc,{styles:Uc(a,!t,i,n?``:`!important`)})},qc=!1;if(typeof window<`u`)try{var Jc=Object.defineProperty({},"passive",{get:function(){return qc=!0,!0}});window.addEventListener(`test`,Jc,Jc),window.removeEventListener(`test`,Jc,Jc)}catch{qc=!1}var Yc=qc?{passive:!1}:!1,Xc=function(e){return e.tagName===`TEXTAREA`},Zc=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!Xc(e)&&n[t]===`visible`)},Qc=function(e){return Zc(e,`overflowY`)},$c=function(e){return Zc(e,`overflowX`)},el=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),rl(e,r)){var i=il(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},tl=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},nl=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},rl=function(e,t){return e===`v`?Qc(t):$c(t)},il=function(e,t){return e===`v`?tl(t):nl(t)},al=function(e,t){return e===`h`&&t===`rtl`?-1:1},ol=function(e,t,n,r,i){var a=al(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=il(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&rl(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},sl=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},cl=function(e){return[e.deltaX,e.deltaY]},ll=function(e){return e&&`current`in e?e.current:e},ul=function(e,t){return e[0]===t[0]&&e[1]===t[1]},dl=function(e){return` - .block-interactivity-${e} {pointer-events: none;} - .allow-interactivity-${e} {pointer-events: all;} -`},fl=0,pl=[];function ml(e){var t=_.useRef([]),n=_.useRef([0,0]),r=_.useRef(),i=_.useState(fl++)[0],a=_.useState(Ic)[0],o=_.useRef(e);_.useEffect(function(){o.current=e},[e]),_.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=fc([e.lockRef.current],(e.shards||[]).map(ll),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=_.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=sl(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=el(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=el(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ol(h,t,e,h===`h`?s:c,!0)},[]),c=_.useCallback(function(e){var n=e;if(!(!pl.length||pl[pl.length-1]!==a)){var r=`deltaY`in n?cl(n):sl(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&ul(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(ll).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=_.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:hl(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=_.useCallback(function(e){n.current=sl(e),r.current=void 0},[]),d=_.useCallback(function(t){l(t.type,cl(t),t.target,s(t,e.lockRef.current))},[]),f=_.useCallback(function(t){l(t.type,sl(t),t.target,s(t,e.lockRef.current))},[]);_.useEffect(function(){return pl.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,Yc),document.addEventListener(`touchmove`,c,Yc),document.addEventListener(`touchstart`,u,Yc),function(){pl=pl.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,Yc),document.removeEventListener(`touchmove`,c,Yc),document.removeEventListener(`touchstart`,u,Yc)}},[]);var p=e.removeScrollBar,m=e.inert;return _.createElement(_.Fragment,null,m?_.createElement(a,{styles:dl(i)}):null,p?_.createElement(Kc,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function hl(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var gl=Tc(Ec,ml),_l=_.forwardRef(function(e,t){return _.createElement(Oc,uc({},e,{ref:t,sideCar:gl}))});_l.classNames=Oc.classNames;var vl=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},yl=new WeakMap,bl=new WeakMap,xl={},Sl=0,Cl=function(e){return e&&(e.host||Cl(e.parentNode))},wl=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Cl(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},Tl=function(e,t,n,r){var i=wl(t,Array.isArray(e)?e:[e]);xl[n]||(xl[n]=new WeakMap);var a=xl[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(yl.get(e)||0)+1,l=(a.get(e)||0)+1;yl.set(e,c),a.set(e,l),o.push(e),c===1&&i&&bl.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),Sl++,function(){o.forEach(function(e){var t=yl.get(e)-1,i=a.get(e)-1;yl.set(e,t),a.set(e,i),t||(bl.has(e)||e.removeAttribute(r),bl.delete(e)),i||e.removeAttribute(n)}),Sl--,Sl||(yl=new WeakMap,yl=new WeakMap,bl=new WeakMap,xl={})}},El=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||vl(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Tl(r,i,n,`aria-hidden`)):function(){return null}};function Dl(e){let t=Ol(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Al);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Ol(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Ml(n),i=jl(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var kl=Symbol(`radix.slottable`);function Al(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===kl}function jl(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Ml(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Nl=`Dialog`,[Pl,Fl]=Sr(Nl),[Il,Ll]=Pl(Nl),Rl=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=_.useRef(null),c=_.useRef(null),[l,u]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:Nl});return(0,V.jsx)(Il,{scope:t,triggerRef:s,contentRef:c,contentId:Ws(),titleId:Ws(),descriptionId:Ws(),open:l,onOpenChange:u,onOpenToggle:_.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Rl.displayName=Nl;var zl=`DialogTrigger`,Bl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(zl,n),a=br(t,i.triggerRef);return(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":ou(i.open),...r,ref:a,onClick:H(e.onClick,i.onOpenToggle)})});Bl.displayName=zl;var Vl=`DialogPortal`,[Hl,Ul]=Pl(Vl,{forceMount:void 0}),Wl=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Ll(Vl,t);return(0,V.jsx)(Hl,{scope:t,forceMount:n,children:_.Children.map(r,e=>(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:e})}))})};Wl.displayName=Vl;var Gl=`DialogOverlay`,Kl=_.forwardRef((e,t)=>{let n=Ul(Gl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Gl,e.__scopeDialog);return a.modal?(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(Jl,{...i,ref:t})}):null});Kl.displayName=Gl;var ql=Dl(`DialogOverlay.RemoveScroll`),Jl=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(Gl,n);return(0,V.jsx)(_l,{as:ql,allowPinchZoom:!0,shards:[i.contentRef],children:(0,V.jsx)(U.div,{"data-state":ou(i.open),...r,ref:t,style:{pointerEvents:`auto`,...r.style}})})}),Yl=`DialogContent`,Xl=_.forwardRef((e,t)=>{let n=Ul(Yl,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Ll(Yl,e.__scopeDialog);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(Zl,{...i,ref:t}):(0,V.jsx)(Ql,{...i,ref:t})})});Xl.displayName=Yl;var Zl=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(null),i=br(t,n.contentRef,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)($l,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault())})}),Ql=_.forwardRef((e,t)=>{let n=Ll(Yl,e.__scopeDialog),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)($l,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),$l=_.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Ll(Yl,n),c=_.useRef(null),l=br(t,c);return cc(),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ou(s.open),...o,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(uu,{titleId:s.titleId}),(0,V.jsx)(fu,{contentRef:c,descriptionId:s.descriptionId})]})]})}),eu=`DialogTitle`,tu=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(eu,n);return(0,V.jsx)(U.h2,{id:i.titleId,...r,ref:t})});tu.displayName=eu;var nu=`DialogDescription`,ru=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(nu,n);return(0,V.jsx)(U.p,{id:i.descriptionId,...r,ref:t})});ru.displayName=nu;var iu=`DialogClose`,au=_.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Ll(iu,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});au.displayName=iu;function ou(e){return e?`open`:`closed`}var su=`DialogTitleWarning`,[cu,lu]=xr(su,{contentName:Yl,titleName:eu,docsSlug:`dialog`}),uu=({titleId:e})=>{let t=lu(su),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. - -If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. - -For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return _.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},du=`DialogDescriptionWarning`,fu=({contentRef:e,descriptionId:t})=>{let n=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${lu(du).contentName}}.`;return _.useEffect(()=>{let r=e.current?.getAttribute(`aria-describedby`);t&&r&&(document.getElementById(t)||console.warn(n))},[n,e,t]),null},pu=Rl,mu=Bl,hu=Wl,gu=Kl,_u=Xl,vu=tu,yu=ru,bu=au,xu=pu,Su=hu,Cu=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(gu,{ref:n,className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t}));Cu.displayName=gu.displayName;var wu=_.forwardRef(({className:e,children:t,hideClose:n,...r},i)=>(0,V.jsxs)(Su,{children:[(0,V.jsx)(Cu,{}),(0,V.jsxs)(_u,{ref:i,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...r,children:[t,!n&&(0,V.jsxs)(bu,{className:`absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground`,children:[(0,V.jsx)(mo,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]}));wu.displayName=_u.displayName;var Tu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-1.5 text-center sm:text-left`,e),...t});Tu.displayName=`DialogHeader`;var Eu=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});Eu.displayName=`DialogFooter`;var Du=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vu,{ref:n,className:W(`text-lg font-semibold leading-none tracking-tight`,e),...t}));Du.displayName=vu.displayName;var Ou=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yu,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Ou.displayName=yu.displayName;var ku=({open:e,onOpenChange:t})=>{let{auth:n,refetch:r}=Vs(),[i,a]=(0,_.useState)(!1),[o,s]=(0,_.useState)(!1);return n.status===`unauthenticated`?(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-amber-200`,children:`Hugging Face CLI not configured`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`Uploads, training, and replay-from-Hub require a logged-in HF CLI. Run this in a terminal:`})]}),(0,V.jsxs)(`pre`,{className:`bg-gray-950 p-3 rounded border border-gray-700 text-xs sm:text-sm overflow-x-auto flex items-center justify-between gap-2`,children:[(0,V.jsx)(`code`,{className:`text-green-400`,children:n.loginCommand}),(0,V.jsx)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(n.loginCommand),a(!0),setTimeout(()=>a(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},className:`flex-shrink-0 text-gray-400 hover:text-gray-200 transition-colors`,"aria-label":`Copy command`,children:i?(0,V.jsx)(Ea,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:async()=>{s(!0);try{await r()}finally{s(!1)}},disabled:o,className:`border-amber-700 bg-transparent text-amber-100 hover:bg-amber-900/40 hover:text-amber-50`,children:[(0,V.jsx)(Qa,{className:`w-4 h-4 mr-2 ${o?`animate-spin`:``}`}),`I've logged in — recheck`]})]})}):null},eee=()=>{let{auth:e}=Vs(),[t,n]=(0,_.useState)(!1);return e.status===`loading`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-400`,children:[(0,V.jsx)(qa,{className:`w-3 h-3 animate-spin`}),(0,V.jsx)(`span`,{children:`Checking HF…`})]}):e.status===`authenticated`?(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 rounded-full border border-gray-800 bg-gray-900/60 px-3 py-1 text-xs text-gray-200`,title:`Hugging Face authenticated`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-emerald-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:e.username})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`inline-flex items-center gap-2 rounded-full border border-amber-700/60 bg-amber-950/40 px-3 py-1 text-xs text-amber-100 hover:bg-amber-900/40 transition-colors`,"aria-label":`Hugging Face not configured — show login instructions`,children:[(0,V.jsx)(`span`,{className:`h-2 w-2 rounded-full bg-amber-400`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`HF not configured`})]}),(0,V.jsx)(ku,{open:t,onOpenChange:n})]})},tee=()=>(0,V.jsx)(`header`,{className:`sticky top-0 z-30 w-full border-b border-gray-800 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex h-12 max-w-7xl items-center justify-between px-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab`,className:`h-7 w-7`}),(0,V.jsx)(`span`,{className:`text-base font-semibold tracking-tight text-white`,children:`LeLab`})]}),(0,V.jsx)(eee,{})]})}),nee=[{href:`https://github.com/huggingface/lerobot`,label:`GitHub`,Icon:Ka},{href:`https://huggingface.co/docs/lerobot`,label:`Documentation`,Icon:wa},{href:`https://discord.com/invite/s3KuuzsPFb`,label:`Discord`,Icon:({className:e})=>(0,V.jsx)(`svg`,{role:`img`,viewBox:`0 0 24 24`,xmlns:`http://www.w3.org/2000/svg`,fill:`currentColor`,className:e,children:(0,V.jsx)(`path`,{d:`M20.317 4.369A19.79 19.79 0 0 0 16.558 3.2a.07.07 0 0 0-.074.035c-.211.375-.444.864-.608 1.249a18.27 18.27 0 0 0-5.487 0 12.51 12.51 0 0 0-.617-1.249.077.077 0 0 0-.074-.035 19.736 19.736 0 0 0-3.76 1.169.07.07 0 0 0-.032.027C2.533 8.046 1.79 11.624 2.155 15.157a.082.082 0 0 0 .031.056 19.9 19.9 0 0 0 5.993 3.03.078.078 0 0 0 .084-.027c.462-.63.873-1.295 1.226-1.994a.076.076 0 0 0-.041-.105 13.13 13.13 0 0 1-1.873-.892.077.077 0 0 1-.008-.128c.126-.094.252-.192.372-.291a.074.074 0 0 1 .077-.01c3.927 1.793 8.18 1.793 12.061 0a.074.074 0 0 1 .078.009c.12.099.246.198.373.292a.077.077 0 0 1-.006.128 12.32 12.32 0 0 1-1.873.891.077.077 0 0 0-.04.106c.36.698.772 1.363 1.225 1.993a.076.076 0 0 0 .084.028 19.84 19.84 0 0 0 6.002-3.03.077.077 0 0 0 .032-.054c.5-4.087-.838-7.636-3.548-10.787a.061.061 0 0 0-.031-.028zM8.02 12.997c-1.182 0-2.156-1.085-2.156-2.419 0-1.333.955-2.419 2.156-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.955 2.418-2.156 2.418zm7.974 0c-1.182 0-2.157-1.085-2.157-2.419 0-1.333.955-2.419 2.157-2.419 1.21 0 2.175 1.095 2.156 2.42 0 1.333-.946 2.418-2.156 2.418z`})})}],ree=()=>(0,V.jsx)(`footer`,{className:`fixed inset-x-0 bottom-0 z-30 border-t border-gray-800 bg-black/95`,children:(0,V.jsxs)(`div`,{className:`mx-auto flex max-w-7xl flex-col items-center justify-between gap-3 px-4 py-4 text-sm text-gray-400 sm:flex-row`,children:[(0,V.jsxs)(`span`,{children:[`Powered by`,` `,(0,V.jsx)(`a`,{href:`https://github.com/huggingface/lerobot`,target:`_blank`,rel:`noopener noreferrer`,className:`font-medium text-gray-200 hover:text-white`,children:`LeRobot`})]}),(0,V.jsx)(`nav`,{className:`flex items-center gap-4`,children:nee.map(({href:e,label:t,Icon:n})=>(0,V.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-gray-400 hover:text-white`,children:[(0,V.jsx)(n,{className:`h-4 w-4`}),(0,V.jsx)(`span`,{children:t})]},t))})]})}),iee=[`top`,`right`,`bottom`,`left`],Au=Math.min,ju=Math.max,Mu=Math.round,Nu=Math.floor,Pu=e=>({x:e,y:e}),Fu={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Iu(e,t,n){return ju(e,Au(t,n))}function Lu(e,t){return typeof e==`function`?e(t):e}function Ru(e){return e.split(`-`)[0]}function zu(e){return e.split(`-`)[1]}function Bu(e){return e===`x`?`y`:`x`}function Vu(e){return e===`y`?`height`:`width`}function Hu(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Uu(e){return Bu(Hu(e))}function Wu(e,t,n){n===void 0&&(n=!1);let r=zu(e),i=Uu(e),a=Vu(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=$u(o)),[o,$u(o)]}function Gu(e){let t=$u(e);return[Ku(e),t,Ku(t)]}function Ku(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var qu=[`left`,`right`],Ju=[`right`,`left`],Yu=[`top`,`bottom`],Xu=[`bottom`,`top`];function Zu(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ju:qu:t?qu:Ju;case`left`:case`right`:return t?Yu:Xu;default:return[]}}function Qu(e,t,n,r){let i=zu(e),a=Zu(Ru(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ku)))),a}function $u(e){let t=Ru(e);return Fu[t]+e.slice(t.length)}function ed(e){return{top:0,right:0,bottom:0,left:0,...e}}function td(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ed(e)}function nd(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function rd(e,t,n){let{reference:r,floating:i}=e,a=Hu(t),o=Uu(t),s=Vu(o),c=Ru(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(zu(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function id(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Lu(t,e),p=td(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=nd(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=nd(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var ad=50,od=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:id},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=rd(l,r,c),f=r,p=0,m={};for(let n=0;n({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=Lu(e,t)||{};if(l==null)return{};let d=td(u),f={x:n,y:r},p=Uu(i),m=Vu(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Au(d[_],T),D=Au(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Iu(O,A,k),M=!c.arrow&&zu(i)!=null&&A!==j&&a.reference[m]/2-(Ae<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==Hu(t))||T.every(e=>Hu(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=Hu(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function ld(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ud(e){return iee.some(t=>e[t]>=0)}var dd=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Lu(e,t);switch(i){case`referenceHidden`:{let e=ld(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:ud(e)}}}case`escaped`:{let e=ld(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:ud(e)}}}default:return{}}}}},fd=new Set([`left`,`top`]);async function pd(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Ru(n),s=zu(n),c=Hu(n)===`y`,l=fd.has(o)?-1:1,u=a&&c?-1:1,d=Lu(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var md=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await pd(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},hd=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Lu(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=Hu(Ru(i)),p=Bu(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=Iu(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=Iu(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},gd=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Lu(e,t),u={x:n,y:r},d=Hu(i),f=Bu(d),p=u[f],m=u[d],h=Lu(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;pn&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=fd.has(Ru(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);mr&&(m=r)}return{[f]:p,[d]:m}}}},_d=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Lu(e,t),u=await o.detectOverflow(t,l),d=Ru(i),f=zu(i),p=Hu(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Au(h-u[g],v),x=Au(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=ju(u.left,0),t=ju(u.right,0),n=ju(u.top,0),r=ju(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:ju(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:ju(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function vd(){return typeof window<`u`}function yd(e){return Sd(e)?(e.nodeName||``).toLowerCase():`#document`}function bd(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function xd(e){return((Sd(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Sd(e){return vd()?e instanceof Node||e instanceof bd(e).Node:!1}function Cd(e){return vd()?e instanceof Element||e instanceof bd(e).Element:!1}function wd(e){return vd()?e instanceof HTMLElement||e instanceof bd(e).HTMLElement:!1}function Td(e){return!vd()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof bd(e).ShadowRoot}function Ed(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Pd(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function aee(e){return/^(table|td|th)$/.test(yd(e))}function Dd(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var oee=/transform|translate|scale|rotate|perspective|filter/,see=/paint|layout|strict|content/,Od=e=>!!e&&e!==`none`,kd;function Ad(e){let t=Cd(e)?Pd(e):e;return Od(t.transform)||Od(t.translate)||Od(t.scale)||Od(t.rotate)||Od(t.perspective)||!Md()&&(Od(t.backdropFilter)||Od(t.filter))||oee.test(t.willChange||``)||see.test(t.contain||``)}function jd(e){let t=Id(e);for(;wd(t)&&!Nd(t);){if(Ad(t))return t;if(Dd(t))return null;t=Id(t)}return null}function Md(){return kd??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),kd}function Nd(e){return/^(html|body|#document)$/.test(yd(e))}function Pd(e){return bd(e).getComputedStyle(e)}function Fd(e){return Cd(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Id(e){if(yd(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Td(e)&&e.host||xd(e);return Td(t)?t.host:t}function Ld(e){let t=Id(e);return Nd(t)?e.ownerDocument?e.ownerDocument.body:e.body:wd(t)&&Ed(t)?t:Ld(t)}function Rd(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ld(e),i=r===e.ownerDocument?.body,a=bd(r);if(i){let e=zd(a);return t.concat(a,a.visualViewport||[],Ed(r)?r:[],e&&n?Rd(e):[])}else return t.concat(r,Rd(r,[],n))}function zd(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Bd(e){let t=Pd(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=wd(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=Mu(n)!==a||Mu(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Vd(e){return Cd(e)?e:e.contextElement}function Hd(e){let t=Vd(e);if(!wd(t))return Pu(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=Bd(t),o=(a?Mu(n.width):n.width)/r,s=(a?Mu(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ud=Pu(0);function Wd(e){let t=bd(e);return!Md()||!t.visualViewport?Ud:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Gd(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==bd(e)?!1:t}function Kd(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Vd(e),o=Pu(1);t&&(r?Cd(r)&&(o=Hd(r)):o=Hd(e));let s=Gd(a,n,r)?Wd(a):Pu(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=bd(a),t=r&&Cd(r)?bd(r):r,n=e,i=zd(n);for(;i&&r&&t!==n;){let e=Hd(i),t=i.getBoundingClientRect(),r=Pd(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=bd(i),i=zd(n)}}return nd({width:u,height:d,x:c,y:l})}function qd(e,t){let n=Fd(e).scrollLeft;return t?t.left+n:Kd(xd(e)).left+n}function Jd(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-qd(e,n),y:n.top+t.scrollTop}}function Yd(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=xd(r),s=t?Dd(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=Pu(1),u=Pu(0),d=wd(r);if((d||!d&&!a)&&((yd(r)!==`body`||Ed(o))&&(c=Fd(r)),d)){let e=Kd(r);l=Hd(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Jd(o,c):Pu(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Xd(e){return Array.from(e.getClientRects())}function Zd(e){let t=xd(e),n=Fd(e),r=e.ownerDocument.body,i=ju(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ju(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+qd(e),s=-n.scrollTop;return Pd(r).direction===`rtl`&&(o+=ju(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Qd=25;function $d(e,t){let n=bd(e),r=xd(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Md();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=qd(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Qd&&(a-=o)}else l<=Qd&&(a+=l);return{width:a,height:o,x:s,y:c}}function ef(e,t){let n=Kd(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=wd(e)?Hd(e):Pu(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function tf(e,t,n){let r;if(t===`viewport`)r=$d(e,n);else if(t===`document`)r=Zd(xd(e));else if(Cd(t))r=ef(t,n);else{let n=Wd(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return nd(r)}function nf(e,t){let n=Id(e);return n===t||!Cd(n)||Nd(n)?!1:Pd(n).position===`fixed`||nf(n,t)}function rf(e,t){let n=t.get(e);if(n)return n;let r=Rd(e,[],!1).filter(e=>Cd(e)&&yd(e)!==`body`),i=null,a=Pd(e).position===`fixed`,o=a?Id(e):e;for(;Cd(o)&&!Nd(o);){let t=Pd(o),n=Ad(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||Ed(o)&&!n&&nf(e,o))?r=r.filter(e=>e!==o):i=t,o=Id(o)}return t.set(e,r),r}function af(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Dd(t)?[]:rf(t,this._c):[].concat(n),r],o=tf(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e{o(!1,1e-7)},1e3)}n===1&&!mf(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function gf(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Vd(e),u=i||a?[...l?Rd(l):[],...t?Rd(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?hf(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Kd(e):null;c&&g();function g(){let t=Kd(e);h&&!mf(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var _f=md,vf=hd,yf=cd,bf=_d,xf=dd,Sf=sd,Cf=gd,wf=(e,t,n)=>{let r=new Map,i={platform:pf,...n},a={...i.platform,_c:r};return od(e,t,{...i,platform:a})},Tf=typeof document<`u`?_.useLayoutEffect:function(){};function Ef(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Ef(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Ef(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Df(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Of(e,t){let n=Df(e);return Math.round(t*n)/n}function kf(e){let t=_.useRef(e);return Tf(()=>{t.current=e}),t}function Af(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=_.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=_.useState(r);Ef(f,r)||p(r);let[m,h]=_.useState(null),[g,y]=_.useState(null),b=_.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=_.useCallback(e=>{e!==T.current&&(T.current=e,y(e))},[]),S=a||m,C=o||g,w=_.useRef(null),T=_.useRef(null),E=_.useRef(u),D=c!=null,O=kf(c),k=kf(i),A=kf(l),j=_.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),wf(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!Ef(E.current,t)&&(E.current=t,v.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);Tf(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=_.useRef(!1);Tf(()=>(M.current=!0,()=>{M.current=!1}),[]),Tf(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=_.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=_.useMemo(()=>({reference:S,floating:C}),[S,C]),F=_.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=Of(P.floating,u.x),r=Of(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Df(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return _.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var jf=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Sf({element:r.current,padding:i}).fn(n):r?Sf({element:r,padding:i}).fn(n):{}}}},Mf=(e,t)=>{let n=_f(e);return{name:n.name,fn:n.fn,options:[e,t]}},Nf=(e,t)=>{let n=vf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Pf=(e,t)=>({fn:Cf(e).fn,options:[e,t]}),Ff=(e,t)=>{let n=yf(e);return{name:n.name,fn:n.fn,options:[e,t]}},If=(e,t)=>{let n=bf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Lf=(e,t)=>{let n=xf(e);return{name:n.name,fn:n.fn,options:[e,t]}},Rf=(e,t)=>{let n=jf(e);return{name:n.name,fn:n.fn,options:[e,t]}},zf=`Arrow`,Bf=_.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(U.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});Bf.displayName=zf;var Vf=Bf;function Hf(e){let[t,n]=_.useState(void 0);return ti(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var Uf=`Popper`,[Wf,Gf]=Sr(Uf),[Kf,qf]=Wf(Uf),Jf=e=>{let{__scopePopper:t,children:n}=e,[r,i]=_.useState(null);return(0,V.jsx)(Kf,{scope:t,anchor:r,onAnchorChange:i,children:n})};Jf.displayName=Uf;var Yf=`PopperAnchor`,Xf=_.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=qf(Yf,n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return _.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,V.jsx)(U.div,{...i,ref:s})});Xf.displayName=Yf;var Zf=`PopperContent`,[cee,lee]=Wf(Zf),Qf=_.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=qf(Zf,n),[v,y]=_.useState(null),b=br(t,e=>y(e)),[x,S]=_.useState(null),C=Hf(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(dee),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=Af({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>gf(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[Mf({mainAxis:i+T,alignmentAxis:o}),c&&Nf({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Pf():void 0,...A}),c&&Ff({...A}),If({...A,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&Rf({element:x,padding:s}),fee({arrowWidth:w,arrowHeight:T}),f&&Lf({strategy:`referenceHidden`,...A})]}),[I,ee]=tp(N),te=Rr(m);ti(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[ae,oe]=_.useState();return ti(()=>{v&&oe(window.getComputedStyle(v).zIndex)},[v]),(0,V.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:ae,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(cee,{scope:n,placedSide:I,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,V.jsx)(U.div,{"data-side":I,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Qf.displayName=Zf;var $f=`PopperArrow`,uee={top:`bottom`,right:`left`,bottom:`top`,left:`right`},ep=_.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=lee($f,n),a=uee[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(Vf,{...r,ref:t,style:{...r.style,display:`block`}})})});ep.displayName=$f;function dee(e){return e!==null}var fee=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=tp(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function tp(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var np=Jf,rp=Xf,ip=Qf,ap=ep,op=Symbol(`radix.slottable`);function sp(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=op,t}var[cp,pee]=Sr(`Tooltip`,[Gf]),lp=Gf(),up=`TooltipProvider`,dp=700,fp=`tooltip.open`,[pp,mp]=cp(up),hp=e=>{let{__scopeTooltip:t,delayDuration:n=dp,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=_.useRef(!0),s=_.useRef(!1),c=_.useRef(0);return _.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)(pp,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:_.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:_.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:_.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};hp.displayName=up;var gp=`Tooltip`,[_p,vp]=cp(gp),yp=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=mp(gp,e.__scopeTooltip),l=lp(t),[u,d]=_.useState(null),f=Ws(),p=_.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=_.useRef(!1),[v,y]=ui({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(fp))):c.onClose(),a?.(e)},caller:gp}),b=_.useMemo(()=>v?g.current?`delayed-open`:`instant-open`:`closed`,[v]),x=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=_.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=_.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return _.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(np,{...l,children:(0,V.jsx)(_p,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:_.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:_.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};yp.displayName=gp;var bp=`TooltipTrigger`,xp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=vp(bp,n),a=mp(bp,n),o=lp(n),s=br(t,_.useRef(null),i.onTriggerChange),c=_.useRef(!1),l=_.useRef(!1),u=_.useCallback(()=>c.current=!1,[]);return _.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(rp,{asChild:!0,...o,children:(0,V.jsx)(U.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:H(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:H(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:H(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:H(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:H(e.onBlur,i.onClose),onClick:H(e.onClick,i.onClose)})})});xp.displayName=bp;var Sp=`TooltipPortal`,[Cp,wp]=cp(Sp,{forceMount:void 0}),Tp=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=vp(Sp,t);return(0,V.jsx)(Cp,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};Tp.displayName=Sp;var Ep=`TooltipContent`,Dp=_.forwardRef((e,t)=>{let n=wp(Ep,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=vp(Ep,e.__scopeTooltip);return(0,V.jsx)(ai,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(Mp,{side:i,...a,ref:t}):(0,V.jsx)(Op,{side:i,...a,ref:t})})}),Op=_.forwardRef((e,t)=>{let n=vp(Ep,e.__scopeTooltip),r=mp(Ep,e.__scopeTooltip),i=_.useRef(null),a=br(t,i),[o,s]=_.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=_.useCallback(()=>{s(null),d(!1)},[d]),p=_.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ip(r,Fp(r,n.getBoundingClientRect())),a=Lp(t.getBoundingClientRect());s(zp([...i,...a])),d(!0)},[d]);return _.useEffect(()=>()=>f(),[f]),_.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),_.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!Rp(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(Mp,{...e,ref:a})}),[kp,Ap]=cp(gp,{isInside:!1}),jp=sp(`TooltipContent`),Mp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=vp(Ep,n),l=lp(n),{onClose:u}=c;return _.useEffect(()=>(document.addEventListener(fp,u),()=>document.removeEventListener(fp,u)),[u]),_.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(ip,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(jp,{children:r}),(0,V.jsx)(kp,{scope:n,isInside:!0,children:(0,V.jsx)(gi,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});Dp.displayName=Ep;var Np=`TooltipArrow`,Pp=_.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=lp(n);return Ap(Np,n).isInside?null:(0,V.jsx)(ap,{...i,...r,ref:t})});Pp.displayName=Np;function Fp(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Ip(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Lp(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function Rp(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function zp(e){let t=e.slice();return t.sort((e,t)=>e.xt.x?1:e.yt.y)),Bp(t)}function Bp(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Vp=yp,Hp=xp,Up=Dp,Wp=Vp,Gp=Hp,Kp=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(Up,{ref:r,sideOffset:t,className:W(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n}));Kp.displayName=Up.displayName;function qp(e){let t=Jp(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(Xp);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function Jp(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=Qp(n),i=Zp(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Yp=Symbol(`radix.slottable`);function Xp(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===Yp}function Zp(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function Qp(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var $p=`Popover`,[em,mee]=Sr($p,[Gf]),tm=Gf(),[hee,nm]=em($p),rm=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=tm(t),c=_.useRef(null),[l,u]=_.useState(!1),[d,f]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:$p});return(0,V.jsx)(np,{...s,children:(0,V.jsx)(hee,{scope:t,contentId:Ws(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:_.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:_.useCallback(()=>u(!0),[]),onCustomAnchorRemove:_.useCallback(()=>u(!1),[]),modal:o,children:n})})};rm.displayName=$p;var im=`PopoverAnchor`,gee=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(im,n),a=tm(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return _.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(rp,{...a,...r,ref:t})});gee.displayName=im;var am=`PopoverTrigger`,om=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(am,n),a=tm(n),o=br(t,i.triggerRef),s=(0,V.jsx)(U.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.contentId,"data-state":pm(i.open),...r,ref:o,onClick:H(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(rp,{asChild:!0,...a,children:s})});om.displayName=am;var sm=`PopoverPortal`,[_ee,vee]=em(sm,{forceMount:void 0}),cm=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=nm(sm,t);return(0,V.jsx)(_ee,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};cm.displayName=sm;var lm=`PopoverContent`,um=_.forwardRef((e,t)=>{let n=vee(lm,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=nm(lm,e.__scopePopover);return(0,V.jsx)(ai,{present:r||a.open,children:a.modal?(0,V.jsx)(bee,{...i,ref:t}):(0,V.jsx)(xee,{...i,ref:t})})});um.displayName=lm;var yee=qp(`PopoverContent.RemoveScroll`),bee=_.forwardRef((e,t)=>{let n=nm(lm,e.__scopePopover),r=_.useRef(null),i=br(t,r),a=_.useRef(!1);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(_l,{as:yee,allowPinchZoom:!0,children:(0,V.jsx)(dm,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:H(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;a.current=t.button===2||n},{checkForDefaultPrevented:!1}),onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),xee=_.forwardRef((e,t)=>{let n=nm(lm,e.__scopePopover),r=_.useRef(!1),i=_.useRef(!1);return(0,V.jsx)(dm,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),dm=_.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=nm(lm,n),p=tm(n);return cc(),(0,V.jsx)(Ys,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),children:(0,V.jsx)(ip,{"data-state":pm(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),fm=`PopoverClose`,See=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=nm(fm,n);return(0,V.jsx)(U.button,{type:`button`,...r,ref:t,onClick:H(e.onClick,()=>i.onOpenChange(!1))})});See.displayName=fm;var Cee=`PopoverArrow`,wee=_.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=tm(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});wee.displayName=Cee;function pm(e){return e?`open`:`closed`}var Tee=rm,Eee=om,mm=cm,hm=um,gm=Tee,_m=Eee,vm=_.forwardRef(({className:e,align:t=`center`,sideOffset:n=4,...r},i)=>(0,V.jsx)(mm,{children:(0,V.jsx)(hm,{ref:i,align:t,sideOffset:n,className:W(`z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...r})}));vm.displayName=hm.displayName;var ym=1,bm=.9,xm=.8,Sm=.17,Cm=.1,wm=.999,Tm=.9999,Em=.99,Dm=/[\\\/_+.#"@\[\(\{&]/,Om=/[\\\/_+.#"@\[\(\{&]/g,km=/[\s-]/,Am=/[\s-]/g;function jm(e,t,n,r,i,a,o){if(a===t.length)return i===e.length?ym:Em;var s=`${i},${a}`;if(o[s]!==void 0)return o[s];for(var c=r.charAt(a),l=n.indexOf(c,i),u=0,d,f,p,m;l>=0;)d=jm(e,t,n,r,l+1,a+1,o),d>u&&(l===i?d*=ym:Dm.test(e.charAt(l-1))?(d*=xm,p=e.slice(i,l-1).match(Om),p&&i>0&&(d*=wm**+p.length)):km.test(e.charAt(l-1))?(d*=bm,m=e.slice(i,l-1).match(Am),m&&i>0&&(d*=wm**+m.length)):(d*=Sm,i>0&&(d*=wm**+(l-i))),e.charAt(l)!==t.charAt(a)&&(d*=Tm)),(dd&&(d=f*Cm)),d>u&&(u=d),l=n.indexOf(c,l+1);return o[s]=u,u}function Mm(e){return e.toLowerCase().replace(Am,` `)}function Nm(e,t,n){return e=n&&n.length>0?`${e+` `+n.join(` `)}`:e,jm(e,t,Mm(e),Mm(t),0,0,{})}var Pm=`[cmdk-group=""]`,Fm=`[cmdk-group-items=""]`,Im=`[cmdk-group-heading=""]`,Lm=`[cmdk-item=""]`,Rm=`${Lm}:not([aria-disabled="true"])`,zm=`cmdk-item-select`,Bm=`data-value`,Vm=(e,t,n)=>Nm(e,t,n),Hm=_.createContext(void 0),Um=()=>_.useContext(Hm),Wm=_.createContext(void 0),Gm=()=>_.useContext(Wm),Km=_.createContext(void 0),qm=_.forwardRef((e,t)=>{let n=sh(()=>({search:``,value:e.value??e.defaultValue??``,selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}})),r=sh(()=>new Set),i=sh(()=>new Map),a=sh(()=>new Map),o=sh(()=>new Set),s=ah(e),{label:c,children:l,value:u,onValueChange:d,filter:f,shouldFilter:p,loop:m,disablePointerSelection:h=!1,vimBindings:g=!0,...v}=e,y=Ws(),b=Ws(),x=Ws(),S=_.useRef(null),C=uh();oh(()=>{if(u!==void 0){let e=u.trim();n.current.value=e,w.emit()}},[u]),oh(()=>{C(6,A)},[]);let w=_.useMemo(()=>({subscribe:e=>(o.current.add(e),()=>o.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var i,a,o;if(!Object.is(n.current[e],t)){if(n.current[e]=t,e===`search`)k(),D(),C(1,O);else if(e===`value`){if(document.activeElement.hasAttribute(`cmdk-input`)||document.activeElement.hasAttribute(`cmdk-root`)){let e=document.getElementById(x);e?e.focus():(i=document.getElementById(y))==null||i.focus()}if(C(7,()=>{n.current.selectedItemId=j()?.id,w.emit()}),r||C(5,A),s.current?.value!==void 0){let e=t??``;(o=(a=s.current).onValueChange)==null||o.call(a,e);return}}w.emit()}},emit:()=>{o.current.forEach(e=>e())}}),[]),T=_.useMemo(()=>({value:(e,t,r)=>{t!==a.current.get(e)?.value&&(a.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,E(t,r)),C(2,()=>{D(),w.emit()}))},item:(e,t)=>(r.current.add(e),t&&(i.current.has(t)?i.current.get(t).add(e):i.current.set(t,new Set([e]))),C(3,()=>{k(),D(),n.current.value||O(),w.emit()}),()=>{a.current.delete(e),r.current.delete(e),n.current.filtered.items.delete(e);let t=j();C(4,()=>{k(),t?.getAttribute(`id`)===e&&O(),w.emit()})}),group:e=>(i.current.has(e)||i.current.set(e,new Set),()=>{a.current.delete(e),i.current.delete(e)}),filter:()=>s.current.shouldFilter,label:c||e[`aria-label`],getDisablePointerSelection:()=>s.current.disablePointerSelection,listId:y,inputId:x,labelId:b,listInnerRef:S}),[]);function E(e,t){let r=s.current?.filter??Vm;return e?r(e,n.current.search,t):0}function D(){if(!n.current.search||s.current.shouldFilter===!1)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(n=>{let r=i.current.get(n),a=0;r.forEach(t=>{let n=e.get(t);a=Math.max(n,a)}),t.push([n,a])});let r=S.current;M().sort((t,n)=>{let r=t.getAttribute(`id`),i=n.getAttribute(`id`);return(e.get(i)??0)-(e.get(r)??0)}).forEach(e=>{let t=e.closest(Fm);t?t.appendChild(e.parentElement===t?e:e.closest(`${Fm} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${Fm} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{let t=S.current?.querySelector(`${Pm}[${Bm}="${encodeURIComponent(e[0])}"]`);t?.parentElement.appendChild(t)})}function O(){let e=M().find(e=>e.getAttribute(`aria-disabled`)!==`true`)?.getAttribute(Bm);w.setState(`value`,e||void 0)}function k(){if(!n.current.search||s.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let e=0;for(let t of r.current){let r=E(a.current.get(t)?.value??``,a.current.get(t)?.keywords??[]);n.current.filtered.items.set(t,r),r>0&&e++}for(let[e,t]of i.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=e}function A(){var e;let t=j();t&&(t.parentElement?.firstChild===t&&((e=t.closest(Pm)?.querySelector(Im))==null||e.scrollIntoView({block:`nearest`})),t.scrollIntoView({block:`nearest`}))}function j(){return S.current?.querySelector(`${Lm}[aria-selected="true"]`)}function M(){return Array.from(S.current?.querySelectorAll(Rm)||[])}function N(e){let t=M()[e];t&&w.setState(`value`,t.getAttribute(Bm))}function P(e){var t;let n=j(),r=M(),i=r.findIndex(e=>e===n),a=r[i+e];(t=s.current)!=null&&t.loop&&(a=i+e<0?r[r.length-1]:i+e===r.length?r[0]:r[i+e]),a&&w.setState(`value`,a.getAttribute(Bm))}function F(e){let t=j()?.closest(Pm),n;for(;t&&!n;)t=e>0?rh(t,Pm):ih(t,Pm),n=t?.querySelector(Rm);n?w.setState(`value`,n.getAttribute(Bm)):P(e)}let I=()=>N(M().length-1),ee=e=>{e.preventDefault(),e.metaKey?I():e.altKey?F(1):P(1)},te=e=>{e.preventDefault(),e.metaKey?N(0):e.altKey?F(-1):P(-1)};return _.createElement(U.div,{ref:t,tabIndex:-1,...v,"cmdk-root":``,onKeyDown:e=>{var t;(t=v.onKeyDown)==null||t.call(v,e);let n=e.nativeEvent.isComposing||e.keyCode===229;if(!(e.defaultPrevented||n))switch(e.key){case`n`:case`j`:g&&e.ctrlKey&&ee(e);break;case`ArrowDown`:ee(e);break;case`p`:case`k`:g&&e.ctrlKey&&te(e);break;case`ArrowUp`:te(e);break;case`Home`:e.preventDefault(),N(0);break;case`End`:e.preventDefault(),I();break;case`Enter`:{e.preventDefault();let t=j();if(t){let e=new Event(zm);t.dispatchEvent(e)}}}}},_.createElement(`label`,{"cmdk-label":``,htmlFor:T.inputId,id:T.labelId,style:ph},c),fh(e,e=>_.createElement(Wm.Provider,{value:w},_.createElement(Hm.Provider,{value:T},e))))}),Jm=_.forwardRef((e,t)=>{let n=Ws(),r=_.useRef(null),i=_.useContext(Km),a=Um(),o=ah(e),s=o.current?.forceMount??i?.forceMount;oh(()=>{if(!s)return a.item(n,i?.id)},[s]);let c=lh(n,r,[e.value,e.children,r],e.keywords),l=Gm(),u=ch(e=>e.value&&e.value===c.current),d=ch(e=>s||a.filter()===!1?!0:e.search?e.filtered.items.get(n)>0:!0);_.useEffect(()=>{let t=r.current;if(!(!t||e.disabled))return t.addEventListener(zm,f),()=>t.removeEventListener(zm,f)},[d,e.onSelect,e.disabled]);function f(){var e,t;p(),(t=(e=o.current).onSelect)==null||t.call(e,c.current)}function p(){l.setState(`value`,c.current,!0)}if(!d)return null;let{disabled:m,value:h,onSelect:g,forceMount:v,keywords:y,...b}=e;return _.createElement(U.div,{ref:yr(r,t),...b,id:n,"cmdk-item":``,role:`option`,"aria-disabled":!!m,"aria-selected":!!u,"data-disabled":!!m,"data-selected":!!u,onPointerMove:m||a.getDisablePointerSelection()?void 0:p,onClick:m?void 0:f},e.children)}),Ym=_.forwardRef((e,t)=>{let{heading:n,children:r,forceMount:i,...a}=e,o=Ws(),s=_.useRef(null),c=_.useRef(null),l=Ws(),u=Um(),d=ch(e=>i||u.filter()===!1?!0:e.search?e.filtered.groups.has(o):!0);oh(()=>u.group(o),[]),lh(o,s,[e.value,e.heading,c]);let f=_.useMemo(()=>({id:o,forceMount:i}),[i]);return _.createElement(U.div,{ref:yr(s,t),...a,"cmdk-group":``,role:`presentation`,hidden:d?void 0:!0},n&&_.createElement(`div`,{ref:c,"cmdk-group-heading":``,"aria-hidden":!0,id:l},n),fh(e,e=>_.createElement(`div`,{"cmdk-group-items":``,role:`group`,"aria-labelledby":n?l:void 0},_.createElement(Km.Provider,{value:f},e))))}),Xm=_.forwardRef((e,t)=>{let{alwaysRender:n,...r}=e,i=_.useRef(null),a=ch(e=>!e.search);return!n&&!a?null:_.createElement(U.div,{ref:yr(i,t),...r,"cmdk-separator":``,role:`separator`})}),Zm=_.forwardRef((e,t)=>{let{onValueChange:n,...r}=e,i=e.value!=null,a=Gm(),o=ch(e=>e.search),s=ch(e=>e.selectedItemId),c=Um();return _.useEffect(()=>{e.value!=null&&a.setState(`search`,e.value)},[e.value]),_.createElement(U.input,{ref:t,...r,"cmdk-input":``,autoComplete:`off`,autoCorrect:`off`,spellCheck:!1,"aria-autocomplete":`list`,role:`combobox`,"aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":s,id:c.inputId,type:`text`,value:i?e.value:o,onChange:e=>{i||a.setState(`search`,e.target.value),n?.(e.target.value)}})}),Qm=_.forwardRef((e,t)=>{let{children:n,label:r=`Suggestions`,...i}=e,a=_.useRef(null),o=_.useRef(null),s=ch(e=>e.selectedItemId),c=Um();return _.useEffect(()=>{if(o.current&&a.current){let e=o.current,t=a.current,n,r=new ResizeObserver(()=>{n=requestAnimationFrame(()=>{let n=e.offsetHeight;t.style.setProperty(`--cmdk-list-height`,n.toFixed(1)+`px`)})});return r.observe(e),()=>{cancelAnimationFrame(n),r.unobserve(e)}}},[]),_.createElement(U.div,{ref:yr(a,t),...i,"cmdk-list":``,role:`listbox`,tabIndex:-1,"aria-activedescendant":s,"aria-label":r,id:c.listId},fh(e,e=>_.createElement(`div`,{ref:yr(o,c.listInnerRef),"cmdk-list-sizer":``},e)))}),$m=_.forwardRef((e,t)=>{let{open:n,onOpenChange:r,overlayClassName:i,contentClassName:a,container:o,...s}=e;return _.createElement(pu,{open:n,onOpenChange:r},_.createElement(hu,{container:o},_.createElement(gu,{"cmdk-overlay":``,className:i}),_.createElement(_u,{"aria-label":e.label,"cmdk-dialog":``,className:a},_.createElement(qm,{ref:t,...s}))))}),eh=_.forwardRef((e,t)=>ch(e=>e.filtered.count===0)?_.createElement(U.div,{ref:t,...e,"cmdk-empty":``,role:`presentation`}):null),th=_.forwardRef((e,t)=>{let{progress:n,children:r,label:i=`Loading...`,...a}=e;return _.createElement(U.div,{ref:t,...a,"cmdk-loading":``,role:`progressbar`,"aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":i},fh(e,e=>_.createElement(`div`,{"aria-hidden":!0},e)))}),nh=Object.assign(qm,{List:Qm,Item:Jm,Input:Zm,Group:Ym,Separator:Xm,Dialog:$m,Empty:eh,Loading:th});function rh(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function ih(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ah(e){let t=_.useRef(e);return oh(()=>{t.current=e}),t}var oh=typeof window>`u`?_.useEffect:_.useLayoutEffect;function sh(e){let t=_.useRef();return t.current===void 0&&(t.current=e()),t}function ch(e){let t=Gm(),n=()=>e(t.snapshot());return _.useSyncExternalStore(t.subscribe,n,n)}function lh(e,t,n,r=[]){let i=_.useRef(),a=Um();return oh(()=>{var o;let s=(()=>{for(let e of n){if(typeof e==`string`)return e.trim();if(typeof e==`object`&&`current`in e)return e.current?e.current.textContent?.trim():i.current}})(),c=r.map(e=>e.trim());a.value(e,s,c),(o=t.current)==null||o.setAttribute(Bm,s),i.current=s}),i}var uh=()=>{let[e,t]=_.useState(),n=sh(()=>new Map);return oh(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function dh(e){let t=e.type;return typeof t==`function`?t(e.props):`render`in t?t.render(e.props):e}function fh({asChild:e,children:t},n){return e&&_.isValidElement(t)?_.cloneElement(dh(t),{ref:t.ref},n(t.props.children)):n(t)}var ph={position:`absolute`,width:`1px`,height:`1px`,padding:`0`,margin:`-1px`,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,borderWidth:`0`},mh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh,{ref:n,className:W(`flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground`,e),...t}));mh.displayName=nh.displayName;var hh=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(`div`,{className:`flex items-center border-b px-3`,"cmdk-input-wrapper":``,children:[(0,V.jsx)(eo,{className:`mr-2 h-4 w-4 shrink-0 text-slate-400`}),(0,V.jsx)(nh.Input,{ref:n,className:W(`flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50`,e),...t})]}));hh.displayName=nh.Input.displayName;var gh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.List,{ref:n,className:W(`max-h-[300px] overflow-y-auto overflow-x-hidden`,e),...t}));gh.displayName=nh.List.displayName;var _h=_.forwardRef((e,t)=>(0,V.jsx)(nh.Empty,{ref:t,className:`py-6 text-center text-sm`,...e}));_h.displayName=nh.Empty.displayName;var vh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Group,{ref:n,className:W(`overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground`,e),...t}));vh.displayName=nh.Group.displayName;var yh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Separator,{ref:n,className:W(`-mx-1 h-px bg-border`,e),...t}));yh.displayName=nh.Separator.displayName;var bh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(nh.Item,{ref:n,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50`,e),...t}));bh.displayName=nh.Item.displayName;var xh=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t});xh.displayName=`CommandShortcut`;var Sh=({selectedName:e,availableNames:t,onSelect:n,onCreateNew:r,isLoading:i})=>{let[a,o]=(0,_.useState)(!1),[s,c]=(0,_.useState)(``),l=s.trim(),u=t.some(e=>e.toLowerCase()===l.toLowerCase()),d=l.length>0&&!u,f=!d,p=u?`Already exists`:l===``?`Create new robot…`:`Create "${l}"`,m=()=>{c(``),o(!1)},h=e=>{n(e),m()},g=async()=>{d&&await r(l)&&m()};return(0,V.jsxs)(gm,{open:a,onOpenChange:o,children:[(0,V.jsx)(_m,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":a,disabled:i,className:`w-full justify-between bg-gray-900 border-gray-700 text-white hover:bg-gray-700 hover:text-white font-normal`,children:[(0,V.jsx)(`span`,{className:W(`truncate`,e?``:`text-gray-400`),children:i?`Loading...`:e??`Select a robot or type a new name`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(vm,{className:`p-0 bg-gray-800 border-gray-700 text-white`,style:{width:`var(--radix-popover-trigger-width)`},align:`start`,children:(0,V.jsxs)(mh,{className:`bg-gray-800`,children:[(0,V.jsx)(hh,{placeholder:`Search or type new name...`,value:s,onValueChange:c,onKeyDown:e=>{e.key===`Enter`&&d&&(e.preventDefault(),g())},className:`text-white`}),(0,V.jsxs)(gh,{children:[t.length===0&&(0,V.jsx)(_h,{className:`py-4 text-sm text-gray-400 text-center`,children:`No robots yet. Type a name to create one.`}),t.length>0&&(0,V.jsx)(vh,{heading:`Existing`,children:t.map(t=>(0,V.jsxs)(bh,{value:t,onSelect:()=>h(t),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,e===t?`opacity-100`:`opacity-0`)}),t]},t))})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:g,disabled:f,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),p]})]})})]})},Ch=({robot:e,selectedName:t,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:o,onTeleop:s,onDelete:c})=>{let[l,u]=(0,_.useState)(!1),d=e?e.is_clean?`Ready`:`Needs configuration`:null,f=!e||!e.is_clean;return(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2 relative`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex-1 min-w-0`,children:(0,V.jsx)(Sh,{selectedName:t,availableNames:n,onSelect:i,onCreateNew:a,isLoading:r})}),d&&(0,V.jsx)(`p`,{className:`text-xs truncate shrink-0 ${e.is_clean?`text-green-400`:`text-amber-400`}`,children:d}),e&&(0,V.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,children:[(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-gray-300 hover:text-white`,onClick:()=>o(e.name),"aria-label":`Configure`,children:(0,V.jsx)(to,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Configure (calibrate)`})]}),(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(G,{size:`icon`,variant:`ghost`,className:`h-8 w-8 text-red-400 hover:text-red-300 hover:bg-red-900/20`,onClick:()=>u(!0),"aria-label":`Delete robot`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})}),(0,V.jsx)(Kp,{children:`Delete robot config`})]})]})]}),e&&(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`div`,{className:`w-full`,children:(0,V.jsx)(G,{onClick:()=>s(e),disabled:f,className:`w-full ${f?`bg-red-500/30 hover:bg-red-500/30 text-red-200 cursor-not-allowed`:`bg-yellow-500 hover:bg-yellow-600 text-white`}`,children:`Teleoperation`})})}),f&&(0,V.jsx)(Kp,{children:`Configure the robot first.`})]}),e&&(0,V.jsx)(xu,{open:l,onOpenChange:u,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{children:`Delete robot config?`}),(0,V.jsx)(Ou,{className:`text-gray-400`,children:`This deletes the robot config file from disk. Calibration files are not removed. This cannot be undone.`})]}),(0,V.jsxs)(Eu,{className:`flex gap-2 justify-end`,children:[(0,V.jsx)(G,{variant:`outline`,className:`border-gray-600 text-gray-300`,onClick:()=>u(!1),children:`Cancel`}),(0,V.jsx)(G,{className:`bg-red-500 hover:bg-red-600 text-white`,onClick:async()=>{u(!1),await c(e.name)},children:`Delete`})]})]})})]})},wh=({selectedName:e,selectedRecord:t,availableNames:n,isLoading:r,selectRobot:i,createRobot:a,deleteRobot:o})=>{let s=Re(),{baseUrl:c,fetchWithHeaders:l}=Rs(),{toast:u}=_r();return(0,V.jsx)(Ch,{robot:t,selectedName:e,availableNames:n,isLoading:r,onSelect:i,onCreateNew:a,onConfigure:e=>{s(`/calibration`,{state:{robot_name:e}})},onTeleop:async e=>{try{let t=await l(`${c}/move-arm`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config})}),n=await t.json();t.ok&&n.success?(u({title:`Teleoperation Started`,description:n.message||`Started teleoperation for ${e.name}.`}),s(`/teleoperation`)):u({title:`Error Starting Teleoperation`,description:n.message||`Failed to start.`,variant:`destructive`})}catch{u({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},onDelete:o})},Th=_.forwardRef(({className:e,type:t,...n},r)=>(0,V.jsx)(`input`,{type:t,className:W(`flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,e),ref:r,...n}));Th.displayName=`Input`;var Eh=_.forwardRef(({value:e,onChange:t,integer:n=!0,className:r,...i},a)=>{let[o,s]=_.useState(e==null?``:String(e)),c=_.useRef(e);return _.useEffect(()=>{e!==c.current&&(c.current=e,s(e==null?``:String(e)))},[e]),(0,V.jsx)(Th,{ref:a,type:`number`,inputMode:n?`numeric`:`decimal`,value:o,onChange:e=>{let r=e.target.value;if(s(r),r===``){t(void 0);return}let i=n?parseInt(r,10):parseFloat(r);Number.isFinite(i)&&t(i)},className:W(`[appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:m-0 [&::-webkit-outer-spin-button]:m-0`,r),...i})});Eh.displayName=`NumberInput`;var Dh=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),Oh=`Label`,kh=_.forwardRef((e,t)=>(0,V.jsx)(Dh.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));kh.displayName=Oh;var Ah=kh,jh=ga(`text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70`),q=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Ah,{ref:n,className:W(jh(),e),...t}));q.displayName=Ah.displayName;function Mh(e){let t=_.useRef({value:e,previous:e});return _.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Nh=`Checkbox`,[Ph,Dee]=Sr(Nh),[Fh,Ih]=Ph(Nh);function Lh(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=ui({prop:n,defaultProp:i??!1,onChange:c,caller:Nh}),[m,h]=_.useState(null),[g,v]=_.useState(null),y=_.useRef(!1),b=m?!!o||!!m.closest(`form`):!0,x={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:y,required:l,defaultChecked:Kh(i)?!1:i,isFormControl:b,bubbleInput:g,setBubbleInput:v};return(0,V.jsx)(Fh,{scope:t,...x,children:Gh(d)?d(x):r})}var Rh=`CheckboxTrigger`,zh=_.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i)=>{let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,isFormControl:p,bubbleInput:m}=Ih(Rh,e),h=br(i,u),g=_.useRef(c);return _.useEffect(()=>{let e=a?.form;if(e){let t=()=>d(g.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,V.jsx)(U.button,{type:`button`,role:`checkbox`,"aria-checked":Kh(c)?`mixed`:c,"aria-required":l,"data-state":qh(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:h,onKeyDown:H(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:H(n,e=>{d(e=>Kh(e)?!0:!e),m&&p&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})});zh.displayName=Rh;var Bh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,V.jsx)(Lh,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(zh,{...d,ref:t,__scopeCheckbox:n}),e&&(0,V.jsx)(Wh,{__scopeCheckbox:n})]})})});Bh.displayName=Nh;var Vh=`CheckboxIndicator`,Hh=_.forwardRef((e,t)=>{let{__scopeCheckbox:n,forceMount:r,...i}=e,a=Ih(Vh,n);return(0,V.jsx)(ai,{present:r||Kh(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{"data-state":qh(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})});Hh.displayName=Vh;var Uh=`CheckboxBubbleInput`,Wh=_.forwardRef(({__scopeCheckbox:e,...t},n)=>{let{control:r,hasConsumerStoppedPropagationRef:i,checked:a,defaultChecked:o,required:s,disabled:c,name:l,value:u,form:d,bubbleInput:f,setBubbleInput:p}=Ih(Uh,e),m=br(n,p),h=Mh(a),g=Hf(r);_.useEffect(()=>{let e=f;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!i.current;if(h!==a&&n){let t=new Event(`click`,{bubbles:r});e.indeterminate=Kh(a),n.call(e,Kh(a)?!1:a),e.dispatchEvent(t)}},[f,h,a,i]);let v=_.useRef(Kh(a)?!1:a);return(0,V.jsx)(U.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:o??v.current,required:s,disabled:c,name:l,value:u,form:d,...t,tabIndex:-1,ref:m,style:{...t.style,...g,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});Wh.displayName=Uh;function Gh(e){return typeof e==`function`}function Kh(e){return e===`indeterminate`}function qh(e){return Kh(e)?`indeterminate`:e?`checked`:`unchecked`}var Jh=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Bh,{ref:n,className:W(`peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground`,e),...t,children:(0,V.jsx)(Hh,{className:W(`flex items-center justify-center text-current`),children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}));Jh.displayName=Bh.displayName;var Yh=`Collapsible`,[Xh,Oee]=Sr(Yh),[Zh,Qh]=Xh(Yh),$h=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,open:r,defaultOpen:i,disabled:a,onOpenChange:o,...s}=e,[c,l]=ui({prop:r,defaultProp:i??!1,onChange:o,caller:Yh});return(0,V.jsx)(Zh,{scope:n,disabled:a,contentId:Ws(),open:c,onOpenToggle:_.useCallback(()=>l(e=>!e),[l]),children:(0,V.jsx)(U.div,{"data-state":ag(c),"data-disabled":a?``:void 0,...s,ref:t})})});$h.displayName=Yh;var eg=`CollapsibleTrigger`,tg=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,...r}=e,i=Qh(eg,n);return(0,V.jsx)(U.button,{type:`button`,"aria-controls":i.contentId,"aria-expanded":i.open||!1,"data-state":ag(i.open),"data-disabled":i.disabled?``:void 0,disabled:i.disabled,...r,ref:t,onClick:H(e.onClick,i.onOpenToggle)})});tg.displayName=eg;var ng=`CollapsibleContent`,rg=_.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=Qh(ng,e.__scopeCollapsible);return(0,V.jsx)(ai,{present:n||i.open,children:({present:e})=>(0,V.jsx)(ig,{...r,ref:t,present:e})})});rg.displayName=ng;var ig=_.forwardRef((e,t)=>{let{__scopeCollapsible:n,present:r,children:i,...a}=e,o=Qh(ng,n),[s,c]=_.useState(r),l=_.useRef(null),u=br(t,l),d=_.useRef(0),f=d.current,p=_.useRef(0),m=p.current,h=o.open||s,g=_.useRef(h),v=_.useRef(void 0);return _.useEffect(()=>{let e=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(e)},[]),ti(()=>{let e=l.current;if(e){v.current=v.current||{transitionDuration:e.style.transitionDuration,animationName:e.style.animationName},e.style.transitionDuration=`0s`,e.style.animationName=`none`;let t=e.getBoundingClientRect();d.current=t.height,p.current=t.width,g.current||(e.style.transitionDuration=v.current.transitionDuration,e.style.animationName=v.current.animationName),c(r)}},[o.open,r]),(0,V.jsx)(U.div,{"data-state":ag(o.open),"data-disabled":o.disabled?``:void 0,id:o.contentId,hidden:!h,...a,ref:u,style:{"--radix-collapsible-content-height":f?`${f}px`:void 0,"--radix-collapsible-content-width":m?`${m}px`:void 0,...e.style},children:h&&i})});function ag(e){return e?`open`:`closed`}var og=$h,sg=tg,cg=rg,lg=ga(`relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground`,{variants:{variant:{default:`bg-background text-foreground`,destructive:`border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive`}},defaultVariants:{variant:`default`}}),ug=_.forwardRef(({className:e,variant:t,...n},r)=>(0,V.jsx)(`div`,{ref:r,role:`alert`,className:W(lg({variant:t}),e),...n}));ug.displayName=`Alert`;var dg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h5`,{ref:n,className:W(`mb-1 font-medium leading-none tracking-tight`,e),...t}));dg.displayName=`AlertTitle`;var fg=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`text-sm [&_p]:leading-relaxed`,e),...t}));fg.displayName=`AlertDescription`;function pg(e,[t,n]){return Math.min(n,Math.max(t,e))}var mg=_.createContext(void 0);function hg(e){let t=_.useContext(mg);return e||t||`ltr`}function gg(e){let t=_g(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(yg);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function _g(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=xg(n),i=bg(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var vg=Symbol(`radix.slottable`);function yg(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===vg}function bg(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function xg(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Sg=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Cg=[` `,`Enter`],wg=`Select`,[Tg,Eg,Dg]=Ar(wg),[Og,kee]=Sr(wg,[Dg,Gf]),kg=Gf(),[Ag,jg]=Og(wg),[Mg,Ng]=Og(wg),Pg=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=kg(t),[g,v]=_.useState(null),[y,b]=_.useState(null),[x,S]=_.useState(!1),C=hg(l),[w,T]=ui({prop:r,defaultProp:i??!1,onChange:a,caller:wg}),[E,D]=ui({prop:o,defaultProp:s,onChange:c,caller:wg}),O=_.useRef(null),k=g?m||!!g.closest(`form`):!0,[A,j]=_.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,V.jsx)(np,{...h,children:(0,V.jsxs)(Ag,{required:p,scope:t,trigger:g,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:Ws(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,V.jsx)(Tg.Provider,{scope:t,children:(0,V.jsx)(Mg,{scope:e.__scopeSelect,onNativeOptionAdd:_.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:_.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,V.jsxs)(k_,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,V.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Pg.displayName=wg;var Fg=`SelectTrigger`,Ig=_.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=kg(n),o=jg(Fg,n),s=o.disabled||r,c=br(t,o.onTriggerChange),l=Eg(n),u=_.useRef(`touch`),[d,f,p]=j_(e=>{let t=l().filter(e=>!e.disabled),n=M_(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,V.jsx)(rp,{asChild:!0,...a,children:(0,V.jsx)(U.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":A_(o.value)?``:void 0,...i,ref:c,onClick:H(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:H(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:H(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&Sg.includes(e.key)&&(m(),e.preventDefault())})})})});Ig.displayName=Fg;var Lg=`SelectValue`,Rg=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=jg(Lg,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=br(t,c.onValueNodeChange);return ti(()=>{l(u)},[l,u]),(0,V.jsx)(U.span,{...s,ref:d,style:{pointerEvents:`none`},children:A_(c.value)?(0,V.jsx)(V.Fragment,{children:o}):a})});Rg.displayName=Lg;var zg=`SelectIcon`,Bg=_.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,V.jsx)(U.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});Bg.displayName=zg;var Vg=`SelectPortal`,Hg=e=>(0,V.jsx)(ri,{asChild:!0,...e});Hg.displayName=Vg;var Ug=`SelectContent`,Wg=_.forwardRef((e,t)=>{let n=jg(Ug,e.__scopeSelect),[r,i]=_.useState();if(ti(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?v.createPortal((0,V.jsx)(Kg,{scope:e.__scopeSelect,children:(0,V.jsx)(Tg.Slot,{scope:e.__scopeSelect,children:(0,V.jsx)(`div`,{children:e.children})})}),t):null}return(0,V.jsx)(Xg,{...e,ref:t})});Wg.displayName=Ug;var Gg=10,[Kg,qg]=Og(Ug),Jg=`SelectContentImpl`,Yg=gg(`SelectContent.RemoveScroll`),Xg=_.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,...v}=e,y=jg(Ug,n),[b,x]=_.useState(null),[S,C]=_.useState(null),w=br(t,e=>x(e)),[T,E]=_.useState(null),[D,O]=_.useState(null),k=Eg(n),[A,j]=_.useState(!1),M=_.useRef(!1);_.useEffect(()=>{if(b)return El(b)},[b]),cc();let N=_.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=_.useCallback(()=>N([T,b]),[N,T,b]);_.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;_.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():b.contains(n.target)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),_.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[ee,te]=j_(e=>{let t=k().filter(e=>!e.disabled),n=M_(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),ne=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),re=_.useCallback(()=>b?.focus(),[b]),ie=_.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ae=r===`popper`?e_:Qg,oe=ae===e_?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,V.jsx)(Kg,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:ne,selectedItem:T,onItemLeave:re,itemTextRefCallback:ie,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:ee,children:(0,V.jsx)(_l,{as:Yg,allowPinchZoom:!0,children:(0,V.jsx)(Ys,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:H(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,V.jsx)(ae,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),...v,...oe,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,...v.style},onKeyDown:H(v.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&te(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Xg.displayName=Jg;var Zg=`SelectItemAlignedPosition`,Qg=_.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=jg(Ug,n),o=qg(Ug,n),[s,c]=_.useState(null),[l,u]=_.useState(null),d=br(t,e=>u(e)),f=Eg(n),p=_.useRef(!1),m=_.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:v,focusSelectedItem:y}=o,b=_.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&v){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=v.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Gg,d=pg(a,[Gg,Math.max(Gg,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Gg,d=pg(a,[Gg,Math.max(Gg,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Gg*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),_=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+_+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Gg,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+_+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Gg}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,v,a.dir,r]);ti(()=>b(),[b]);let[x,S]=_.useState();return ti(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,V.jsx)(t_,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:_.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,V.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,V.jsx)(U.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});Qg.displayName=Zg;var $g=`SelectPopperPosition`,e_=_.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Gg,...a}=e,o=kg(n);return(0,V.jsx)(ip,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});e_.displayName=$g;var[t_,n_]=Og(Ug,{}),r_=`SelectViewport`,i_=_.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=qg(r_,n),o=n_(r_,n),s=br(t,a.onViewportChange),c=_.useRef(0);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,V.jsx)(Tg.Slot,{scope:n,children:(0,V.jsx)(U.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:H(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Gg*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});i_.displayName=r_;var a_=`SelectGroup`,[o_,s_]=Og(a_),c_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ws();return(0,V.jsx)(o_,{scope:n,id:i,children:(0,V.jsx)(U.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});c_.displayName=a_;var l_=`SelectLabel`,u_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=s_(l_,n);return(0,V.jsx)(U.div,{id:i.id,...r,ref:t})});u_.displayName=l_;var d_=`SelectItem`,[f_,p_]=Og(d_),m_=_.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=jg(d_,n),c=qg(d_,n),l=s.value===r,[u,d]=_.useState(a??``),[f,p]=_.useState(!1),m=br(t,e=>c.itemRefCallback?.(e,r,i)),h=Ws(),g=_.useRef(`touch`),v=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};if(r===``)throw Error(`A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,V.jsx)(f_,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:_.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,V.jsx)(Tg.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,V.jsx)(U.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:H(o.onFocus,()=>p(!0)),onBlur:H(o.onBlur,()=>p(!1)),onClick:H(o.onClick,()=>{g.current!==`mouse`&&v()}),onPointerUp:H(o.onPointerUp,()=>{g.current===`mouse`&&v()}),onPointerDown:H(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:H(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:H(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:H(o.onKeyDown,e=>{c.searchRef?.current!==``&&e.key===` `||(Cg.includes(e.key)&&v(),e.key===` `&&e.preventDefault())})})})})});m_.displayName=d_;var h_=`SelectItemText`,g_=_.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=jg(h_,n),s=qg(h_,n),c=p_(h_,n),l=Ng(h_,n),[u,d]=_.useState(null),f=br(t,e=>d(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=u?.textContent,m=_.useMemo(()=>(0,V.jsx)(`option`,{value:c.value,disabled:c.disabled,children:p},c.value),[c.disabled,c.value,p]),{onNativeOptionAdd:h,onNativeOptionRemove:g}=l;return ti(()=>(h(m),()=>g(m)),[h,g,m]),(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(U.span,{id:c.textId,...a,ref:f}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?v.createPortal(a.children,o.valueNode):null]})});g_.displayName=h_;var __=`SelectItemIndicator`,v_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return p_(__,n).isSelected?(0,V.jsx)(U.span,{"aria-hidden":!0,...r,ref:t}):null});v_.displayName=__;var y_=`SelectScrollUpButton`,b_=_.forwardRef((e,t)=>{let n=qg(y_,e.__scopeSelect),r=n_(y_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(C_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});b_.displayName=y_;var x_=`SelectScrollDownButton`,S_=_.forwardRef((e,t)=>{let n=qg(x_,e.__scopeSelect),r=n_(x_,e.__scopeSelect),[i,a]=_.useState(!1),o=br(t,r.onScrollButtonChange);return ti(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,V.jsx)(C_,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});S_.displayName=x_;var C_=_.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=qg(`SelectScrollButton`,n),o=_.useRef(null),s=Eg(n),c=_.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return _.useEffect(()=>()=>c(),[c]),ti(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,V.jsx)(U.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:H(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:H(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:H(i.onPointerLeave,()=>{c()})})}),w_=`SelectSeparator`,T_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,V.jsx)(U.div,{"aria-hidden":!0,...r,ref:t})});T_.displayName=w_;var E_=`SelectArrow`,D_=_.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=kg(n),a=jg(E_,n),o=qg(E_,n);return a.open&&o.position===`popper`?(0,V.jsx)(ap,{...i,...r,ref:t}):null});D_.displayName=E_;var O_=`SelectBubbleInput`,k_=_.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=_.useRef(null),a=br(r,i),o=Mh(t);return _.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,V.jsx)(U.select,{...n,style:{...pi,...n.style},ref:a,defaultValue:t})});k_.displayName=O_;function A_(e){return e===``||e===void 0}function j_(e){let t=Rr(e),n=_.useRef(``),r=_.useRef(0),i=_.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=_.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return _.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function M_(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=N_(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function N_(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var P_=Pg,F_=Ig,I_=Rg,L_=Bg,R_=Hg,z_=Wg,B_=i_,V_=u_,H_=m_,U_=g_,W_=v_,G_=b_,K_=S_,q_=T_,J_=P_,Y_=I_,X_=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(F_,{ref:r,className:W(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,e),...n,children:[t,(0,V.jsx)(L_,{asChild:!0,children:(0,V.jsx)(Da,{className:`h-4 w-4 text-slate-400`})})]}));X_.displayName=F_.displayName;var Z_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(G_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(ka,{className:`h-4 w-4`})}));Z_.displayName=G_.displayName;var Q_=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(K_,{ref:n,className:W(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,V.jsx)(Da,{className:`h-4 w-4`})}));Q_.displayName=K_.displayName;var $_=_.forwardRef(({className:e,children:t,position:n=`popper`,...r},i)=>(0,V.jsx)(R_,{children:(0,V.jsxs)(z_,{ref:i,className:W(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,...r,children:[(0,V.jsx)(Z_,{}),(0,V.jsx)(B_,{className:W(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`),children:t}),(0,V.jsx)(Q_,{})]})}));$_.displayName=z_.displayName;var ev=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(V_,{ref:n,className:W(`py-1.5 pl-8 pr-2 text-sm font-semibold`,e),...t}));ev.displayName=V_.displayName;var tv=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(H_,{ref:r,className:W(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(W_,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),(0,V.jsx)(U_,{children:t})]}));tv.displayName=H_.displayName;var nv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(q_,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));nv.displayName=q_.displayName;var rv=e=>e.toLowerCase().replace(/\s+/g,` `).trim();function iv({enabled:e=!0}={}){let{baseUrl:t,fetchWithHeaders:n}=Rs(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!1),s=(0,_.useCallback)(async()=>{o(!0);try{try{(await navigator.mediaDevices.getUserMedia({video:!0})).getTracks().forEach(e=>e.stop())}catch{}let e=(await navigator.mediaDevices.enumerateDevices()).filter(e=>e.kind===`videoinput`).map(e=>({deviceId:e.deviceId,label:e.label})),r=await n(`${t}/available-cameras`);if(!r.ok)return i([]),[];let a=(await r.json()).cameras??[],o=new Set,s=a.map(t=>{let n=t.name||`Camera ${t.index}`,r=rv(n),i=e.filter(e=>!o.has(e.deviceId)&&e.label),a=i.find(e=>rv(e.label)===r)||i.find(e=>rv(e.label).startsWith(r))||i.find(e=>rv(e.label).includes(r)||r.includes(rv(e.label)));return a&&o.add(a.deviceId),{index:t.index,name:n,deviceId:a?.deviceId??``,available:t.available}});return i(s),s}catch{return i([]),[]}finally{o(!1)}},[t,n]);return(0,_.useEffect)(()=>{if(!e)return;s();let t=()=>s();return navigator.mediaDevices.addEventListener(`devicechange`,t),()=>navigator.mediaDevices.removeEventListener(`devicechange`,t)},[e,s]),{cameras:r,isLoading:a,refresh:s}}var av=4,ov=300,sv=new Set([`NotReadableError`,`AbortError`]);function cv(e,t){let n=(0,_.useRef)(null),[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(0),s=(0,_.useRef)(!1);return s.current=r,(0,_.useEffect)(()=>{let e=()=>{s.current&&o(e=>e+1)};return navigator.mediaDevices.addEventListener(`devicechange`,e),()=>navigator.mediaDevices.removeEventListener(`devicechange`,e)},[]),(0,_.useEffect)(()=>{if(t||!e){e||i(!0);return}let r=!1,a=null,o=null;i(!1);let s=async t=>{try{if(a=await navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:e}}}),r){a.getTracks().forEach(e=>e.stop());return}n.current&&(n.current.srcObject=a,await n.current.play().catch(()=>{}))}catch(e){if(r)return;let n=e instanceof DOMException?e.name:``;ts(t+1),ov*2**t):i(!0)}};return s(0),()=>{r=!0,o&&clearTimeout(o),a&&a.getTracks().forEach(e=>e.stop())}},[e,t,a]),{videoRef:n,hasError:r}}var lv=`__auto__`,uv=`__default__`,dv=[`MJPG`,`YUYV`,`I420`,`NV12`,`H264`,`MP4V`],fv=[`ANY`,`V4L2`,`DSHOW`,`PVAPI`,`ANDROID`,`AVFOUNDATION`,`MSMF`],pv=({cameras:e,onCamerasChange:t,releaseStreamsRef:n})=>{let{toast:r}=_r(),{cameras:i,isLoading:a,refresh:o}=iv(),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(``);(0,_.useEffect)(()=>{if(i.length===0||e.length===0)return;let n=!1,r=e.map(e=>{if(!e.device_id)return e;let t=i.find(t=>t.deviceId===e.device_id);return t&&t.index!==e.camera_index?(n=!0,{...e,camera_index:t.index}):e});n&&t(r)},[i]);let d=()=>{if(!s||!l.trim()){r({title:`Missing Information`,description:`Please select a camera and provide a name.`,variant:`destructive`});return}let n=parseInt(s),a=i.find(e=>e.index===n);if(!a){r({title:`Invalid Camera`,description:`Selected camera is not available.`,variant:`destructive`});return}if(e.some(e=>e.camera_index===a.index||a.deviceId&&e.device_id===a.deviceId)){r({title:`Camera Already Added`,description:`This camera is already in the configuration.`,variant:`destructive`});return}let o={id:`camera_${Date.now()}`,name:l.trim(),type:`opencv`,camera_index:a.index,device_id:a.deviceId,width:640,height:480,fps:30};t([...e,o]),c(``),u(``),r({title:`Camera Added`,description:`${o.name} has been added to the configuration.`})},f=n=>{t(e.filter(e=>e.id!==n)),r({title:`Camera Removed`,description:`Camera has been removed from the configuration.`})},p=(n,r)=>{t(e.map(e=>e.id===n?{...e,...r}:e))},[m,h]=(0,_.useState)(!1),g=(0,_.useCallback)(()=>{h(!0)},[]);return(0,_.useEffect)(()=>{n&&(n.current=g)},[n,g]),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Camera Configuration`}),(0,V.jsxs)(`div`,{className:`bg-gray-800/50 rounded-lg p-4 space-y-4`,children:[(0,V.jsx)(`h4`,{className:`text-md font-medium text-gray-300`,children:`Add Camera`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-300`,children:`Available Cameras`}),(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>o(),disabled:a,className:`h-6 w-6 text-gray-400 hover:text-white`,title:`Rescan for cameras (e.g. after plugging in a new USB camera)`,"aria-label":`Rescan for cameras`,children:(0,V.jsx)(Qa,{className:`w-3.5 h-3.5 ${a?`animate-spin`:``}`})})]}),(0,V.jsxs)(J_,{value:s,onValueChange:c,disabled:a,children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white`,children:(0,V.jsx)(Y_,{placeholder:a?`Loading cameras...`:`Select camera`})}),(0,V.jsx)($_,{className:`bg-gray-800 border-gray-700`,children:i.map(t=>{let n=e.some(e=>e.camera_index===t.index||t.deviceId&&e.device_id===t.deviceId);return(0,V.jsx)(tv,{value:t.index.toString(),className:`text-white hover:bg-gray-700`,disabled:!t.available||n,children:(0,V.jsxs)(`div`,{className:`flex flex-col`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:t.name}),(0,V.jsxs)(`span`,{className:`text-xs text-gray-400`,children:[`Index `,t.index,n&&` · already added`]})]})},t.index)})})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-300`,children:`Camera Name`}),(0,V.jsx)(Th,{value:l,onChange:e=>u(e.target.value),placeholder:`e.g., workspace_cam`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsx)(`div`,{className:`space-y-2 flex flex-col justify-end`,children:(0,V.jsxs)(G,{onClick:d,className:`bg-blue-500 hover:bg-blue-600 text-white`,disabled:!s||!l.trim(),children:[(0,V.jsx)(Za,{className:`w-4 h-4 mr-2`}),`Add Camera`]})})]})]}),e.length>0&&(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`h4`,{className:`text-md font-medium text-gray-300`,children:[`Configured Cameras (`,e.length,`)`]}),(0,V.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-2 gap-4`,children:e.map(e=>(0,V.jsx)(mv,{camera:e,paused:m,onRemove:()=>f(e.id),onUpdate:t=>p(e.id,t)},e.id))})]}),e.length===0&&(0,V.jsxs)(`div`,{className:`text-center py-8 text-gray-500`,children:[(0,V.jsx)(Ta,{className:`w-12 h-12 mx-auto mb-4 text-gray-600`}),(0,V.jsx)(`p`,{children:`No cameras configured. Add a camera to get started.`})]})]})},mv=({camera:e,paused:t,onRemove:n,onUpdate:r})=>{let{videoRef:i,hasError:a}=cv(e.device_id,t);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:!t&&e.device_id&&!a?(0,V.jsx)(`video`,{ref:i,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:t?`Preview paused`:e.device_id?`Preview failed`:`No browser match`})]})}),(0,V.jsxs)(`div`,{className:`p-3 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h5`,{className:`font-medium text-white truncate`,children:e.name}),(0,V.jsx)(G,{onClick:n,size:`sm`,variant:`ghost`,className:`text-red-400 hover:text-red-300 hover:bg-red-900/20 p-1`,children:(0,V.jsx)(mo,{className:`w-4 h-4`})})]}),(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-medium text-gray-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Configuration`]}),(0,V.jsxs)(cg,{className:`pt-2 space-y-2`,children:[(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 text-xs text-gray-400`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Resolution:`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,V.jsx)(Eh,{value:e.width,onChange:e=>{e!==void 0&&r({width:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`320`,max:`1920`}),(0,V.jsx)(`span`,{className:`flex items-center`,children:`×`}),(0,V.jsx)(Eh,{value:e.height,onChange:e=>{e!==void 0&&r({height:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`240`,max:`1080`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FPS:`}),(0,V.jsx)(Eh,{value:e.fps??30,onChange:e=>{e!==void 0&&r({fps:e})},className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-16`,min:`10`,max:`60`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`FOURCC:`}),(0,V.jsxs)(J_,{value:e.fourcc??lv,onValueChange:e=>r({fourcc:e===lv?void 0:e}),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(tv,{value:lv,className:`text-white hover:bg-gray-700 text-xs`,children:`Auto`}),dv.map(e=>(0,V.jsx)(tv,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`w-16`,children:`Backend:`}),(0,V.jsxs)(J_,{value:e.backend??uv,onValueChange:e=>r({backend:e===uv?void 0:e}),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white text-xs h-6 px-2 w-28`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-gray-800 border-gray-700`,children:[(0,V.jsx)(tv,{value:uv,className:`text-white hover:bg-gray-700 text-xs`,children:`Default`}),fv.map(e=>(0,V.jsx)(tv,{value:e,className:`text-white hover:bg-gray-700 text-xs`,children:e},e))]})]})]}),(0,V.jsx)(`p`,{className:`text-[10px] text-gray-500 leading-tight`,children:`Overriding the backend can reorder camera indices on macOS.`})]}),(0,V.jsxs)(`div`,{className:`text-xs text-gray-500`,children:[`Type: `,e.type,` | Device:`,` `,e.device_id?.substring(0,10),`...`]})]})]})]})]})},hv=({open:e,onOpenChange:t,robot:n,datasetName:r,setDatasetName:i,singleTask:a,setSingleTask:o,numEpisodes:s,setNumEpisodes:c,episodeTimeS:l,setEpisodeTimeS:u,resetTimeS:d,setResetTimeS:f,streamingEncoding:p,setStreamingEncoding:m,cameras:h,setCameras:g,onStart:_,releaseStreamsRef:v})=>{let{auth:y}=Vs(),b=!!n&&n.is_clean;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-red-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(`span`,{className:`text-white font-bold text-sm`,children:`REC`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Recording`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a configured robot and dataset parameters for recording.`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Recording with `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before recording.`]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Select and configure a robot on the Landing page before recording.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Dataset Configuration`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`datasetName`,className:`text-sm font-medium text-gray-300`,children:`Dataset Name *`}),(0,V.jsx)(Th,{id:`datasetName`,value:r,onChange:e=>i(e.target.value.replace(/[^A-Za-z0-9._-]/g,`_`)),placeholder:`my_dataset`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Letters, numbers, `,(0,V.jsx)(`code`,{children:`.`}),` `,(0,V.jsx)(`code`,{children:`_`}),` `,(0,V.jsx)(`code`,{children:`-`}),` only — other characters become`,` `,(0,V.jsx)(`code`,{children:`_`}),`.`]}),r&&(y.status===`authenticated`?(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`Will be saved as`,` `,(0,V.jsxs)(`span`,{className:`text-gray-300 font-mono`,children:[y.username,`/`,r]})]}):y.status===`unauthenticated`?(0,V.jsx)(`p`,{className:`text-xs text-amber-400/80`,children:`Log in to Hugging Face to set the repository owner.`}):null)]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`singleTask`,className:`text-sm font-medium text-gray-300`,children:`Task Description *`}),(0,V.jsx)(Th,{id:`singleTask`,value:a,onChange:e=>o(e.target.value),placeholder:`e.g., pick up the red block and place it on the blue square`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`numEpisodes`,className:`text-sm font-medium text-gray-300`,children:`Number of Episodes`}),(0,V.jsx)(Eh,{id:`numEpisodes`,min:`1`,max:`100`,value:s,onChange:e=>{e!==void 0&&c(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`episodeTimeS`,className:`text-sm font-medium text-gray-300`,children:`Episode duration (seconds)`}),(0,V.jsx)(Eh,{id:`episodeTimeS`,min:`1`,value:l,onChange:e=>{e!==void 0&&u(e)},className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`resetTimeS`,className:`text-sm font-medium text-gray-300`,children:`Reset duration (seconds)`}),(0,V.jsx)(Eh,{id:`resetTimeS`,min:`1`,value:d,onChange:e=>{e!==void 0&&f(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]})]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(pv,{cameras:h,onCamerasChange:g,releaseStreamsRef:v})}),(0,V.jsxs)(og,{className:`space-y-4 group`,children:[(0,V.jsxs)(sg,{className:`flex items-center justify-between w-full text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:[(0,V.jsx)(`span`,{children:`Advanced Parameters`}),(0,V.jsx)(Da,{className:`w-4 h-4 transition-transform group-data-[state=open]:rotate-180`})]}),(0,V.jsx)(cg,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(Jh,{id:`streamingEncoding`,checked:p,onCheckedChange:e=>m(e===!0),className:`mt-0.5 border-gray-500 data-[state=checked]:bg-red-500 data-[state=checked]:border-red-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(q,{htmlFor:`streamingEncoding`,className:`text-sm font-medium text-gray-200 cursor-pointer`,children:`Streaming video encoding`}),(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Encodes frames in real time during capture so each episode saves almost instantly. Uncheck to fall back to the slower PNG-then-encode flow.`})]})]})})]})]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsx)(G,{onClick:_,disabled:!b,className:`w-full sm:w-auto bg-red-500 hover:bg-red-600 text-white px-10 py-6 text-lg transition-all shadow-md shadow-red-500/30 hover:shadow-lg hover:shadow-red-500/40 disabled:opacity-40 disabled:cursor-not-allowed`,children:`Start Recording`}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},gv=/^[\w.\-]+\/[\w.\-]+$/,Aee=/^[A-Za-z0-9._-]+$/,jee=({datasets:e,loading:t,onPickExisting:n,onCreateNew:r,onOpenCustom:i,children:a})=>{let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(``),u=c.trim(),d=e.some(e=>e.repo_id.toLowerCase()===u.toLowerCase()),f=gv.test(u),p=Aee.test(u)&&!u.includes(`/`),m=u.length>0&&p&&!d,h=f&&!d,g=d||u!==``&&!m,v=d?`Already exists`:u===``?`Create new dataset…`:m?`Create "${u}"`:`Use a name without "/"`,y=()=>{g||(r(u),S())},b=e.filter(e=>e.source===`local`||e.source===`both`),x=e.filter(e=>e.source===`hub`),S=()=>{l(``),s(!1)},C=e=>{n(e),S()},w=()=>{m&&(r(u),S())},T=()=>{h&&(i(u),S())},E=e=>(0,V.jsxs)(bh,{value:e.repo_id,onSelect:()=>C(e),className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return(0,V.jsxs)(gm,{open:o,onOpenChange:s,children:[(0,V.jsx)(_m,{asChild:!0,children:a}),(0,V.jsx)(vm,{className:`w-[320px] p-0 bg-gray-800 border-gray-700 text-white`,align:`end`,children:(0,V.jsxs)(mh,{className:`bg-gray-800`,children:[(0,V.jsx)(hh,{placeholder:`Search, type a new name, or org/name…`,value:c,onValueChange:e=>l(e.replace(/[^A-Za-z0-9._\-/]/g,`_`)),onKeyDown:e=>{e.key===`Enter`&&(m?(e.preventDefault(),w()):h&&(e.preventDefault(),T()))},className:`text-white`}),(0,V.jsxs)(gh,{children:[e.length===0&&!m&&!h&&(0,V.jsx)(_h,{className:`py-4 text-sm text-gray-400 text-center`,children:t?`Loading datasets…`:`No datasets yet. Type a name to create one.`}),b.length>0&&(0,V.jsx)(vh,{heading:`Local`,children:b.map(E)}),x.length>0&&(0,V.jsx)(vh,{heading:`Hugging Face`,children:x.map(E)}),h&&(0,V.jsx)(vh,{heading:`Custom repo`,children:(0,V.jsxs)(bh,{value:`__open__${u}`,onSelect:T,className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ha,{className:`mr-2 h-4 w-4`}),`Open "`,u,`" in viewer`]})})]}),(0,V.jsxs)(`button`,{type:`button`,onClick:y,disabled:g,className:`flex w-full items-center gap-2 border-t border-gray-700 px-3 py-2 text-sm text-white hover:bg-gray-700 disabled:cursor-not-allowed disabled:text-gray-500 disabled:hover:bg-transparent`,children:[(0,V.jsx)(Za,{className:`h-4 w-4`}),v]})]})})]})},Mee=(e,t)=>{let{wsBaseUrl:n}=Rs(),r=(0,_.useRef)(e);r.current=e;let i=(0,_.useRef)(t);i.current=t,(0,_.useEffect)(()=>{let e=!1,t=null,a=null,o=()=>{if(!e){try{t=new WebSocket(`${n}/ws/joint-data`)}catch{a=setTimeout(o,3e3);return}t.onmessage=e=>{try{let t=JSON.parse(e.data);t?.type===`jobs_changed`?r.current():t?.type===`job_progress`&&i.current&&Array.isArray(t?.jobs)&&i.current(t.jobs)}catch{}},t.onclose=()=>{e||(a=setTimeout(o,3e3))}}};return o(),()=>{e=!0,a&&clearTimeout(a),t&&t.close()}},[n])},_v=class extends Error{status;detail;constructor(e,t,n){super(e),this.name=`ApiError`,this.status=t,this.detail=n}};async function vv(e,t,n,{method:r=`GET`,body:i,signal:a,action:o}={}){let s={method:r,signal:a};i!==void 0&&(s.body=JSON.stringify(i));let c=await t(`${e}${n}`,s);if(!c.ok){let e=null;try{let t=await c.json();e=t?.detail??t?.message??null}catch{}throw new _v(`${o||`${r} ${n}`} failed: ${e??c.status}`,c.status,e)}if(c.status!==204)return c.json()}async function yv(e,t,n=10,r){return(await vv(e,t,`/jobs?limit=${n}`,{signal:r,action:`List jobs`})).jobs}async function Nee(e,t,n,r){return vv(e,t,`/jobs/${n}`,{signal:r,action:`Get job`})}async function Pee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/logs`,{signal:r,action:`Get job logs`})).logs}async function Fee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/log-file`,{signal:r,action:`Get job log file`})).logs}async function Iee(e,t,n,r){return(await vv(e,t,`/jobs/${n}/metrics-history`,{signal:r,action:`Get job metrics history`})).points}async function Lee(e,t,n){let{target:r,...i}=n,a=r?{config:i,target:r}:i;try{return await vv(e,t,`/jobs/training`,{method:`POST`,body:a,action:`Start training`})}catch(e){throw e instanceof _v&&e.status===409?Error(`Another training is already running. Stop it first.`):e}}async function Ree(e,t,n,r){return vv(e,t,`/jobs/import`,{method:`POST`,body:r?{source:n,name:r}:{source:n},action:`Import model`})}async function bv(e,t,n){return vv(e,t,`/jobs/${n}/stop`,{method:`POST`,action:`Stop job`})}async function xv(e,t,n){await vv(e,t,`/jobs/${n}`,{method:`DELETE`,action:`Delete job`})}var zee={authenticated:!1,username:null,flavors:[]};async function Bee(e,t,n){try{return await vv(e,t,`/jobs/runners/hardware`,{signal:n,action:`List runner hardware`})}catch(e){if(e instanceof _v)return zee;throw e}}var Vee={authenticated:!1,jobs:[],models:[]};async function Hee(e,t,n){try{return await vv(e,t,`/jobs/hub`,{signal:n,action:`List hub jobs`})}catch(e){if(e instanceof _v)return Vee;throw e}}var Sv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`rounded-lg border bg-card text-card-foreground shadow-sm`,e),...t}));Sv.displayName=`Card`;var Cv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex flex-col space-y-1.5 p-6`,e),...t}));Cv.displayName=`CardHeader`;var wv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`h3`,{ref:n,className:W(`text-2xl font-semibold leading-none tracking-tight`,e),...t}));wv.displayName=`CardTitle`;var Uee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`p`,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));Uee.displayName=`CardDescription`;var Tv=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`p-6 pt-0`,e),...t}));Tv.displayName=`CardContent`;var Wee=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(`div`,{ref:n,className:W(`flex items-center p-6 pt-0`,e),...t}));Wee.displayName=`CardFooter`;async function Ev(e,t,n,r){return(await vv(e,t,`/jobs/${n}/checkpoints`,{signal:r,action:`List checkpoints`})).checkpoints}async function Gee(e,t,n,r,i){return vv(e,t,`/jobs/${n}/checkpoints/${r}/policy-config`,{signal:i,action:`Load policy config`})}var Dv=({checkpoints:e,selectedStep:t,onChange:n,disabled:r,placeholder:i=`Select checkpoint`})=>{let a=e=>e===0?`latest`:`step ${e}`;return(0,V.jsxs)(J_,{value:t==null?void 0:String(t),onValueChange:e=>n(Number(e)),disabled:r||e.length===0,children:[(0,V.jsx)(X_,{className:`bg-slate-800 border-slate-700 text-white h-8 text-xs px-2 w-auto min-w-[110px]`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Y_,{placeholder:i})}),(0,V.jsx)($_,{className:`bg-slate-900 border-slate-700 text-white`,children:e.map(e=>(0,V.jsx)(tv,{value:String(e.step),onClick:e=>e.stopPropagation(),children:a(e.step)},e.step))})]})};function Ov(e){let t=Math.max(0,Date.now()/1e3-e);return t<60?`${Math.floor(t)}s ago`:t<3600?`${Math.floor(t/60)}m ago`:t<86400?`${Math.floor(t/3600)}h ago`:`${Math.floor(t/86400)}d ago`}var Kee={running:{label:`Running`,color:`text-green-400`,Icon:qa},done:{label:`Done`,color:`text-slate-400`,Icon:Na},failed:{label:`Failed`,color:`text-red-400`,Icon:Fa},interrupted:{label:`Interrupted`,color:`text-amber-400`,Icon:co}},kv=({job:e,onStop:t,onDelete:n,onPlay:r})=>{let i=Re(),{baseUrl:a,fetchWithHeaders:o}=Rs(),s=Kee[e.state],c=s.Icon,l=e.state===`running`,u=e.runner===`imported`,d=e.hf_repo_id||e.output_dir,f=u?`Imported`:s.label,p=l&&e.metrics.total_steps===0,m=e.metrics.total_steps>0?Math.min(100,e.metrics.current_step/e.metrics.total_steps*100):0,h=u?d:p?`starting…`:l?`started ${Ov(e.started_at)}`:e.ended_at==null?s.label.toLowerCase():`ended ${Ov(e.ended_at)}`,[g,v]=(0,_.useState)([]),[y,b]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(e.checkpoint_count<=0){v([]),b(null);return}let t=!1;return Ev(a,o,e.id).then(e=>{if(!t)if(v(e),e.length>0){let t=e[e.length-1].step;b(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else b(null)}).catch(()=>{t||(v([]),b(null))}),()=>{t=!0}},[a,o,e.id,e.checkpoint_count]);let x=r=>{r.stopPropagation(),l?window.confirm(`Stop this run?`)&&t(e.id):u?window.confirm(`Remove this imported model? The source files are left untouched.`)&&n(e.id):window.confirm(`Delete this run? This wipes the output directory.`)&&n(e.id)},S=t=>{t.stopPropagation(),y!=null&&r(e,y)},C=l,w=g.length>0&&y!=null;return(0,V.jsx)(Sv,{onClick:()=>{u||i(`/training/${e.id}`)},className:`bg-slate-800/50 border-slate-700 rounded-xl transition-colors ${u?``:`cursor-pointer hover:border-slate-500`}`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${s.color}`,children:[(0,V.jsx)(c,{className:`w-3.5 h-3.5 ${l?`animate-spin`:``}`}),f]}),e.runner===`hf_cloud`&&e.hf_job_url?(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Open Hub job page`,children:(0,V.jsx)(`a`,{href:e.hf_job_url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})}):(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:x,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":l?`Stop job`:`Delete job`,children:l?(0,V.jsx)(ao,{className:`w-3.5 h-3.5`}):(0,V.jsx)(mo,{className:`w-3.5 h-3.5`})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:e.name,children:e.name}),(0,V.jsx)(`div`,{className:`text-xs text-slate-400 truncate`,title:h,style:u?{direction:`rtl`,textAlign:`left`}:void 0,children:u?`‎`+h:h})]}),C?(0,V.jsxs)(`div`,{className:`relative h-5 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${m}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-xs font-semibold text-white tabular-nums drop-shadow`,children:p?`Training starting…`:`${m.toFixed(1)}%`})]}):null,w?(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Dv,{checkpoints:g,selectedStep:y,onChange:b}),(0,V.jsx)(G,{size:`icon`,onClick:S,className:`h-8 w-8 bg-green-500 hover:bg-green-600 text-white`,"aria-label":`Run inference with this checkpoint`,children:(0,V.jsx)(Xa,{className:`w-4 h-4`})})]}):null]})})};function qee(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Jee={RUNNING:{label:`Running`,color:`text-green-400`,Icon:qa,spin:!0},QUEUED:{label:`Queued`,color:`text-amber-400`,Icon:La},SCHEDULING:{label:`Scheduling`,color:`text-amber-400`,Icon:La},COMPLETED:{label:`Done`,color:`text-slate-400`,Icon:Na},FAILED:{label:`Failed`,color:`text-red-400`,Icon:Fa},CANCELED:{label:`Cancelled`,color:`text-amber-400`,Icon:co},CANCELLED:{label:`Cancelled`,color:`text-amber-400`,Icon:co}},Av=({job:e})=>{let t=e.status?.stage?.toUpperCase()??``,n=Jee[t]??{label:t||`Unknown`,color:`text-slate-400`,Icon:Pa},r=n.Icon,i=e.docker_image??e.space_id??`Job ${e.id.slice(0,12)}…`;return(0,V.jsx)(Sv,{onClick:()=>window.open(e.url,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold ${n.color}`,children:[(0,V.jsx)(r,{className:`w-3.5 h-3.5 ${n.spin?`animate-spin`:``}`}),n.label]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-white font-semibold truncate`,title:i,children:i}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,children:[e.flavor??`—`,` · `,qee(e.created_at),e.owner?` · ${e.owner}`:``]})]}),e.status?.message?(0,V.jsx)(`div`,{className:`text-xs text-slate-500 truncate`,title:e.status.message,children:e.status.message}):null]})})};function Yee(e){if(!e)return`—`;let t=Date.parse(e);if(Number.isNaN(t))return`—`;let n=Math.max(0,(Date.now()-t)/1e3);return n<60?`${Math.floor(n)}s ago`:n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:`${Math.floor(n/86400)}d ago`}var Xee=({model:e})=>{let t=`https://huggingface.co/${e.repo_id}`,n=e.repo_id.includes(`/`)?e.repo_id.split(`/`).slice(1).join(`/`):e.repo_id;return(0,V.jsx)(Sv,{onClick:()=>window.open(t,`_blank`,`noopener,noreferrer`),className:`bg-slate-800/50 border-slate-700 rounded-xl cursor-pointer hover:border-slate-500 transition-colors`,children:(0,V.jsxs)(Tv,{className:`p-4 space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs font-semibold text-sky-400`,children:[(0,V.jsx)(lo,{className:`w-3.5 h-3.5`}),`Uploaded`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,asChild:!0,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`View on Hub`,children:(0,V.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(Ha,{className:`w-3.5 h-3.5`})})})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`text-white font-semibold truncate flex items-center gap-1.5`,title:e.repo_id,children:[e.private?(0,V.jsx)(Ja,{className:`w-3.5 h-3.5 text-slate-400 shrink-0`}):null,(0,V.jsx)(`span`,{className:`truncate`,children:n})]}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-400 truncate`,title:e.repo_id,children:[e.repo_id,` · updated `,Yee(e.last_modified)]})]})]})})};async function Zee(e,t,n){return vv(e,t,`/start-inference`,{method:`POST`,body:n,action:`Start inference`})}async function jv(e,t){return vv(e,t,`/stop-inference`,{method:`POST`,action:`Stop inference`})}async function Qee(e,t,n){return vv(e,t,`/inference-status`,{signal:n,action:`Get inference status`})}var $ee=({deviceId:e,paused:t})=>{let{videoRef:n,hasError:r}=cv(e,t);return t||r||!e?(0,V.jsxs)(`div`,{className:`w-32 h-24 bg-gray-800 rounded border border-gray-700 flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-5 h-5 text-gray-500 mb-1`}),(0,V.jsx)(`span`,{className:`text-[10px] text-gray-500`,children:t?`Released`:`No preview`})]}):(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-32 h-24 object-cover rounded border border-gray-700 bg-black`})},ete=30,Mv=({open:e,onOpenChange:t,robot:n,jobId:r,initialStep:i})=>{let{baseUrl:a,fetchWithHeaders:o}=Rs(),{toast:s}=_r(),c=Re(),[l,u]=(0,_.useState)([]),[d,f]=(0,_.useState)(i),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(60),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)({}),{cameras:O}=iv({enabled:e});(0,_.useEffect)(()=>{if(!e)return;let t=!1;return Ev(a,o,r).then(e=>{if(!t&&(u(e),e.length>0)){let t=e[e.length-1].step;f(e=>e??t)}}).catch(()=>{t||u([])}),()=>{t=!0}},[e,a,o,r]),(0,_.useEffect)(()=>{if(!e||d==null){x(null),T(null);return}let t=!1;return C(!0),T(null),Gee(a,o,r,d).then(e=>{t||(x(e),D(t=>{let n={};for(let r of Object.keys(e.image_features))n[r]=t[r]??null;return n}))}).catch(e=>{t||(x(null),T(e instanceof Error?e.message:String(e)))}).finally(()=>{t||C(!1)}),()=>{t=!0}},[e,a,o,r,d]),(0,_.useEffect)(()=>{if(!b)return;let e=n?.cameras??[];e.length===0||O.length===0||D(t=>{let n=!1,r={...t};for(let t of Object.keys(b.image_features)){if(r[t]!=null)continue;let i=e.find(e=>e.name.toLowerCase()===t.toLowerCase());if(!i)continue;let a=i.device_id&&O.find(e=>e.deviceId===i.device_id)||O.find(e=>e.index===i.camera_index);a&&(r[t]=a.index,n=!0)}return n?r:t})},[b,n,O]);let k=d==null?null:l.find(e=>e.step===d)?.ref??null,A=b?Object.keys(b.image_features):[],j=A.every(e=>E[e]!=null),M=!!n&&n.is_clean&&k!=null&&!!b&&j&&!v,N=async()=>{if(!n||k==null||!b)return;y(!0),await new Promise(e=>setTimeout(e,300));let e={};for(let[t,n]of Object.entries(b.image_features)){let r=E[t];r!=null&&(e[t]={type:`opencv`,camera_index:r,width:n.width,height:n.height,fps:ete})}try{await Zee(a,o,{follower_port:n.follower_port,follower_config:n.follower_config,policy_ref:k,task:p,cameras:e,duration_s:h}),t(!1),c(`/inference`)}catch(e){s({title:`Couldn't start inference`,description:e instanceof Error?e.message:String(e),variant:`destructive`}),y(!1)}},P=(e,t)=>{let n=Number(t);D(t=>({...t,[e]:n}))};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[600px] p-8 max-h-[90vh] overflow-y-auto`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(`div`,{className:`flex justify-center items-center mb-4`,children:(0,V.jsx)(`div`,{className:`w-8 h-8 bg-green-500 rounded-full flex items-center justify-center`,children:(0,V.jsx)(Xa,{className:`w-4 h-4 text-white`})})}),(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Configure Inference`})]}),(0,V.jsxs)(`div`,{className:`space-y-6 py-4`,children:[(0,V.jsx)(Ou,{className:`text-gray-400 text-base leading-relaxed text-center`,children:`Pick a checkpoint and confirm hardware. The selected policy will drive the follower autonomously for the configured duration.`}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Robot Configuration`}),n?n.is_clean?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}),(0,V.jsxs)(`span`,{className:`text-slate-200`,children:[`Running on `,(0,V.jsx)(`strong`,{children:n.name})]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:n.name}),` is missing a calibration. Configure it before running inference.`]})]}):(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Select and configure a robot on the Landing page first.`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Checkpoint`}),l.length===0?(0,V.jsxs)(ug,{className:`bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`No checkpoints available for this job yet.`})]}):(0,V.jsx)(Dv,{checkpoints:l,selectedStep:d,onChange:f})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Run parameters`}),b?.requires_task?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`task`,className:`text-sm font-medium text-gray-300`,children:`Task description`}),(0,V.jsx)(Th,{id:`task`,value:p,onChange:e=>m(e.target.value),placeholder:`e.g., pick up the red block`,className:`bg-gray-800 border-gray-700 text-white`}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[`This policy is language-conditioned (`,b.policy_type,`).`]})]}):null,(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`durationS`,className:`text-sm font-medium text-gray-300`,children:`Max duration (seconds)`}),(0,V.jsx)(Eh,{id:`durationS`,min:1,value:h,onChange:e=>{e!==void 0&&g(e)},className:`bg-gray-800 border-gray-700 text-white`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white border-b border-gray-700 pb-2`,children:`Cameras`}),S?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),`Reading policy config…`]}):w?(0,V.jsxs)(ug,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[`Couldn't load policy config: `,w]})]}):b?A.length===0?(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`This policy doesn't use cameras.`}):(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{className:`text-xs text-gray-500`,children:`Bind a physical camera to each name the policy was trained with. Resolution comes from the checkpoint.`}),A.map(e=>{let t=b.image_features[e],n=E[e],r=n==null?void 0:O.find(e=>e.index===n);return(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(q,{className:`text-sm font-medium text-gray-200`,children:e}),(0,V.jsxs)(`p`,{className:`text-xs text-gray-500`,children:[t.width,`×`,t.height]})]}),(0,V.jsxs)(J_,{value:n==null?void 0:String(n),onValueChange:t=>P(e,t),children:[(0,V.jsx)(X_,{className:`bg-gray-800 border-gray-700 text-white w-56`,children:(0,V.jsx)(Y_,{placeholder:`Select a camera`})}),(0,V.jsx)($_,{className:`bg-gray-900 border-gray-700 text-white`,children:O.length===0?(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-xs text-gray-500`,children:`No cameras detected`}):O.map(e=>(0,V.jsxs)(tv,{value:String(e.index),children:[`#`,e.index,` — `,e.name]},e.index))})]}),(0,V.jsx)($ee,{deviceId:r?.deviceId??``,paused:v})]},e)})]}):null]}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center pt-4`,children:[(0,V.jsxs)(G,{onClick:N,disabled:!M,className:`w-full sm:w-auto bg-green-500 hover:bg-green-600 text-white px-10 py-6 text-lg disabled:opacity-40 disabled:cursor-not-allowed`,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),v?`Starting…`:`Start Inference`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`w-full sm:w-auto border-gray-500 hover:border-gray-200 px-10 py-6 text-lg text-zinc-500 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Nv=({open:e,onOpenChange:t,onImported:n})=>{let{baseUrl:r,fetchWithHeaders:i}=Rs(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(``),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[520px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-2xl font-bold`,children:`Import a model`}),(0,V.jsx)(Ou,{className:`text-gray-400 text-center`,children:`Point at a local directory or a Hugging Face repo. It appears as a job you can run inference on.`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-4`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`source`,className:`text-sm font-medium text-gray-300`,children:`Local path or Hugging Face repo id`}),(0,V.jsx)(Th,{id:`source`,value:a,onChange:e=>o(e.target.value),placeholder:`/path/to/pretrained_model or user/my-policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`name`,className:`text-sm font-medium text-gray-300`,children:`Display name (optional)`}),(0,V.jsx)(Th,{id:`name`,value:s,onChange:e=>c(e.target.value),placeholder:`My imported policy`,className:`bg-gray-800 border-gray-700 text-white`})]}),d?(0,V.jsxs)(ug,{className:`bg-red-900/40 border-red-700 text-red-100`,children:[(0,V.jsx)(co,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:d})]}):null,(0,V.jsxs)(`div`,{className:`flex gap-3 justify-center pt-2`,children:[(0,V.jsxs)(G,{onClick:async()=>{let e=a.trim();if(e){u(!0),f(null);try{await Ree(r,i,e,s.trim()||void 0),o(``),c(``),t(!1),n()}catch(e){f(e instanceof Error?e.message:String(e))}finally{u(!1)}}},disabled:!a.trim()||l,className:`bg-green-500 hover:bg-green-600 text-white px-8 disabled:opacity-40`,children:[l?(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}):(0,V.jsx)(Ba,{className:`w-4 h-4 mr-2`}),l?`Importing…`:`Import`]}),(0,V.jsx)(G,{onClick:()=>t(!1),variant:`outline`,className:`border-gray-500 px-8 text-zinc-400 bg-zinc-900 hover:bg-zinc-800`,children:`Cancel`})]})]})]})})},Pv=`lelab.selectedRobot`,Fv=()=>{try{let e=localStorage.getItem(Pv);return e&&typeof e==`string`?e:null}catch{return null}},Iv=e=>{try{e?localStorage.setItem(Pv,e):localStorage.removeItem(Pv)}catch{}},Lv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),r=Ie(),[i,a]=(0,_.useState)({}),[o,s]=(0,_.useState)(()=>Fv()),[c,l]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let n=!1;return(async()=>{l(!0);try{let r=await(await t(`${e}/robots`)).json();if(n)return;let i={};for(let e of r.robots??[])i[e.name]=e;a(i),s(e=>e&&e in i?e:null)}catch(e){n||console.error(`Failed to fetch robots:`,e)}finally{n||l(!1)}})(),()=>{n=!0}},[e,t,r.key]),(0,_.useEffect)(()=>{Iv(o)},[o]);let u=(0,_.useCallback)(e=>{s(e)},[]),d=(0,_.useCallback)(()=>{s(null)},[]),f=(0,_.useCallback)(async r=>{let i=r.trim();if(!i)return n({title:`Missing name`,description:`Robot name cannot be empty.`,variant:`destructive`}),!1;if(/[/\\]|\.\./.test(i))return n({title:`Invalid name`,description:`Robot names cannot contain '/', '\\', or '..'`,variant:`destructive`}),!1;try{let r=await t(`${e}/robots/${encodeURIComponent(i)}?create=true`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(r.status===409)return n({title:`Already exists`,description:`A robot named "${i}" already exists. Pick it from the dropdown or choose a different name.`,variant:`destructive`}),!1;if(!r.ok)return n({title:`Failed to create`,description:await r.text(),variant:`destructive`}),!1;let o=await r.json();return o.robot&&(a(e=>({...e,[i]:o.robot})),s(i)),!0}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]),p=(0,_.useCallback)(async r=>{try{let i=await t(`${e}/robots/${encodeURIComponent(r)}`,{method:`DELETE`});return i.ok?(a(e=>{let{[r]:t,...n}=e;return n}),s(e=>e===r?null:e),!0):(n({title:`Failed to delete`,description:await i.text(),variant:`destructive`}),!1)}catch(e){return n({title:`Network error`,description:String(e),variant:`destructive`}),!1}},[e,t,n]);return{records:i,selectedName:o,selectedRecord:(0,_.useMemo)(()=>o?i[o]??null:null,[o,i]),availableNames:(0,_.useMemo)(()=>Object.keys(i).sort(),[i]),isLoading:c,selectRobot:u,clearSelection:d,createRobot:f,deleteRobot:p}},Rv=10,zv=new Set([`RUNNING`,`QUEUED`,`SCHEDULING`]),Bv=e=>e.state===`running`||e.checkpoint_count>0,Vv=e=>zv.has((e.status?.stage??``).toUpperCase()),Hv=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{toast:n}=_r(),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)([]),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(``),{selectedRecord:h}=Lv(),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),T=(0,_.useCallback)(async()=>{try{let[n,r]=await Promise.all([yv(e,t,Rv),Hee(e,t)]);i(n),o(r.jobs),c(r.models),u(r.authenticated),f(null)}catch(e){f(e instanceof Error?e.message:String(e))}},[e,t]);(0,_.useEffect)(()=>{T();let e=()=>{document.visibilityState===`visible`&&T()};return document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,T),()=>{document.removeEventListener(`visibilitychange`,e),window.removeEventListener(`focus`,T)}},[T]),Mee(T,(0,_.useCallback)(e=>{e.length!==0&&i(t=>{if(t.length===0)return t;let n=new Map(e.map(e=>[e.id,e])),r=!1,i=t.map(e=>{let t=n.get(e.id);return t?(r=!0,{...e,state:t.state,metrics:t.metrics,wandb_run_url:t.wandb_run_url,checkpoint_count:t.checkpoint_count}):e});return r?i:t})},[]));let E=async r=>{try{await bv(e,t,r),n({title:`Job stopping`}),T()}catch(e){n({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},D=(e,t)=>{S(e),w(t),v(!0)},O=async r=>{try{await xv(e,t,r),n({title:`Job removed`}),T()}catch(e){n({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},k=p.trim().toLowerCase(),A=(0,_.useCallback)(e=>!k||(e??``).toLowerCase().includes(k),[k]),j=(0,_.useMemo)(()=>r.filter(e=>A(e.name)),[r,A]),M=(0,_.useMemo)(()=>a.filter(e=>A(e.docker_image??e.space_id??e.id)),[a,A]),N=(0,_.useMemo)(()=>s.filter(e=>A(e.repo_id)),[s,A]),P=(0,_.useMemo)(()=>j.filter(e=>e.runner===`local`),[j]),F=(0,_.useMemo)(()=>j.filter(e=>e.runner===`hf_cloud`),[j]),I=(0,_.useMemo)(()=>j.filter(e=>e.runner===`imported`),[j]),ee=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_job_id).filter(e=>!!e)),[F]),te=(0,_.useMemo)(()=>M.filter(e=>!ee.has(e.id)),[M,ee]),ne=(0,_.useMemo)(()=>new Set(F.map(e=>e.hf_repo_id).filter(e=>!!e)),[F]),re=(0,_.useMemo)(()=>N.filter(e=>!ne.has(e.repo_id)),[N,ne]),ie=(0,_.useMemo)(()=>P.filter(Bv),[P]),ae=(0,_.useMemo)(()=>P.filter(e=>!Bv(e)),[P]),oe=(0,_.useMemo)(()=>F.filter(Bv),[F]),se=(0,_.useMemo)(()=>F.filter(e=>!Bv(e)),[F]),ce=(0,_.useMemo)(()=>te.filter(Vv),[te]),le=(0,_.useMemo)(()=>te.filter(e=>!Vv(e)),[te]),ue=ae.length+se.length+le.length;return(0,V.jsxs)(`section`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold text-white`,children:`Jobs`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(eo,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-slate-400 pointer-events-none`}),(0,V.jsx)(Th,{value:p,onChange:e=>m(e.target.value),placeholder:`Search jobs`,className:`h-8 w-48 sm:w-60 pl-8 bg-slate-800/50 border-slate-700 text-sm text-white placeholder:text-slate-500`,"aria-label":`Search jobs`})]}),(0,V.jsxs)(G,{variant:`outline`,size:`sm`,onClick:()=>b(!0),className:`h-8 border-slate-700 bg-slate-800/50 text-slate-200 hover:text-white`,children:[(0,V.jsx)(Ba,{className:`w-3.5 h-3.5 mr-1.5`}),`Import model`]}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:T,className:`h-7 w-7 text-slate-400 hover:text-white`,"aria-label":`Refresh jobs`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})})]})]}),d?(0,V.jsxs)(`p`,{className:`text-sm text-red-300`,children:[`Couldn't load jobs: `,d]}):null,(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Local jobs (`,ie.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:ie.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No local jobs match your search.`:`No active local jobs. Start one from the Training page.`}):(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:ie.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]}),I.length>0?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Imported models (`,I.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:(0,V.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:I.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id))})})]})]}):null,(0,V.jsx)(`div`,{className:`border-t border-slate-700`}),(0,V.jsxs)(og,{defaultOpen:!0,children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-sm font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Online jobs (`,oe.length+ce.length+re.length,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:!l&&F.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:`Sign in with Hugging Face to see your cloud jobs.`}):oe.length===0&&ce.length===0&&re.length===0?(0,V.jsx)(`p`,{className:`text-sm text-slate-500`,children:k?`No online jobs match your search.`:`No active cloud jobs.`}):(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[oe.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),ce.map(e=>(0,V.jsx)(Av,{job:e},e.id)),re.map(e=>(0,V.jsx)(Xee,{model:e},e.repo_id))]})})]}),ue>0?(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-slate-400 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Untracked (`,ue,`)`]}),(0,V.jsx)(cg,{className:`pt-3`,children:(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4`,children:[ae.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),se.map(e=>(0,V.jsx)(kv,{job:e,onStop:E,onDelete:O,onPlay:D},e.id)),le.map(e=>(0,V.jsx)(Av,{job:e},e.id))]})})]}):null,x?(0,V.jsx)(Mv,{open:g,onOpenChange:v,robot:h,jobId:x.id,initialStep:C}):null,(0,V.jsx)(Nv,{open:y,onOpenChange:b,onImported:T})]})},Uv=`uv tool install git+https://github.com/huggingface/leLab.git && lelab`,Wv=`http://localhost:8000/`,Gv=({open:e,onOpenChange:t,dismissible:n=!0})=>{let[r,i]=(0,_.useState)(!1),a=e=>{n||e.preventDefault()};return(0,V.jsx)(xu,{open:e,onOpenChange:n?t:()=>void 0,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-700 text-gray-300 sm:max-w-xl`,hideClose:!n,onEscapeKeyDown:a,onPointerDownOutside:a,onInteractOutside:a,children:[(0,V.jsxs)(Tu,{className:`text-center sm:text-center min-w-0`,children:[(0,V.jsxs)(Du,{className:`text-white flex items-center justify-center gap-2 text-xl`,children:[(0,V.jsx)(oo,{className:`w-6 h-6`}),`Get Started with LeLab`]}),(0,V.jsx)(Ou,{children:`LeLab runs on your machine. Click the command to copy it, then paste in a terminal:`})]}),(0,V.jsxs)(`div`,{className:`space-y-4 py-2 min-w-0`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:async()=>{try{await navigator.clipboard.writeText(Uv),i(!0),setTimeout(()=>i(!1),1500)}catch(e){console.warn(`Clipboard write failed:`,e)}},"aria-label":`Copy command to clipboard`,className:`group relative w-full bg-gray-800 hover:bg-gray-750 rounded-lg border border-gray-700 hover:border-gray-600 text-left transition-colors cursor-pointer`,children:[(0,V.jsx)(`pre`,{className:`p-4 pr-12 text-xs sm:text-sm overflow-x-auto whitespace-pre-wrap break-all`,children:(0,V.jsx)(`code`,{className:`text-green-400`,children:Uv})}),(0,V.jsx)(`span`,{className:`absolute right-2 top-2 flex items-center gap-1 px-2 py-1 rounded text-xs text-gray-400 group-hover:text-white bg-gray-900/80`,children:r?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ea,{className:`w-3.5 h-3.5 text-green-400`}),`Copied`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Ra,{className:`w-3.5 h-3.5`}),`Copy`]})})]}),(0,V.jsx)(`p`,{className:`text-gray-400 text-sm text-center`,children:`After running, your browser will open the local LeLab app.`}),(0,V.jsx)(G,{asChild:!0,className:`w-full bg-blue-600 hover:bg-blue-700 text-white`,children:(0,V.jsxs)(`a`,{href:Wv,target:`_blank`,rel:`noopener noreferrer`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`Open LeLab`]})})]})]})})};async function Kv(e,t,n){return vv(e,t,`/datasets`,{signal:n,action:`List datasets`})}var tte=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)([]),[i,a]=(0,_.useState)(!0),o=(0,_.useCallback)(()=>{a(!0),Kv(e,t).then(r).catch(()=>r([])).finally(()=>a(!1))},[e,t]);return(0,_.useEffect)(()=>{o()},[o]),{datasets:n,loading:i,refresh:o}},qv=()=>typeof window<`u`&&window.location.hostname.endsWith(`.hf.space`),Jv=qv(),Yv=()=>{let[e,t]=(0,_.useState)(Jv),{auth:n}=Vs(),{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}=Lv(),{datasets:u,loading:d}=tte(),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(``),[g,v]=(0,_.useState)(``),[y,b]=(0,_.useState)(5),[x,S]=(0,_.useState)(60),[C,w]=(0,_.useState)(15),[T,E]=(0,_.useState)(!0),[D,O]=(0,_.useState)([]),k=(0,_.useRef)(null),A=Re(),{toast:j}=_r();(0,_.useEffect)(()=>{D.length>0&&(console.log(`🧹 Landing page: Cleaning up camera state from previous session`),k.current&&k.current(),O([]))},[]),(0,_.useEffect)(()=>()=>{k.current&&(console.log(`🧹 Landing page: Cleaning up camera streams on unmount`),k.current())},[]);let M=()=>{O(i?[...i.cameras??[]]:[]),p(!0)},N=e=>{p(e),!e&&k.current&&(console.log(`🧹 Modal closed: Releasing camera streams`),k.current())},P=()=>A(`/training`),F=(e,t)=>{let n=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,r=t?`https://huggingface.co/login?next=${encodeURIComponent(n)}`:`https://huggingface.co${n}`;window.open(r,`_blank`,`noopener,noreferrer`)};return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white pb-16`,style:{"--lelab-topbar-h":`48px`},children:[(0,V.jsx)(tee,{}),(0,V.jsx)(`div`,{className:`sticky z-20 bg-black/95 backdrop-blur supports-[backdrop-filter]:bg-black/70 border-b border-gray-800`,style:{top:`var(--lelab-topbar-h)`},children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-7xl px-4 py-4 grid gap-4 grid-cols-1 lg:grid-cols-[1.2fr_2fr]`,children:[(0,V.jsx)(wh,{selectedName:r,selectedRecord:i,availableNames:a,isLoading:o,selectRobot:s,createRobot:c,deleteRobot:l}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-3`,children:[(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Dataset`}),(0,V.jsx)(jee,{datasets:u,loading:d,onPickExisting:e=>{if(e.source===`local`||e.source===`both`){A(`/upload`,{state:{datasetInfo:{dataset_repo_id:e.repo_id,source:e.source}}});return}F(e.repo_id,e.private)},onOpenCustom:e=>{F(e,!0)},onCreateNew:e=>{h(e),M()},children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[(0,V.jsx)(`span`,{className:`truncate text-gray-300`,children:d?`Loading datasets…`:`Select or create a dataset…`}),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})})]}),(0,V.jsxs)(`div`,{className:`bg-gray-800 rounded-lg border border-gray-700 p-3 flex flex-col gap-2`,children:[(0,V.jsx)(`h3`,{className:`font-semibold text-lg text-left h-10 flex items-center`,children:`Create a model`}),(0,V.jsx)(G,{onClick:P,className:`w-full bg-green-500 hover:bg-green-600 text-white`,children:`Training`})]})]})]})}),(0,V.jsx)(`main`,{className:`mx-auto max-w-7xl px-4 py-6`,children:(0,V.jsx)(Hv,{})}),(0,V.jsx)(ree,{}),(0,V.jsx)(Gv,{open:e,onOpenChange:t,dismissible:!Jv}),(0,V.jsx)(hv,{open:f,onOpenChange:N,robot:i,datasetName:m,setDatasetName:h,singleTask:g,setSingleTask:v,numEpisodes:y,setNumEpisodes:b,episodeTimeS:x,setEpisodeTimeS:S,resetTimeS:C,setResetTimeS:w,streamingEncoding:T,setStreamingEncoding:E,cameras:D,setCameras:O,onStart:async()=>{if(!i){j({title:`No robot selected`,description:`Select or create a robot on the Landing page first.`,variant:`destructive`});return}let e=i;if(!e.is_clean){j({title:`Robot not ready`,description:`${e.name} is missing a calibration. Configure it before recording.`,variant:`destructive`});return}if(!m||!g){j({title:`Missing dataset details`,description:`Please enter a dataset name and task description.`,variant:`destructive`});return}let t=n.status===`authenticated`?`${n.username}/${m}`:m;D.length>0&&k.current&&(console.log(`🔓 Releasing camera streams before starting recording...`),j({title:`Preparing Camera Resources`,description:`Releasing ${D.length} camera stream(s) for recording...`}),k.current(),await new Promise(e=>setTimeout(e,500)),console.log(`✅ Camera streams released, proceeding with recording...`),j({title:`Camera Resources Ready`,description:`Camera streams released successfully. Starting recording...`}));let r=D.reduce((e,t)=>(e[t.name]={type:t.type,camera_index:t.camera_index,width:t.width,height:t.height,fps:t.fps,...t.fourcc?{fourcc:t.fourcc}:{},...t.backend?{backend:t.backend}:{}},e),{}),a={leader_port:e.leader_port,follower_port:e.follower_port,leader_config:e.leader_config,follower_config:e.follower_config,dataset_repo_id:t,single_task:g,num_episodes:y,episode_time_s:x,reset_time_s:C,fps:30,video:!0,push_to_hub:!1,resume:!1,streaming_encoding:T,cameras:r};p(!1),A(`/recording`,{state:{recordingConfig:a}})},releaseStreamsRef:k})]})},Xv={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},Zv={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},Qv=`attached`,$v=1e3,ey=1001,ty=1002,ny=1003,ry=1004,iy=1005,ay=1006,oy=1007,sy=1008,cy=1009,ly=1010,uy=1011,dy=1012,fy=1013,py=1014,my=1015,hy=1016,gy=1017,_y=1018,vy=1020,yy=35902,nte=1021,rte=1022,by=1023,xy=1026,Sy=1027,Cy=1028,wy=1029,Ty=1030,Ey=1031,Dy=1033,Oy=33776,ky=33777,Ay=33778,jy=33779,My=35840,Ny=35841,Py=35842,Fy=35843,Iy=36196,Ly=37492,Ry=37496,zy=37808,By=37809,Vy=37810,Hy=37811,Uy=37812,Wy=37813,Gy=37814,Ky=37815,qy=37816,Jy=37817,Yy=37818,Xy=37819,Zy=37820,Qy=37821,$y=36492,eb=36494,tb=36495,nb=36283,rb=36284,ib=36285,ab=36286,ob=2300,sb=2301,cb=2302,lb=2400,ub=2401,db=2402,fb=2500,pb=3200,mb=3201,hb=`srgb`,gb=`srgb-linear`,_b=`linear`,vb=`srgb`,yb=7680,bb=35044,xb=2e3,Sb=class{addEventListener(e,t){this._listeners===void 0&&(this._listeners={});let n=this._listeners;n[e]===void 0&&(n[e]=[]),n[e].indexOf(t)===-1&&n[e].push(t)}hasEventListener(e,t){let n=this._listeners;return n===void 0?!1:n[e]!==void 0&&n[e].indexOf(t)!==-1}removeEventListener(e,t){let n=this._listeners;if(n===void 0)return;let r=n[e];if(r!==void 0){let e=r.indexOf(t);e!==-1&&r.splice(e,1)}}dispatchEvent(e){let t=this._listeners;if(t===void 0)return;let n=t[e.type];if(n!==void 0){e.target=this;let t=n.slice(0);for(let n=0,r=t.length;n>8&255]+Cb[e>>16&255]+Cb[e>>24&255]+`-`+Cb[t&255]+Cb[t>>8&255]+`-`+Cb[t>>16&15|64]+Cb[t>>24&255]+`-`+Cb[n&63|128]+Cb[n>>8&255]+`-`+Cb[n>>16&255]+Cb[n>>24&255]+Cb[r&255]+Cb[r>>8&255]+Cb[r>>16&255]+Cb[r>>24&255]).toLowerCase()}function Ob(e,t,n){return Math.max(t,Math.min(n,e))}function kb(e,t){return(e%t+t)%t}function ite(e,t,n,r,i){return r+(e-t)*(i-r)/(n-t)}function ate(e,t,n){return e===t?0:(n-e)/(t-e)}function Ab(e,t,n){return(1-n)*e+n*t}function ote(e,t,n,r){return Ab(e,t,1-Math.exp(-n*r))}function ste(e,t=1){return t-Math.abs(kb(e,t*2)-t)}function cte(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*(3-2*e))}function lte(e,t,n){return e<=t?0:e>=n?1:(e=(e-t)/(n-t),e*e*e*(e*(e*6-15)+10))}function ute(e,t){return e+Math.floor(Math.random()*(t-e+1))}function jb(e,t){return e+Math.random()*(t-e)}function Mb(e){return e*(.5-Math.random())}function Nb(e){e!==void 0&&(wb=e);let t=wb+=1831565813;return t=Math.imul(t^t>>>15,t|1),t^=t+Math.imul(t^t>>>7,t|61),((t^t>>>14)>>>0)/4294967296}function Pb(e){return e*Tb}function Fb(e){return e*Eb}function Ib(e){return(e&e-1)==0&&e!==0}function Lb(e){return 2**Math.ceil(Math.log(e)/Math.LN2)}function Rb(e){return 2**Math.floor(Math.log(e)/Math.LN2)}function zb(e,t,n,r,i){let a=Math.cos,o=Math.sin,s=a(n/2),c=o(n/2),l=a((t+r)/2),u=o((t+r)/2),d=a((t-r)/2),f=o((t-r)/2),p=a((r-t)/2),m=o((r-t)/2);switch(i){case`XYX`:e.set(s*u,c*d,c*f,s*l);break;case`YZY`:e.set(c*f,s*u,c*d,s*l);break;case`ZXZ`:e.set(c*d,c*f,s*u,s*l);break;case`XZX`:e.set(s*u,c*m,c*p,s*l);break;case`YXY`:e.set(c*p,s*u,c*m,s*l);break;case`ZYZ`:e.set(c*m,c*p,s*u,s*l);break;default:console.warn(`THREE.MathUtils: .setQuaternionFromProperEuler() encountered an unknown order: `+i)}}function Bb(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return e/4294967295;case Uint16Array:return e/65535;case Uint8Array:return e/255;case Int32Array:return Math.max(e/2147483647,-1);case Int16Array:return Math.max(e/32767,-1);case Int8Array:return Math.max(e/127,-1);default:throw Error(`Invalid component type.`)}}function Vb(e,t){switch(t.constructor){case Float32Array:return e;case Uint32Array:return Math.round(e*4294967295);case Uint16Array:return Math.round(e*65535);case Uint8Array:return Math.round(e*255);case Int32Array:return Math.round(e*2147483647);case Int16Array:return Math.round(e*32767);case Int8Array:return Math.round(e*127);default:throw Error(`Invalid component type.`)}}var Hb={DEG2RAD:Tb,RAD2DEG:Eb,generateUUID:Db,clamp:Ob,euclideanModulo:kb,mapLinear:ite,inverseLerp:ate,lerp:Ab,damp:ote,pingpong:ste,smoothstep:cte,smootherstep:lte,randInt:ute,randFloat:jb,randFloatSpread:Mb,seededRandom:Nb,degToRad:Pb,radToDeg:Fb,isPowerOfTwo:Ib,ceilPowerOfTwo:Lb,floorPowerOfTwo:Rb,setQuaternionFromProperEuler:zb,normalize:Vb,denormalize:Bb},Ub=class e{constructor(t=0,n=0){e.prototype.isVector2=!0,this.x=t,this.y=n}get width(){return this.x}set width(e){this.x=e}get height(){return this.y}set height(e){this.y=e}set(e,t){return this.x=e,this.y=t,this}setScalar(e){return this.x=e,this.y=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y)}copy(e){return this.x=e.x,this.y=e.y,this}add(e){return this.x+=e.x,this.y+=e.y,this}addScalar(e){return this.x+=e,this.y+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this}subScalar(e){return this.x-=e,this.y-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this}multiply(e){return this.x*=e.x,this.y*=e.y,this}multiplyScalar(e){return this.x*=e,this.y*=e,this}divide(e){return this.x/=e.x,this.y/=e.y,this}divideScalar(e){return this.multiplyScalar(1/e)}applyMatrix3(e){let t=this.x,n=this.y,r=e.elements;return this.x=r[0]*t+r[3]*n+r[6],this.y=r[1]*t+r[4]*n+r[7],this}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this}clamp(e,t){return this.x=Ob(this.x,e.x,t.x),this.y=Ob(this.y,e.y,t.y),this}clampScalar(e,t){return this.x=Ob(this.x,e,t),this.y=Ob(this.y,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ob(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(e){return this.x*e.x+this.y*e.y}cross(e){return this.x*e.y-this.y*e.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ob(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y;return t*t+n*n}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this}equals(e){return e.x===this.x&&e.y===this.y}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this}rotateAround(e,t){let n=Math.cos(t),r=Math.sin(t),i=this.x-e.x,a=this.y-e.y;return this.x=i*n-a*r+e.x,this.y=i*r+a*n+e.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}},Wb=class{constructor(e=0,t=0,n=0,r=1){this.isQuaternion=!0,this._x=e,this._y=t,this._z=n,this._w=r}static slerpFlat(e,t,n,r,i,a,o){let s=n[r+0],c=n[r+1],l=n[r+2],u=n[r+3],d=i[a+0],f=i[a+1],p=i[a+2],m=i[a+3];if(o===0){e[t+0]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u;return}if(o===1){e[t+0]=d,e[t+1]=f,e[t+2]=p,e[t+3]=m;return}if(u!==m||s!==d||c!==f||l!==p){let e=1-o,t=s*d+c*f+l*p+u*m,n=t>=0?1:-1,r=1-t*t;if(r>2**-52){let i=Math.sqrt(r),a=Math.atan2(i,t*n);e=Math.sin(e*a)/i,o=Math.sin(o*a)/i}let i=o*n;if(s=s*e+d*i,c=c*e+f*i,l=l*e+p*i,u=u*e+m*i,e===1-o){let e=1/Math.sqrt(s*s+c*c+l*l+u*u);s*=e,c*=e,l*=e,u*=e}}e[t]=s,e[t+1]=c,e[t+2]=l,e[t+3]=u}static multiplyQuaternionsFlat(e,t,n,r,i,a){let o=n[r],s=n[r+1],c=n[r+2],l=n[r+3],u=i[a],d=i[a+1],f=i[a+2],p=i[a+3];return e[t]=o*p+l*u+s*f-c*d,e[t+1]=s*p+l*d+c*u-o*f,e[t+2]=c*p+l*f+o*d-s*u,e[t+3]=l*p-o*u-s*d-c*f,e}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get w(){return this._w}set w(e){this._w=e,this._onChangeCallback()}set(e,t,n,r){return this._x=e,this._y=t,this._z=n,this._w=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(e){return this._x=e.x,this._y=e.y,this._z=e.z,this._w=e.w,this._onChangeCallback(),this}setFromEuler(e,t=!0){let n=e._x,r=e._y,i=e._z,a=e._order,o=Math.cos,s=Math.sin,c=o(n/2),l=o(r/2),u=o(i/2),d=s(n/2),f=s(r/2),p=s(i/2);switch(a){case`XYZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`YXZ`:this._x=d*l*u+c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`ZXY`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u-d*f*p;break;case`ZYX`:this._x=d*l*u-c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u+d*f*p;break;case`YZX`:this._x=d*l*u+c*f*p,this._y=c*f*u+d*l*p,this._z=c*l*p-d*f*u,this._w=c*l*u-d*f*p;break;case`XZY`:this._x=d*l*u-c*f*p,this._y=c*f*u-d*l*p,this._z=c*l*p+d*f*u,this._w=c*l*u+d*f*p;break;default:console.warn(`THREE.Quaternion: .setFromEuler() encountered an unknown order: `+a)}return t===!0&&this._onChangeCallback(),this}setFromAxisAngle(e,t){let n=t/2,r=Math.sin(n);return this._x=e.x*r,this._y=e.y*r,this._z=e.z*r,this._w=Math.cos(n),this._onChangeCallback(),this}setFromRotationMatrix(e){let t=e.elements,n=t[0],r=t[4],i=t[8],a=t[1],o=t[5],s=t[9],c=t[2],l=t[6],u=t[10],d=n+o+u;if(d>0){let e=.5/Math.sqrt(d+1);this._w=.25/e,this._x=(l-s)*e,this._y=(i-c)*e,this._z=(a-r)*e}else if(n>o&&n>u){let e=2*Math.sqrt(1+n-o-u);this._w=(l-s)/e,this._x=.25*e,this._y=(r+a)/e,this._z=(i+c)/e}else if(o>u){let e=2*Math.sqrt(1+o-n-u);this._w=(i-c)/e,this._x=(r+a)/e,this._y=.25*e,this._z=(s+l)/e}else{let e=2*Math.sqrt(1+u-n-o);this._w=(a-r)/e,this._x=(i+c)/e,this._y=(s+l)/e,this._z=.25*e}return this._onChangeCallback(),this}setFromUnitVectors(e,t){let n=e.dot(t)+1;return n<2**-52?(n=0,Math.abs(e.x)>Math.abs(e.z)?(this._x=-e.y,this._y=e.x,this._z=0,this._w=n):(this._x=0,this._y=-e.z,this._z=e.y,this._w=n)):(this._x=e.y*t.z-e.z*t.y,this._y=e.z*t.x-e.x*t.z,this._z=e.x*t.y-e.y*t.x,this._w=n),this.normalize()}angleTo(e){return 2*Math.acos(Math.abs(Ob(this.dot(e),-1,1)))}rotateTowards(e,t){let n=this.angleTo(e);if(n===0)return this;let r=Math.min(1,t/n);return this.slerp(e,r),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(e){return this._x*e._x+this._y*e._y+this._z*e._z+this._w*e._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let e=this.length();return e===0?(this._x=0,this._y=0,this._z=0,this._w=1):(e=1/e,this._x*=e,this._y*=e,this._z*=e,this._w*=e),this._onChangeCallback(),this}multiply(e){return this.multiplyQuaternions(this,e)}premultiply(e){return this.multiplyQuaternions(e,this)}multiplyQuaternions(e,t){let n=e._x,r=e._y,i=e._z,a=e._w,o=t._x,s=t._y,c=t._z,l=t._w;return this._x=n*l+a*o+r*c-i*s,this._y=r*l+a*s+i*o-n*c,this._z=i*l+a*c+n*s-r*o,this._w=a*l-n*o-r*s-i*c,this._onChangeCallback(),this}slerp(e,t){if(t===0)return this;if(t===1)return this.copy(e);let n=this._x,r=this._y,i=this._z,a=this._w,o=a*e._w+n*e._x+r*e._y+i*e._z;if(o<0?(this._w=-e._w,this._x=-e._x,this._y=-e._y,this._z=-e._z,o=-o):this.copy(e),o>=1)return this._w=a,this._x=n,this._y=r,this._z=i,this;let s=1-o*o;if(s<=2**-52){let e=1-t;return this._w=e*a+t*this._w,this._x=e*n+t*this._x,this._y=e*r+t*this._y,this._z=e*i+t*this._z,this.normalize(),this}let c=Math.sqrt(s),l=Math.atan2(c,o),u=Math.sin((1-t)*l)/c,d=Math.sin(t*l)/c;return this._w=a*u+this._w*d,this._x=n*u+this._x*d,this._y=r*u+this._y*d,this._z=i*u+this._z*d,this._onChangeCallback(),this}slerpQuaternions(e,t,n){return this.copy(e).slerp(t,n)}random(){let e=2*Math.PI*Math.random(),t=2*Math.PI*Math.random(),n=Math.random(),r=Math.sqrt(1-n),i=Math.sqrt(n);return this.set(r*Math.sin(e),r*Math.cos(e),i*Math.sin(t),i*Math.cos(t))}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._w===this._w}fromArray(e,t=0){return this._x=e[t],this._y=e[t+1],this._z=e[t+2],this._w=e[t+3],this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._w,e}fromBufferAttribute(e,t){return this._x=e.getX(t),this._y=e.getY(t),this._z=e.getZ(t),this._w=e.getW(t),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}},J=class e{constructor(t=0,n=0,r=0){e.prototype.isVector3=!0,this.x=t,this.y=n,this.z=r}set(e,t,n){return n===void 0&&(n=this.z),this.x=e,this.y=t,this.z=n,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this}multiplyVectors(e,t){return this.x=e.x*t.x,this.y=e.y*t.y,this.z=e.z*t.z,this}applyEuler(e){return this.applyQuaternion(Kb.setFromEuler(e))}applyAxisAngle(e,t){return this.applyQuaternion(Kb.setFromAxisAngle(e,t))}applyMatrix3(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[3]*n+i[6]*r,this.y=i[1]*t+i[4]*n+i[7]*r,this.z=i[2]*t+i[5]*n+i[8]*r,this}applyNormalMatrix(e){return this.applyMatrix3(e).normalize()}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=e.elements,a=1/(i[3]*t+i[7]*n+i[11]*r+i[15]);return this.x=(i[0]*t+i[4]*n+i[8]*r+i[12])*a,this.y=(i[1]*t+i[5]*n+i[9]*r+i[13])*a,this.z=(i[2]*t+i[6]*n+i[10]*r+i[14])*a,this}applyQuaternion(e){let t=this.x,n=this.y,r=this.z,i=e.x,a=e.y,o=e.z,s=e.w,c=2*(a*r-o*n),l=2*(o*t-i*r),u=2*(i*n-a*t);return this.x=t+s*c+a*u-o*l,this.y=n+s*l+o*c-i*u,this.z=r+s*u+i*l-a*c,this}project(e){return this.applyMatrix4(e.matrixWorldInverse).applyMatrix4(e.projectionMatrix)}unproject(e){return this.applyMatrix4(e.projectionMatrixInverse).applyMatrix4(e.matrixWorld)}transformDirection(e){let t=this.x,n=this.y,r=this.z,i=e.elements;return this.x=i[0]*t+i[4]*n+i[8]*r,this.y=i[1]*t+i[5]*n+i[9]*r,this.z=i[2]*t+i[6]*n+i[10]*r,this.normalize()}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this}divideScalar(e){return this.multiplyScalar(1/e)}min(e){return this.x=Math.min(this.x,e.x),this.y=Math.min(this.y,e.y),this.z=Math.min(this.z,e.z),this}max(e){return this.x=Math.max(this.x,e.x),this.y=Math.max(this.y,e.y),this.z=Math.max(this.z,e.z),this}clamp(e,t){return this.x=Ob(this.x,e.x,t.x),this.y=Ob(this.y,e.y,t.y),this.z=Ob(this.z,e.z,t.z),this}clampScalar(e,t){return this.x=Ob(this.x,e,t),this.y=Ob(this.y,e,t),this.z=Ob(this.z,e,t),this}clampLength(e,t){let n=this.length();return this.divideScalar(n||1).multiplyScalar(Ob(n,e,t))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(e){return this.x*e.x+this.y*e.y+this.z*e.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(e){return this.normalize().multiplyScalar(e)}lerp(e,t){return this.x+=(e.x-this.x)*t,this.y+=(e.y-this.y)*t,this.z+=(e.z-this.z)*t,this}lerpVectors(e,t,n){return this.x=e.x+(t.x-e.x)*n,this.y=e.y+(t.y-e.y)*n,this.z=e.z+(t.z-e.z)*n,this}cross(e){return this.crossVectors(this,e)}crossVectors(e,t){let n=e.x,r=e.y,i=e.z,a=t.x,o=t.y,s=t.z;return this.x=r*s-i*o,this.y=i*a-n*s,this.z=n*o-r*a,this}projectOnVector(e){let t=e.lengthSq();if(t===0)return this.set(0,0,0);let n=e.dot(this)/t;return this.copy(e).multiplyScalar(n)}projectOnPlane(e){return Gb.copy(this).projectOnVector(e),this.sub(Gb)}reflect(e){return this.sub(Gb.copy(e).multiplyScalar(2*this.dot(e)))}angleTo(e){let t=Math.sqrt(this.lengthSq()*e.lengthSq());if(t===0)return Math.PI/2;let n=this.dot(e)/t;return Math.acos(Ob(n,-1,1))}distanceTo(e){return Math.sqrt(this.distanceToSquared(e))}distanceToSquared(e){let t=this.x-e.x,n=this.y-e.y,r=this.z-e.z;return t*t+n*n+r*r}manhattanDistanceTo(e){return Math.abs(this.x-e.x)+Math.abs(this.y-e.y)+Math.abs(this.z-e.z)}setFromSpherical(e){return this.setFromSphericalCoords(e.radius,e.phi,e.theta)}setFromSphericalCoords(e,t,n){let r=Math.sin(t)*e;return this.x=r*Math.sin(n),this.y=Math.cos(t)*e,this.z=r*Math.cos(n),this}setFromCylindrical(e){return this.setFromCylindricalCoords(e.radius,e.theta,e.y)}setFromCylindricalCoords(e,t,n){return this.x=e*Math.sin(t),this.y=n,this.z=e*Math.cos(t),this}setFromMatrixPosition(e){let t=e.elements;return this.x=t[12],this.y=t[13],this.z=t[14],this}setFromMatrixScale(e){let t=this.setFromMatrixColumn(e,0).length(),n=this.setFromMatrixColumn(e,1).length(),r=this.setFromMatrixColumn(e,2).length();return this.x=t,this.y=n,this.z=r,this}setFromMatrixColumn(e,t){return this.fromArray(e.elements,t*4)}setFromMatrix3Column(e,t){return this.fromArray(e.elements,t*3)}setFromEuler(e){return this.x=e._x,this.y=e._y,this.z=e._z,this}setFromColor(e){return this.x=e.r,this.y=e.g,this.z=e.b,this}equals(e){return e.x===this.x&&e.y===this.y&&e.z===this.z}fromArray(e,t=0){return this.x=e[t],this.y=e[t+1],this.z=e[t+2],this}toArray(e=[],t=0){return e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e}fromBufferAttribute(e,t){return this.x=e.getX(t),this.y=e.getY(t),this.z=e.getZ(t),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){let e=Math.random()*Math.PI*2,t=Math.random()*2-1,n=Math.sqrt(1-t*t);return this.x=n*Math.cos(e),this.y=t,this.z=n*Math.sin(e),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}},Gb=new J,Kb=new Wb,qb=class e{constructor(t,n,r,i,a,o,s,c,l){e.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l)}set(e,t,n,r,i,a,o,s,c){let l=this.elements;return l[0]=e,l[1]=r,l[2]=o,l[3]=t,l[4]=i,l[5]=s,l[6]=n,l[7]=a,l[8]=c,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],this}extractBasis(e,t,n){return e.setFromMatrix3Column(this,0),t.setFromMatrix3Column(this,1),n.setFromMatrix3Column(this,2),this}setFromMatrix4(e){let t=e.elements;return this.set(t[0],t[4],t[8],t[1],t[5],t[9],t[2],t[6],t[10]),this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[3],s=n[6],c=n[1],l=n[4],u=n[7],d=n[2],f=n[5],p=n[8],m=r[0],h=r[3],g=r[6],_=r[1],v=r[4],y=r[7],b=r[2],x=r[5],S=r[8];return i[0]=a*m+o*_+s*b,i[3]=a*h+o*v+s*x,i[6]=a*g+o*y+s*S,i[1]=c*m+l*_+u*b,i[4]=c*h+l*v+u*x,i[7]=c*g+l*y+u*S,i[2]=d*m+f*_+p*b,i[5]=d*h+f*v+p*x,i[8]=d*g+f*y+p*S,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[3]*=e,t[6]*=e,t[1]*=e,t[4]*=e,t[7]*=e,t[2]*=e,t[5]*=e,t[8]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8];return t*a*l-t*o*c-n*i*l+n*o*s+r*i*c-r*a*s}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=l*a-o*c,d=o*s-l*i,f=c*i-a*s,p=t*u+n*d+r*f;if(p===0)return this.set(0,0,0,0,0,0,0,0,0);let m=1/p;return e[0]=u*m,e[1]=(r*c-l*n)*m,e[2]=(o*n-r*a)*m,e[3]=d*m,e[4]=(l*t-r*s)*m,e[5]=(r*i-o*t)*m,e[6]=f*m,e[7]=(n*s-c*t)*m,e[8]=(a*t-n*i)*m,this}transpose(){let e,t=this.elements;return e=t[1],t[1]=t[3],t[3]=e,e=t[2],t[2]=t[6],t[6]=e,e=t[5],t[5]=t[7],t[7]=e,this}getNormalMatrix(e){return this.setFromMatrix4(e).invert().transpose()}transposeIntoArray(e){let t=this.elements;return e[0]=t[0],e[1]=t[3],e[2]=t[6],e[3]=t[1],e[4]=t[4],e[5]=t[7],e[6]=t[2],e[7]=t[5],e[8]=t[8],this}setUvTransform(e,t,n,r,i,a,o){let s=Math.cos(i),c=Math.sin(i);return this.set(n*s,n*c,-n*(s*a+c*o)+a+e,-r*c,r*s,-r*(-c*a+s*o)+o+t,0,0,1),this}scale(e,t){return this.premultiply(Jb.makeScale(e,t)),this}rotate(e){return this.premultiply(Jb.makeRotation(-e)),this}translate(e,t){return this.premultiply(Jb.makeTranslation(e,t)),this}makeTranslation(e,t){return e.isVector2?this.set(1,0,e.x,0,1,e.y,0,0,1):this.set(1,0,e,0,1,t,0,0,1),this}makeRotation(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,n,t,0,0,0,1),this}makeScale(e,t){return this.set(e,0,0,0,t,0,0,0,1),this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<9;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<9;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e}clone(){return new this.constructor().fromArray(this.elements)}},Jb=new qb;function Yb(e){for(let t=e.length-1;t>=0;--t)if(e[t]>=65535)return!0;return!1}function Xb(e){return document.createElementNS(`http://www.w3.org/1999/xhtml`,e)}function Zb(){let e=Xb(`canvas`);return e.style.display=`block`,e}var Qb={};function $b(e){e in Qb||(Qb[e]=!0,console.warn(e))}function ex(e,t,n){return new Promise(function(r,i){function a(){switch(e.clientWaitSync(t,e.SYNC_FLUSH_COMMANDS_BIT,0)){case e.WAIT_FAILED:i();break;case e.TIMEOUT_EXPIRED:setTimeout(a,n);break;default:r()}}setTimeout(a,n)})}function tx(e){let t=e.elements;t[2]=.5*t[2]+.5*t[3],t[6]=.5*t[6]+.5*t[7],t[10]=.5*t[10]+.5*t[11],t[14]=.5*t[14]+.5*t[15]}function nx(e){let t=e.elements;t[11]===-1?(t[10]=-t[10]-1,t[14]=-t[14]):(t[10]=-t[10],t[14]=-t[14]+1)}var rx=new qb().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),ix=new qb().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function ax(){let e={enabled:!0,workingColorSpace:gb,spaces:{},convert:function(e,t,n){return this.enabled===!1||t===n||!t||!n?e:(this.spaces[t].transfer===`srgb`&&(e.r=sx(e.r),e.g=sx(e.g),e.b=sx(e.b)),this.spaces[t].primaries!==this.spaces[n].primaries&&(e.applyMatrix3(this.spaces[t].toXYZ),e.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===`srgb`&&(e.r=cx(e.r),e.g=cx(e.g),e.b=cx(e.b)),e)},workingToColorSpace:function(e,t){return this.convert(e,this.workingColorSpace,t)},colorSpaceToWorking:function(e,t){return this.convert(e,t,this.workingColorSpace)},getPrimaries:function(e){return this.spaces[e].primaries},getTransfer:function(e){return e===``?_b:this.spaces[e].transfer},getLuminanceCoefficients:function(e,t=this.workingColorSpace){return e.fromArray(this.spaces[t].luminanceCoefficients)},define:function(e){Object.assign(this.spaces,e)},_getMatrix:function(e,t,n){return e.copy(this.spaces[t].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(e){return this.spaces[e].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(e=this.workingColorSpace){return this.spaces[e].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(t,n){return $b(`THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace().`),e.workingToColorSpace(t,n)},toWorkingColorSpace:function(t,n){return $b(`THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking().`),e.colorSpaceToWorking(t,n)}},t=[.64,.33,.3,.6,.15,.06],n=[.2126,.7152,.0722],r=[.3127,.329];return e.define({[gb]:{primaries:t,whitePoint:r,transfer:_b,toXYZ:rx,fromXYZ:ix,luminanceCoefficients:n,workingColorSpaceConfig:{unpackColorSpace:hb},outputColorSpaceConfig:{drawingBufferColorSpace:hb}},[hb]:{primaries:t,whitePoint:r,transfer:vb,toXYZ:rx,fromXYZ:ix,luminanceCoefficients:n,outputColorSpaceConfig:{drawingBufferColorSpace:hb}}}),e}var ox=ax();function sx(e){return e<.04045?e*.0773993808:(e*.9478672986+.0521327014)**2.4}function cx(e){return e<.0031308?e*12.92:1.055*e**.41666-.055}var lx,ux=class{static getDataURL(e,t=`image/png`){if(/^data:/i.test(e.src)||typeof HTMLCanvasElement>`u`)return e.src;let n;if(e instanceof HTMLCanvasElement)n=e;else{lx===void 0&&(lx=Xb(`canvas`)),lx.width=e.width,lx.height=e.height;let t=lx.getContext(`2d`);e instanceof ImageData?t.putImageData(e,0,0):t.drawImage(e,0,0,e.width,e.height),n=lx}return n.toDataURL(t)}static sRGBToLinear(e){if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap){let t=Xb(`canvas`);t.width=e.width,t.height=e.height;let n=t.getContext(`2d`);n.drawImage(e,0,0,e.width,e.height);let r=n.getImageData(0,0,e.width,e.height),i=r.data;for(let e=0;e1),this.pmremVersion=0}get width(){return this.source.getSize(hx).x}get height(){return this.source.getSize(hx).y}get depth(){return this.source.getSize(hx).z}get image(){return this.source.data}set image(e=null){this.source.data=e}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(e){return this.name=e.name,this.source=e.source,this.mipmaps=e.mipmaps.slice(0),this.mapping=e.mapping,this.channel=e.channel,this.wrapS=e.wrapS,this.wrapT=e.wrapT,this.magFilter=e.magFilter,this.minFilter=e.minFilter,this.anisotropy=e.anisotropy,this.format=e.format,this.internalFormat=e.internalFormat,this.type=e.type,this.offset.copy(e.offset),this.repeat.copy(e.repeat),this.center.copy(e.center),this.rotation=e.rotation,this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrix.copy(e.matrix),this.generateMipmaps=e.generateMipmaps,this.premultiplyAlpha=e.premultiplyAlpha,this.flipY=e.flipY,this.unpackAlignment=e.unpackAlignment,this.colorSpace=e.colorSpace,this.renderTarget=e.renderTarget,this.isRenderTargetTexture=e.isRenderTargetTexture,this.isArrayTexture=e.isArrayTexture,this.userData=JSON.parse(JSON.stringify(e.userData)),this.needsUpdate=!0,this}setValues(e){for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Texture.setValues(): parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Texture.setValues(): property '${t}' does not exist.`);continue}r&&n&&r.isVector2&&n.isVector2||r&&n&&r.isVector3&&n.isVector3||r&&n&&r.isMatrix3&&n.isMatrix3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;if(!t&&e.textures[this.uuid]!==void 0)return e.textures[this.uuid];let n={metadata:{version:4.7,type:`Texture`,generator:`Texture.toJSON`},uuid:this.uuid,name:this.name,image:this.source.toJSON(e).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(n.userData=this.userData),t||(e.textures[this.uuid]=n),n}dispose(){this.dispatchEvent({type:`dispose`})}transformUv(e){if(this.mapping!==300)return e;if(e.applyMatrix3(this.matrix),e.x<0||e.x>1)switch(this.wrapS){case $v:e.x-=Math.floor(e.x);break;case ey:e.x=e.x<0?0:1;break;case ty:Math.abs(Math.floor(e.x)%2)===1?e.x=Math.ceil(e.x)-e.x:e.x-=Math.floor(e.x);break}if(e.y<0||e.y>1)switch(this.wrapT){case $v:e.y-=Math.floor(e.y);break;case ey:e.y=e.y<0?0:1;break;case ty:Math.abs(Math.floor(e.y)%2)===1?e.y=Math.ceil(e.y)-e.y:e.y-=Math.floor(e.y);break}return this.flipY&&(e.y=1-e.y),e}set needsUpdate(e){e===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(e){e===!0&&this.pmremVersion++}};gx.DEFAULT_IMAGE=null,gx.DEFAULT_MAPPING=300,gx.DEFAULT_ANISOTROPY=1;var _x=class e{constructor(t=0,n=0,r=0,i=1){e.prototype.isVector4=!0,this.x=t,this.y=n,this.z=r,this.w=i}get width(){return this.z}set width(e){this.z=e}get height(){return this.w}set height(e){this.w=e}set(e,t,n,r){return this.x=e,this.y=t,this.z=n,this.w=r,this}setScalar(e){return this.x=e,this.y=e,this.z=e,this.w=e,this}setX(e){return this.x=e,this}setY(e){return this.y=e,this}setZ(e){return this.z=e,this}setW(e){return this.w=e,this}setComponent(e,t){switch(e){case 0:this.x=t;break;case 1:this.y=t;break;case 2:this.z=t;break;case 3:this.w=t;break;default:throw Error(`index is out of range: `+e)}return this}getComponent(e){switch(e){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw Error(`index is out of range: `+e)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w===void 0?1:e.w,this}add(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this}addScalar(e){return this.x+=e,this.y+=e,this.z+=e,this.w+=e,this}addVectors(e,t){return this.x=e.x+t.x,this.y=e.y+t.y,this.z=e.z+t.z,this.w=e.w+t.w,this}addScaledVector(e,t){return this.x+=e.x*t,this.y+=e.y*t,this.z+=e.z*t,this.w+=e.w*t,this}sub(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this}subScalar(e){return this.x-=e,this.y-=e,this.z-=e,this.w-=e,this}subVectors(e,t){return this.x=e.x-t.x,this.y=e.y-t.y,this.z=e.z-t.z,this.w=e.w-t.w,this}multiply(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this}multiplyScalar(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this}applyMatrix4(e){let t=this.x,n=this.y,r=this.z,i=this.w,a=e.elements;return this.x=a[0]*t+a[4]*n+a[8]*r+a[12]*i,this.y=a[1]*t+a[5]*n+a[9]*r+a[13]*i,this.z=a[2]*t+a[6]*n+a[10]*r+a[14]*i,this.w=a[3]*t+a[7]*n+a[11]*r+a[15]*i,this}divide(e){return this.x/=e.x,this.y/=e.y,this.z/=e.z,this.w/=e.w,this}divideScalar(e){return this.multiplyScalar(1/e)}setAxisAngleFromQuaternion(e){this.w=2*Math.acos(e.w);let t=Math.sqrt(1-e.w*e.w);return t<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=e.x/t,this.y=e.y/t,this.z=e.z/t),this}setAxisAngleFromRotationMatrix(e){let t,n,r,i,a=.01,o=.1,s=e.elements,c=s[0],l=s[4],u=s[8],d=s[1],f=s[5],p=s[9],m=s[2],h=s[6],g=s[10];if(Math.abs(l-d)s&&e>_?e_?s1;this.dispose()}this.viewport.set(0,0,e,t),this.scissor.set(0,0,e,t)}clone(){return new this.constructor().copy(this)}copy(e){this.width=e.width,this.height=e.height,this.depth=e.depth,this.scissor.copy(e.scissor),this.scissorTest=e.scissorTest,this.viewport.copy(e.viewport),this.textures.length=0;for(let t=0,n=e.textures.length;t=this.min.x&&e.x<=this.max.x&&e.y>=this.min.y&&e.y<=this.max.y&&e.z>=this.min.z&&e.z<=this.max.z}containsBox(e){return this.min.x<=e.min.x&&e.max.x<=this.max.x&&this.min.y<=e.min.y&&e.max.y<=this.max.y&&this.min.z<=e.min.z&&e.max.z<=this.max.z}getParameter(e,t){return t.set((e.x-this.min.x)/(this.max.x-this.min.x),(e.y-this.min.y)/(this.max.y-this.min.y),(e.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(e){return e.max.x>=this.min.x&&e.min.x<=this.max.x&&e.max.y>=this.min.y&&e.min.y<=this.max.y&&e.max.z>=this.min.z&&e.min.z<=this.max.z}intersectsSphere(e){return this.clampPoint(e.center,wx),wx.distanceToSquared(e.center)<=e.radius*e.radius}intersectsPlane(e){let t,n;return e.normal.x>0?(t=e.normal.x*this.min.x,n=e.normal.x*this.max.x):(t=e.normal.x*this.max.x,n=e.normal.x*this.min.x),e.normal.y>0?(t+=e.normal.y*this.min.y,n+=e.normal.y*this.max.y):(t+=e.normal.y*this.max.y,n+=e.normal.y*this.min.y),e.normal.z>0?(t+=e.normal.z*this.min.z,n+=e.normal.z*this.max.z):(t+=e.normal.z*this.max.z,n+=e.normal.z*this.min.z),t<=-e.constant&&n>=-e.constant}intersectsTriangle(e){if(this.isEmpty())return!1;this.getCenter(Mx),Nx.subVectors(this.max,Mx),Ex.subVectors(e.a,Mx),Dx.subVectors(e.b,Mx),Ox.subVectors(e.c,Mx),kx.subVectors(Dx,Ex),Ax.subVectors(Ox,Dx),jx.subVectors(Ex,Ox);let t=[0,-kx.z,kx.y,0,-Ax.z,Ax.y,0,-jx.z,jx.y,kx.z,0,-kx.x,Ax.z,0,-Ax.x,jx.z,0,-jx.x,-kx.y,kx.x,0,-Ax.y,Ax.x,0,-jx.y,jx.x,0];return!Ix(t,Ex,Dx,Ox,Nx)||(t=[1,0,0,0,1,0,0,0,1],!Ix(t,Ex,Dx,Ox,Nx))?!1:(Px.crossVectors(kx,Ax),t=[Px.x,Px.y,Px.z],Ix(t,Ex,Dx,Ox,Nx))}clampPoint(e,t){return t.copy(e).clamp(this.min,this.max)}distanceToPoint(e){return this.clampPoint(e,wx).distanceTo(e)}getBoundingSphere(e){return this.isEmpty()?e.makeEmpty():(this.getCenter(e.center),e.radius=this.getSize(wx).length()*.5),e}intersect(e){return this.min.max(e.min),this.max.min(e.max),this.isEmpty()&&this.makeEmpty(),this}union(e){return this.min.min(e.min),this.max.max(e.max),this}applyMatrix4(e){return this.isEmpty()?this:(Cx[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(e),Cx[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(e),Cx[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(e),Cx[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(e),Cx[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(e),Cx[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(e),Cx[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(e),Cx[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(e),this.setFromPoints(Cx),this)}translate(e){return this.min.add(e),this.max.add(e),this}equals(e){return e.min.equals(this.min)&&e.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(e){return this.min.fromArray(e.min),this.max.fromArray(e.max),this}},Cx=[new J,new J,new J,new J,new J,new J,new J,new J],wx=new J,Tx=new Sx,Ex=new J,Dx=new J,Ox=new J,kx=new J,Ax=new J,jx=new J,Mx=new J,Nx=new J,Px=new J,Fx=new J;function Ix(e,t,n,r,i){for(let a=0,o=e.length-3;a<=o;a+=3){Fx.fromArray(e,a);let o=i.x*Math.abs(Fx.x)+i.y*Math.abs(Fx.y)+i.z*Math.abs(Fx.z),s=t.dot(Fx),c=n.dot(Fx),l=r.dot(Fx);if(Math.max(-Math.max(s,c,l),Math.min(s,c,l))>o)return!1}return!0}var Lx=new Sx,Rx=new J,zx=new J,Bx=class{constructor(e=new J,t=-1){this.isSphere=!0,this.center=e,this.radius=t}set(e,t){return this.center.copy(e),this.radius=t,this}setFromPoints(e,t){let n=this.center;t===void 0?Lx.setFromPoints(e).getCenter(n):n.copy(t);let r=0;for(let t=0,i=e.length;tthis.radius*this.radius&&(t.sub(this.center).normalize(),t.multiplyScalar(this.radius).add(this.center)),t}getBoundingBox(e){return this.isEmpty()?(e.makeEmpty(),e):(e.set(this.center,this.center),e.expandByScalar(this.radius),e)}applyMatrix4(e){return this.center.applyMatrix4(e),this.radius*=e.getMaxScaleOnAxis(),this}translate(e){return this.center.add(e),this}expandByPoint(e){if(this.isEmpty())return this.center.copy(e),this.radius=0,this;Rx.subVectors(e,this.center);let t=Rx.lengthSq();if(t>this.radius*this.radius){let e=Math.sqrt(t),n=(e-this.radius)*.5;this.center.addScaledVector(Rx,n/e),this.radius+=n}return this}union(e){return e.isEmpty()?this:this.isEmpty()?(this.copy(e),this):(this.center.equals(e.center)===!0?this.radius=Math.max(this.radius,e.radius):(zx.subVectors(e.center,this.center).setLength(e.radius),this.expandByPoint(Rx.copy(e.center).add(zx)),this.expandByPoint(Rx.copy(e.center).sub(zx))),this)}equals(e){return e.center.equals(this.center)&&e.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(e){return this.radius=e.radius,this.center.fromArray(e.center),this}},Vx=new J,Hx=new J,Ux=new J,Wx=new J,Gx=new J,Kx=new J,qx=new J,Jx=class{constructor(e=new J,t=new J(0,0,-1)){this.origin=e,this.direction=t}set(e,t){return this.origin.copy(e),this.direction.copy(t),this}copy(e){return this.origin.copy(e.origin),this.direction.copy(e.direction),this}at(e,t){return t.copy(this.origin).addScaledVector(this.direction,e)}lookAt(e){return this.direction.copy(e).sub(this.origin).normalize(),this}recast(e){return this.origin.copy(this.at(e,Vx)),this}closestPointToPoint(e,t){t.subVectors(e,this.origin);let n=t.dot(this.direction);return n<0?t.copy(this.origin):t.copy(this.origin).addScaledVector(this.direction,n)}distanceToPoint(e){return Math.sqrt(this.distanceSqToPoint(e))}distanceSqToPoint(e){let t=Vx.subVectors(e,this.origin).dot(this.direction);return t<0?this.origin.distanceToSquared(e):(Vx.copy(this.origin).addScaledVector(this.direction,t),Vx.distanceToSquared(e))}distanceSqToSegment(e,t,n,r){Hx.copy(e).add(t).multiplyScalar(.5),Ux.copy(t).sub(e).normalize(),Wx.copy(this.origin).sub(Hx);let i=e.distanceTo(t)*.5,a=-this.direction.dot(Ux),o=Wx.dot(this.direction),s=-Wx.dot(Ux),c=Wx.lengthSq(),l=Math.abs(1-a*a),u,d,f,p;if(l>0)if(u=a*s-o,d=a*o-s,p=i*l,u>=0)if(d>=-p)if(d<=p){let e=1/l;u*=e,d*=e,f=u*(u+a*d+2*o)+d*(a*u+d+2*s)+c}else d=i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d=-i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;else d<=-p?(u=Math.max(0,-(-a*i+o)),d=u>0?-i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c):d<=p?(u=0,d=Math.min(Math.max(-i,-s),i),f=d*(d+2*s)+c):(u=Math.max(0,-(a*i+o)),d=u>0?i:Math.min(Math.max(-i,-s),i),f=-u*u+d*(d+2*s)+c);else d=a>0?-i:i,u=Math.max(0,-(a*d+o)),f=-u*u+d*(d+2*s)+c;return n&&n.copy(this.origin).addScaledVector(this.direction,u),r&&r.copy(Hx).addScaledVector(Ux,d),f}intersectSphere(e,t){Vx.subVectors(e.center,this.origin);let n=Vx.dot(this.direction),r=Vx.dot(Vx)-n*n,i=e.radius*e.radius;if(r>i)return null;let a=Math.sqrt(i-r),o=n-a,s=n+a;return s<0?null:o<0?this.at(s,t):this.at(o,t)}intersectsSphere(e){return e.radius<0?!1:this.distanceSqToPoint(e.center)<=e.radius*e.radius}distanceToPlane(e){let t=e.normal.dot(this.direction);if(t===0)return e.distanceToPoint(this.origin)===0?0:null;let n=-(this.origin.dot(e.normal)+e.constant)/t;return n>=0?n:null}intersectPlane(e,t){let n=this.distanceToPlane(e);return n===null?null:this.at(n,t)}intersectsPlane(e){let t=e.distanceToPoint(this.origin);return t===0||e.normal.dot(this.direction)*t<0}intersectBox(e,t){let n,r,i,a,o,s,c=1/this.direction.x,l=1/this.direction.y,u=1/this.direction.z,d=this.origin;return c>=0?(n=(e.min.x-d.x)*c,r=(e.max.x-d.x)*c):(n=(e.max.x-d.x)*c,r=(e.min.x-d.x)*c),l>=0?(i=(e.min.y-d.y)*l,a=(e.max.y-d.y)*l):(i=(e.max.y-d.y)*l,a=(e.min.y-d.y)*l),n>a||i>r||((i>n||isNaN(n))&&(n=i),(a=0?(o=(e.min.z-d.z)*u,s=(e.max.z-d.z)*u):(o=(e.max.z-d.z)*u,s=(e.min.z-d.z)*u),n>s||o>r)||((o>n||n!==n)&&(n=o),(s=0?n:r,t)}intersectsBox(e){return this.intersectBox(e,Vx)!==null}intersectTriangle(e,t,n,r,i){Gx.subVectors(t,e),Kx.subVectors(n,e),qx.crossVectors(Gx,Kx);let a=this.direction.dot(qx),o;if(a>0){if(r)return null;o=1}else if(a<0)o=-1,a=-a;else return null;Wx.subVectors(this.origin,e);let s=o*this.direction.dot(Kx.crossVectors(Wx,Kx));if(s<0)return null;let c=o*this.direction.dot(Gx.cross(Wx));if(c<0||s+c>a)return null;let l=-o*Wx.dot(qx);return l<0?null:this.at(l/a,i)}applyMatrix4(e){return this.origin.applyMatrix4(e),this.direction.transformDirection(e),this}equals(e){return e.origin.equals(this.origin)&&e.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}},Y=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g){e.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],t!==void 0&&this.set(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g)}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){let g=this.elements;return g[0]=e,g[4]=t,g[8]=n,g[12]=r,g[1]=i,g[5]=a,g[9]=o,g[13]=s,g[2]=c,g[6]=l,g[10]=u,g[14]=d,g[3]=f,g[7]=p,g[11]=m,g[15]=h,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new e().fromArray(this.elements)}copy(e){let t=this.elements,n=e.elements;return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],this}copyPosition(e){let t=this.elements,n=e.elements;return t[12]=n[12],t[13]=n[13],t[14]=n[14],this}setFromMatrix3(e){let t=e.elements;return this.set(t[0],t[3],t[6],0,t[1],t[4],t[7],0,t[2],t[5],t[8],0,0,0,0,1),this}extractBasis(e,t,n){return e.setFromMatrixColumn(this,0),t.setFromMatrixColumn(this,1),n.setFromMatrixColumn(this,2),this}makeBasis(e,t,n){return this.set(e.x,t.x,n.x,0,e.y,t.y,n.y,0,e.z,t.z,n.z,0,0,0,0,1),this}extractRotation(e){let t=this.elements,n=e.elements,r=1/Yx.setFromMatrixColumn(e,0).length(),i=1/Yx.setFromMatrixColumn(e,1).length(),a=1/Yx.setFromMatrixColumn(e,2).length();return t[0]=n[0]*r,t[1]=n[1]*r,t[2]=n[2]*r,t[3]=0,t[4]=n[4]*i,t[5]=n[5]*i,t[6]=n[6]*i,t[7]=0,t[8]=n[8]*a,t[9]=n[9]*a,t[10]=n[10]*a,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromEuler(e){let t=this.elements,n=e.x,r=e.y,i=e.z,a=Math.cos(n),o=Math.sin(n),s=Math.cos(r),c=Math.sin(r),l=Math.cos(i),u=Math.sin(i);if(e.order===`XYZ`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=-s*u,t[8]=c,t[1]=n+r*c,t[5]=e-i*c,t[9]=-o*s,t[2]=i-e*c,t[6]=r+n*c,t[10]=a*s}else if(e.order===`YXZ`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e+i*o,t[4]=r*o-n,t[8]=a*c,t[1]=a*u,t[5]=a*l,t[9]=-o,t[2]=n*o-r,t[6]=i+e*o,t[10]=a*s}else if(e.order===`ZXY`){let e=s*l,n=s*u,r=c*l,i=c*u;t[0]=e-i*o,t[4]=-a*u,t[8]=r+n*o,t[1]=n+r*o,t[5]=a*l,t[9]=i-e*o,t[2]=-a*c,t[6]=o,t[10]=a*s}else if(e.order===`ZYX`){let e=a*l,n=a*u,r=o*l,i=o*u;t[0]=s*l,t[4]=r*c-n,t[8]=e*c+i,t[1]=s*u,t[5]=i*c+e,t[9]=n*c-r,t[2]=-c,t[6]=o*s,t[10]=a*s}else if(e.order===`YZX`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=i-e*u,t[8]=r*u+n,t[1]=u,t[5]=a*l,t[9]=-o*l,t[2]=-c*l,t[6]=n*u+r,t[10]=e-i*u}else if(e.order===`XZY`){let e=a*s,n=a*c,r=o*s,i=o*c;t[0]=s*l,t[4]=-u,t[8]=c*l,t[1]=e*u+i,t[5]=a*l,t[9]=n*u-r,t[2]=r*u-n,t[6]=o*l,t[10]=i*u+e}return t[3]=0,t[7]=0,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this}makeRotationFromQuaternion(e){return this.compose(Zx,e,Qx)}lookAt(e,t,n){let r=this.elements;return tS.subVectors(e,t),tS.lengthSq()===0&&(tS.z=1),tS.normalize(),$x.crossVectors(n,tS),$x.lengthSq()===0&&(Math.abs(n.z)===1?tS.x+=1e-4:tS.z+=1e-4,tS.normalize(),$x.crossVectors(n,tS)),$x.normalize(),eS.crossVectors(tS,$x),r[0]=$x.x,r[4]=eS.x,r[8]=tS.x,r[1]=$x.y,r[5]=eS.y,r[9]=tS.y,r[2]=$x.z,r[6]=eS.z,r[10]=tS.z,this}multiply(e){return this.multiplyMatrices(this,e)}premultiply(e){return this.multiplyMatrices(e,this)}multiplyMatrices(e,t){let n=e.elements,r=t.elements,i=this.elements,a=n[0],o=n[4],s=n[8],c=n[12],l=n[1],u=n[5],d=n[9],f=n[13],p=n[2],m=n[6],h=n[10],g=n[14],_=n[3],v=n[7],y=n[11],b=n[15],x=r[0],S=r[4],C=r[8],w=r[12],T=r[1],E=r[5],D=r[9],O=r[13],k=r[2],A=r[6],j=r[10],M=r[14],N=r[3],P=r[7],F=r[11],I=r[15];return i[0]=a*x+o*T+s*k+c*N,i[4]=a*S+o*E+s*A+c*P,i[8]=a*C+o*D+s*j+c*F,i[12]=a*w+o*O+s*M+c*I,i[1]=l*x+u*T+d*k+f*N,i[5]=l*S+u*E+d*A+f*P,i[9]=l*C+u*D+d*j+f*F,i[13]=l*w+u*O+d*M+f*I,i[2]=p*x+m*T+h*k+g*N,i[6]=p*S+m*E+h*A+g*P,i[10]=p*C+m*D+h*j+g*F,i[14]=p*w+m*O+h*M+g*I,i[3]=_*x+v*T+y*k+b*N,i[7]=_*S+v*E+y*A+b*P,i[11]=_*C+v*D+y*j+b*F,i[15]=_*w+v*O+y*M+b*I,this}multiplyScalar(e){let t=this.elements;return t[0]*=e,t[4]*=e,t[8]*=e,t[12]*=e,t[1]*=e,t[5]*=e,t[9]*=e,t[13]*=e,t[2]*=e,t[6]*=e,t[10]*=e,t[14]*=e,t[3]*=e,t[7]*=e,t[11]*=e,t[15]*=e,this}determinant(){let e=this.elements,t=e[0],n=e[4],r=e[8],i=e[12],a=e[1],o=e[5],s=e[9],c=e[13],l=e[2],u=e[6],d=e[10],f=e[14],p=e[3],m=e[7],h=e[11],g=e[15];return p*(+i*s*u-r*c*u-i*o*d+n*c*d+r*o*f-n*s*f)+m*(+t*s*f-t*c*d+i*a*d-r*a*f+r*c*l-i*s*l)+h*(+t*c*u-t*o*f-i*a*u+n*a*f+i*o*l-n*c*l)+g*(-r*o*l-t*s*u+t*o*d+r*a*u-n*a*d+n*s*l)}transpose(){let e=this.elements,t;return t=e[1],e[1]=e[4],e[4]=t,t=e[2],e[2]=e[8],e[8]=t,t=e[6],e[6]=e[9],e[9]=t,t=e[3],e[3]=e[12],e[12]=t,t=e[7],e[7]=e[13],e[13]=t,t=e[11],e[11]=e[14],e[14]=t,this}setPosition(e,t,n){let r=this.elements;return e.isVector3?(r[12]=e.x,r[13]=e.y,r[14]=e.z):(r[12]=e,r[13]=t,r[14]=n),this}invert(){let e=this.elements,t=e[0],n=e[1],r=e[2],i=e[3],a=e[4],o=e[5],s=e[6],c=e[7],l=e[8],u=e[9],d=e[10],f=e[11],p=e[12],m=e[13],h=e[14],g=e[15],_=u*h*c-m*d*c+m*s*f-o*h*f-u*s*g+o*d*g,v=p*d*c-l*h*c-p*s*f+a*h*f+l*s*g-a*d*g,y=l*m*c-p*u*c+p*o*f-a*m*f-l*o*g+a*u*g,b=p*u*s-l*m*s-p*o*d+a*m*d+l*o*h-a*u*h,x=t*_+n*v+r*y+i*b;if(x===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);let S=1/x;return e[0]=_*S,e[1]=(m*d*i-u*h*i-m*r*f+n*h*f+u*r*g-n*d*g)*S,e[2]=(o*h*i-m*s*i+m*r*c-n*h*c-o*r*g+n*s*g)*S,e[3]=(u*s*i-o*d*i-u*r*c+n*d*c+o*r*f-n*s*f)*S,e[4]=v*S,e[5]=(l*h*i-p*d*i+p*r*f-t*h*f-l*r*g+t*d*g)*S,e[6]=(p*s*i-a*h*i-p*r*c+t*h*c+a*r*g-t*s*g)*S,e[7]=(a*d*i-l*s*i+l*r*c-t*d*c-a*r*f+t*s*f)*S,e[8]=y*S,e[9]=(p*u*i-l*m*i-p*n*f+t*m*f+l*n*g-t*u*g)*S,e[10]=(a*m*i-p*o*i+p*n*c-t*m*c-a*n*g+t*o*g)*S,e[11]=(l*o*i-a*u*i-l*n*c+t*u*c+a*n*f-t*o*f)*S,e[12]=b*S,e[13]=(l*m*r-p*u*r+p*n*d-t*m*d-l*n*h+t*u*h)*S,e[14]=(p*o*r-a*m*r-p*n*s+t*m*s+a*n*h-t*o*h)*S,e[15]=(a*u*r-l*o*r+l*n*s-t*u*s-a*n*d+t*o*d)*S,this}scale(e){let t=this.elements,n=e.x,r=e.y,i=e.z;return t[0]*=n,t[4]*=r,t[8]*=i,t[1]*=n,t[5]*=r,t[9]*=i,t[2]*=n,t[6]*=r,t[10]*=i,t[3]*=n,t[7]*=r,t[11]*=i,this}getMaxScaleOnAxis(){let e=this.elements,t=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],n=e[4]*e[4]+e[5]*e[5]+e[6]*e[6],r=e[8]*e[8]+e[9]*e[9]+e[10]*e[10];return Math.sqrt(Math.max(t,n,r))}makeTranslation(e,t,n){return e.isVector3?this.set(1,0,0,e.x,0,1,0,e.y,0,0,1,e.z,0,0,0,1):this.set(1,0,0,e,0,1,0,t,0,0,1,n,0,0,0,1),this}makeRotationX(e){let t=Math.cos(e),n=Math.sin(e);return this.set(1,0,0,0,0,t,-n,0,0,n,t,0,0,0,0,1),this}makeRotationY(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,0,n,0,0,1,0,0,-n,0,t,0,0,0,0,1),this}makeRotationZ(e){let t=Math.cos(e),n=Math.sin(e);return this.set(t,-n,0,0,n,t,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(e,t){let n=Math.cos(t),r=Math.sin(t),i=1-n,a=e.x,o=e.y,s=e.z,c=i*a,l=i*o;return this.set(c*a+n,c*o-r*s,c*s+r*o,0,c*o+r*s,l*o+n,l*s-r*a,0,c*s-r*o,l*s+r*a,i*s*s+n,0,0,0,0,1),this}makeScale(e,t,n){return this.set(e,0,0,0,0,t,0,0,0,0,n,0,0,0,0,1),this}makeShear(e,t,n,r,i,a){return this.set(1,n,i,0,e,1,a,0,t,r,1,0,0,0,0,1),this}compose(e,t,n){let r=this.elements,i=t._x,a=t._y,o=t._z,s=t._w,c=i+i,l=a+a,u=o+o,d=i*c,f=i*l,p=i*u,m=a*l,h=a*u,g=o*u,_=s*c,v=s*l,y=s*u,b=n.x,x=n.y,S=n.z;return r[0]=(1-(m+g))*b,r[1]=(f+y)*b,r[2]=(p-v)*b,r[3]=0,r[4]=(f-y)*x,r[5]=(1-(d+g))*x,r[6]=(h+_)*x,r[7]=0,r[8]=(p+v)*S,r[9]=(h-_)*S,r[10]=(1-(d+m))*S,r[11]=0,r[12]=e.x,r[13]=e.y,r[14]=e.z,r[15]=1,this}decompose(e,t,n){let r=this.elements,i=Yx.set(r[0],r[1],r[2]).length(),a=Yx.set(r[4],r[5],r[6]).length(),o=Yx.set(r[8],r[9],r[10]).length();this.determinant()<0&&(i=-i),e.x=r[12],e.y=r[13],e.z=r[14],Xx.copy(this);let s=1/i,c=1/a,l=1/o;return Xx.elements[0]*=s,Xx.elements[1]*=s,Xx.elements[2]*=s,Xx.elements[4]*=c,Xx.elements[5]*=c,Xx.elements[6]*=c,Xx.elements[8]*=l,Xx.elements[9]*=l,Xx.elements[10]*=l,t.setFromRotationMatrix(Xx),n.x=i,n.y=a,n.z=o,this}makePerspective(e,t,n,r,i,a,o=xb){let s=this.elements,c=2*i/(t-e),l=2*i/(n-r),u=(t+e)/(t-e),d=(n+r)/(n-r),f,p;if(o===2e3)f=-(a+i)/(a-i),p=-2*a*i/(a-i);else if(o===2001)f=-a/(a-i),p=-a*i/(a-i);else throw Error(`THREE.Matrix4.makePerspective(): Invalid coordinate system: `+o);return s[0]=c,s[4]=0,s[8]=u,s[12]=0,s[1]=0,s[5]=l,s[9]=d,s[13]=0,s[2]=0,s[6]=0,s[10]=f,s[14]=p,s[3]=0,s[7]=0,s[11]=-1,s[15]=0,this}makeOrthographic(e,t,n,r,i,a,o=xb){let s=this.elements,c=1/(t-e),l=1/(n-r),u=1/(a-i),d=(t+e)*c,f=(n+r)*l,p,m;if(o===2e3)p=(a+i)*u,m=-2*u;else if(o===2001)p=i*u,m=-1*u;else throw Error(`THREE.Matrix4.makeOrthographic(): Invalid coordinate system: `+o);return s[0]=2*c,s[4]=0,s[8]=0,s[12]=-d,s[1]=0,s[5]=2*l,s[9]=0,s[13]=-f,s[2]=0,s[6]=0,s[10]=m,s[14]=-p,s[3]=0,s[7]=0,s[11]=0,s[15]=1,this}equals(e){let t=this.elements,n=e.elements;for(let e=0;e<16;e++)if(t[e]!==n[e])return!1;return!0}fromArray(e,t=0){for(let n=0;n<16;n++)this.elements[n]=e[n+t];return this}toArray(e=[],t=0){let n=this.elements;return e[t]=n[0],e[t+1]=n[1],e[t+2]=n[2],e[t+3]=n[3],e[t+4]=n[4],e[t+5]=n[5],e[t+6]=n[6],e[t+7]=n[7],e[t+8]=n[8],e[t+9]=n[9],e[t+10]=n[10],e[t+11]=n[11],e[t+12]=n[12],e[t+13]=n[13],e[t+14]=n[14],e[t+15]=n[15],e}},Yx=new J,Xx=new Y,Zx=new J(0,0,0),Qx=new J(1,1,1),$x=new J,eS=new J,tS=new J,nS=new Y,rS=new Wb,iS=class e{constructor(t=0,n=0,r=0,i=e.DEFAULT_ORDER){this.isEuler=!0,this._x=t,this._y=n,this._z=r,this._order=i}get x(){return this._x}set x(e){this._x=e,this._onChangeCallback()}get y(){return this._y}set y(e){this._y=e,this._onChangeCallback()}get z(){return this._z}set z(e){this._z=e,this._onChangeCallback()}get order(){return this._order}set order(e){this._order=e,this._onChangeCallback()}set(e,t,n,r=this._order){return this._x=e,this._y=t,this._z=n,this._order=r,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(e){return this._x=e._x,this._y=e._y,this._z=e._z,this._order=e._order,this._onChangeCallback(),this}setFromRotationMatrix(e,t=this._order,n=!0){let r=e.elements,i=r[0],a=r[4],o=r[8],s=r[1],c=r[5],l=r[9],u=r[2],d=r[6],f=r[10];switch(t){case`XYZ`:this._y=Math.asin(Ob(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-l,f),this._z=Math.atan2(-a,i)):(this._x=Math.atan2(d,c),this._z=0);break;case`YXZ`:this._x=Math.asin(-Ob(l,-1,1)),Math.abs(l)<.9999999?(this._y=Math.atan2(o,f),this._z=Math.atan2(s,c)):(this._y=Math.atan2(-u,i),this._z=0);break;case`ZXY`:this._x=Math.asin(Ob(d,-1,1)),Math.abs(d)<.9999999?(this._y=Math.atan2(-u,f),this._z=Math.atan2(-a,c)):(this._y=0,this._z=Math.atan2(s,i));break;case`ZYX`:this._y=Math.asin(-Ob(u,-1,1)),Math.abs(u)<.9999999?(this._x=Math.atan2(d,f),this._z=Math.atan2(s,i)):(this._x=0,this._z=Math.atan2(-a,c));break;case`YZX`:this._z=Math.asin(Ob(s,-1,1)),Math.abs(s)<.9999999?(this._x=Math.atan2(-l,c),this._y=Math.atan2(-u,i)):(this._x=0,this._y=Math.atan2(o,f));break;case`XZY`:this._z=Math.asin(-Ob(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(d,c),this._y=Math.atan2(o,i)):(this._x=Math.atan2(-l,f),this._y=0);break;default:console.warn(`THREE.Euler: .setFromRotationMatrix() encountered an unknown order: `+t)}return this._order=t,n===!0&&this._onChangeCallback(),this}setFromQuaternion(e,t,n){return nS.makeRotationFromQuaternion(e),this.setFromRotationMatrix(nS,t,n)}setFromVector3(e,t=this._order){return this.set(e.x,e.y,e.z,t)}reorder(e){return rS.setFromEuler(this),this.setFromQuaternion(rS,e)}equals(e){return e._x===this._x&&e._y===this._y&&e._z===this._z&&e._order===this._order}fromArray(e){return this._x=e[0],this._y=e[1],this._z=e[2],e[3]!==void 0&&(this._order=e[3]),this._onChangeCallback(),this}toArray(e=[],t=0){return e[t]=this._x,e[t+1]=this._y,e[t+2]=this._z,e[t+3]=this._order,e}_onChange(e){return this._onChangeCallback=e,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}};iS.DEFAULT_ORDER=`XYZ`;var aS=class{constructor(){this.mask=1}set(e){this.mask=(1<>>0}enable(e){this.mask|=1<1){for(let e=0;e1){for(let e=0;e0&&(r.userData=this.userData),r.layers=this.layers.mask,r.matrix=this.matrix.toArray(),r.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(r.matrixAutoUpdate=!1),this.isInstancedMesh&&(r.type=`InstancedMesh`,r.count=this.count,r.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(r.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(r.type=`BatchedMesh`,r.perObjectFrustumCulled=this.perObjectFrustumCulled,r.sortObjects=this.sortObjects,r.drawRanges=this._drawRanges,r.reservedRanges=this._reservedRanges,r.geometryInfo=this._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox?e.boundingBox.toJSON():void 0,boundingSphere:e.boundingSphere?e.boundingSphere.toJSON():void 0})),r.instanceInfo=this._instanceInfo.map(e=>({...e})),r.availableInstanceIds=this._availableInstanceIds.slice(),r.availableGeometryIds=this._availableGeometryIds.slice(),r.nextIndexStart=this._nextIndexStart,r.nextVertexStart=this._nextVertexStart,r.geometryCount=this._geometryCount,r.maxInstanceCount=this._maxInstanceCount,r.maxVertexCount=this._maxVertexCount,r.maxIndexCount=this._maxIndexCount,r.geometryInitialized=this._geometryInitialized,r.matricesTexture=this._matricesTexture.toJSON(e),r.indirectTexture=this._indirectTexture.toJSON(e),this._colorsTexture!==null&&(r.colorsTexture=this._colorsTexture.toJSON(e)),this.boundingSphere!==null&&(r.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(r.boundingBox=this.boundingBox.toJSON()));function i(t,n){return t[n.uuid]===void 0&&(t[n.uuid]=n.toJSON(e)),n.uuid}if(this.isScene)this.background&&(this.background.isColor?r.background=this.background.toJSON():this.background.isTexture&&(r.background=this.background.toJSON(e).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(r.environment=this.environment.toJSON(e).uuid);else if(this.isMesh||this.isLine||this.isPoints){r.geometry=i(e.geometries,this.geometry);let t=this.geometry.parameters;if(t!==void 0&&t.shapes!==void 0){let n=t.shapes;if(Array.isArray(n))for(let t=0,r=n.length;t0){r.children=[];for(let t=0;t0){r.animations=[];for(let t=0;t0&&(n.geometries=t),r.length>0&&(n.materials=r),i.length>0&&(n.textures=i),o.length>0&&(n.images=o),s.length>0&&(n.shapes=s),c.length>0&&(n.skeletons=c),l.length>0&&(n.animations=l),u.length>0&&(n.nodes=u)}return n.object=r,n;function a(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}}clone(e){return new this.constructor().copy(this,e)}copy(e,t=!0){if(this.name=e.name,this.up.copy(e.up),this.position.copy(e.position),this.rotation.order=e.rotation.order,this.quaternion.copy(e.quaternion),this.scale.copy(e.scale),this.matrix.copy(e.matrix),this.matrixWorld.copy(e.matrixWorld),this.matrixAutoUpdate=e.matrixAutoUpdate,this.matrixWorldAutoUpdate=e.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=e.matrixWorldNeedsUpdate,this.layers.mask=e.layers.mask,this.visible=e.visible,this.castShadow=e.castShadow,this.receiveShadow=e.receiveShadow,this.frustumCulled=e.frustumCulled,this.renderOrder=e.renderOrder,this.animations=e.animations.slice(),this.userData=JSON.parse(JSON.stringify(e.userData)),t===!0)for(let t=0;t0?r.multiplyScalar(1/Math.sqrt(i)):r.set(0,0,0)}static getBarycoord(e,t,n,r,i){SS.subVectors(r,t),CS.subVectors(n,t),wS.subVectors(e,t);let a=SS.dot(SS),o=SS.dot(CS),s=SS.dot(wS),c=CS.dot(CS),l=CS.dot(wS),u=a*c-o*o;if(u===0)return i.set(0,0,0),null;let d=1/u,f=(c*s-o*l)*d,p=(a*l-o*s)*d;return i.set(1-f-p,p,f)}static containsPoint(e,t,n,r){return this.getBarycoord(e,t,n,r,TS)===null?!1:TS.x>=0&&TS.y>=0&&TS.x+TS.y<=1}static getInterpolation(e,t,n,r,i,a,o,s){return this.getBarycoord(e,t,n,r,TS)===null?(s.x=0,s.y=0,`z`in s&&(s.z=0),`w`in s&&(s.w=0),null):(s.setScalar(0),s.addScaledVector(i,TS.x),s.addScaledVector(a,TS.y),s.addScaledVector(o,TS.z),s)}static getInterpolatedAttribute(e,t,n,r,i,a){return MS.setScalar(0),NS.setScalar(0),PS.setScalar(0),MS.fromBufferAttribute(e,t),NS.fromBufferAttribute(e,n),PS.fromBufferAttribute(e,r),a.setScalar(0),a.addScaledVector(MS,i.x),a.addScaledVector(NS,i.y),a.addScaledVector(PS,i.z),a}static isFrontFacing(e,t,n,r){return SS.subVectors(n,t),CS.subVectors(e,t),SS.cross(CS).dot(r)<0}set(e,t,n){return this.a.copy(e),this.b.copy(t),this.c.copy(n),this}setFromPointsAndIndices(e,t,n,r){return this.a.copy(e[t]),this.b.copy(e[n]),this.c.copy(e[r]),this}setFromAttributeAndIndices(e,t,n,r){return this.a.fromBufferAttribute(e,t),this.b.fromBufferAttribute(e,n),this.c.fromBufferAttribute(e,r),this}clone(){return new this.constructor().copy(this)}copy(e){return this.a.copy(e.a),this.b.copy(e.b),this.c.copy(e.c),this}getArea(){return SS.subVectors(this.c,this.b),CS.subVectors(this.a,this.b),SS.cross(CS).length()*.5}getMidpoint(e){return e.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(t){return e.getNormal(this.a,this.b,this.c,t)}getPlane(e){return e.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(t,n){return e.getBarycoord(t,this.a,this.b,this.c,n)}getInterpolation(t,n,r,i,a){return e.getInterpolation(t,this.a,this.b,this.c,n,r,i,a)}containsPoint(t){return e.containsPoint(t,this.a,this.b,this.c)}isFrontFacing(t){return e.isFrontFacing(this.a,this.b,this.c,t)}intersectsBox(e){return e.intersectsTriangle(this)}closestPointToPoint(e,t){let n=this.a,r=this.b,i=this.c,a,o;ES.subVectors(r,n),DS.subVectors(i,n),kS.subVectors(e,n);let s=ES.dot(kS),c=DS.dot(kS);if(s<=0&&c<=0)return t.copy(n);AS.subVectors(e,r);let l=ES.dot(AS),u=DS.dot(AS);if(l>=0&&u<=l)return t.copy(r);let d=s*u-l*c;if(d<=0&&s>=0&&l<=0)return a=s/(s-l),t.copy(n).addScaledVector(ES,a);jS.subVectors(e,i);let f=ES.dot(jS),p=DS.dot(jS);if(p>=0&&f<=p)return t.copy(i);let m=f*c-s*p;if(m<=0&&c>=0&&p<=0)return o=c/(c-p),t.copy(n).addScaledVector(DS,o);let h=l*p-f*u;if(h<=0&&u-l>=0&&f-p>=0)return OS.subVectors(i,r),o=(u-l)/(u-l+(f-p)),t.copy(r).addScaledVector(OS,o);let g=1/(h+m+d);return a=m*g,o=d*g,t.copy(n).addScaledVector(ES,a).addScaledVector(DS,o)}equals(e){return e.a.equals(this.a)&&e.b.equals(this.b)&&e.c.equals(this.c)}},IS={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},LS={h:0,s:0,l:0},RS={h:0,s:0,l:0};function zS(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*6*(2/3-n):e}var X=class{constructor(e,t,n){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(e,t,n)}set(e,t,n){if(t===void 0&&n===void 0){let t=e;t&&t.isColor?this.copy(t):typeof t==`number`?this.setHex(t):typeof t==`string`&&this.setStyle(t)}else this.setRGB(e,t,n);return this}setScalar(e){return this.r=e,this.g=e,this.b=e,this}setHex(e,t=hb){return e=Math.floor(e),this.r=(e>>16&255)/255,this.g=(e>>8&255)/255,this.b=(e&255)/255,ox.colorSpaceToWorking(this,t),this}setRGB(e,t,n,r=ox.workingColorSpace){return this.r=e,this.g=t,this.b=n,ox.colorSpaceToWorking(this,r),this}setHSL(e,t,n,r=ox.workingColorSpace){if(e=kb(e,1),t=Ob(t,0,1),n=Ob(n,0,1),t===0)this.r=this.g=this.b=n;else{let r=n<=.5?n*(1+t):n+t-n*t,i=2*n-r;this.r=zS(i,r,e+1/3),this.g=zS(i,r,e),this.b=zS(i,r,e-1/3)}return ox.colorSpaceToWorking(this,r),this}setStyle(e,t=hb){function n(t){t!==void 0&&parseFloat(t)<1&&console.warn(`THREE.Color: Alpha component of `+e+` will be ignored.`)}let r;if(r=/^(\w+)\(([^\)]*)\)/.exec(e)){let i,a=r[1],o=r[2];switch(a){case`rgb`:case`rgba`:if(i=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(255,parseInt(i[1],10))/255,Math.min(255,parseInt(i[2],10))/255,Math.min(255,parseInt(i[3],10))/255,t);if(i=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setRGB(Math.min(100,parseInt(i[1],10))/100,Math.min(100,parseInt(i[2],10))/100,Math.min(100,parseInt(i[3],10))/100,t);break;case`hsl`:case`hsla`:if(i=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return n(i[4]),this.setHSL(parseFloat(i[1])/360,parseFloat(i[2])/100,parseFloat(i[3])/100,t);break;default:console.warn(`THREE.Color: Unknown color model `+e)}}else if(r=/^\#([A-Fa-f\d]+)$/.exec(e)){let n=r[1],i=n.length;if(i===3)return this.setRGB(parseInt(n.charAt(0),16)/15,parseInt(n.charAt(1),16)/15,parseInt(n.charAt(2),16)/15,t);if(i===6)return this.setHex(parseInt(n,16),t);console.warn(`THREE.Color: Invalid hex color `+e)}else if(e&&e.length>0)return this.setColorName(e,t);return this}setColorName(e,t=hb){let n=IS[e.toLowerCase()];return n===void 0?console.warn(`THREE.Color: Unknown color `+e):this.setHex(n,t),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(e){return this.r=e.r,this.g=e.g,this.b=e.b,this}copySRGBToLinear(e){return this.r=sx(e.r),this.g=sx(e.g),this.b=sx(e.b),this}copyLinearToSRGB(e){return this.r=cx(e.r),this.g=cx(e.g),this.b=cx(e.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(e=hb){return ox.workingToColorSpace(BS.copy(this),e),Math.round(Ob(BS.r*255,0,255))*65536+Math.round(Ob(BS.g*255,0,255))*256+Math.round(Ob(BS.b*255,0,255))}getHexString(e=hb){return(`000000`+this.getHex(e).toString(16)).slice(-6)}getHSL(e,t=ox.workingColorSpace){ox.workingToColorSpace(BS.copy(this),t);let n=BS.r,r=BS.g,i=BS.b,a=Math.max(n,r,i),o=Math.min(n,r,i),s,c,l=(o+a)/2;if(o===a)s=0,c=0;else{let e=a-o;switch(c=l<=.5?e/(a+o):e/(2-a-o),a){case n:s=(r-i)/e+(r0!=e>0&&this.version++,this._alphaTest=e}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(e){if(e!==void 0)for(let t in e){let n=e[t];if(n===void 0){console.warn(`THREE.Material: parameter '${t}' has value of undefined.`);continue}let r=this[t];if(r===void 0){console.warn(`THREE.Material: '${t}' is not a property of THREE.${this.type}.`);continue}r&&r.isColor?r.set(n):r&&r.isVector3&&n&&n.isVector3?r.copy(n):this[t]=n}}toJSON(e){let t=e===void 0||typeof e==`string`;t&&(e={textures:{},images:{}});let n={metadata:{version:4.7,type:`Material`,generator:`Material.toJSON`}};n.uuid=this.uuid,n.type=this.type,this.name!==``&&(n.name=this.name),this.color&&this.color.isColor&&(n.color=this.color.getHex()),this.roughness!==void 0&&(n.roughness=this.roughness),this.metalness!==void 0&&(n.metalness=this.metalness),this.sheen!==void 0&&(n.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(n.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(n.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(n.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(n.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(n.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(n.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(n.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(n.shininess=this.shininess),this.clearcoat!==void 0&&(n.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(n.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(n.clearcoatMap=this.clearcoatMap.toJSON(e).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(n.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(e).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(n.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(e).uuid,n.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.dispersion!==void 0&&(n.dispersion=this.dispersion),this.iridescence!==void 0&&(n.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(n.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(n.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(n.iridescenceMap=this.iridescenceMap.toJSON(e).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(n.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(e).uuid),this.anisotropy!==void 0&&(n.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(n.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(n.anisotropyMap=this.anisotropyMap.toJSON(e).uuid),this.map&&this.map.isTexture&&(n.map=this.map.toJSON(e).uuid),this.matcap&&this.matcap.isTexture&&(n.matcap=this.matcap.toJSON(e).uuid),this.alphaMap&&this.alphaMap.isTexture&&(n.alphaMap=this.alphaMap.toJSON(e).uuid),this.lightMap&&this.lightMap.isTexture&&(n.lightMap=this.lightMap.toJSON(e).uuid,n.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(n.aoMap=this.aoMap.toJSON(e).uuid,n.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(n.bumpMap=this.bumpMap.toJSON(e).uuid,n.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(n.normalMap=this.normalMap.toJSON(e).uuid,n.normalMapType=this.normalMapType,n.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(n.displacementMap=this.displacementMap.toJSON(e).uuid,n.displacementScale=this.displacementScale,n.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(n.roughnessMap=this.roughnessMap.toJSON(e).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(n.metalnessMap=this.metalnessMap.toJSON(e).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(n.emissiveMap=this.emissiveMap.toJSON(e).uuid),this.specularMap&&this.specularMap.isTexture&&(n.specularMap=this.specularMap.toJSON(e).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(n.specularIntensityMap=this.specularIntensityMap.toJSON(e).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(n.specularColorMap=this.specularColorMap.toJSON(e).uuid),this.envMap&&this.envMap.isTexture&&(n.envMap=this.envMap.toJSON(e).uuid,this.combine!==void 0&&(n.combine=this.combine)),this.envMapRotation!==void 0&&(n.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(n.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(n.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(n.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(n.gradientMap=this.gradientMap.toJSON(e).uuid),this.transmission!==void 0&&(n.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(n.transmissionMap=this.transmissionMap.toJSON(e).uuid),this.thickness!==void 0&&(n.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(n.thicknessMap=this.thicknessMap.toJSON(e).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(n.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(n.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(n.size=this.size),this.shadowSide!==null&&(n.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(n.sizeAttenuation=this.sizeAttenuation),this.blending!==1&&(n.blending=this.blending),this.side!==0&&(n.side=this.side),this.vertexColors===!0&&(n.vertexColors=!0),this.opacity<1&&(n.opacity=this.opacity),this.transparent===!0&&(n.transparent=!0),this.blendSrc!==204&&(n.blendSrc=this.blendSrc),this.blendDst!==205&&(n.blendDst=this.blendDst),this.blendEquation!==100&&(n.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(n.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(n.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(n.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(n.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(n.blendAlpha=this.blendAlpha),this.depthFunc!==3&&(n.depthFunc=this.depthFunc),this.depthTest===!1&&(n.depthTest=this.depthTest),this.depthWrite===!1&&(n.depthWrite=this.depthWrite),this.colorWrite===!1&&(n.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(n.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==519&&(n.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(n.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(n.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==7680&&(n.stencilFail=this.stencilFail),this.stencilZFail!==7680&&(n.stencilZFail=this.stencilZFail),this.stencilZPass!==7680&&(n.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(n.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(n.rotation=this.rotation),this.polygonOffset===!0&&(n.polygonOffset=!0),this.polygonOffsetFactor!==0&&(n.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(n.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(n.linewidth=this.linewidth),this.dashSize!==void 0&&(n.dashSize=this.dashSize),this.gapSize!==void 0&&(n.gapSize=this.gapSize),this.scale!==void 0&&(n.scale=this.scale),this.dithering===!0&&(n.dithering=!0),this.alphaTest>0&&(n.alphaTest=this.alphaTest),this.alphaHash===!0&&(n.alphaHash=!0),this.alphaToCoverage===!0&&(n.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(n.premultipliedAlpha=!0),this.forceSinglePass===!0&&(n.forceSinglePass=!0),this.wireframe===!0&&(n.wireframe=!0),this.wireframeLinewidth>1&&(n.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!==`round`&&(n.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!==`round`&&(n.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(n.flatShading=!0),this.visible===!1&&(n.visible=!1),this.toneMapped===!1&&(n.toneMapped=!1),this.fog===!1&&(n.fog=!1),Object.keys(this.userData).length>0&&(n.userData=this.userData);function r(e){let t=[];for(let n in e){let r=e[n];delete r.metadata,t.push(r)}return t}if(t){let t=r(e.textures),i=r(e.images);t.length>0&&(n.textures=t),i.length>0&&(n.images=i)}return n}clone(){return new this.constructor().copy(this)}copy(e){this.name=e.name,this.blending=e.blending,this.side=e.side,this.vertexColors=e.vertexColors,this.opacity=e.opacity,this.transparent=e.transparent,this.blendSrc=e.blendSrc,this.blendDst=e.blendDst,this.blendEquation=e.blendEquation,this.blendSrcAlpha=e.blendSrcAlpha,this.blendDstAlpha=e.blendDstAlpha,this.blendEquationAlpha=e.blendEquationAlpha,this.blendColor.copy(e.blendColor),this.blendAlpha=e.blendAlpha,this.depthFunc=e.depthFunc,this.depthTest=e.depthTest,this.depthWrite=e.depthWrite,this.stencilWriteMask=e.stencilWriteMask,this.stencilFunc=e.stencilFunc,this.stencilRef=e.stencilRef,this.stencilFuncMask=e.stencilFuncMask,this.stencilFail=e.stencilFail,this.stencilZFail=e.stencilZFail,this.stencilZPass=e.stencilZPass,this.stencilWrite=e.stencilWrite;let t=e.clippingPlanes,n=null;if(t!==null){let e=t.length;n=Array(e);for(let r=0;r!==e;++r)n[r]=t[r].clone()}return this.clippingPlanes=n,this.clipIntersection=e.clipIntersection,this.clipShadows=e.clipShadows,this.shadowSide=e.shadowSide,this.colorWrite=e.colorWrite,this.precision=e.precision,this.polygonOffset=e.polygonOffset,this.polygonOffsetFactor=e.polygonOffsetFactor,this.polygonOffsetUnits=e.polygonOffsetUnits,this.dithering=e.dithering,this.alphaTest=e.alphaTest,this.alphaHash=e.alphaHash,this.alphaToCoverage=e.alphaToCoverage,this.premultipliedAlpha=e.premultipliedAlpha,this.forceSinglePass=e.forceSinglePass,this.visible=e.visible,this.toneMapped=e.toneMapped,this.userData=JSON.parse(JSON.stringify(e.userData)),this}dispose(){this.dispatchEvent({type:`dispose`})}set needsUpdate(e){e===!0&&this.version++}},US=class extends HS{constructor(e){super(),this.isMeshBasicMaterial=!0,this.type=`MeshBasicMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.fog=e.fog,this}},WS=new J,GS=new Ub,KS=0,qS=class{constructor(e,t,n=!1){if(Array.isArray(e))throw TypeError(`THREE.BufferAttribute: array should be a Typed Array.`);this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:KS++}),this.name=``,this.array=e,this.itemSize=t,this.count=e===void 0?0:e.length/t,this.normalized=n,this.usage=bb,this.updateRanges=[],this.gpuType=my,this.version=0}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.name=e.name,this.array=new e.array.constructor(e.array),this.itemSize=e.itemSize,this.count=e.count,this.normalized=e.normalized,this.usage=e.usage,this.gpuType=e.gpuType,this}copyAt(e,t,n){e*=this.itemSize,n*=t.itemSize;for(let r=0,i=this.itemSize;rt.count&&console.warn(`THREE.BufferGeometry: Buffer size too small for points data. Use .dispose() and create a new geometry.`),t.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Sx);let e=this.attributes.position,t=this.morphAttributes.position;if(e&&e.isGLBufferAttribute){console.error(`THREE.BufferGeometry.computeBoundingBox(): GLBufferAttribute requires a manual bounding box.`,this),this.boundingBox.set(new J(-1/0,-1/0,-1/0),new J(1/0,1/0,1/0));return}if(e!==void 0){if(this.boundingBox.setFromBufferAttribute(e),t)for(let e=0,n=t.length;e0&&(e.userData=this.userData),this.parameters!==void 0){let t=this.parameters;for(let n in t)t[n]!==void 0&&(e[n]=t[n]);return e}e.data={attributes:{}};let t=this.index;t!==null&&(e.data.index={type:t.array.constructor.name,array:Array.prototype.slice.call(t.array)});let n=this.attributes;for(let t in n){let r=n[t];e.data.attributes[t]=r.toJSON(e.data)}let r={},i=!1;for(let t in this.morphAttributes){let n=this.morphAttributes[t],a=[];for(let t=0,r=n.length;t0&&(r[t]=a,i=!0)}i&&(e.data.morphAttributes=r,e.data.morphTargetsRelative=this.morphTargetsRelative);let a=this.groups;a.length>0&&(e.data.groups=JSON.parse(JSON.stringify(a)));let o=this.boundingSphere;return o!==null&&(e.data.boundingSphere=o.toJSON()),e}clone(){return new this.constructor().copy(this)}copy(e){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;let t={};this.name=e.name;let n=e.index;n!==null&&this.setIndex(n.clone());let r=e.attributes;for(let e in r){let n=r[e];this.setAttribute(e,n.clone(t))}let i=e.morphAttributes;for(let e in i){let n=[],r=i[e];for(let e=0,i=r.length;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;e(e.far-e.near)**2))&&(aC.copy(i).invert(),oC.copy(e.ray).applyMatrix4(aC),!(n.boundingBox!==null&&oC.intersectsBox(n.boundingBox)===!1)&&this._computeIntersections(e,t,oC)))}_computeIntersections(e,t,n){let r,i=this.geometry,a=this.material,o=i.index,s=i.attributes.position,c=i.attributes.uv,l=i.attributes.uv1,u=i.attributes.normal,d=i.groups,f=i.drawRange;if(o!==null)if(Array.isArray(a))for(let i=0,s=d.length;in.far?null:{distance:l,point:hC.clone(),object:e}}function vC(e,t,n,r,i,a,o,s,c,l){e.getVertexPosition(s,lC),e.getVertexPosition(c,uC),e.getVertexPosition(l,dC);let u=_C(e,t,n,r,lC,uC,dC,mC);if(u){let e=new J;FS.getBarycoord(mC,lC,uC,dC,e),i&&(u.uv=FS.getInterpolatedAttribute(i,s,c,l,e,new Ub)),a&&(u.uv1=FS.getInterpolatedAttribute(a,s,c,l,e,new Ub)),o&&(u.normal=FS.getInterpolatedAttribute(o,s,c,l,e,new J),u.normal.dot(r.direction)>0&&u.normal.multiplyScalar(-1));let t={a:s,b:c,c:l,normal:new J,materialIndex:0};FS.getNormal(lC,uC,dC,t.normal),u.face=t,u.barycoord=e}return u}var yC=class e extends iC{constructor(e=1,t=1,n=1,r=1,i=1,a=1){super(),this.type=`BoxGeometry`,this.parameters={width:e,height:t,depth:n,widthSegments:r,heightSegments:i,depthSegments:a};let o=this;r=Math.floor(r),i=Math.floor(i),a=Math.floor(a);let s=[],c=[],l=[],u=[],d=0,f=0;p(`z`,`y`,`x`,-1,-1,n,t,e,a,i,0),p(`z`,`y`,`x`,1,-1,n,t,-e,a,i,1),p(`x`,`z`,`y`,1,1,e,n,t,r,a,2),p(`x`,`z`,`y`,1,-1,e,n,-t,r,a,3),p(`x`,`y`,`z`,1,-1,e,t,n,r,i,4),p(`x`,`y`,`z`,-1,-1,e,t,-n,r,i,5),this.setIndex(s),this.setAttribute(`position`,new XS(c,3)),this.setAttribute(`normal`,new XS(l,3)),this.setAttribute(`uv`,new XS(u,2));function p(e,t,n,r,i,a,p,m,h,g,_){let v=a/h,y=p/g,b=a/2,x=p/2,S=m/2,C=h+1,w=g+1,T=0,E=0,D=new J;for(let a=0;a0?1:-1,l.push(D.x,D.y,D.z),u.push(s/h),u.push(1-a/g),T+=1}for(let e=0;e0&&(t.defines=this.defines),t.vertexShader=this.vertexShader,t.fragmentShader=this.fragmentShader,t.lights=this.lights,t.clipping=this.clipping;let n={};for(let e in this.extensions)this.extensions[e]===!0&&(n[e]=!0);return Object.keys(n).length>0&&(t.extensions=n),t}},OC=class extends xS{constructor(){super(),this.isCamera=!0,this.type=`Camera`,this.matrixWorldInverse=new Y,this.projectionMatrix=new Y,this.projectionMatrixInverse=new Y,this.coordinateSystem=xb}copy(e,t){return super.copy(e,t),this.matrixWorldInverse.copy(e.matrixWorldInverse),this.projectionMatrix.copy(e.projectionMatrix),this.projectionMatrixInverse.copy(e.projectionMatrixInverse),this.coordinateSystem=e.coordinateSystem,this}getWorldDirection(e){return super.getWorldDirection(e).negate()}updateMatrixWorld(e){super.updateMatrixWorld(e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(e,t){super.updateWorldMatrix(e,t),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}},kC=new J,AC=new Ub,jC=new Ub,MC=class extends OC{constructor(e=50,t=1,n=.1,r=2e3){super(),this.isPerspectiveCamera=!0,this.type=`PerspectiveCamera`,this.fov=e,this.zoom=1,this.near=n,this.far=r,this.focus=10,this.aspect=t,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.fov=e.fov,this.zoom=e.zoom,this.near=e.near,this.far=e.far,this.focus=e.focus,this.aspect=e.aspect,this.view=e.view===null?null:Object.assign({},e.view),this.filmGauge=e.filmGauge,this.filmOffset=e.filmOffset,this}setFocalLength(e){let t=.5*this.getFilmHeight()/e;this.fov=Eb*2*Math.atan(t),this.updateProjectionMatrix()}getFocalLength(){let e=Math.tan(Tb*.5*this.fov);return .5*this.getFilmHeight()/e}getEffectiveFOV(){return Eb*2*Math.atan(Math.tan(Tb*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(e,t,n){kC.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),t.set(kC.x,kC.y).multiplyScalar(-e/kC.z),kC.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),n.set(kC.x,kC.y).multiplyScalar(-e/kC.z)}getViewSize(e,t){return this.getViewBounds(e,AC,jC),t.subVectors(jC,AC)}setViewOffset(e,t,n,r,i,a){this.aspect=e/t,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=this.near,t=e*Math.tan(Tb*.5*this.fov)/this.zoom,n=2*t,r=this.aspect*n,i=-.5*r,a=this.view;if(this.view!==null&&this.view.enabled){let e=a.fullWidth,o=a.fullHeight;i+=a.offsetX*r/e,t-=a.offsetY*n/o,r*=a.width/e,n*=a.height/o}let o=this.filmOffset;o!==0&&(i+=e*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(i,i+r,t,t-n,e,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.fov=this.fov,t.object.zoom=this.zoom,t.object.near=this.near,t.object.far=this.far,t.object.focus=this.focus,t.object.aspect=this.aspect,this.view!==null&&(t.object.view=Object.assign({},this.view)),t.object.filmGauge=this.filmGauge,t.object.filmOffset=this.filmOffset,t}},NC=-90,PC=1,FC=class extends xS{constructor(e,t,n){super(),this.type=`CubeCamera`,this.renderTarget=n,this.coordinateSystem=null,this.activeMipmapLevel=0;let r=new MC(NC,PC,e,t);r.layers=this.layers,this.add(r);let i=new MC(NC,PC,e,t);i.layers=this.layers,this.add(i);let a=new MC(NC,PC,e,t);a.layers=this.layers,this.add(a);let o=new MC(NC,PC,e,t);o.layers=this.layers,this.add(o);let s=new MC(NC,PC,e,t);s.layers=this.layers,this.add(s);let c=new MC(NC,PC,e,t);c.layers=this.layers,this.add(c)}updateCoordinateSystem(){let e=this.coordinateSystem,t=this.children.concat(),[n,r,i,a,o,s]=t;for(let e of t)this.remove(e);if(e===2e3)n.up.set(0,1,0),n.lookAt(1,0,0),r.up.set(0,1,0),r.lookAt(-1,0,0),i.up.set(0,0,-1),i.lookAt(0,1,0),a.up.set(0,0,1),a.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),s.up.set(0,1,0),s.lookAt(0,0,-1);else if(e===2001)n.up.set(0,-1,0),n.lookAt(-1,0,0),r.up.set(0,-1,0),r.lookAt(1,0,0),i.up.set(0,0,1),i.lookAt(0,1,0),a.up.set(0,0,-1),a.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),s.up.set(0,-1,0),s.lookAt(0,0,-1);else throw Error(`THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: `+e);for(let e of t)this.add(e),e.updateMatrixWorld()}update(e,t){this.parent===null&&this.updateMatrixWorld();let{renderTarget:n,activeMipmapLevel:r}=this;this.coordinateSystem!==e.coordinateSystem&&(this.coordinateSystem=e.coordinateSystem,this.updateCoordinateSystem());let[i,a,o,s,c,l]=this.children,u=e.getRenderTarget(),d=e.getActiveCubeFace(),f=e.getActiveMipmapLevel(),p=e.xr.enabled;e.xr.enabled=!1;let m=n.texture.generateMipmaps;n.texture.generateMipmaps=!1,e.setRenderTarget(n,0,r),e.render(t,i),e.setRenderTarget(n,1,r),e.render(t,a),e.setRenderTarget(n,2,r),e.render(t,o),e.setRenderTarget(n,3,r),e.render(t,s),e.setRenderTarget(n,4,r),e.render(t,c),n.texture.generateMipmaps=m,e.setRenderTarget(n,5,r),e.render(t,l),e.setRenderTarget(u,d,f),e.xr.enabled=p,n.texture.needsPMREMUpdate=!0}},IC=class extends gx{constructor(e=[],t=301,n,r,i,a,o,s,c,l){super(e,t,n,r,i,a,o,s,c,l),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(e){this.image=e}},LC=class extends yx{constructor(e=1,t={}){super(e,e,t),this.isWebGLCubeRenderTarget=!0;let n={width:e,height:e,depth:1},r=[n,n,n,n,n,n];this.texture=new IC(r),this._setTextureOptions(t),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(e,t){this.texture.type=t.type,this.texture.colorSpace=t.colorSpace,this.texture.generateMipmaps=t.generateMipmaps,this.texture.minFilter=t.minFilter,this.texture.magFilter=t.magFilter;let n={uniforms:{tEquirect:{value:null}},vertexShader:` - - varying vec3 vWorldDirection; - - vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); - - } - - void main() { - - vWorldDirection = transformDirection( position, modelMatrix ); - - #include - #include - - } - `,fragmentShader:` - - uniform sampler2D tEquirect; - - varying vec3 vWorldDirection; - - #include - - void main() { - - vec3 direction = normalize( vWorldDirection ); - - vec2 sampleUV = equirectUv( direction ); - - gl_FragColor = texture2D( tEquirect, sampleUV ); - - } - `},r=new yC(5,5,5),i=new DC({name:`CubemapFromEquirect`,uniforms:bC(n.uniforms),vertexShader:n.vertexShader,fragmentShader:n.fragmentShader,side:1,blending:0});i.uniforms.tEquirect.value=t;let a=new gC(r,i),o=t.minFilter;return t.minFilter===1008&&(t.minFilter=ay),new FC(1,10,this).update(e,a),t.minFilter=o,a.geometry.dispose(),a.material.dispose(),this}clear(e,t=!0,n=!0,r=!0){let i=e.getRenderTarget();for(let i=0;i<6;i++)e.setRenderTarget(this,i),e.clear(t,n,r);e.setRenderTarget(i)}},RC=class extends xS{constructor(){super(),this.isGroup=!0,this.type=`Group`}},zC={type:`move`},BC=class{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new RC,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new RC,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new J,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new J),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new RC,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new J,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new J),this._grip}dispatchEvent(e){return this._targetRay!==null&&this._targetRay.dispatchEvent(e),this._grip!==null&&this._grip.dispatchEvent(e),this._hand!==null&&this._hand.dispatchEvent(e),this}connect(e){if(e&&e.hand){let t=this._hand;if(t)for(let n of e.hand.values())this._getHandJoint(t,n)}return this.dispatchEvent({type:`connected`,data:e}),this}disconnect(e){return this.dispatchEvent({type:`disconnected`,data:e}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(e,t,n){let r=null,i=null,a=null,o=this._targetRay,s=this._grip,c=this._hand;if(e&&t.session.visibilityState!==`visible-blurred`){if(c&&e.hand){a=!0;for(let r of e.hand.values()){let e=t.getJointPose(r,n),i=this._getHandJoint(c,r);e!==null&&(i.matrix.fromArray(e.transform.matrix),i.matrix.decompose(i.position,i.rotation,i.scale),i.matrixWorldNeedsUpdate=!0,i.jointRadius=e.radius),i.visible=e!==null}let r=c.joints[`index-finger-tip`],i=c.joints[`thumb-tip`],o=r.position.distanceTo(i.position);c.inputState.pinching&&o>.025?(c.inputState.pinching=!1,this.dispatchEvent({type:`pinchend`,handedness:e.handedness,target:this})):!c.inputState.pinching&&o<=.015&&(c.inputState.pinching=!0,this.dispatchEvent({type:`pinchstart`,handedness:e.handedness,target:this}))}else s!==null&&e.gripSpace&&(i=t.getPose(e.gripSpace,n),i!==null&&(s.matrix.fromArray(i.transform.matrix),s.matrix.decompose(s.position,s.rotation,s.scale),s.matrixWorldNeedsUpdate=!0,i.linearVelocity?(s.hasLinearVelocity=!0,s.linearVelocity.copy(i.linearVelocity)):s.hasLinearVelocity=!1,i.angularVelocity?(s.hasAngularVelocity=!0,s.angularVelocity.copy(i.angularVelocity)):s.hasAngularVelocity=!1));o!==null&&(r=t.getPose(e.targetRaySpace,n),r===null&&i!==null&&(r=i),r!==null&&(o.matrix.fromArray(r.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,r.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(r.linearVelocity)):o.hasLinearVelocity=!1,r.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(r.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(zC)))}return o!==null&&(o.visible=r!==null),s!==null&&(s.visible=i!==null),c!==null&&(c.visible=a!==null),this}_getHandJoint(e,t){if(e.joints[t.jointName]===void 0){let n=new RC;n.matrixAutoUpdate=!1,n.visible=!1,e.joints[t.jointName]=n,e.add(n)}return e.joints[t.jointName]}},VC=class extends xS{constructor(){super(),this.isScene=!0,this.type=`Scene`,this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new iS,this.environmentIntensity=1,this.environmentRotation=new iS,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<`u`&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent(`observe`,{detail:this}))}copy(e,t){return super.copy(e,t),e.background!==null&&(this.background=e.background.clone()),e.environment!==null&&(this.environment=e.environment.clone()),e.fog!==null&&(this.fog=e.fog.clone()),this.backgroundBlurriness=e.backgroundBlurriness,this.backgroundIntensity=e.backgroundIntensity,this.backgroundRotation.copy(e.backgroundRotation),this.environmentIntensity=e.environmentIntensity,this.environmentRotation.copy(e.environmentRotation),e.overrideMaterial!==null&&(this.overrideMaterial=e.overrideMaterial.clone()),this.matrixAutoUpdate=e.matrixAutoUpdate,this}toJSON(e){let t=super.toJSON(e);return this.fog!==null&&(t.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(t.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(t.object.backgroundIntensity=this.backgroundIntensity),t.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(t.object.environmentIntensity=this.environmentIntensity),t.object.environmentRotation=this.environmentRotation.toArray(),t}},HC=class{constructor(e,t){this.isInterleavedBuffer=!0,this.array=e,this.stride=t,this.count=e===void 0?0:e.length/t,this.usage=bb,this.updateRanges=[],this.version=0,this.uuid=Db()}onUploadCallback(){}set needsUpdate(e){e===!0&&this.version++}setUsage(e){return this.usage=e,this}addUpdateRange(e,t){this.updateRanges.push({start:e,count:t})}clearUpdateRanges(){this.updateRanges.length=0}copy(e){return this.array=new e.array.constructor(e.array),this.count=e.count,this.stride=e.stride,this.usage=e.usage,this}copyAt(e,t,n){e*=this.stride,n*=t.stride;for(let r=0,i=this.stride;r1?null:t.copy(e.start).addScaledVector(n,i)}intersectsLine(e){let t=this.distanceToPoint(e.start),n=this.distanceToPoint(e.end);return t<0&&n>0||n<0&&t>0}intersectsBox(e){return e.intersectsPlane(this)}intersectsSphere(e){return e.intersectsPlane(this)}coplanarPoint(e){return e.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(e,t){let n=t||_w.getNormalMatrix(e),r=this.coplanarPoint(hw).applyMatrix4(e),i=this.normal.applyMatrix3(n).normalize();return this.constant=-r.dot(i),this}translate(e){return this.constant-=e.dot(this.normal),this}equals(e){return e.normal.equals(this.normal)&&e.constant===this.constant}clone(){return new this.constructor().copy(this)}},yw=new Bx,bw=new J,xw=class{constructor(e=new vw,t=new vw,n=new vw,r=new vw,i=new vw,a=new vw){this.planes=[e,t,n,r,i,a]}set(e,t,n,r,i,a){let o=this.planes;return o[0].copy(e),o[1].copy(t),o[2].copy(n),o[3].copy(r),o[4].copy(i),o[5].copy(a),this}copy(e){let t=this.planes;for(let n=0;n<6;n++)t[n].copy(e.planes[n]);return this}setFromProjectionMatrix(e,t=xb){let n=this.planes,r=e.elements,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=r[8],p=r[9],m=r[10],h=r[11],g=r[12],_=r[13],v=r[14],y=r[15];if(n[0].setComponents(s-i,d-c,h-f,y-g).normalize(),n[1].setComponents(s+i,d+c,h+f,y+g).normalize(),n[2].setComponents(s+a,d+l,h+p,y+_).normalize(),n[3].setComponents(s-a,d-l,h-p,y-_).normalize(),n[4].setComponents(s-o,d-u,h-m,y-v).normalize(),t===2e3)n[5].setComponents(s+o,d+u,h+m,y+v).normalize();else if(t===2001)n[5].setComponents(o,u,m,v).normalize();else throw Error(`THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: `+t);return this}intersectsObject(e){if(e.boundingSphere!==void 0)e.boundingSphere===null&&e.computeBoundingSphere(),yw.copy(e.boundingSphere).applyMatrix4(e.matrixWorld);else{let t=e.geometry;t.boundingSphere===null&&t.computeBoundingSphere(),yw.copy(t.boundingSphere).applyMatrix4(e.matrixWorld)}return this.intersectsSphere(yw)}intersectsSprite(e){return yw.center.set(0,0,0),yw.radius=.7071067811865476,yw.applyMatrix4(e.matrixWorld),this.intersectsSphere(yw)}intersectsSphere(e){let t=this.planes,n=e.center,r=-e.radius;for(let e=0;e<6;e++)if(t[e].distanceToPoint(n)0?e.max.x:e.min.x,bw.y=r.normal.y>0?e.max.y:e.min.y,bw.z=r.normal.z>0?e.max.z:e.min.z,r.distanceToPoint(bw)<0)return!1}return!0}containsPoint(e){let t=this.planes;for(let n=0;n<6;n++)if(t[n].distanceToPoint(e)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}},Sw=class extends HS{constructor(e){super(),this.isLineBasicMaterial=!0,this.type=`LineBasicMaterial`,this.color=new X(16777215),this.map=null,this.linewidth=1,this.linecap=`round`,this.linejoin=`round`,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.linewidth=e.linewidth,this.linecap=e.linecap,this.linejoin=e.linejoin,this.fog=e.fog,this}},Cw=new J,ww=new J,Tw=new Y,Ew=new Jx,Dw=new Bx,Ow=new J,kw=new J,Aw=class extends xS{constructor(e=new iC,t=new Sw){super(),this.isLine=!0,this.type=`Line`,this.geometry=e,this.material=t,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(e,t){return super.copy(e,t),this.material=Array.isArray(e.material)?e.material.slice():e.material,this.geometry=e.geometry,this}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[0];for(let e=1,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;er)return;Ow.applyMatrix4(e.matrixWorld);let c=t.ray.origin.distanceTo(Ow);if(!(ct.far))return{distance:c,point:kw.clone().applyMatrix4(e.matrixWorld),index:o,face:null,faceIndex:null,barycoord:null,object:e}}var Mw=new J,Nw=new J,Pw=class extends Aw{constructor(e,t){super(e,t),this.isLineSegments=!0,this.type=`LineSegments`}computeLineDistances(){let e=this.geometry;if(e.index===null){let t=e.attributes.position,n=[];for(let e=0,r=t.count;e0){let n=e[t[0]];if(n!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let e=0,t=n.length;ei.far)return;a.push({distance:c,distanceToRay:Math.sqrt(s),point:n,index:t,face:null,faceIndex:null,barycoord:null,object:o})}}var Uw=class extends gx{constructor(e,t,n=py,r,i,a,o=ny,s=ny,c,l=xy,u=1){if(l!==1026&&l!==1027)throw Error(`DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat`);super({width:e,height:t,depth:u},r,i,a,o,s,l,n,c),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(e){return super.copy(e),this.source=new fx(Object.assign({},e.image)),this.compareFunction=e.compareFunction,this}toJSON(e){let t=super.toJSON(e);return this.compareFunction!==null&&(t.compareFunction=this.compareFunction),t}},Ww=class e extends iC{constructor(e=1,t=1,n=1,r=32,i=1,a=!1,o=0,s=Math.PI*2){super(),this.type=`CylinderGeometry`,this.parameters={radiusTop:e,radiusBottom:t,height:n,radialSegments:r,heightSegments:i,openEnded:a,thetaStart:o,thetaLength:s};let c=this;r=Math.floor(r),i=Math.floor(i);let l=[],u=[],d=[],f=[],p=0,m=[],h=n/2,g=0;_(),a===!1&&(e>0&&v(!0),t>0&&v(!1)),this.setIndex(l),this.setAttribute(`position`,new XS(u,3)),this.setAttribute(`normal`,new XS(d,3)),this.setAttribute(`uv`,new XS(f,2));function _(){let a=new J,_=new J,v=0,y=(t-e)/n;for(let c=0;c<=i;c++){let l=[],g=c/i,v=g*(t-e)+e;for(let e=0;e<=r;e++){let t=e/r,i=t*s+o,c=Math.sin(i),m=Math.cos(i);_.x=v*c,_.y=-g*n+h,_.z=v*m,u.push(_.x,_.y,_.z),a.set(c,y,m).normalize(),d.push(a.x,a.y,a.z),f.push(t,1-g),l.push(p++)}m.push(l)}for(let n=0;n0||r!==0)&&(l.push(a,o,c),v+=3),(t>0||r!==i-1)&&(l.push(o,s,c),v+=3)}c.addGroup(g,v,0),g+=v}function v(n){let i=p,a=new Ub,m=new J,_=0,v=n===!0?e:t,y=n===!0?1:-1;for(let e=1;e<=r;e++)u.push(0,h*y,0),d.push(0,y,0),f.push(.5,.5),p++;let b=p;for(let e=0;e<=r;e++){let t=e/r*s+o,n=Math.cos(t),i=Math.sin(t);m.x=v*i,m.y=h*y,m.z=v*n,u.push(m.x,m.y,m.z),d.push(0,y,0),a.x=n*.5+.5,a.y=i*.5*y+.5,f.push(a.x,a.y),p++}for(let e=0;e0)&&f.push(t,i,c),(e!==n-1||s0!=e>0&&this.version++,this._anisotropy=e}get clearcoat(){return this._clearcoat}set clearcoat(e){this._clearcoat>0!=e>0&&this.version++,this._clearcoat=e}get iridescence(){return this._iridescence}set iridescence(e){this._iridescence>0!=e>0&&this.version++,this._iridescence=e}get dispersion(){return this._dispersion}set dispersion(e){this._dispersion>0!=e>0&&this.version++,this._dispersion=e}get sheen(){return this._sheen}set sheen(e){this._sheen>0!=e>0&&this.version++,this._sheen=e}get transmission(){return this._transmission}set transmission(e){this._transmission>0!=e>0&&this.version++,this._transmission=e}copy(e){return super.copy(e),this.defines={STANDARD:``,PHYSICAL:``},this.anisotropy=e.anisotropy,this.anisotropyRotation=e.anisotropyRotation,this.anisotropyMap=e.anisotropyMap,this.clearcoat=e.clearcoat,this.clearcoatMap=e.clearcoatMap,this.clearcoatRoughness=e.clearcoatRoughness,this.clearcoatRoughnessMap=e.clearcoatRoughnessMap,this.clearcoatNormalMap=e.clearcoatNormalMap,this.clearcoatNormalScale.copy(e.clearcoatNormalScale),this.dispersion=e.dispersion,this.ior=e.ior,this.iridescence=e.iridescence,this.iridescenceMap=e.iridescenceMap,this.iridescenceIOR=e.iridescenceIOR,this.iridescenceThicknessRange=[...e.iridescenceThicknessRange],this.iridescenceThicknessMap=e.iridescenceThicknessMap,this.sheen=e.sheen,this.sheenColor.copy(e.sheenColor),this.sheenColorMap=e.sheenColorMap,this.sheenRoughness=e.sheenRoughness,this.sheenRoughnessMap=e.sheenRoughnessMap,this.transmission=e.transmission,this.transmissionMap=e.transmissionMap,this.thickness=e.thickness,this.thicknessMap=e.thicknessMap,this.attenuationDistance=e.attenuationDistance,this.attenuationColor.copy(e.attenuationColor),this.specularIntensity=e.specularIntensity,this.specularIntensityMap=e.specularIntensityMap,this.specularColor.copy(e.specularColor),this.specularColorMap=e.specularColorMap,this}},Xw=class extends HS{constructor(e){super(),this.isMeshPhongMaterial=!0,this.type=`MeshPhongMaterial`,this.color=new X(16777215),this.specular=new X(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ub(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.specular.copy(e.specular),this.shininess=e.shininess,this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Zw=class extends HS{constructor(e){super(),this.isMeshLambertMaterial=!0,this.type=`MeshLambertMaterial`,this.color=new X(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new X(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=0,this.normalScale=new Ub(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new iS,this.combine=0,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap=`round`,this.wireframeLinejoin=`round`,this.flatShading=!1,this.fog=!0,this.setValues(e)}copy(e){return super.copy(e),this.color.copy(e.color),this.map=e.map,this.lightMap=e.lightMap,this.lightMapIntensity=e.lightMapIntensity,this.aoMap=e.aoMap,this.aoMapIntensity=e.aoMapIntensity,this.emissive.copy(e.emissive),this.emissiveMap=e.emissiveMap,this.emissiveIntensity=e.emissiveIntensity,this.bumpMap=e.bumpMap,this.bumpScale=e.bumpScale,this.normalMap=e.normalMap,this.normalMapType=e.normalMapType,this.normalScale.copy(e.normalScale),this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.specularMap=e.specularMap,this.alphaMap=e.alphaMap,this.envMap=e.envMap,this.envMapRotation.copy(e.envMapRotation),this.combine=e.combine,this.reflectivity=e.reflectivity,this.refractionRatio=e.refractionRatio,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this.wireframeLinecap=e.wireframeLinecap,this.wireframeLinejoin=e.wireframeLinejoin,this.flatShading=e.flatShading,this.fog=e.fog,this}},Qw=class extends HS{constructor(e){super(),this.isMeshDepthMaterial=!0,this.type=`MeshDepthMaterial`,this.depthPacking=pb,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(e)}copy(e){return super.copy(e),this.depthPacking=e.depthPacking,this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this.wireframe=e.wireframe,this.wireframeLinewidth=e.wireframeLinewidth,this}},dte=class extends HS{constructor(e){super(),this.isMeshDistanceMaterial=!0,this.type=`MeshDistanceMaterial`,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(e)}copy(e){return super.copy(e),this.map=e.map,this.alphaMap=e.alphaMap,this.displacementMap=e.displacementMap,this.displacementScale=e.displacementScale,this.displacementBias=e.displacementBias,this}};function $w(e,t){return!e||e.constructor===t?e:typeof t.BYTES_PER_ELEMENT==`number`?new t(e):Array.prototype.slice.call(e)}function eT(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function tT(e){function t(t,n){return e[t]-e[n]}let n=e.length,r=Array(n);for(let e=0;e!==n;++e)r[e]=e;return r.sort(t),r}function nT(e,t,n){let r=e.length,i=new e.constructor(r);for(let a=0,o=0;o!==r;++a){let r=n[a]*t;for(let n=0;n!==t;++n)i[o++]=e[r+n]}return i}function rT(e,t,n,r){let i=1,a=e[0];for(;a!==void 0&&a[r]===void 0;)a=e[i++];if(a===void 0)return;let o=a[r];if(o!==void 0)if(Array.isArray(o))do o=a[r],o!==void 0&&(t.push(a.time),n.push(...o)),a=e[i++];while(a!==void 0);else if(o.toArray!==void 0)do o=a[r],o!==void 0&&(t.push(a.time),o.toArray(n,n.length)),a=e[i++];while(a!==void 0);else do o=a[r],o!==void 0&&(t.push(a.time),n.push(o)),a=e[i++];while(a!==void 0)}var iT=class{constructor(e,t,n,r){this.parameterPositions=e,this._cachedIndex=0,this.resultBuffer=r===void 0?new t.constructor(n):r,this.sampleValues=t,this.valueSize=n,this.settings=null,this.DefaultSettings_={}}evaluate(e){let t=this.parameterPositions,n=this._cachedIndex,r=t[n],i=t[n-1];validate_interval:{seek:{let a;linear_scan:{forward_scan:if(!(e=i)){let o=t[1];e=i)break seek}a=n,n=0;break linear_scan}break validate_interval}for(;n>>1;et;)--a;if(++a,i!==0||a!==r){i>=a&&(a=Math.max(a,1),i=a-1);let e=this.getValueSize();this.times=n.slice(i,a),this.values=this.values.slice(i*e,a*e)}return this}validate(){let e=!0,t=this.getValueSize();t-Math.floor(t)!==0&&(console.error(`THREE.KeyframeTrack: Invalid value size in track.`,this),e=!1);let n=this.times,r=this.values,i=n.length;i===0&&(console.error(`THREE.KeyframeTrack: Track is empty.`,this),e=!1);let a=null;for(let t=0;t!==i;t++){let r=n[t];if(typeof r==`number`&&isNaN(r)){console.error(`THREE.KeyframeTrack: Time is not a valid number.`,this,t,r),e=!1;break}if(a!==null&&a>r){console.error(`THREE.KeyframeTrack: Out of order keys.`,this,t,r,a),e=!1;break}a=r}if(r!==void 0&&eT(r))for(let t=0,n=r.length;t!==n;++t){let n=r[t];if(isNaN(n)){console.error(`THREE.KeyframeTrack: Value is not a valid number.`,this,t,n),e=!1;break}}return e}optimize(){let e=this.times.slice(),t=this.values.slice(),n=this.getValueSize(),r=this.getInterpolation()===cb,i=e.length-1,a=1;for(let o=1;o0){e[a]=e[i];for(let e=i*n,r=a*n,o=0;o!==n;++o)t[r+o]=t[e+o];++a}return a===e.length?(this.times=e,this.values=t):(this.times=e.slice(0,a),this.values=t.slice(0,a*n)),this}clone(){let e=this.times.slice(),t=this.values.slice(),n=this.constructor,r=new n(this.name,e,t);return r.createInterpolant=this.createInterpolant,r}};cT.prototype.ValueTypeName=``,cT.prototype.TimeBufferType=Float32Array,cT.prototype.ValueBufferType=Float32Array,cT.prototype.DefaultInterpolation=sb;var lT=class extends cT{constructor(e,t,n){super(e,t,n)}};lT.prototype.ValueTypeName=`bool`,lT.prototype.ValueBufferType=Array,lT.prototype.DefaultInterpolation=ob,lT.prototype.InterpolantFactoryMethodLinear=void 0,lT.prototype.InterpolantFactoryMethodSmooth=void 0;var uT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};uT.prototype.ValueTypeName=`color`;var dT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};dT.prototype.ValueTypeName=`number`;var fT=class extends iT{constructor(e,t,n,r){super(e,t,n,r)}interpolate_(e,t,n,r){let i=this.resultBuffer,a=this.sampleValues,o=this.valueSize,s=(n-t)/(r-t),c=e*o;for(let e=c+o;c!==e;c+=4)Wb.slerpFlat(i,0,a,c-o,a,c,s);return i}},pT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}InterpolantFactoryMethodLinear(e){return new fT(this.times,this.values,this.getValueSize(),e)}};pT.prototype.ValueTypeName=`quaternion`,pT.prototype.InterpolantFactoryMethodSmooth=void 0;var mT=class extends cT{constructor(e,t,n){super(e,t,n)}};mT.prototype.ValueTypeName=`string`,mT.prototype.ValueBufferType=Array,mT.prototype.DefaultInterpolation=ob,mT.prototype.InterpolantFactoryMethodLinear=void 0,mT.prototype.InterpolantFactoryMethodSmooth=void 0;var hT=class extends cT{constructor(e,t,n,r){super(e,t,n,r)}};hT.prototype.ValueTypeName=`vector`;var gT=class{constructor(e=``,t=-1,n=[],r=fb){this.name=e,this.tracks=n,this.duration=t,this.blendMode=r,this.uuid=Db(),this.duration<0&&this.resetDuration()}static parse(e){let t=[],n=e.tracks,r=1/(e.fps||1);for(let e=0,i=n.length;e!==i;++e)t.push(vT(n[e]).scale(r));let i=new this(e.name,e.duration,t,e.blendMode);return i.uuid=e.uuid,i}static toJSON(e){let t=[],n=e.tracks,r={name:e.name,duration:e.duration,tracks:t,uuid:e.uuid,blendMode:e.blendMode};for(let e=0,r=n.length;e!==r;++e)t.push(cT.toJSON(n[e]));return r}static CreateFromMorphTargetSequence(e,t,n,r){let i=t.length,a=[];for(let e=0;e1){let e=a[1],t=r[e];t||(r[e]=t=[]),t.push(n)}}let a=[];for(let e in r)a.push(this.CreateFromMorphTargetSequence(e,r[e],t,n));return a}static parseAnimation(e,t){if(console.warn(`THREE.AnimationClip: parseAnimation() is deprecated and will be removed with r185`),!e)return console.error(`THREE.AnimationClip: No animation in JSONLoader data.`),null;let n=function(e,t,n,r,i){if(n.length!==0){let a=[],o=[];rT(n,a,o,r),a.length!==0&&i.push(new e(t,a,o))}},r=[],i=e.name||`default`,a=e.fps||30,o=e.blendMode,s=e.length||-1,c=e.hierarchy||[];for(let e=0;e{t&&t(i),this.manager.itemEnd(e)},0),i;if(CT[e]!==void 0){CT[e].push({onLoad:t,onProgress:n,onError:r});return}CT[e]=[],CT[e].push({onLoad:t,onProgress:n,onError:r});let a=new Request(e,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?`include`:`same-origin`}),o=this.mimeType,s=this.responseType;fetch(a).then(t=>{if(t.status===200||t.status===0){if(t.status===0&&console.warn(`THREE.FileLoader: HTTP Status 0 received.`),typeof ReadableStream>`u`||t.body===void 0||t.body.getReader===void 0)return t;let n=CT[e],r=t.body.getReader(),i=t.headers.get(`X-File-Size`)||t.headers.get(`Content-Length`),a=i?parseInt(i):0,o=a!==0,s=0,c=new ReadableStream({start(e){t();function t(){r.read().then(({done:r,value:i})=>{if(r)e.close();else{s+=i.byteLength;let r=new ProgressEvent(`progress`,{lengthComputable:o,loaded:s,total:a});for(let e=0,t=n.length;e{e.error(t)})}}});return new Response(c)}else throw new wT(`fetch for "${t.url}" responded with ${t.status}: ${t.statusText}`,t)}).then(e=>{switch(s){case`arraybuffer`:return e.arrayBuffer();case`blob`:return e.blob();case`document`:return e.text().then(e=>new DOMParser().parseFromString(e,o));case`json`:return e.json();default:if(o===``)return e.text();{let t=/charset="?([^;"\s]*)"?/i.exec(o),n=t&&t[1]?t[1].toLowerCase():void 0,r=new TextDecoder(n);return e.arrayBuffer().then(e=>r.decode(e))}}}).then(t=>{yT.add(e,t);let n=CT[e];delete CT[e];for(let e=0,r=n.length;e{let n=CT[e];if(n===void 0)throw this.manager.itemError(e),t;delete CT[e];for(let e=0,r=n.length;e{this.manager.itemEnd(e)}),this.manager.itemStart(e)}setResponseType(e){return this.responseType=e,this}setMimeType(e){return this.mimeType=e,this}},ET=class extends ST{constructor(e){super(e)}load(e,t,n,r){this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=yT.get(e);if(a!==void 0)return i.manager.itemStart(e),setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a;let o=Xb(`img`);function s(){l(),yT.add(e,this),t&&t(this),i.manager.itemEnd(e)}function c(t){l(),r&&r(t),i.manager.itemError(e),i.manager.itemEnd(e)}function l(){o.removeEventListener(`load`,s,!1),o.removeEventListener(`error`,c,!1)}return o.addEventListener(`load`,s,!1),o.addEventListener(`error`,c,!1),e.slice(0,5)!==`data:`&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),i.manager.itemStart(e),o.src=e,o}},DT=class extends ST{constructor(e){super(e)}load(e,t,n,r){let i=this,a=new nw,o=new TT(this.manager);return o.setResponseType(`arraybuffer`),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(i.withCredentials),o.load(e,function(e){let n;try{n=i.parse(e)}catch(e){if(r!==void 0)r(e);else{console.error(e);return}}n.image===void 0?n.data!==void 0&&(a.image.width=n.width,a.image.height=n.height,a.image.data=n.data):a.image=n.image,a.wrapS=n.wrapS===void 0?ey:n.wrapS,a.wrapT=n.wrapT===void 0?ey:n.wrapT,a.magFilter=n.magFilter===void 0?ay:n.magFilter,a.minFilter=n.minFilter===void 0?ay:n.minFilter,a.anisotropy=n.anisotropy===void 0?1:n.anisotropy,n.colorSpace!==void 0&&(a.colorSpace=n.colorSpace),n.flipY!==void 0&&(a.flipY=n.flipY),n.format!==void 0&&(a.format=n.format),n.type!==void 0&&(a.type=n.type),n.mipmaps!==void 0&&(a.mipmaps=n.mipmaps,a.minFilter=sy),n.mipmapCount===1&&(a.minFilter=ay),n.generateMipmaps!==void 0&&(a.generateMipmaps=n.generateMipmaps),a.needsUpdate=!0,t&&t(a,n)},n,r),a}},OT=class extends ST{constructor(e){super(e)}load(e,t,n,r){let i=new gx,a=new ET(this.manager);return a.setCrossOrigin(this.crossOrigin),a.setPath(this.path),a.load(e,function(e){i.image=e,i.needsUpdate=!0,t!==void 0&&t(i)},n,r),i}},kT=class extends xS{constructor(e,t=1){super(),this.isLight=!0,this.type=`Light`,this.color=new X(e),this.intensity=t}dispose(){}copy(e,t){return super.copy(e,t),this.color.copy(e.color),this.intensity=e.intensity,this}toJSON(e){let t=super.toJSON(e);return t.object.color=this.color.getHex(),t.object.intensity=this.intensity,this.groundColor!==void 0&&(t.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(t.object.distance=this.distance),this.angle!==void 0&&(t.object.angle=this.angle),this.decay!==void 0&&(t.object.decay=this.decay),this.penumbra!==void 0&&(t.object.penumbra=this.penumbra),this.shadow!==void 0&&(t.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(t.object.target=this.target.uuid),t}},AT=class extends kT{constructor(e,t,n){super(e,n),this.isHemisphereLight=!0,this.type=`HemisphereLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.groundColor=new X(t)}copy(e,t){return super.copy(e,t),this.groundColor.copy(e.groundColor),this}},jT=new Y,MT=new J,NT=new J,PT=class{constructor(e){this.camera=e,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ub(512,512),this.mapType=cy,this.map=null,this.mapPass=null,this.matrix=new Y,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new xw,this._frameExtents=new Ub(1,1),this._viewportCount=1,this._viewports=[new _x(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(e){let t=this.camera,n=this.matrix;MT.setFromMatrixPosition(e.matrixWorld),t.position.copy(MT),NT.setFromMatrixPosition(e.target.matrixWorld),t.lookAt(NT),t.updateMatrixWorld(),jT.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this._frustum.setFromProjectionMatrix(jT),n.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),n.multiply(jT)}getViewport(e){return this._viewports[e]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(e){return this.camera=e.camera.clone(),this.intensity=e.intensity,this.bias=e.bias,this.radius=e.radius,this.autoUpdate=e.autoUpdate,this.needsUpdate=e.needsUpdate,this.normalBias=e.normalBias,this.blurSamples=e.blurSamples,this.mapSize.copy(e.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){let e={};return this.intensity!==1&&(e.intensity=this.intensity),this.bias!==0&&(e.bias=this.bias),this.normalBias!==0&&(e.normalBias=this.normalBias),this.radius!==1&&(e.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(e.mapSize=this.mapSize.toArray()),e.camera=this.camera.toJSON(!1).object,delete e.camera.matrix,e}},FT=class extends PT{constructor(){super(new MC(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(e){let t=this.camera,n=Eb*2*e.angle*this.focus,r=this.mapSize.width/this.mapSize.height*this.aspect,i=e.distance||t.far;(n!==t.fov||r!==t.aspect||i!==t.far)&&(t.fov=n,t.aspect=r,t.far=i,t.updateProjectionMatrix()),super.updateMatrices(e)}copy(e){return super.copy(e),this.focus=e.focus,this}},IT=class extends kT{constructor(e,t,n=0,r=Math.PI/3,i=0,a=2){super(e,t),this.isSpotLight=!0,this.type=`SpotLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.target=new xS,this.distance=n,this.angle=r,this.penumbra=i,this.decay=a,this.map=null,this.shadow=new FT}get power(){return this.intensity*Math.PI}set power(e){this.intensity=e/Math.PI}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.angle=e.angle,this.penumbra=e.penumbra,this.decay=e.decay,this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},LT=new Y,RT=new J,zT=new J,BT=class extends PT{constructor(){super(new MC(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ub(4,2),this._viewportCount=6,this._viewports=[new _x(2,1,1,1),new _x(0,1,1,1),new _x(3,1,1,1),new _x(1,1,1,1),new _x(3,0,1,1),new _x(1,0,1,1)],this._cubeDirections=[new J(1,0,0),new J(-1,0,0),new J(0,0,1),new J(0,0,-1),new J(0,1,0),new J(0,-1,0)],this._cubeUps=[new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,1,0),new J(0,0,1),new J(0,0,-1)]}updateMatrices(e,t=0){let n=this.camera,r=this.matrix,i=e.distance||n.far;i!==n.far&&(n.far=i,n.updateProjectionMatrix()),RT.setFromMatrixPosition(e.matrixWorld),n.position.copy(RT),zT.copy(n.position),zT.add(this._cubeDirections[t]),n.up.copy(this._cubeUps[t]),n.lookAt(zT),n.updateMatrixWorld(),r.makeTranslation(-RT.x,-RT.y,-RT.z),LT.multiplyMatrices(n.projectionMatrix,n.matrixWorldInverse),this._frustum.setFromProjectionMatrix(LT)}},VT=class extends kT{constructor(e,t,n=0,r=2){super(e,t),this.isPointLight=!0,this.type=`PointLight`,this.distance=n,this.decay=r,this.shadow=new BT}get power(){return this.intensity*4*Math.PI}set power(e){this.intensity=e/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(e,t){return super.copy(e,t),this.distance=e.distance,this.decay=e.decay,this.shadow=e.shadow.clone(),this}},HT=class extends OC{constructor(e=-1,t=1,n=1,r=-1,i=.1,a=2e3){super(),this.isOrthographicCamera=!0,this.type=`OrthographicCamera`,this.zoom=1,this.view=null,this.left=e,this.right=t,this.top=n,this.bottom=r,this.near=i,this.far=a,this.updateProjectionMatrix()}copy(e,t){return super.copy(e,t),this.left=e.left,this.right=e.right,this.top=e.top,this.bottom=e.bottom,this.near=e.near,this.far=e.far,this.zoom=e.zoom,this.view=e.view===null?null:Object.assign({},e.view),this}setViewOffset(e,t,n,r,i,a){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=e,this.view.fullHeight=t,this.view.offsetX=n,this.view.offsetY=r,this.view.width=i,this.view.height=a,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){let e=(this.right-this.left)/(2*this.zoom),t=(this.top-this.bottom)/(2*this.zoom),n=(this.right+this.left)/2,r=(this.top+this.bottom)/2,i=n-e,a=n+e,o=r+t,s=r-t;if(this.view!==null&&this.view.enabled){let e=(this.right-this.left)/this.view.fullWidth/this.zoom,t=(this.top-this.bottom)/this.view.fullHeight/this.zoom;i+=e*this.view.offsetX,a=i+e*this.view.width,o-=t*this.view.offsetY,s=o-t*this.view.height}this.projectionMatrix.makeOrthographic(i,a,o,s,this.near,this.far,this.coordinateSystem),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(e){let t=super.toJSON(e);return t.object.zoom=this.zoom,t.object.left=this.left,t.object.right=this.right,t.object.top=this.top,t.object.bottom=this.bottom,t.object.near=this.near,t.object.far=this.far,this.view!==null&&(t.object.view=Object.assign({},this.view)),t}},UT=class extends PT{constructor(){super(new HT(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}},WT=class extends kT{constructor(e,t){super(e,t),this.isDirectionalLight=!0,this.type=`DirectionalLight`,this.position.copy(xS.DEFAULT_UP),this.updateMatrix(),this.target=new xS,this.shadow=new UT}dispose(){this.shadow.dispose()}copy(e){return super.copy(e),this.target=e.target.clone(),this.shadow=e.shadow.clone(),this}},GT=class extends kT{constructor(e,t){super(e,t),this.isAmbientLight=!0,this.type=`AmbientLight`}},KT=class{static extractUrlBase(e){let t=e.lastIndexOf(`/`);return t===-1?`./`:e.slice(0,t+1)}static resolveURL(e,t){return typeof e!=`string`||e===``?``:(/^https?:\/\//i.test(t)&&/^\//.test(e)&&(t=t.replace(/(^https?:\/\/[^\/]+).*/i,`$1`)),/^(https?:)?\/\//i.test(e)||/^data:.*,.*$/i.test(e)||/^blob:.*$/i.test(e)?e:t+e)}},qT=new WeakMap,JT=class extends ST{constructor(e){super(e),this.isImageBitmapLoader=!0,typeof createImageBitmap>`u`&&console.warn(`THREE.ImageBitmapLoader: createImageBitmap() not supported.`),typeof fetch>`u`&&console.warn(`THREE.ImageBitmapLoader: fetch() not supported.`),this.options={premultiplyAlpha:`none`}}setOptions(e){return this.options=e,this}load(e,t,n,r){e===void 0&&(e=``),this.path!==void 0&&(e=this.path+e),e=this.manager.resolveURL(e);let i=this,a=yT.get(e);if(a!==void 0){if(i.manager.itemStart(e),a.then){a.then(n=>{if(qT.has(a)===!0)r&&r(qT.get(a)),i.manager.itemError(e),i.manager.itemEnd(e);else return t&&t(n),i.manager.itemEnd(e),n});return}return setTimeout(function(){t&&t(a),i.manager.itemEnd(e)},0),a}let o={};o.credentials=this.crossOrigin===`anonymous`?`same-origin`:`include`,o.headers=this.requestHeader;let s=fetch(e,o).then(function(e){return e.blob()}).then(function(e){return createImageBitmap(e,Object.assign(i.options,{colorSpaceConversion:`none`}))}).then(function(n){return yT.add(e,n),t&&t(n),i.manager.itemEnd(e),n}).catch(function(t){r&&r(t),qT.set(s,t),yT.remove(e),i.manager.itemError(e),i.manager.itemEnd(e)});yT.add(e,s),i.manager.itemStart(e)}},YT=class extends MC{constructor(e=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=e}},XT=`\\[\\]\\.:\\/`,ZT=RegExp(`[\\[\\]\\.:\\/]`,`g`),QT=`[^\\[\\]\\.:\\/]`,$T=`[^`+XT.replace(`\\.`,``)+`]`,eE=`((?:WC+[\\/:])*)`.replace(`WC`,QT),tE=`(WCOD+)?`.replace(`WCOD`,$T),nE=`(?:\\.(WC+)(?:\\[(.+)\\])?)?`.replace(`WC`,QT),rE=`\\.(WC+)(?:\\[(.+)\\])?`.replace(`WC`,QT),iE=RegExp(`^`+eE+tE+nE+rE+`$`),aE=[`material`,`materials`,`bones`,`map`],oE=class{constructor(e,t,n){let r=n||sE.parseTrackName(t);this._targetGroup=e,this._bindings=e.subscribe_(t,r)}getValue(e,t){this.bind();let n=this._targetGroup.nCachedObjects_,r=this._bindings[n];r!==void 0&&r.getValue(e,t)}setValue(e,t){let n=this._bindings;for(let r=this._targetGroup.nCachedObjects_,i=n.length;r!==i;++r)n[r].setValue(e,t)}bind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].bind()}unbind(){let e=this._bindings;for(let t=this._targetGroup.nCachedObjects_,n=e.length;t!==n;++t)e[t].unbind()}},sE=class e{constructor(t,n,r){this.path=n,this.parsedPath=r||e.parseTrackName(n),this.node=e.findNode(t,this.parsedPath.nodeName),this.rootNode=t,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(t,n,r){return t&&t.isAnimationObjectGroup?new e.Composite(t,n,r):new e(t,n,r)}static sanitizeNodeName(e){return e.replace(/\s/g,`_`).replace(ZT,``)}static parseTrackName(e){let t=iE.exec(e);if(t===null)throw Error(`PropertyBinding: Cannot parse trackName: `+e);let n={nodeName:t[2],objectName:t[3],objectIndex:t[4],propertyName:t[5],propertyIndex:t[6]},r=n.nodeName&&n.nodeName.lastIndexOf(`.`);if(r!==void 0&&r!==-1){let e=n.nodeName.substring(r+1);aE.indexOf(e)!==-1&&(n.nodeName=n.nodeName.substring(0,r),n.objectName=e)}if(n.propertyName===null||n.propertyName.length===0)throw Error(`PropertyBinding: can not parse propertyName from trackName: `+e);return n}static findNode(e,t){if(t===void 0||t===``||t===`.`||t===-1||t===e.name||t===e.uuid)return e;if(e.skeleton){let n=e.skeleton.getBoneByName(t);if(n!==void 0)return n}if(e.children){let n=function(e){for(let r=0;re.start-t.start);let t=0;for(let e=1;e 0 - vec4 plane; - #ifdef ALPHA_TO_COVERAGE - float distanceToPlane, distanceGradient; - float clipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - if ( clipOpacity == 0.0 ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - float unionClipOpacity = 1.0; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w; - distanceGradient = fwidth( distanceToPlane ) / 2.0; - unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane ); - } - #pragma unroll_loop_end - clipOpacity *= 1.0 - unionClipOpacity; - #endif - diffuseColor.a *= clipOpacity; - if ( diffuseColor.a == 0.0 ) discard; - #else - #pragma unroll_loop_start - for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard; - } - #pragma unroll_loop_end - #if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES - bool clipped = true; - #pragma unroll_loop_start - for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) { - plane = clippingPlanes[ i ]; - clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped; - } - #pragma unroll_loop_end - if ( clipped ) discard; - #endif - #endif -#endif`,clipping_planes_pars_fragment:`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; - uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ]; -#endif`,clipping_planes_pars_vertex:`#if NUM_CLIPPING_PLANES > 0 - varying vec3 vClipPosition; -#endif`,clipping_planes_vertex:`#if NUM_CLIPPING_PLANES > 0 - vClipPosition = - mvPosition.xyz; -#endif`,color_fragment:`#if defined( USE_COLOR_ALPHA ) - diffuseColor *= vColor; -#elif defined( USE_COLOR ) - diffuseColor.rgb *= vColor; -#endif`,color_pars_fragment:`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) - varying vec3 vColor; -#endif`,color_pars_vertex:`#if defined( USE_COLOR_ALPHA ) - varying vec4 vColor; -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - varying vec3 vColor; -#endif`,color_vertex:`#if defined( USE_COLOR_ALPHA ) - vColor = vec4( 1.0 ); -#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR ) - vColor = vec3( 1.0 ); -#endif -#ifdef USE_COLOR - vColor *= color; -#endif -#ifdef USE_INSTANCING_COLOR - vColor.xyz *= instanceColor.xyz; -#endif -#ifdef USE_BATCHING_COLOR - vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) ); - vColor.xyz *= batchingColor.xyz; -#endif`,common:`#define PI 3.141592653589793 -#define PI2 6.283185307179586 -#define PI_HALF 1.5707963267948966 -#define RECIPROCAL_PI 0.3183098861837907 -#define RECIPROCAL_PI2 0.15915494309189535 -#define EPSILON 1e-6 -#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -#define whiteComplement( a ) ( 1.0 - saturate( a ) ) -float pow2( const in float x ) { return x*x; } -vec3 pow2( const in vec3 x ) { return x*x; } -float pow3( const in float x ) { return x*x*x; } -float pow4( const in float x ) { float x2 = x*x; return x2*x2; } -float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); } -float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); } -highp float rand( const in vec2 uv ) { - const highp float a = 12.9898, b = 78.233, c = 43758.5453; - highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI ); - return fract( sin( sn ) * c ); -} -#ifdef HIGH_PRECISION - float precisionSafeLength( vec3 v ) { return length( v ); } -#else - float precisionSafeLength( vec3 v ) { - float maxComponent = max3( abs( v ) ); - return length( v / maxComponent ) * maxComponent; - } -#endif -struct IncidentLight { - vec3 color; - vec3 direction; - bool visible; -}; -struct ReflectedLight { - vec3 directDiffuse; - vec3 directSpecular; - vec3 indirectDiffuse; - vec3 indirectSpecular; -}; -#ifdef USE_ALPHAHASH - varying vec3 vPosition; -#endif -vec3 transformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz ); -} -vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) { - return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz ); -} -mat3 transposeMat3( const in mat3 m ) { - mat3 tmp; - tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x ); - tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y ); - tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z ); - return tmp; -} -bool isPerspectiveMatrix( mat4 m ) { - return m[ 2 ][ 3 ] == - 1.0; -} -vec2 equirectUv( in vec3 dir ) { - float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5; - float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5; - return vec2( u, v ); -} -vec3 BRDF_Lambert( const in vec3 diffuseColor ) { - return RECIPROCAL_PI * diffuseColor; -} -vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} -float F_Schlick( const in float f0, const in float f90, const in float dotVH ) { - float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH ); - return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel ); -} // validated`,cube_uv_reflection_fragment:`#ifdef ENVMAP_TYPE_CUBE_UV - #define cubeUV_minMipLevel 4.0 - #define cubeUV_minTileSize 16.0 - float getFace( vec3 direction ) { - vec3 absDirection = abs( direction ); - float face = - 1.0; - if ( absDirection.x > absDirection.z ) { - if ( absDirection.x > absDirection.y ) - face = direction.x > 0.0 ? 0.0 : 3.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } else { - if ( absDirection.z > absDirection.y ) - face = direction.z > 0.0 ? 2.0 : 5.0; - else - face = direction.y > 0.0 ? 1.0 : 4.0; - } - return face; - } - vec2 getUV( vec3 direction, float face ) { - vec2 uv; - if ( face == 0.0 ) { - uv = vec2( direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 1.0 ) { - uv = vec2( - direction.x, - direction.z ) / abs( direction.y ); - } else if ( face == 2.0 ) { - uv = vec2( - direction.x, direction.y ) / abs( direction.z ); - } else if ( face == 3.0 ) { - uv = vec2( - direction.z, direction.y ) / abs( direction.x ); - } else if ( face == 4.0 ) { - uv = vec2( - direction.x, direction.z ) / abs( direction.y ); - } else { - uv = vec2( direction.x, direction.y ) / abs( direction.z ); - } - return 0.5 * ( uv + 1.0 ); - } - vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) { - float face = getFace( direction ); - float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 ); - mipInt = max( mipInt, cubeUV_minMipLevel ); - float faceSize = exp2( mipInt ); - highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0; - if ( face > 2.0 ) { - uv.y += faceSize; - face -= 3.0; - } - uv.x += face * faceSize; - uv.x += filterInt * 3.0 * cubeUV_minTileSize; - uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize ); - uv.x *= CUBEUV_TEXEL_WIDTH; - uv.y *= CUBEUV_TEXEL_HEIGHT; - #ifdef texture2DGradEXT - return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb; - #else - return texture2D( envMap, uv ).rgb; - #endif - } - #define cubeUV_r0 1.0 - #define cubeUV_m0 - 2.0 - #define cubeUV_r1 0.8 - #define cubeUV_m1 - 1.0 - #define cubeUV_r4 0.4 - #define cubeUV_m4 2.0 - #define cubeUV_r5 0.305 - #define cubeUV_m5 3.0 - #define cubeUV_r6 0.21 - #define cubeUV_m6 4.0 - float roughnessToMip( float roughness ) { - float mip = 0.0; - if ( roughness >= cubeUV_r1 ) { - mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0; - } else if ( roughness >= cubeUV_r4 ) { - mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1; - } else if ( roughness >= cubeUV_r5 ) { - mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4; - } else if ( roughness >= cubeUV_r6 ) { - mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5; - } else { - mip = - 2.0 * log2( 1.16 * roughness ); } - return mip; - } - vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) { - float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP ); - float mipF = fract( mip ); - float mipInt = floor( mip ); - vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt ); - if ( mipF == 0.0 ) { - return vec4( color0, 1.0 ); - } else { - vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 ); - return vec4( mix( color0, color1, mipF ), 1.0 ); - } - } -#endif`,defaultnormal_vertex:`vec3 transformedNormal = objectNormal; -#ifdef USE_TANGENT - vec3 transformedTangent = objectTangent; -#endif -#ifdef USE_BATCHING - mat3 bm = mat3( batchingMatrix ); - transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) ); - transformedNormal = bm * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = bm * transformedTangent; - #endif -#endif -#ifdef USE_INSTANCING - mat3 im = mat3( instanceMatrix ); - transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) ); - transformedNormal = im * transformedNormal; - #ifdef USE_TANGENT - transformedTangent = im * transformedTangent; - #endif -#endif -transformedNormal = normalMatrix * transformedNormal; -#ifdef FLIP_SIDED - transformedNormal = - transformedNormal; -#endif -#ifdef USE_TANGENT - transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz; - #ifdef FLIP_SIDED - transformedTangent = - transformedTangent; - #endif -#endif`,displacementmap_pars_vertex:`#ifdef USE_DISPLACEMENTMAP - uniform sampler2D displacementMap; - uniform float displacementScale; - uniform float displacementBias; -#endif`,displacementmap_vertex:`#ifdef USE_DISPLACEMENTMAP - transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias ); -#endif`,emissivemap_fragment:`#ifdef USE_EMISSIVEMAP - vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv ); - #ifdef DECODE_VIDEO_TEXTURE_EMISSIVE - emissiveColor = sRGBTransferEOTF( emissiveColor ); - #endif - totalEmissiveRadiance *= emissiveColor.rgb; -#endif`,emissivemap_pars_fragment:`#ifdef USE_EMISSIVEMAP - uniform sampler2D emissiveMap; -#endif`,colorspace_fragment:`gl_FragColor = linearToOutputTexel( gl_FragColor );`,colorspace_pars_fragment:`vec4 LinearTransferOETF( in vec4 value ) { - return value; -} -vec4 sRGBTransferEOTF( in vec4 value ) { - return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a ); -} -vec4 sRGBTransferOETF( in vec4 value ) { - return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a ); -}`,envmap_fragment:`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vec3 cameraToFrag; - if ( isOrthographic ) { - cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToFrag = normalize( vWorldPosition - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vec3 reflectVec = reflect( cameraToFrag, worldNormal ); - #else - vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio ); - #endif - #else - vec3 reflectVec = vReflect; - #endif - #ifdef ENVMAP_TYPE_CUBE - vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) ); - #else - vec4 envColor = vec4( 0.0 ); - #endif - #ifdef ENVMAP_BLENDING_MULTIPLY - outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_MIX ) - outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity ); - #elif defined( ENVMAP_BLENDING_ADD ) - outgoingLight += envColor.xyz * specularStrength * reflectivity; - #endif -#endif`,envmap_common_pars_fragment:`#ifdef USE_ENVMAP - uniform float envMapIntensity; - uniform float flipEnvMap; - uniform mat3 envMapRotation; - #ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; - #else - uniform sampler2D envMap; - #endif - -#endif`,envmap_pars_fragment:`#ifdef USE_ENVMAP - uniform float reflectivity; - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - varying vec3 vWorldPosition; - uniform float refractionRatio; - #else - varying vec3 vReflect; - #endif -#endif`,envmap_pars_vertex:`#ifdef USE_ENVMAP - #if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT ) - #define ENV_WORLDPOS - #endif - #ifdef ENV_WORLDPOS - - varying vec3 vWorldPosition; - #else - varying vec3 vReflect; - uniform float refractionRatio; - #endif -#endif`,envmap_physical_pars_fragment:`#ifdef USE_ENVMAP - vec3 getIBLIrradiance( const in vec3 normal ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 ); - return PI * envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 reflectVec = reflect( - viewDir, normal ); - reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) ); - reflectVec = inverseTransformDirection( reflectVec, viewMatrix ); - vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness ); - return envMapColor.rgb * envMapIntensity; - #else - return vec3( 0.0 ); - #endif - } - #ifdef USE_ANISOTROPY - vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) { - #ifdef ENVMAP_TYPE_CUBE_UV - vec3 bentNormal = cross( bitangent, viewDir ); - bentNormal = normalize( cross( bentNormal, bitangent ) ); - bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) ); - return getIBLRadiance( viewDir, bentNormal, roughness ); - #else - return vec3( 0.0 ); - #endif - } - #endif -#endif`,envmap_vertex:`#ifdef USE_ENVMAP - #ifdef ENV_WORLDPOS - vWorldPosition = worldPosition.xyz; - #else - vec3 cameraToVertex; - if ( isOrthographic ) { - cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) ); - } else { - cameraToVertex = normalize( worldPosition.xyz - cameraPosition ); - } - vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - #ifdef ENVMAP_MODE_REFLECTION - vReflect = reflect( cameraToVertex, worldNormal ); - #else - vReflect = refract( cameraToVertex, worldNormal, refractionRatio ); - #endif - #endif -#endif`,fog_vertex:`#ifdef USE_FOG - vFogDepth = - mvPosition.z; -#endif`,fog_pars_vertex:`#ifdef USE_FOG - varying float vFogDepth; -#endif`,fog_fragment:`#ifdef USE_FOG - #ifdef FOG_EXP2 - float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth ); - #else - float fogFactor = smoothstep( fogNear, fogFar, vFogDepth ); - #endif - gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor ); -#endif`,fog_pars_fragment:`#ifdef USE_FOG - uniform vec3 fogColor; - varying float vFogDepth; - #ifdef FOG_EXP2 - uniform float fogDensity; - #else - uniform float fogNear; - uniform float fogFar; - #endif -#endif`,gradientmap_pars_fragment:`#ifdef USE_GRADIENTMAP - uniform sampler2D gradientMap; -#endif -vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) { - float dotNL = dot( normal, lightDirection ); - vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 ); - #ifdef USE_GRADIENTMAP - return vec3( texture2D( gradientMap, coord ).r ); - #else - vec2 fw = fwidth( coord ) * 0.5; - return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) ); - #endif -}`,lightmap_pars_fragment:`#ifdef USE_LIGHTMAP - uniform sampler2D lightMap; - uniform float lightMapIntensity; -#endif`,lights_lambert_fragment:`LambertMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularStrength = specularStrength;`,lights_lambert_pars_fragment:`varying vec3 vViewPosition; -struct LambertMaterial { - vec3 diffuseColor; - float specularStrength; -}; -void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Lambert -#define RE_IndirectDiffuse RE_IndirectDiffuse_Lambert`,lights_pars_begin:`uniform bool receiveShadow; -uniform vec3 ambientLightColor; -#if defined( USE_LIGHT_PROBES ) - uniform vec3 lightProbe[ 9 ]; -#endif -vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) { - float x = normal.x, y = normal.y, z = normal.z; - vec3 result = shCoefficients[ 0 ] * 0.886227; - result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y; - result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z; - result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x; - result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y; - result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z; - result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 ); - result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z; - result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y ); - return result; -} -vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) { - vec3 worldNormal = inverseTransformDirection( normal, viewMatrix ); - vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe ); - return irradiance; -} -vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) { - vec3 irradiance = ambientLightColor; - return irradiance; -} -float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) { - float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 ); - if ( cutoffDistance > 0.0 ) { - distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) ); - } - return distanceFalloff; -} -float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) { - return smoothstep( coneCosine, penumbraCosine, angleCosine ); -} -#if NUM_DIR_LIGHTS > 0 - struct DirectionalLight { - vec3 direction; - vec3 color; - }; - uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ]; - void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) { - light.color = directionalLight.color; - light.direction = directionalLight.direction; - light.visible = true; - } -#endif -#if NUM_POINT_LIGHTS > 0 - struct PointLight { - vec3 position; - vec3 color; - float distance; - float decay; - }; - uniform PointLight pointLights[ NUM_POINT_LIGHTS ]; - void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = pointLight.position - geometryPosition; - light.direction = normalize( lVector ); - float lightDistance = length( lVector ); - light.color = pointLight.color; - light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } -#endif -#if NUM_SPOT_LIGHTS > 0 - struct SpotLight { - vec3 position; - vec3 direction; - vec3 color; - float distance; - float decay; - float coneCos; - float penumbraCos; - }; - uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ]; - void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) { - vec3 lVector = spotLight.position - geometryPosition; - light.direction = normalize( lVector ); - float angleCos = dot( light.direction, spotLight.direction ); - float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos ); - if ( spotAttenuation > 0.0 ) { - float lightDistance = length( lVector ); - light.color = spotLight.color * spotAttenuation; - light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay ); - light.visible = ( light.color != vec3( 0.0 ) ); - } else { - light.color = vec3( 0.0 ); - light.visible = false; - } - } -#endif -#if NUM_RECT_AREA_LIGHTS > 0 - struct RectAreaLight { - vec3 color; - vec3 position; - vec3 halfWidth; - vec3 halfHeight; - }; - uniform sampler2D ltc_1; uniform sampler2D ltc_2; - uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ]; -#endif -#if NUM_HEMI_LIGHTS > 0 - struct HemisphereLight { - vec3 direction; - vec3 skyColor; - vec3 groundColor; - }; - uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ]; - vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) { - float dotNL = dot( normal, hemiLight.direction ); - float hemiDiffuseWeight = 0.5 * dotNL + 0.5; - vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight ); - return irradiance; - } -#endif`,lights_toon_fragment:`ToonMaterial material; -material.diffuseColor = diffuseColor.rgb;`,lights_toon_pars_fragment:`varying vec3 vViewPosition; -struct ToonMaterial { - vec3 diffuseColor; -}; -void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_Toon -#define RE_IndirectDiffuse RE_IndirectDiffuse_Toon`,lights_phong_fragment:`BlinnPhongMaterial material; -material.diffuseColor = diffuseColor.rgb; -material.specularColor = specular; -material.specularShininess = shininess; -material.specularStrength = specularStrength;`,lights_phong_pars_fragment:`varying vec3 vViewPosition; -struct BlinnPhongMaterial { - vec3 diffuseColor; - vec3 specularColor; - float specularShininess; - float specularStrength; -}; -void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); - reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength; -} -void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -#define RE_Direct RE_Direct_BlinnPhong -#define RE_IndirectDiffuse RE_IndirectDiffuse_BlinnPhong`,lights_physical_fragment:`PhysicalMaterial material; -material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor ); -vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) ); -float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z ); -material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness; -material.roughness = min( material.roughness, 1.0 ); -#ifdef IOR - material.ior = ior; - #ifdef USE_SPECULAR - float specularIntensityFactor = specularIntensity; - vec3 specularColorFactor = specularColor; - #ifdef USE_SPECULAR_COLORMAP - specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a; - #endif - material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor ); - #else - float specularIntensityFactor = 1.0; - vec3 specularColorFactor = vec3( 1.0 ); - material.specularF90 = 1.0; - #endif - material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor ); -#else - material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor ); - material.specularF90 = 1.0; -#endif -#ifdef USE_CLEARCOAT - material.clearcoat = clearcoat; - material.clearcoatRoughness = clearcoatRoughness; - material.clearcoatF0 = vec3( 0.04 ); - material.clearcoatF90 = 1.0; - #ifdef USE_CLEARCOATMAP - material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x; - #endif - #ifdef USE_CLEARCOAT_ROUGHNESSMAP - material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y; - #endif - material.clearcoat = saturate( material.clearcoat ); material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 ); - material.clearcoatRoughness += geometryRoughness; - material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 ); -#endif -#ifdef USE_DISPERSION - material.dispersion = dispersion; -#endif -#ifdef USE_IRIDESCENCE - material.iridescence = iridescence; - material.iridescenceIOR = iridescenceIOR; - #ifdef USE_IRIDESCENCEMAP - material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r; - #endif - #ifdef USE_IRIDESCENCE_THICKNESSMAP - material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum; - #else - material.iridescenceThickness = iridescenceThicknessMaximum; - #endif -#endif -#ifdef USE_SHEEN - material.sheenColor = sheenColor; - #ifdef USE_SHEEN_COLORMAP - material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb; - #endif - material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 ); - #ifdef USE_SHEEN_ROUGHNESSMAP - material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a; - #endif -#endif -#ifdef USE_ANISOTROPY - #ifdef USE_ANISOTROPYMAP - mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x ); - vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb; - vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b; - #else - vec2 anisotropyV = anisotropyVector; - #endif - material.anisotropy = length( anisotropyV ); - if( material.anisotropy == 0.0 ) { - anisotropyV = vec2( 1.0, 0.0 ); - } else { - anisotropyV /= material.anisotropy; - material.anisotropy = saturate( material.anisotropy ); - } - material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) ); - material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y; - material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y; -#endif`,lights_physical_pars_fragment:`struct PhysicalMaterial { - vec3 diffuseColor; - float roughness; - vec3 specularColor; - float specularF90; - float dispersion; - #ifdef USE_CLEARCOAT - float clearcoat; - float clearcoatRoughness; - vec3 clearcoatF0; - float clearcoatF90; - #endif - #ifdef USE_IRIDESCENCE - float iridescence; - float iridescenceIOR; - float iridescenceThickness; - vec3 iridescenceFresnel; - vec3 iridescenceF0; - #endif - #ifdef USE_SHEEN - vec3 sheenColor; - float sheenRoughness; - #endif - #ifdef IOR - float ior; - #endif - #ifdef USE_TRANSMISSION - float transmission; - float transmissionAlpha; - float thickness; - float attenuationDistance; - vec3 attenuationColor; - #endif - #ifdef USE_ANISOTROPY - float anisotropy; - float alphaT; - vec3 anisotropyT; - vec3 anisotropyB; - #endif -}; -vec3 clearcoatSpecularDirect = vec3( 0.0 ); -vec3 clearcoatSpecularIndirect = vec3( 0.0 ); -vec3 sheenSpecularDirect = vec3( 0.0 ); -vec3 sheenSpecularIndirect = vec3(0.0 ); -vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) { - float x = clamp( 1.0 - dotVH, 0.0, 1.0 ); - float x2 = x * x; - float x5 = clamp( x * x2 * x2, 0.0, 0.9999 ); - return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 ); -} -float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) { - float a2 = pow2( alpha ); - float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) ); - float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) ); - return 0.5 / max( gv + gl, EPSILON ); -} -float D_GGX( const in float alpha, const in float dotNH ) { - float a2 = pow2( alpha ); - float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0; - return RECIPROCAL_PI * a2 / pow2( denom ); -} -#ifdef USE_ANISOTROPY - float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) { - float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) ); - float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) ); - float v = 0.5 / ( gv + gl ); - return saturate(v); - } - float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) { - float a2 = alphaT * alphaB; - highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH ); - highp float v2 = dot( v, v ); - float w2 = a2 / v2; - return RECIPROCAL_PI * a2 * pow2 ( w2 ); - } -#endif -#ifdef USE_CLEARCOAT - vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) { - vec3 f0 = material.clearcoatF0; - float f90 = material.clearcoatF90; - float roughness = material.clearcoatRoughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - return F * ( V * D ); - } -#endif -vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) { - vec3 f0 = material.specularColor; - float f90 = material.specularF90; - float roughness = material.roughness; - float alpha = pow2( roughness ); - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float dotVH = saturate( dot( viewDir, halfDir ) ); - vec3 F = F_Schlick( f0, f90, dotVH ); - #ifdef USE_IRIDESCENCE - F = mix( F, material.iridescenceFresnel, material.iridescence ); - #endif - #ifdef USE_ANISOTROPY - float dotTL = dot( material.anisotropyT, lightDir ); - float dotTV = dot( material.anisotropyT, viewDir ); - float dotTH = dot( material.anisotropyT, halfDir ); - float dotBL = dot( material.anisotropyB, lightDir ); - float dotBV = dot( material.anisotropyB, viewDir ); - float dotBH = dot( material.anisotropyB, halfDir ); - float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL ); - float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH ); - #else - float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV ); - float D = D_GGX( alpha, dotNH ); - #endif - return F * ( V * D ); -} -vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) { - const float LUT_SIZE = 64.0; - const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE; - const float LUT_BIAS = 0.5 / LUT_SIZE; - float dotNV = saturate( dot( N, V ) ); - vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) ); - uv = uv * LUT_SCALE + LUT_BIAS; - return uv; -} -float LTC_ClippedSphereFormFactor( const in vec3 f ) { - float l = length( f ); - return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 ); -} -vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) { - float x = dot( v1, v2 ); - float y = abs( x ); - float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y; - float b = 3.4175940 + ( 4.1616724 + y ) * y; - float v = a / b; - float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v; - return cross( v1, v2 ) * theta_sintheta; -} -vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) { - vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ]; - vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ]; - vec3 lightNormal = cross( v1, v2 ); - if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 ); - vec3 T1, T2; - T1 = normalize( V - N * dot( V, N ) ); - T2 = - cross( N, T1 ); - mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) ); - vec3 coords[ 4 ]; - coords[ 0 ] = mat * ( rectCoords[ 0 ] - P ); - coords[ 1 ] = mat * ( rectCoords[ 1 ] - P ); - coords[ 2 ] = mat * ( rectCoords[ 2 ] - P ); - coords[ 3 ] = mat * ( rectCoords[ 3 ] - P ); - coords[ 0 ] = normalize( coords[ 0 ] ); - coords[ 1 ] = normalize( coords[ 1 ] ); - coords[ 2 ] = normalize( coords[ 2 ] ); - coords[ 3 ] = normalize( coords[ 3 ] ); - vec3 vectorFormFactor = vec3( 0.0 ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] ); - vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] ); - float result = LTC_ClippedSphereFormFactor( vectorFormFactor ); - return vec3( result ); -} -#if defined( USE_SHEEN ) -float D_Charlie( float roughness, float dotNH ) { - float alpha = pow2( roughness ); - float invAlpha = 1.0 / alpha; - float cos2h = dotNH * dotNH; - float sin2h = max( 1.0 - cos2h, 0.0078125 ); - return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI ); -} -float V_Neubelt( float dotNV, float dotNL ) { - return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) ); -} -vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) { - vec3 halfDir = normalize( lightDir + viewDir ); - float dotNL = saturate( dot( normal, lightDir ) ); - float dotNV = saturate( dot( normal, viewDir ) ); - float dotNH = saturate( dot( normal, halfDir ) ); - float D = D_Charlie( sheenRoughness, dotNH ); - float V = V_Neubelt( dotNV, dotNL ); - return sheenColor * ( D * V ); -} -#endif -float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - float r2 = roughness * roughness; - float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95; - float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72; - float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) ); - return saturate( DG * RECIPROCAL_PI ); -} -vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) { - float dotNV = saturate( dot( normal, viewDir ) ); - const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 ); - const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 ); - vec4 r = roughness * c0 + c1; - float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y; - vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw; - return fab; -} -vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) { - vec2 fab = DFGApprox( normal, viewDir, roughness ); - return specularColor * fab.x + specularF90 * fab.y; -} -#ifdef USE_IRIDESCENCE -void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#else -void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) { -#endif - vec2 fab = DFGApprox( normal, viewDir, roughness ); - #ifdef USE_IRIDESCENCE - vec3 Fr = mix( specularColor, iridescenceF0, iridescence ); - #else - vec3 Fr = specularColor; - #endif - vec3 FssEss = Fr * fab.x + specularF90 * fab.y; - float Ess = fab.x + fab.y; - float Ems = 1.0 - Ess; - vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619; vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg ); - singleScatter += FssEss; - multiScatter += Fms * Ems; -} -#if NUM_RECT_AREA_LIGHTS > 0 - void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - vec3 normal = geometryNormal; - vec3 viewDir = geometryViewDir; - vec3 position = geometryPosition; - vec3 lightPos = rectAreaLight.position; - vec3 halfWidth = rectAreaLight.halfWidth; - vec3 halfHeight = rectAreaLight.halfHeight; - vec3 lightColor = rectAreaLight.color; - float roughness = material.roughness; - vec3 rectCoords[ 4 ]; - rectCoords[ 0 ] = lightPos + halfWidth - halfHeight; rectCoords[ 1 ] = lightPos - halfWidth - halfHeight; - rectCoords[ 2 ] = lightPos - halfWidth + halfHeight; - rectCoords[ 3 ] = lightPos + halfWidth + halfHeight; - vec2 uv = LTC_Uv( normal, viewDir, roughness ); - vec4 t1 = texture2D( ltc_1, uv ); - vec4 t2 = texture2D( ltc_2, uv ); - mat3 mInv = mat3( - vec3( t1.x, 0, t1.y ), - vec3( 0, 1, 0 ), - vec3( t1.z, 0, t1.w ) - ); - vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y ); - reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords ); - reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords ); - } -#endif -void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - float dotNL = saturate( dot( geometryNormal, directLight.direction ) ); - vec3 irradiance = dotNL * directLight.color; - #ifdef USE_CLEARCOAT - float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) ); - vec3 ccIrradiance = dotNLcc * directLight.color; - clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material ); - #endif - #ifdef USE_SHEEN - sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness ); - #endif - reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material ); - reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) { - reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor ); -} -void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) { - #ifdef USE_CLEARCOAT - clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness ); - #endif - #ifdef USE_SHEEN - sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness ); - #endif - vec3 singleScattering = vec3( 0.0 ); - vec3 multiScattering = vec3( 0.0 ); - vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI; - #ifdef USE_IRIDESCENCE - computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering ); - #else - computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering ); - #endif - vec3 totalScattering = singleScattering + multiScattering; - vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) ); - reflectedLight.indirectSpecular += radiance * singleScattering; - reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance; - reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance; -} -#define RE_Direct RE_Direct_Physical -#define RE_Direct_RectArea RE_Direct_RectArea_Physical -#define RE_IndirectDiffuse RE_IndirectDiffuse_Physical -#define RE_IndirectSpecular RE_IndirectSpecular_Physical -float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) { - return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion ); -}`,lights_fragment_begin:` -vec3 geometryPosition = - vViewPosition; -vec3 geometryNormal = normal; -vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition ); -vec3 geometryClearcoatNormal = vec3( 0.0 ); -#ifdef USE_CLEARCOAT - geometryClearcoatNormal = clearcoatNormal; -#endif -#ifdef USE_IRIDESCENCE - float dotNVi = saturate( dot( normal, geometryViewDir ) ); - if ( material.iridescenceThickness == 0.0 ) { - material.iridescence = 0.0; - } else { - material.iridescence = saturate( material.iridescence ); - } - if ( material.iridescence > 0.0 ) { - material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor ); - material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi ); - } -#endif -IncidentLight directLight; -#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct ) - PointLight pointLight; - #if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) { - pointLight = pointLights[ i ]; - getPointLightInfo( pointLight, geometryPosition, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS ) - pointLightShadow = pointLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct ) - SpotLight spotLight; - vec4 spotColor; - vec3 spotLightCoord; - bool inSpotLightMap; - #if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) { - spotLight = spotLights[ i ]; - getSpotLightInfo( spotLight, geometryPosition, directLight ); - #if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX - #elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - #define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS - #else - #define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS ) - #endif - #if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS ) - spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w; - inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) ); - spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy ); - directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color; - #endif - #undef SPOT_LIGHT_MAP_INDEX - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - spotLightShadow = spotLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct ) - DirectionalLight directionalLight; - #if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLightShadow; - #endif - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) { - directionalLight = directionalLights[ i ]; - getDirectionalLightInfo( directionalLight, directLight ); - #if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS ) - directionalLightShadow = directionalLightShadows[ i ]; - directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - #endif - RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea ) - RectAreaLight rectAreaLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) { - rectAreaLight = rectAreaLights[ i ]; - RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); - } - #pragma unroll_loop_end -#endif -#if defined( RE_IndirectDiffuse ) - vec3 iblIrradiance = vec3( 0.0 ); - vec3 irradiance = getAmbientLightIrradiance( ambientLightColor ); - #if defined( USE_LIGHT_PROBES ) - irradiance += getLightProbeIrradiance( lightProbe, geometryNormal ); - #endif - #if ( NUM_HEMI_LIGHTS > 0 ) - #pragma unroll_loop_start - for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) { - irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal ); - } - #pragma unroll_loop_end - #endif -#endif -#if defined( RE_IndirectSpecular ) - vec3 radiance = vec3( 0.0 ); - vec3 clearcoatRadiance = vec3( 0.0 ); -#endif`,lights_fragment_maps:`#if defined( RE_IndirectDiffuse ) - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity; - irradiance += lightMapIrradiance; - #endif - #if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV ) - iblIrradiance += getIBLIrradiance( geometryNormal ); - #endif -#endif -#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular ) - #ifdef USE_ANISOTROPY - radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy ); - #else - radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness ); - #endif - #ifdef USE_CLEARCOAT - clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness ); - #endif -#endif`,lights_fragment_end:`#if defined( RE_IndirectDiffuse ) - RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif -#if defined( RE_IndirectSpecular ) - RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight ); -#endif`,logdepthbuf_fragment:`#if defined( USE_LOGDEPTHBUF ) - gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5; -#endif`,logdepthbuf_pars_fragment:`#if defined( USE_LOGDEPTHBUF ) - uniform float logDepthBufFC; - varying float vFragDepth; - varying float vIsPerspective; -#endif`,logdepthbuf_pars_vertex:`#ifdef USE_LOGDEPTHBUF - varying float vFragDepth; - varying float vIsPerspective; -#endif`,logdepthbuf_vertex:`#ifdef USE_LOGDEPTHBUF - vFragDepth = 1.0 + gl_Position.w; - vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) ); -#endif`,map_fragment:`#ifdef USE_MAP - vec4 sampledDiffuseColor = texture2D( map, vMapUv ); - #ifdef DECODE_VIDEO_TEXTURE - sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor ); - #endif - diffuseColor *= sampledDiffuseColor; -#endif`,map_pars_fragment:`#ifdef USE_MAP - uniform sampler2D map; -#endif`,map_particle_fragment:`#if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - #if defined( USE_POINTS_UV ) - vec2 uv = vUv; - #else - vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy; - #endif -#endif -#ifdef USE_MAP - diffuseColor *= texture2D( map, uv ); -#endif -#ifdef USE_ALPHAMAP - diffuseColor.a *= texture2D( alphaMap, uv ).g; -#endif`,map_particle_pars_fragment:`#if defined( USE_POINTS_UV ) - varying vec2 vUv; -#else - #if defined( USE_MAP ) || defined( USE_ALPHAMAP ) - uniform mat3 uvTransform; - #endif -#endif -#ifdef USE_MAP - uniform sampler2D map; -#endif -#ifdef USE_ALPHAMAP - uniform sampler2D alphaMap; -#endif`,metalnessmap_fragment:`float metalnessFactor = metalness; -#ifdef USE_METALNESSMAP - vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv ); - metalnessFactor *= texelMetalness.b; -#endif`,metalnessmap_pars_fragment:`#ifdef USE_METALNESSMAP - uniform sampler2D metalnessMap; -#endif`,morphinstance_vertex:`#ifdef USE_INSTANCING_MORPH - float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - morphTargetInfluences[i] = texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r; - } -#endif`,morphcolor_vertex:`#if defined( USE_MORPHCOLORS ) - vColor *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - #if defined( USE_COLOR_ALPHA ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ]; - #elif defined( USE_COLOR ) - if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ]; - #endif - } -#endif`,morphnormal_vertex:`#ifdef USE_MORPHNORMALS - objectNormal *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,morphtarget_pars_vertex:`#ifdef USE_MORPHTARGETS - #ifndef USE_INSTANCING_MORPH - uniform float morphTargetBaseInfluence; - uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ]; - #endif - uniform sampler2DArray morphTargetsTexture; - uniform ivec2 morphTargetsTextureSize; - vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) { - int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset; - int y = texelIndex / morphTargetsTextureSize.x; - int x = texelIndex - y * morphTargetsTextureSize.x; - ivec3 morphUV = ivec3( x, y, morphTargetIndex ); - return texelFetch( morphTargetsTexture, morphUV, 0 ); - } -#endif`,morphtarget_vertex:`#ifdef USE_MORPHTARGETS - transformed *= morphTargetBaseInfluence; - for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) { - if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ]; - } -#endif`,normal_fragment_begin:`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0; -#ifdef FLAT_SHADED - vec3 fdx = dFdx( vViewPosition ); - vec3 fdy = dFdy( vViewPosition ); - vec3 normal = normalize( cross( fdx, fdy ) ); -#else - vec3 normal = normalize( vNormal ); - #ifdef DOUBLE_SIDED - normal *= faceDirection; - #endif -#endif -#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) - #ifdef USE_TANGENT - mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn = getTangentFrame( - vViewPosition, normal, - #if defined( USE_NORMALMAP ) - vNormalMapUv - #elif defined( USE_CLEARCOAT_NORMALMAP ) - vClearcoatNormalMapUv - #else - vUv - #endif - ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn[0] *= faceDirection; - tbn[1] *= faceDirection; - #endif -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - #ifdef USE_TANGENT - mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal ); - #else - mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv ); - #endif - #if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED ) - tbn2[0] *= faceDirection; - tbn2[1] *= faceDirection; - #endif -#endif -vec3 nonPerturbedNormal = normal;`,normal_fragment_maps:`#ifdef USE_NORMALMAP_OBJECTSPACE - normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - #ifdef FLIP_SIDED - normal = - normal; - #endif - #ifdef DOUBLE_SIDED - normal = normal * faceDirection; - #endif - normal = normalize( normalMatrix * normal ); -#elif defined( USE_NORMALMAP_TANGENTSPACE ) - vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0; - mapN.xy *= normalScale; - normal = normalize( tbn * mapN ); -#elif defined( USE_BUMPMAP ) - normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection ); -#endif`,normal_pars_fragment:`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,normal_pars_vertex:`#ifndef FLAT_SHADED - varying vec3 vNormal; - #ifdef USE_TANGENT - varying vec3 vTangent; - varying vec3 vBitangent; - #endif -#endif`,normal_vertex:`#ifndef FLAT_SHADED - vNormal = normalize( transformedNormal ); - #ifdef USE_TANGENT - vTangent = normalize( transformedTangent ); - vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w ); - #endif -#endif`,normalmap_pars_fragment:`#ifdef USE_NORMALMAP - uniform sampler2D normalMap; - uniform vec2 normalScale; -#endif -#ifdef USE_NORMALMAP_OBJECTSPACE - uniform mat3 normalMatrix; -#endif -#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) ) - mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) { - vec3 q0 = dFdx( eye_pos.xyz ); - vec3 q1 = dFdy( eye_pos.xyz ); - vec2 st0 = dFdx( uv.st ); - vec2 st1 = dFdy( uv.st ); - vec3 N = surf_norm; - vec3 q1perp = cross( q1, N ); - vec3 q0perp = cross( N, q0 ); - vec3 T = q1perp * st0.x + q0perp * st1.x; - vec3 B = q1perp * st0.y + q0perp * st1.y; - float det = max( dot( T, T ), dot( B, B ) ); - float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det ); - return mat3( T * scale, B * scale, N ); - } -#endif`,clearcoat_normal_fragment_begin:`#ifdef USE_CLEARCOAT - vec3 clearcoatNormal = nonPerturbedNormal; -#endif`,clearcoat_normal_fragment_maps:`#ifdef USE_CLEARCOAT_NORMALMAP - vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0; - clearcoatMapN.xy *= clearcoatNormalScale; - clearcoatNormal = normalize( tbn2 * clearcoatMapN ); -#endif`,clearcoat_pars_fragment:`#ifdef USE_CLEARCOATMAP - uniform sampler2D clearcoatMap; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform sampler2D clearcoatNormalMap; - uniform vec2 clearcoatNormalScale; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform sampler2D clearcoatRoughnessMap; -#endif`,iridescence_pars_fragment:`#ifdef USE_IRIDESCENCEMAP - uniform sampler2D iridescenceMap; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform sampler2D iridescenceThicknessMap; -#endif`,opaque_fragment:`#ifdef OPAQUE -diffuseColor.a = 1.0; -#endif -#ifdef USE_TRANSMISSION -diffuseColor.a *= material.transmissionAlpha; -#endif -gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,packing:`vec3 packNormalToRGB( const in vec3 normal ) { - return normalize( normal ) * 0.5 + 0.5; -} -vec3 unpackRGBToNormal( const in vec3 rgb ) { - return 2.0 * rgb.xyz - 1.0; -} -const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.; -const float Inv255 = 1. / 255.; -const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 ); -const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g ); -const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b ); -const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a ); -vec4 packDepthToRGBA( const in float v ) { - if( v <= 0.0 ) - return vec4( 0., 0., 0., 0. ); - if( v >= 1.0 ) - return vec4( 1., 1., 1., 1. ); - float vuf; - float af = modf( v * PackFactors.a, vuf ); - float bf = modf( vuf * ShiftRight8, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af ); -} -vec3 packDepthToRGB( const in float v ) { - if( v <= 0.0 ) - return vec3( 0., 0., 0. ); - if( v >= 1.0 ) - return vec3( 1., 1., 1. ); - float vuf; - float bf = modf( v * PackFactors.b, vuf ); - float gf = modf( vuf * ShiftRight8, vuf ); - return vec3( vuf * Inv255, gf * PackUpscale, bf ); -} -vec2 packDepthToRG( const in float v ) { - if( v <= 0.0 ) - return vec2( 0., 0. ); - if( v >= 1.0 ) - return vec2( 1., 1. ); - float vuf; - float gf = modf( v * 256., vuf ); - return vec2( vuf * Inv255, gf ); -} -float unpackRGBAToDepth( const in vec4 v ) { - return dot( v, UnpackFactors4 ); -} -float unpackRGBToDepth( const in vec3 v ) { - return dot( v, UnpackFactors3 ); -} -float unpackRGToDepth( const in vec2 v ) { - return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g; -} -vec4 pack2HalfToRGBA( const in vec2 v ) { - vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) ); - return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w ); -} -vec2 unpackRGBATo2Half( const in vec4 v ) { - return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) ); -} -float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) { - return ( viewZ + near ) / ( near - far ); -} -float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) { - return depth * ( near - far ) - near; -} -float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) { - return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ ); -} -float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) { - return ( near * far ) / ( ( far - near ) * depth - far ); -}`,premultiplied_alpha_fragment:`#ifdef PREMULTIPLIED_ALPHA - gl_FragColor.rgb *= gl_FragColor.a; -#endif`,project_vertex:`vec4 mvPosition = vec4( transformed, 1.0 ); -#ifdef USE_BATCHING - mvPosition = batchingMatrix * mvPosition; -#endif -#ifdef USE_INSTANCING - mvPosition = instanceMatrix * mvPosition; -#endif -mvPosition = modelViewMatrix * mvPosition; -gl_Position = projectionMatrix * mvPosition;`,dithering_fragment:`#ifdef DITHERING - gl_FragColor.rgb = dithering( gl_FragColor.rgb ); -#endif`,dithering_pars_fragment:`#ifdef DITHERING - vec3 dithering( vec3 color ) { - float grid_position = rand( gl_FragCoord.xy ); - vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 ); - dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position ); - return color + dither_shift_RGB; - } -#endif`,roughnessmap_fragment:`float roughnessFactor = roughness; -#ifdef USE_ROUGHNESSMAP - vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv ); - roughnessFactor *= texelRoughness.g; -#endif`,roughnessmap_pars_fragment:`#ifdef USE_ROUGHNESSMAP - uniform sampler2D roughnessMap; -#endif`,shadowmap_pars_fragment:`#if NUM_SPOT_LIGHT_COORDS > 0 - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#if NUM_SPOT_LIGHT_MAPS > 0 - uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ]; - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif - float texture2DCompare( sampler2D depths, vec2 uv, float compare ) { - return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) ); - } - vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) { - return unpackRGBATo2Half( texture2D( shadow, uv ) ); - } - float VSMShadow (sampler2D shadow, vec2 uv, float compare ){ - float occlusion = 1.0; - vec2 distribution = texture2DDistribution( shadow, uv ); - float hard_shadow = step( compare , distribution.x ); - if (hard_shadow != 1.0 ) { - float distance = compare - distribution.x ; - float variance = max( 0.00000, distribution.y * distribution.y ); - float softness_probability = variance / (variance + distance * distance ); softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 ); occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 ); - } - return occlusion; - } - float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) { - float shadow = 1.0; - shadowCoord.xyz /= shadowCoord.w; - shadowCoord.z += shadowBias; - bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0; - bool frustumTest = inFrustum && shadowCoord.z <= 1.0; - if ( frustumTest ) { - #if defined( SHADOWMAP_TYPE_PCF ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx0 = - texelSize.x * shadowRadius; - float dy0 = - texelSize.y * shadowRadius; - float dx1 = + texelSize.x * shadowRadius; - float dy1 = + texelSize.y * shadowRadius; - float dx2 = dx0 / 2.0; - float dy2 = dy0 / 2.0; - float dx3 = dx1 / 2.0; - float dy3 = dy1 / 2.0; - shadow = ( - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) + - texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z ) - ) * ( 1.0 / 17.0 ); - #elif defined( SHADOWMAP_TYPE_PCF_SOFT ) - vec2 texelSize = vec2( 1.0 ) / shadowMapSize; - float dx = texelSize.x; - float dy = texelSize.y; - vec2 uv = shadowCoord.xy; - vec2 f = fract( uv * shadowMapSize + 0.5 ); - uv -= f * texelSize; - shadow = ( - texture2DCompare( shadowMap, uv, shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) + - texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ), - f.x ) + - mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ), - f.y ) + - mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ), - f.x ), - mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ), - texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ), - f.x ), - f.y ) - ) * ( 1.0 / 9.0 ); - #elif defined( SHADOWMAP_TYPE_VSM ) - shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z ); - #else - shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } - vec2 cubeToUV( vec3 v, float texelSizeY ) { - vec3 absV = abs( v ); - float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) ); - absV *= scaleToCube; - v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY ); - vec2 planar = v.xy; - float almostATexel = 1.5 * texelSizeY; - float almostOne = 1.0 - almostATexel; - if ( absV.z >= almostOne ) { - if ( v.z > 0.0 ) - planar.x = 4.0 - v.x; - } else if ( absV.x >= almostOne ) { - float signX = sign( v.x ); - planar.x = v.z * signX + 2.0 * signX; - } else if ( absV.y >= almostOne ) { - float signY = sign( v.y ); - planar.x = v.x + 2.0 * signY + 2.0; - planar.y = v.z * signY - 2.0; - } - return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 ); - } - float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) { - float shadow = 1.0; - vec3 lightToPosition = shadowCoord.xyz; - - float lightToPositionLength = length( lightToPosition ); - if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) { - float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear ); dp += shadowBias; - vec3 bd3D = normalize( lightToPosition ); - vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) ); - #if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM ) - vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y; - shadow = ( - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) + - texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp ) - ) * ( 1.0 / 9.0 ); - #else - shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ); - #endif - } - return mix( 1.0, shadow, shadowIntensity ); - } -#endif`,shadowmap_pars_vertex:`#if NUM_SPOT_LIGHT_COORDS > 0 - uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ]; - varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ]; -#endif -#ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ]; - varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ]; - struct DirectionalLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ]; - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - struct SpotLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - }; - uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ]; - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ]; - varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ]; - struct PointLightShadow { - float shadowIntensity; - float shadowBias; - float shadowNormalBias; - float shadowRadius; - vec2 shadowMapSize; - float shadowCameraNear; - float shadowCameraFar; - }; - uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ]; - #endif -#endif`,shadowmap_vertex:`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 ) - vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix ); - vec4 shadowWorldPosition; -#endif -#if defined( USE_SHADOWMAP ) - #if NUM_DIR_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 ); - vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 ); - vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end - #endif -#endif -#if NUM_SPOT_LIGHT_COORDS > 0 - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) { - shadowWorldPosition = worldPosition; - #if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS ) - shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias; - #endif - vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition; - } - #pragma unroll_loop_end -#endif`,shadowmask_pars_fragment:`float getShadowMask() { - float shadow = 1.0; - #ifdef USE_SHADOWMAP - #if NUM_DIR_LIGHT_SHADOWS > 0 - DirectionalLightShadow directionalLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) { - directionalLight = directionalLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_SPOT_LIGHT_SHADOWS > 0 - SpotLightShadow spotLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) { - spotLight = spotLightShadows[ i ]; - shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0; - } - #pragma unroll_loop_end - #endif - #if NUM_POINT_LIGHT_SHADOWS > 0 - PointLightShadow pointLight; - #pragma unroll_loop_start - for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) { - pointLight = pointLightShadows[ i ]; - shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0; - } - #pragma unroll_loop_end - #endif - #endif - return shadow; -}`,skinbase_vertex:`#ifdef USE_SKINNING - mat4 boneMatX = getBoneMatrix( skinIndex.x ); - mat4 boneMatY = getBoneMatrix( skinIndex.y ); - mat4 boneMatZ = getBoneMatrix( skinIndex.z ); - mat4 boneMatW = getBoneMatrix( skinIndex.w ); -#endif`,skinning_pars_vertex:`#ifdef USE_SKINNING - uniform mat4 bindMatrix; - uniform mat4 bindMatrixInverse; - uniform highp sampler2D boneTexture; - mat4 getBoneMatrix( const in float i ) { - int size = textureSize( boneTexture, 0 ).x; - int j = int( i ) * 4; - int x = j % size; - int y = j / size; - vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 ); - vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 ); - vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 ); - vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 ); - return mat4( v1, v2, v3, v4 ); - } -#endif`,skinning_vertex:`#ifdef USE_SKINNING - vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 ); - vec4 skinned = vec4( 0.0 ); - skinned += boneMatX * skinVertex * skinWeight.x; - skinned += boneMatY * skinVertex * skinWeight.y; - skinned += boneMatZ * skinVertex * skinWeight.z; - skinned += boneMatW * skinVertex * skinWeight.w; - transformed = ( bindMatrixInverse * skinned ).xyz; -#endif`,skinnormal_vertex:`#ifdef USE_SKINNING - mat4 skinMatrix = mat4( 0.0 ); - skinMatrix += skinWeight.x * boneMatX; - skinMatrix += skinWeight.y * boneMatY; - skinMatrix += skinWeight.z * boneMatZ; - skinMatrix += skinWeight.w * boneMatW; - skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix; - objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz; - #ifdef USE_TANGENT - objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz; - #endif -#endif`,specularmap_fragment:`float specularStrength; -#ifdef USE_SPECULARMAP - vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv ); - specularStrength = texelSpecular.r; -#else - specularStrength = 1.0; -#endif`,specularmap_pars_fragment:`#ifdef USE_SPECULARMAP - uniform sampler2D specularMap; -#endif`,tonemapping_fragment:`#if defined( TONE_MAPPING ) - gl_FragColor.rgb = toneMapping( gl_FragColor.rgb ); -#endif`,tonemapping_pars_fragment:`#ifndef saturate -#define saturate( a ) clamp( a, 0.0, 1.0 ) -#endif -uniform float toneMappingExposure; -vec3 LinearToneMapping( vec3 color ) { - return saturate( toneMappingExposure * color ); -} -vec3 ReinhardToneMapping( vec3 color ) { - color *= toneMappingExposure; - return saturate( color / ( vec3( 1.0 ) + color ) ); -} -vec3 CineonToneMapping( vec3 color ) { - color *= toneMappingExposure; - color = max( vec3( 0.0 ), color - 0.004 ); - return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) ); -} -vec3 RRTAndODTFit( vec3 v ) { - vec3 a = v * ( v + 0.0245786 ) - 0.000090537; - vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081; - return a / b; -} -vec3 ACESFilmicToneMapping( vec3 color ) { - const mat3 ACESInputMat = mat3( - vec3( 0.59719, 0.07600, 0.02840 ), vec3( 0.35458, 0.90834, 0.13383 ), - vec3( 0.04823, 0.01566, 0.83777 ) - ); - const mat3 ACESOutputMat = mat3( - vec3( 1.60475, -0.10208, -0.00327 ), vec3( -0.53108, 1.10813, -0.07276 ), - vec3( -0.07367, -0.00605, 1.07602 ) - ); - color *= toneMappingExposure / 0.6; - color = ACESInputMat * color; - color = RRTAndODTFit( color ); - color = ACESOutputMat * color; - return saturate( color ); -} -const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3( - vec3( 1.6605, - 0.1246, - 0.0182 ), - vec3( - 0.5876, 1.1329, - 0.1006 ), - vec3( - 0.0728, - 0.0083, 1.1187 ) -); -const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3( - vec3( 0.6274, 0.0691, 0.0164 ), - vec3( 0.3293, 0.9195, 0.0880 ), - vec3( 0.0433, 0.0113, 0.8956 ) -); -vec3 agxDefaultContrastApprox( vec3 x ) { - vec3 x2 = x * x; - vec3 x4 = x2 * x2; - return + 15.5 * x4 * x2 - - 40.14 * x4 * x - + 31.96 * x4 - - 6.868 * x2 * x - + 0.4298 * x2 - + 0.1191 * x - - 0.00232; -} -vec3 AgXToneMapping( vec3 color ) { - const mat3 AgXInsetMatrix = mat3( - vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ), - vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ), - vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 ) - ); - const mat3 AgXOutsetMatrix = mat3( - vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ), - vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ), - vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 ) - ); - const float AgxMinEv = - 12.47393; const float AgxMaxEv = 4.026069; - color *= toneMappingExposure; - color = LINEAR_SRGB_TO_LINEAR_REC2020 * color; - color = AgXInsetMatrix * color; - color = max( color, 1e-10 ); color = log2( color ); - color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv ); - color = clamp( color, 0.0, 1.0 ); - color = agxDefaultContrastApprox( color ); - color = AgXOutsetMatrix * color; - color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) ); - color = LINEAR_REC2020_TO_LINEAR_SRGB * color; - color = clamp( color, 0.0, 1.0 ); - return color; -} -vec3 NeutralToneMapping( vec3 color ) { - const float StartCompression = 0.8 - 0.04; - const float Desaturation = 0.15; - color *= toneMappingExposure; - float x = min( color.r, min( color.g, color.b ) ); - float offset = x < 0.08 ? x - 6.25 * x * x : 0.04; - color -= offset; - float peak = max( color.r, max( color.g, color.b ) ); - if ( peak < StartCompression ) return color; - float d = 1. - StartCompression; - float newPeak = 1. - d * d / ( peak + d - StartCompression ); - color *= newPeak / peak; - float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. ); - return mix( color, vec3( newPeak ), g ); -} -vec3 CustomToneMapping( vec3 color ) { return color; }`,transmission_fragment:`#ifdef USE_TRANSMISSION - material.transmission = transmission; - material.transmissionAlpha = 1.0; - material.thickness = thickness; - material.attenuationDistance = attenuationDistance; - material.attenuationColor = attenuationColor; - #ifdef USE_TRANSMISSIONMAP - material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r; - #endif - #ifdef USE_THICKNESSMAP - material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g; - #endif - vec3 pos = vWorldPosition; - vec3 v = normalize( cameraPosition - pos ); - vec3 n = inverseTransformDirection( normal, viewMatrix ); - vec4 transmitted = getIBLVolumeRefraction( - n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90, - pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness, - material.attenuationColor, material.attenuationDistance ); - material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission ); - totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission ); -#endif`,transmission_pars_fragment:`#ifdef USE_TRANSMISSION - uniform float transmission; - uniform float thickness; - uniform float attenuationDistance; - uniform vec3 attenuationColor; - #ifdef USE_TRANSMISSIONMAP - uniform sampler2D transmissionMap; - #endif - #ifdef USE_THICKNESSMAP - uniform sampler2D thicknessMap; - #endif - uniform vec2 transmissionSamplerSize; - uniform sampler2D transmissionSamplerMap; - uniform mat4 modelMatrix; - uniform mat4 projectionMatrix; - varying vec3 vWorldPosition; - float w0( float a ) { - return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 ); - } - float w1( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * ( 3.0 * a - 6.0 ) + 4.0 ); - } - float w2( float a ){ - return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 ); - } - float w3( float a ) { - return ( 1.0 / 6.0 ) * ( a * a * a ); - } - float g0( float a ) { - return w0( a ) + w1( a ); - } - float g1( float a ) { - return w2( a ) + w3( a ); - } - float h0( float a ) { - return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) ); - } - float h1( float a ) { - return 1.0 + w3( a ) / ( w2( a ) + w3( a ) ); - } - vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) { - uv = uv * texelSize.zw + 0.5; - vec2 iuv = floor( uv ); - vec2 fuv = fract( uv ); - float g0x = g0( fuv.x ); - float g1x = g1( fuv.x ); - float h0x = h0( fuv.x ); - float h1x = h1( fuv.x ); - float h0y = h0( fuv.y ); - float h1y = h1( fuv.y ); - vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy; - vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy; - return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) + - g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) ); - } - vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) { - vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) ); - vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) ); - vec2 fLodSizeInv = 1.0 / fLodSize; - vec2 cLodSizeInv = 1.0 / cLodSize; - vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) ); - vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) ); - return mix( fSample, cSample, fract( lod ) ); - } - vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) { - vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior ); - vec3 modelScale; - modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) ); - modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) ); - modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) ); - return normalize( refractionVector ) * thickness * modelScale; - } - float applyIorToRoughness( const in float roughness, const in float ior ) { - return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 ); - } - vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) { - float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior ); - return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod ); - } - vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) { - if ( isinf( attenuationDistance ) ) { - return vec3( 1.0 ); - } else { - vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance; - vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance ); return transmittance; - } - } - vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor, - const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix, - const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness, - const in vec3 attenuationColor, const in float attenuationDistance ) { - vec4 transmittedLight; - vec3 transmittance; - #ifdef USE_DISPERSION - float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion; - vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread ); - for ( int i = 0; i < 3; i ++ ) { - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] ); - transmittedLight[ i ] = transmissionSample[ i ]; - transmittedLight.a += transmissionSample.a; - transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ]; - } - transmittedLight.a /= 3.0; - #else - vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix ); - vec3 refractedRayExit = position + transmissionRay; - vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 ); - vec2 refractionCoords = ndcPos.xy / ndcPos.w; - refractionCoords += 1.0; - refractionCoords /= 2.0; - transmittedLight = getTransmissionSample( refractionCoords, roughness, ior ); - transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance ); - #endif - vec3 attenuatedColor = transmittance * transmittedLight.rgb; - vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness ); - float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0; - return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor ); - } -#endif`,uv_pars_fragment:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - varying vec2 vNormalMapUv; -#endif -#ifdef USE_EMISSIVEMAP - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_SPECULARMAP - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,uv_pars_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - varying vec2 vUv; -#endif -#ifdef USE_MAP - uniform mat3 mapTransform; - varying vec2 vMapUv; -#endif -#ifdef USE_ALPHAMAP - uniform mat3 alphaMapTransform; - varying vec2 vAlphaMapUv; -#endif -#ifdef USE_LIGHTMAP - uniform mat3 lightMapTransform; - varying vec2 vLightMapUv; -#endif -#ifdef USE_AOMAP - uniform mat3 aoMapTransform; - varying vec2 vAoMapUv; -#endif -#ifdef USE_BUMPMAP - uniform mat3 bumpMapTransform; - varying vec2 vBumpMapUv; -#endif -#ifdef USE_NORMALMAP - uniform mat3 normalMapTransform; - varying vec2 vNormalMapUv; -#endif -#ifdef USE_DISPLACEMENTMAP - uniform mat3 displacementMapTransform; - varying vec2 vDisplacementMapUv; -#endif -#ifdef USE_EMISSIVEMAP - uniform mat3 emissiveMapTransform; - varying vec2 vEmissiveMapUv; -#endif -#ifdef USE_METALNESSMAP - uniform mat3 metalnessMapTransform; - varying vec2 vMetalnessMapUv; -#endif -#ifdef USE_ROUGHNESSMAP - uniform mat3 roughnessMapTransform; - varying vec2 vRoughnessMapUv; -#endif -#ifdef USE_ANISOTROPYMAP - uniform mat3 anisotropyMapTransform; - varying vec2 vAnisotropyMapUv; -#endif -#ifdef USE_CLEARCOATMAP - uniform mat3 clearcoatMapTransform; - varying vec2 vClearcoatMapUv; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - uniform mat3 clearcoatNormalMapTransform; - varying vec2 vClearcoatNormalMapUv; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - uniform mat3 clearcoatRoughnessMapTransform; - varying vec2 vClearcoatRoughnessMapUv; -#endif -#ifdef USE_SHEEN_COLORMAP - uniform mat3 sheenColorMapTransform; - varying vec2 vSheenColorMapUv; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - uniform mat3 sheenRoughnessMapTransform; - varying vec2 vSheenRoughnessMapUv; -#endif -#ifdef USE_IRIDESCENCEMAP - uniform mat3 iridescenceMapTransform; - varying vec2 vIridescenceMapUv; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - uniform mat3 iridescenceThicknessMapTransform; - varying vec2 vIridescenceThicknessMapUv; -#endif -#ifdef USE_SPECULARMAP - uniform mat3 specularMapTransform; - varying vec2 vSpecularMapUv; -#endif -#ifdef USE_SPECULAR_COLORMAP - uniform mat3 specularColorMapTransform; - varying vec2 vSpecularColorMapUv; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - uniform mat3 specularIntensityMapTransform; - varying vec2 vSpecularIntensityMapUv; -#endif -#ifdef USE_TRANSMISSIONMAP - uniform mat3 transmissionMapTransform; - varying vec2 vTransmissionMapUv; -#endif -#ifdef USE_THICKNESSMAP - uniform mat3 thicknessMapTransform; - varying vec2 vThicknessMapUv; -#endif`,uv_vertex:`#if defined( USE_UV ) || defined( USE_ANISOTROPY ) - vUv = vec3( uv, 1 ).xy; -#endif -#ifdef USE_MAP - vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ALPHAMAP - vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_LIGHTMAP - vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_AOMAP - vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_BUMPMAP - vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_NORMALMAP - vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_DISPLACEMENTMAP - vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_EMISSIVEMAP - vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_METALNESSMAP - vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ROUGHNESSMAP - vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_ANISOTROPYMAP - vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOATMAP - vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_NORMALMAP - vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_CLEARCOAT_ROUGHNESSMAP - vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCEMAP - vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_IRIDESCENCE_THICKNESSMAP - vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_COLORMAP - vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SHEEN_ROUGHNESSMAP - vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULARMAP - vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_COLORMAP - vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_SPECULAR_INTENSITYMAP - vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_TRANSMISSIONMAP - vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy; -#endif -#ifdef USE_THICKNESSMAP - vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy; -#endif`,worldpos_vertex:`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0 - vec4 worldPosition = vec4( transformed, 1.0 ); - #ifdef USE_BATCHING - worldPosition = batchingMatrix * worldPosition; - #endif - #ifdef USE_INSTANCING - worldPosition = instanceMatrix * worldPosition; - #endif - worldPosition = modelMatrix * worldPosition; -#endif`,background_vert:`varying vec2 vUv; -uniform mat3 uvTransform; -void main() { - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - gl_Position = vec4( position.xy, 1.0, 1.0 ); -}`,background_frag:`uniform sampler2D t2D; -uniform float backgroundIntensity; -varying vec2 vUv; -void main() { - vec4 texColor = texture2D( t2D, vUv ); - #ifdef DECODE_VIDEO_TEXTURE - texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,backgroundCube_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,backgroundCube_frag:`#ifdef ENVMAP_TYPE_CUBE - uniform samplerCube envMap; -#elif defined( ENVMAP_TYPE_CUBE_UV ) - uniform sampler2D envMap; -#endif -uniform float flipEnvMap; -uniform float backgroundBlurriness; -uniform float backgroundIntensity; -uniform mat3 backgroundRotation; -varying vec3 vWorldDirection; -#include -void main() { - #ifdef ENVMAP_TYPE_CUBE - vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) ); - #elif defined( ENVMAP_TYPE_CUBE_UV ) - vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness ); - #else - vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - #endif - texColor.rgb *= backgroundIntensity; - gl_FragColor = texColor; - #include - #include -}`,cube_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include - gl_Position.z = gl_Position.w; -}`,cube_frag:`uniform samplerCube tCube; -uniform float tFlip; -uniform float opacity; -varying vec3 vWorldDirection; -void main() { - vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) ); - gl_FragColor = texColor; - gl_FragColor.a *= opacity; - #include - #include -}`,depth_vert:`#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vHighPrecisionZW = gl_Position.zw; -}`,depth_frag:`#if DEPTH_PACKING == 3200 - uniform float opacity; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -varying vec2 vHighPrecisionZW; -void main() { - vec4 diffuseColor = vec4( 1.0 ); - #include - #if DEPTH_PACKING == 3200 - diffuseColor.a = opacity; - #endif - #include - #include - #include - #include - #include - float fragCoordZ = 0.5 * vHighPrecisionZW[0] / vHighPrecisionZW[1] + 0.5; - #if DEPTH_PACKING == 3200 - gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity ); - #elif DEPTH_PACKING == 3201 - gl_FragColor = packDepthToRGBA( fragCoordZ ); - #elif DEPTH_PACKING == 3202 - gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 ); - #elif DEPTH_PACKING == 3203 - gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 ); - #endif -}`,distanceRGBA_vert:`#define DISTANCE -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #ifdef USE_DISPLACEMENTMAP - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - vWorldPosition = worldPosition.xyz; -}`,distanceRGBA_frag:`#define DISTANCE -uniform vec3 referencePosition; -uniform float nearDistance; -uniform float farDistance; -varying vec3 vWorldPosition; -#include -#include -#include -#include -#include -#include -#include -#include -void main () { - vec4 diffuseColor = vec4( 1.0 ); - #include - #include - #include - #include - #include - float dist = length( vWorldPosition - referencePosition ); - dist = ( dist - nearDistance ) / ( farDistance - nearDistance ); - dist = saturate( dist ); - gl_FragColor = packDepthToRGBA( dist ); -}`,equirect_vert:`varying vec3 vWorldDirection; -#include -void main() { - vWorldDirection = transformDirection( position, modelMatrix ); - #include - #include -}`,equirect_frag:`uniform sampler2D tEquirect; -varying vec3 vWorldDirection; -#include -void main() { - vec3 direction = normalize( vWorldDirection ); - vec2 sampleUV = equirectUv( direction ); - gl_FragColor = texture2D( tEquirect, sampleUV ); - #include - #include -}`,linedashed_vert:`uniform float scale; -attribute float lineDistance; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vLineDistance = scale * lineDistance; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,linedashed_frag:`uniform vec3 diffuse; -uniform float opacity; -uniform float dashSize; -uniform float totalSize; -varying float vLineDistance; -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - if ( mod( vLineDistance, totalSize ) > dashSize ) { - discard; - } - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,meshbasic_vert:`#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #if defined ( USE_ENVMAP ) || defined ( USE_SKINNING ) - #include - #include - #include - #include - #include - #endif - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,meshbasic_frag:`uniform vec3 diffuse; -uniform float opacity; -#ifndef FLAT_SHADED - varying vec3 vNormal; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - #ifdef USE_LIGHTMAP - vec4 lightMapTexel = texture2D( lightMap, vLightMapUv ); - reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI; - #else - reflectedLight.indirectDiffuse += vec3( 1.0 ); - #endif - #include - reflectedLight.indirectDiffuse *= diffuseColor.rgb; - vec3 outgoingLight = reflectedLight.indirectDiffuse; - #include - #include - #include - #include - #include - #include - #include -}`,meshlambert_vert:`#define LAMBERT -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,meshlambert_frag:`#define LAMBERT -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,meshmatcap_vert:`#define MATCAP -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; -}`,meshmatcap_frag:`#define MATCAP -uniform vec3 diffuse; -uniform float opacity; -uniform sampler2D matcap; -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 viewDir = normalize( vViewPosition ); - vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) ); - vec3 y = cross( viewDir, x ); - vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5; - #ifdef USE_MATCAP - vec4 matcapColor = texture2D( matcap, uv ); - #else - vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 ); - #endif - vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb; - #include - #include - #include - #include - #include - #include -}`,meshnormal_vert:`#define NORMAL -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - vViewPosition = - mvPosition.xyz; -#endif -}`,meshnormal_frag:`#define NORMAL -uniform float opacity; -#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE ) - varying vec3 vViewPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity ); - #include - #include - #include - #include - gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a ); - #ifdef OPAQUE - gl_FragColor.a = 1.0; - #endif -}`,meshphong_vert:`#define PHONG -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include - #include -}`,meshphong_frag:`#define PHONG -uniform vec3 diffuse; -uniform vec3 emissive; -uniform vec3 specular; -uniform float shininess; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include - #include -}`,meshphysical_vert:`#define STANDARD -varying vec3 vViewPosition; -#ifdef USE_TRANSMISSION - varying vec3 vWorldPosition; -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -#ifdef USE_TRANSMISSION - vWorldPosition = worldPosition.xyz; -#endif -}`,meshphysical_frag:`#define STANDARD -#ifdef PHYSICAL - #define IOR - #define USE_SPECULAR -#endif -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float roughness; -uniform float metalness; -uniform float opacity; -#ifdef IOR - uniform float ior; -#endif -#ifdef USE_SPECULAR - uniform float specularIntensity; - uniform vec3 specularColor; - #ifdef USE_SPECULAR_COLORMAP - uniform sampler2D specularColorMap; - #endif - #ifdef USE_SPECULAR_INTENSITYMAP - uniform sampler2D specularIntensityMap; - #endif -#endif -#ifdef USE_CLEARCOAT - uniform float clearcoat; - uniform float clearcoatRoughness; -#endif -#ifdef USE_DISPERSION - uniform float dispersion; -#endif -#ifdef USE_IRIDESCENCE - uniform float iridescence; - uniform float iridescenceIOR; - uniform float iridescenceThicknessMinimum; - uniform float iridescenceThicknessMaximum; -#endif -#ifdef USE_SHEEN - uniform vec3 sheenColor; - uniform float sheenRoughness; - #ifdef USE_SHEEN_COLORMAP - uniform sampler2D sheenColorMap; - #endif - #ifdef USE_SHEEN_ROUGHNESSMAP - uniform sampler2D sheenRoughnessMap; - #endif -#endif -#ifdef USE_ANISOTROPY - uniform vec2 anisotropyVector; - #ifdef USE_ANISOTROPYMAP - uniform sampler2D anisotropyMap; - #endif -#endif -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse; - vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular; - #include - vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance; - #ifdef USE_SHEEN - float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor ); - outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect; - #endif - #ifdef USE_CLEARCOAT - float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) ); - vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc ); - outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat; - #endif - #include - #include - #include - #include - #include - #include -}`,meshtoon_vert:`#define TOON -varying vec3 vViewPosition; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vViewPosition = - mvPosition.xyz; - #include - #include - #include -}`,meshtoon_frag:`#define TOON -uniform vec3 diffuse; -uniform vec3 emissive; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) ); - vec3 totalEmissiveRadiance = emissive; - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance; - #include - #include - #include - #include - #include - #include -}`,points_vert:`uniform float size; -uniform float scale; -#include -#include -#include -#include -#include -#include -#ifdef USE_POINTS_UV - varying vec2 vUv; - uniform mat3 uvTransform; -#endif -void main() { - #ifdef USE_POINTS_UV - vUv = ( uvTransform * vec3( uv, 1 ) ).xy; - #endif - #include - #include - #include - #include - #include - #include - gl_PointSize = size; - #ifdef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z ); - #endif - #include - #include - #include - #include -}`,points_frag:`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include - #include -}`,shadow_vert:`#include -#include -#include -#include -#include -#include -#include -void main() { - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include - #include -}`,shadow_frag:`uniform vec3 color; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - #include - gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) ); - #include - #include - #include -}`,sprite_vert:`uniform float rotation; -uniform vec2 center; -#include -#include -#include -#include -#include -void main() { - #include - vec4 mvPosition = modelViewMatrix[ 3 ]; - vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) ); - #ifndef USE_SIZEATTENUATION - bool isPerspective = isPerspectiveMatrix( projectionMatrix ); - if ( isPerspective ) scale *= - mvPosition.z; - #endif - vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale; - vec2 rotatedPosition; - rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y; - rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y; - mvPosition.xy += rotatedPosition; - gl_Position = projectionMatrix * mvPosition; - #include - #include - #include -}`,sprite_frag:`uniform vec3 diffuse; -uniform float opacity; -#include -#include -#include -#include -#include -#include -#include -#include -#include -void main() { - vec4 diffuseColor = vec4( diffuse, opacity ); - #include - vec3 outgoingLight = vec3( 0.0 ); - #include - #include - #include - #include - #include - outgoingLight = diffuseColor.rgb; - #include - #include - #include - #include -}`},Z={common:{diffuse:{value:new X(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new qb},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new qb}},envmap:{envMap:{value:null},envMapRotation:{value:new qb},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new qb}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new qb}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new qb},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new qb},normalScale:{value:new Ub(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new qb},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new qb}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new qb}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new qb}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new X(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new X(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0},uvTransform:{value:new qb}},sprite:{diffuse:{value:new X(16777215)},opacity:{value:1},center:{value:new Ub(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new qb},alphaMap:{value:null},alphaMapTransform:{value:new qb},alphaTest:{value:0}}},gE={basic:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.fog]),vertexShader:hE.meshbasic_vert,fragmentShader:hE.meshbasic_frag},lambert:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:hE.meshlambert_vert,fragmentShader:hE.meshlambert_frag},phong:{uniforms:xC([Z.common,Z.specularmap,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,Z.lights,{emissive:{value:new X(0)},specular:{value:new X(1118481)},shininess:{value:30}}]),vertexShader:hE.meshphong_vert,fragmentShader:hE.meshphong_frag},standard:{uniforms:xC([Z.common,Z.envmap,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.roughnessmap,Z.metalnessmap,Z.fog,Z.lights,{emissive:{value:new X(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:hE.meshphysical_vert,fragmentShader:hE.meshphysical_frag},toon:{uniforms:xC([Z.common,Z.aomap,Z.lightmap,Z.emissivemap,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.gradientmap,Z.fog,Z.lights,{emissive:{value:new X(0)}}]),vertexShader:hE.meshtoon_vert,fragmentShader:hE.meshtoon_frag},matcap:{uniforms:xC([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,Z.fog,{matcap:{value:null}}]),vertexShader:hE.meshmatcap_vert,fragmentShader:hE.meshmatcap_frag},points:{uniforms:xC([Z.points,Z.fog]),vertexShader:hE.points_vert,fragmentShader:hE.points_frag},dashed:{uniforms:xC([Z.common,Z.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:hE.linedashed_vert,fragmentShader:hE.linedashed_frag},depth:{uniforms:xC([Z.common,Z.displacementmap]),vertexShader:hE.depth_vert,fragmentShader:hE.depth_frag},normal:{uniforms:xC([Z.common,Z.bumpmap,Z.normalmap,Z.displacementmap,{opacity:{value:1}}]),vertexShader:hE.meshnormal_vert,fragmentShader:hE.meshnormal_frag},sprite:{uniforms:xC([Z.sprite,Z.fog]),vertexShader:hE.sprite_vert,fragmentShader:hE.sprite_frag},background:{uniforms:{uvTransform:{value:new qb},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:hE.background_vert,fragmentShader:hE.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new qb}},vertexShader:hE.backgroundCube_vert,fragmentShader:hE.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:hE.cube_vert,fragmentShader:hE.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:hE.equirect_vert,fragmentShader:hE.equirect_frag},distanceRGBA:{uniforms:xC([Z.common,Z.displacementmap,{referencePosition:{value:new J},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:hE.distanceRGBA_vert,fragmentShader:hE.distanceRGBA_frag},shadow:{uniforms:xC([Z.lights,Z.fog,{color:{value:new X(0)},opacity:{value:1}}]),vertexShader:hE.shadow_vert,fragmentShader:hE.shadow_frag}};gE.physical={uniforms:xC([gE.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new qb},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new qb},clearcoatNormalScale:{value:new Ub(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new qb},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new qb},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new qb},sheen:{value:0},sheenColor:{value:new X(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new qb},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new qb},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new qb},transmissionSamplerSize:{value:new Ub},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new qb},attenuationDistance:{value:0},attenuationColor:{value:new X(0)},specularColor:{value:new X(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new qb},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new qb},anisotropyVector:{value:new Ub},anisotropyMap:{value:null},anisotropyMapTransform:{value:new qb}}]),vertexShader:hE.meshphysical_vert,fragmentShader:hE.meshphysical_frag};var _E={r:0,b:0,g:0},vE=new iS,hte=new Y;function gte(e,t,n,r,i,a,o){let s=new X(0),c=a===!0?0:1,l,u,d=null,f=0,p=null;function m(e){let r=e.isScene===!0?e.background:null;return r&&r.isTexture&&(r=(e.backgroundBlurriness>0?n:t).get(r)),r}function h(t){let n=!1,i=m(t);i===null?_(s,c):i&&i.isColor&&(_(i,1),n=!0);let a=e.xr.getEnvironmentBlendMode();a===`additive`?r.buffers.color.setClear(0,0,0,1,o):a===`alpha-blend`&&r.buffers.color.setClear(0,0,0,0,o),(e.autoClear||n)&&(r.buffers.depth.setTest(!0),r.buffers.depth.setMask(!0),r.buffers.color.setMask(!0),e.clear(e.autoClearColor,e.autoClearDepth,e.autoClearStencil))}function g(t,n){let r=m(n);r&&(r.isCubeTexture||r.mapping===306)?(u===void 0&&(u=new gC(new yC(1,1,1),new DC({name:`BackgroundCubeMaterial`,uniforms:bC(gE.backgroundCube.uniforms),vertexShader:gE.backgroundCube.vertexShader,fragmentShader:gE.backgroundCube.fragmentShader,side:1,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),u.geometry.deleteAttribute(`normal`),u.geometry.deleteAttribute(`uv`),u.onBeforeRender=function(e,t,n){this.matrixWorld.copyPosition(n.matrixWorld)},Object.defineProperty(u.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),i.update(u)),vE.copy(n.backgroundRotation),vE.x*=-1,vE.y*=-1,vE.z*=-1,r.isCubeTexture&&r.isRenderTargetTexture===!1&&(vE.y*=-1,vE.z*=-1),u.material.uniforms.envMap.value=r,u.material.uniforms.flipEnvMap.value=r.isCubeTexture&&r.isRenderTargetTexture===!1?-1:1,u.material.uniforms.backgroundBlurriness.value=n.backgroundBlurriness,u.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,u.material.uniforms.backgroundRotation.value.setFromMatrix4(hte.makeRotationFromEuler(vE)),u.material.toneMapped=ox.getTransfer(r.colorSpace)!==vb,(d!==r||f!==r.version||p!==e.toneMapping)&&(u.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),u.layers.enableAll(),t.unshift(u,u.geometry,u.material,0,0,null)):r&&r.isTexture&&(l===void 0&&(l=new gC(new Gw(2,2),new DC({name:`BackgroundMaterial`,uniforms:bC(gE.background.uniforms),vertexShader:gE.background.vertexShader,fragmentShader:gE.background.fragmentShader,side:0,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),l.geometry.deleteAttribute(`normal`),Object.defineProperty(l.material,"map",{get:function(){return this.uniforms.t2D.value}}),i.update(l)),l.material.uniforms.t2D.value=r,l.material.uniforms.backgroundIntensity.value=n.backgroundIntensity,l.material.toneMapped=ox.getTransfer(r.colorSpace)!==vb,r.matrixAutoUpdate===!0&&r.updateMatrix(),l.material.uniforms.uvTransform.value.copy(r.matrix),(d!==r||f!==r.version||p!==e.toneMapping)&&(l.material.needsUpdate=!0,d=r,f=r.version,p=e.toneMapping),l.layers.enableAll(),t.unshift(l,l.geometry,l.material,0,0,null))}function _(t,n){t.getRGB(_E,CC(e)),r.buffers.color.setClear(_E.r,_E.g,_E.b,n,o)}function v(){u!==void 0&&(u.geometry.dispose(),u.material.dispose(),u=void 0),l!==void 0&&(l.geometry.dispose(),l.material.dispose(),l=void 0)}return{getClearColor:function(){return s},setClearColor:function(e,t=1){s.set(e),c=t,_(s,c)},getClearAlpha:function(){return c},setClearAlpha:function(e){c=e,_(s,c)},render:h,addToRenderList:g,dispose:v}}function _te(e,t){let n=e.getParameter(e.MAX_VERTEX_ATTRIBS),r={},i=f(null),a=i,o=!1;function s(n,r,i,s,c){let u=!1,f=d(s,i,r);a!==f&&(a=f,l(a.object)),u=p(n,s,i,c),u&&m(n,s,i,c),c!==null&&t.update(c,e.ELEMENT_ARRAY_BUFFER),(u||o)&&(o=!1,b(n,r,i,s),c!==null&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,t.get(c).buffer))}function c(){return e.createVertexArray()}function l(t){return e.bindVertexArray(t)}function u(t){return e.deleteVertexArray(t)}function d(e,t,n){let i=n.wireframe===!0,a=r[e.id];a===void 0&&(a={},r[e.id]=a);let o=a[t.id];o===void 0&&(o={},a[t.id]=o);let s=o[i];return s===void 0&&(s=f(c()),o[i]=s),s}function f(e){let t=[],r=[],i=[];for(let e=0;e=0){let n=i[t],r=o[t];if(r===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(r=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(r=e.instanceColor)),n===void 0||n.attribute!==r||r&&n.data!==r.data)return!0;s++}return a.attributesNum!==s||a.index!==r}function m(e,t,n,r){let i={},o=t.attributes,s=0,c=n.getAttributes();for(let t in c)if(c[t].location>=0){let n=o[t];n===void 0&&(t===`instanceMatrix`&&e.instanceMatrix&&(n=e.instanceMatrix),t===`instanceColor`&&e.instanceColor&&(n=e.instanceColor));let r={};r.attribute=n,n&&n.data&&(r.data=n.data),i[t]=r,s++}a.attributes=i,a.attributesNum=s,a.index=r}function h(){let e=a.newAttributes;for(let t=0,n=e.length;t=0){let s=o[r];if(s===void 0&&(r===`instanceMatrix`&&n.instanceMatrix&&(s=n.instanceMatrix),r===`instanceColor`&&n.instanceColor&&(s=n.instanceColor)),s!==void 0){let r=s.normalized,o=s.itemSize,c=t.get(s);if(c===void 0)continue;let l=c.buffer,u=c.type,d=c.bytesPerElement,f=u===e.INT||u===e.UNSIGNED_INT||s.gpuType===1013;if(s.isInterleavedBufferAttribute){let t=s.data,c=t.stride,p=s.offset;if(t.isInstancedInterleavedBuffer){for(let e=0;e0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT).precision>0)return`highp`;t=`mediump`}return t===`mediump`&&e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.MEDIUM_FLOAT).precision>0&&e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT).precision>0?`mediump`:`lowp`}let l=n.precision===void 0?`highp`:n.precision,u=c(l);u!==l&&(console.warn(`THREE.WebGLRenderer:`,l,`not supported, using`,u,`instead.`),l=u);let d=n.logarithmicDepthBuffer===!0,f=n.reverseDepthBuffer===!0&&t.has(`EXT_clip_control`),p=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS),m=e.getParameter(e.MAX_VERTEX_TEXTURE_IMAGE_UNITS),h=e.getParameter(e.MAX_TEXTURE_SIZE),g=e.getParameter(e.MAX_CUBE_MAP_TEXTURE_SIZE),_=e.getParameter(e.MAX_VERTEX_ATTRIBS),v=e.getParameter(e.MAX_VERTEX_UNIFORM_VECTORS),y=e.getParameter(e.MAX_VARYING_VECTORS),b=e.getParameter(e.MAX_FRAGMENT_UNIFORM_VECTORS),x=m>0,S=e.getParameter(e.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:a,getMaxPrecision:c,textureFormatReadable:o,textureTypeReadable:s,precision:l,logarithmicDepthBuffer:d,reverseDepthBuffer:f,maxTextures:p,maxVertexTextures:m,maxTextureSize:h,maxCubemapSize:g,maxAttributes:_,maxVertexUniforms:v,maxVaryings:y,maxFragmentUniforms:b,vertexTextures:x,maxSamples:S}}function bte(e){let t=this,n=null,r=0,i=!1,a=!1,o=new vw,s=new qb,c={value:null,needsUpdate:!1};this.uniform=c,this.numPlanes=0,this.numIntersection=0,this.init=function(e,t){let n=e.length!==0||t||r!==0||i;return i=t,r=e.length,n},this.beginShadows=function(){a=!0,u(null)},this.endShadows=function(){a=!1},this.setGlobalState=function(e,t){n=u(e,t,0)},this.setState=function(t,o,s){let d=t.clippingPlanes,f=t.clipIntersection,p=t.clipShadows,m=e.get(t);if(!i||d===null||d.length===0||a&&!p)a?u(null):l();else{let e=a?0:r,t=e*4,i=m.clippingState||null;c.value=i,i=u(d,o,t,s);for(let e=0;e!==t;++e)i[e]=n[e];m.clippingState=i,this.numIntersection=f?this.numPlanes:0,this.numPlanes+=e}};function l(){c.value!==n&&(c.value=n,c.needsUpdate=r>0),t.numPlanes=r,t.numIntersection=0}function u(e,n,r,i){let a=e===null?0:e.length,l=null;if(a!==0){if(l=c.value,i!==!0||l===null){let t=r+a*4,i=n.matrixWorldInverse;s.getNormalMatrix(i),(l===null||l.length0){let o=new LC(a.height);return o.fromEquirectangularTexture(e,r),t.set(r,o),r.addEventListener(`dispose`,i),n(o.texture,r.mapping)}else return null}}return r}function i(e){let n=e.target;n.removeEventListener(`dispose`,i);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function a(){t=new WeakMap}return{get:r,dispose:a}}var yE=4,bE=[.125,.215,.35,.446,.526,.582],xE=20,SE=new HT,CE=new X,wE=null,TE=0,EE=0,DE=!1,OE=(1+Math.sqrt(5))/2,kE=1/OE,AE=[new J(-OE,kE,0),new J(OE,kE,0),new J(-kE,0,OE),new J(kE,0,OE),new J(0,OE,-kE),new J(0,OE,kE),new J(-1,1,-1),new J(1,1,-1),new J(-1,1,1),new J(1,1,1)],Ste=new J,jE=class{constructor(e){this._renderer=e,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(e,t=0,n=.1,r=100,i={}){let{size:a=256,position:o=Ste}=i;wE=this._renderer.getRenderTarget(),TE=this._renderer.getActiveCubeFace(),EE=this._renderer.getActiveMipmapLevel(),DE=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(a);let s=this._allocateTargets();return s.depthBuffer=!0,this._sceneToCubeUV(e,n,r,s,o),t>0&&this._blur(s,0,0,t),this._applyPMREM(s),this._cleanup(s),s}fromEquirectangular(e,t=null){return this._fromTexture(e,t)}fromCubemap(e,t=null){return this._fromTexture(e,t)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=IE(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=FE(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(e){this._lodMax=Math.floor(Math.log2(e)),this._cubeSize=2**this._lodMax}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let e=0;e2?l:0,l,l),c.setRenderTarget(r),p&&c.render(f,a),c.render(e,a)}f.geometry.dispose(),f.material.dispose(),c.toneMapping=u,c.autoClear=l,e.background=m}_textureToCubeUV(e,t){let n=this._renderer,r=e.mapping===301||e.mapping===302;r?(this._cubemapMaterial===null&&(this._cubemapMaterial=IE()),this._cubemapMaterial.uniforms.flipEnvMap.value=e.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=FE());let i=r?this._cubemapMaterial:this._equirectMaterial,a=new gC(this._lodPlanes[0],i),o=i.uniforms;o.envMap.value=e;let s=this._cubeSize;NE(t,0,0,3*s,2*s),n.setRenderTarget(t),n.render(a,SE)}_applyPMREM(e){let t=this._renderer,n=t.autoClear;t.autoClear=!1;let r=this._lodPlanes.length;for(let t=1;txE&&console.warn(`sigmaRadians, ${i}, is too large and will clip, as it requested ${m} samples when the maximum is set to ${xE}`);let h=[],g=0;for(let e=0;e_-yE?r-_+yE:0),4*(this._cubeSize-v),3*v,2*v),s.setRenderTarget(t),s.render(l,SE)}};function Cte(e){let t=[],n=[],r=[],i=e,a=e-yE+1+bE.length;for(let o=0;oe-yE?s=bE[o-e+yE-1]:o===0&&(s=0),r.push(s);let c=1/(a-2),l=-c,u=1+c,d=[l,l,u,l,u,u,l,l,u,u,l,u],f=new Float32Array(108),p=new Float32Array(72),m=new Float32Array(36);for(let e=0;e<6;e++){let t=e%3*2/3-1,n=e>2?0:-1,r=[t,n,0,t+2/3,n,0,t+2/3,n+1,0,t,n,0,t+2/3,n+1,0,t,n+1,0];f.set(r,18*e),p.set(d,12*e);let i=[e,e,e,e,e,e];m.set(i,6*e)}let h=new iC;h.setAttribute(`position`,new qS(f,3)),h.setAttribute(`uv`,new qS(p,2)),h.setAttribute(`faceIndex`,new qS(m,1)),t.push(h),i>yE&&i--}return{lodPlanes:t,sizeLods:n,sigmas:r}}function ME(e,t,n){let r=new yx(e,t,n);return r.texture.mapping=306,r.texture.name=`PMREM.cubeUv`,r.scissorTest=!0,r}function NE(e,t,n,r,i){e.viewport.set(t,n,r,i),e.scissor.set(t,n,r,i)}function PE(e,t,n){let r=new Float32Array(xE),i=new J(0,1,0);return new DC({name:`SphericalGaussianBlur`,defines:{n:xE,CUBEUV_TEXEL_WIDTH:1/t,CUBEUV_TEXEL_HEIGHT:1/n,CUBEUV_MAX_MIP:`${e}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:r},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:i}},vertexShader:LE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - uniform int samples; - uniform float weights[ n ]; - uniform bool latitudinal; - uniform float dTheta; - uniform float mipInt; - uniform vec3 poleAxis; - - #define ENVMAP_TYPE_CUBE_UV - #include - - vec3 getSample( float theta, vec3 axis ) { - - float cosTheta = cos( theta ); - // Rodrigues' axis-angle rotation - vec3 sampleDirection = vOutputDirection * cosTheta - + cross( axis, vOutputDirection ) * sin( theta ) - + axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta ); - - return bilinearCubeUV( envMap, sampleDirection, mipInt ); - - } - - void main() { - - vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection ); - - if ( all( equal( axis, vec3( 0.0 ) ) ) ) { - - axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x ); - - } - - axis = normalize( axis ); - - gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 ); - gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis ); - - for ( int i = 1; i < n; i++ ) { - - if ( i >= samples ) { - - break; - - } - - float theta = dTheta * float( i ); - gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis ); - gl_FragColor.rgb += weights[ i ] * getSample( theta, axis ); - - } - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function FE(){return new DC({name:`EquirectangularToCubeUV`,uniforms:{envMap:{value:null}},vertexShader:LE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - varying vec3 vOutputDirection; - - uniform sampler2D envMap; - - #include - - void main() { - - vec3 outputDirection = normalize( vOutputDirection ); - vec2 uv = equirectUv( outputDirection ); - - gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 ); - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function IE(){return new DC({name:`CubemapToCubeUV`,uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:LE(),fragmentShader:` - - precision mediump float; - precision mediump int; - - uniform float flipEnvMap; - - varying vec3 vOutputDirection; - - uniform samplerCube envMap; - - void main() { - - gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) ); - - } - `,blending:0,depthTest:!1,depthWrite:!1})}function LE(){return` - - precision mediump float; - precision mediump int; - - attribute float faceIndex; - - varying vec3 vOutputDirection; - - // RH coordinate system; PMREM face-indexing convention - vec3 getDirection( vec2 uv, float face ) { - - uv = 2.0 * uv - 1.0; - - vec3 direction = vec3( uv, 1.0 ); - - if ( face == 0.0 ) { - - direction = direction.zyx; // ( 1, v, u ) pos x - - } else if ( face == 1.0 ) { - - direction = direction.xzy; - direction.xz *= -1.0; // ( -u, 1, -v ) pos y - - } else if ( face == 2.0 ) { - - direction.x *= -1.0; // ( -u, v, 1 ) pos z - - } else if ( face == 3.0 ) { - - direction = direction.zyx; - direction.xz *= -1.0; // ( -1, v, -u ) neg x - - } else if ( face == 4.0 ) { - - direction = direction.xzy; - direction.xy *= -1.0; // ( -u, -1, v ) neg y - - } else if ( face == 5.0 ) { - - direction.z *= -1.0; // ( u, v, -1 ) neg z - - } - - return direction; - - } - - void main() { - - vOutputDirection = getDirection( uv, faceIndex ); - gl_Position = vec4( position, 1.0 ); - - } - `}function RE(e){let t=new WeakMap,n=null;function r(r){if(r&&r.isTexture){let o=r.mapping,s=o===303||o===304,c=o===301||o===302;if(s||c){let o=t.get(r),l=o===void 0?0:o.texture.pmremVersion;if(r.isRenderTargetTexture&&r.pmremVersion!==l)return n===null&&(n=new jE(e)),o=s?n.fromEquirectangular(r,o):n.fromCubemap(r,o),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),o.texture;if(o!==void 0)return o.texture;{let l=r.image;return s&&l&&l.height>0||c&&l&&i(l)?(n===null&&(n=new jE(e)),o=s?n.fromEquirectangular(r):n.fromCubemap(r),o.texture.pmremVersion=r.pmremVersion,t.set(r,o),r.addEventListener(`dispose`,a),o.texture):null}}}return r}function i(e){let t=0;for(let n=0;n<6;n++)e[n]!==void 0&&t++;return t===6}function a(e){let n=e.target;n.removeEventListener(`dispose`,a);let r=t.get(n);r!==void 0&&(t.delete(n),r.dispose())}function o(){t=new WeakMap,n!==null&&(n.dispose(),n=null)}return{get:r,dispose:o}}function zE(e){let t={};function n(n){if(t[n]!==void 0)return t[n];let r;switch(n){case`WEBGL_depth_texture`:r=e.getExtension(`WEBGL_depth_texture`)||e.getExtension(`MOZ_WEBGL_depth_texture`)||e.getExtension(`WEBKIT_WEBGL_depth_texture`);break;case`EXT_texture_filter_anisotropic`:r=e.getExtension(`EXT_texture_filter_anisotropic`)||e.getExtension(`MOZ_EXT_texture_filter_anisotropic`)||e.getExtension(`WEBKIT_EXT_texture_filter_anisotropic`);break;case`WEBGL_compressed_texture_s3tc`:r=e.getExtension(`WEBGL_compressed_texture_s3tc`)||e.getExtension(`MOZ_WEBGL_compressed_texture_s3tc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_s3tc`);break;case`WEBGL_compressed_texture_pvrtc`:r=e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`);break;default:r=e.getExtension(n)}return t[n]=r,r}return{has:function(e){return n(e)!==null},init:function(){n(`EXT_color_buffer_float`),n(`WEBGL_clip_cull_distance`),n(`OES_texture_float_linear`),n(`EXT_color_buffer_half_float`),n(`WEBGL_multisampled_render_to_texture`),n(`WEBGL_render_shared_exponent`)},get:function(e){let t=n(e);return t===null&&$b(`THREE.WebGLRenderer: `+e+` extension not supported.`),t}}}function BE(e,t,n,r){let i={},a=new WeakMap;function o(e){let s=e.target;s.index!==null&&t.remove(s.index);for(let e in s.attributes)t.remove(s.attributes[e]);s.removeEventListener(`dispose`,o),delete i[s.id];let c=a.get(s);c&&(t.remove(c),a.delete(s)),r.releaseStatesOfGeometry(s),s.isInstancedBufferGeometry===!0&&delete s._maxInstanceCount,n.memory.geometries--}function s(e,t){return i[t.id]===!0?t:(t.addEventListener(`dispose`,o),i[t.id]=!0,n.memory.geometries++,t)}function c(n){let r=n.attributes;for(let n in r)t.update(r[n],e.ARRAY_BUFFER)}function l(e){let n=[],r=e.index,i=e.attributes.position,o=0;if(r!==null){let e=r.array;o=r.version;for(let t=0,r=e.length;tt.maxTextureSize&&(m=Math.ceil(p/t.maxTextureSize),p=t.maxTextureSize);let h=new Float32Array(p*m*4*u),g=new bx(h,p,m,u);g.type=my,g.needsUpdate=!0;let _=f*4;for(let t=0;t0)return e;let i=t*n,a=XE[i];if(a===void 0&&(a=new Float32Array(i),XE[i]=a),t!==0){r.toArray(a,0);for(let r=1,i=0;r!==t;++r)i+=n,e[r].toArray(a,i)}return a}function nD(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n`:` `} ${i}: ${n[e]}`)}return r.join(` -`)}var nO=new qb;function rO(e){ox._getMatrix(nO,ox.workingColorSpace,e);let t=`mat3( ${nO.elements.map(e=>e.toFixed(4))} )`;switch(ox.getTransfer(e)){case _b:return[t,`LinearTransferOETF`];case vb:return[t,`sRGBTransferOETF`];default:return console.warn(`THREE.WebGLProgram: Unsupported color space: `,e),[t,`LinearTransferOETF`]}}function iO(e,t,n){let r=e.getShaderParameter(t,e.COMPILE_STATUS),i=e.getShaderInfoLog(t).trim();if(r&&i===``)return``;let a=/ERROR: 0:(\d+)/.exec(i);if(a){let r=parseInt(a[1]);return n.toUpperCase()+` - -`+i+` - -`+tO(e.getShaderSource(t),r)}else return i}function aO(e,t){let n=rO(t);return[`vec4 ${e}( vec4 value ) {`,` return ${n[1]}( vec4( value.rgb * ${n[0]}, value.a ) );`,`}`].join(` -`)}function oO(e,t){let n;switch(t){case 1:n=`Linear`;break;case 2:n=`Reinhard`;break;case 3:n=`Cineon`;break;case 4:n=`ACESFilmic`;break;case 6:n=`AgX`;break;case 7:n=`Neutral`;break;case 5:n=`Custom`;break;default:console.warn(`THREE.WebGLProgram: Unsupported toneMapping:`,t),n=`Linear`}return`vec3 `+e+`( vec3 color ) { return `+n+`ToneMapping( color ); }`}var sO=new J;function cO(){return ox.getLuminanceCoefficients(sO),[`float luminance( const in vec3 rgb ) {`,` const vec3 weights = vec3( ${sO.x.toFixed(4)}, ${sO.y.toFixed(4)}, ${sO.z.toFixed(4)} );`,` return dot( weights, rgb );`,`}`].join(` -`)}function lO(e){return[e.extensionClipCullDistance?`#extension GL_ANGLE_clip_cull_distance : require`:``,e.extensionMultiDraw?`#extension GL_ANGLE_multi_draw : require`:``].filter(fO).join(` -`)}function uO(e){let t=[];for(let n in e){let r=e[n];r!==!1&&t.push(`#define `+n+` `+r)}return t.join(` -`)}function dO(e,t){let n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES);for(let i=0;i/gm;function gO(e){return e.replace(hO,vO)}var _O=new Map;function vO(e,t){let n=hE[t];if(n===void 0){let e=_O.get(t);if(e!==void 0)n=hE[e],console.warn(`THREE.WebGLRenderer: Shader chunk "%s" has been deprecated. Use "%s" instead.`,t,e);else throw Error(`Can not resolve #include <`+t+`>`)}return gO(n)}var yO=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function bO(e){return e.replace(yO,xO)}function xO(e,t,n,r){let i=``;for(let e=parseInt(t);e0&&(g+=` -`),_=[`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m].filter(fO).join(` -`),_.length>0&&(_+=` -`)):(g=[SO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.extensionClipCullDistance?`#define USE_CLIP_DISTANCE`:``,n.batching?`#define USE_BATCHING`:``,n.batchingColor?`#define USE_BATCHING_COLOR`:``,n.instancing?`#define USE_INSTANCING`:``,n.instancingColor?`#define USE_INSTANCING_COLOR`:``,n.instancingMorph?`#define USE_INSTANCING_MORPH`:``,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.map?`#define USE_MAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+u:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.displacementMap?`#define USE_DISPLACEMENTMAP`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.mapUv?`#define MAP_UV `+n.mapUv:``,n.alphaMapUv?`#define ALPHAMAP_UV `+n.alphaMapUv:``,n.lightMapUv?`#define LIGHTMAP_UV `+n.lightMapUv:``,n.aoMapUv?`#define AOMAP_UV `+n.aoMapUv:``,n.emissiveMapUv?`#define EMISSIVEMAP_UV `+n.emissiveMapUv:``,n.bumpMapUv?`#define BUMPMAP_UV `+n.bumpMapUv:``,n.normalMapUv?`#define NORMALMAP_UV `+n.normalMapUv:``,n.displacementMapUv?`#define DISPLACEMENTMAP_UV `+n.displacementMapUv:``,n.metalnessMapUv?`#define METALNESSMAP_UV `+n.metalnessMapUv:``,n.roughnessMapUv?`#define ROUGHNESSMAP_UV `+n.roughnessMapUv:``,n.anisotropyMapUv?`#define ANISOTROPYMAP_UV `+n.anisotropyMapUv:``,n.clearcoatMapUv?`#define CLEARCOATMAP_UV `+n.clearcoatMapUv:``,n.clearcoatNormalMapUv?`#define CLEARCOAT_NORMALMAP_UV `+n.clearcoatNormalMapUv:``,n.clearcoatRoughnessMapUv?`#define CLEARCOAT_ROUGHNESSMAP_UV `+n.clearcoatRoughnessMapUv:``,n.iridescenceMapUv?`#define IRIDESCENCEMAP_UV `+n.iridescenceMapUv:``,n.iridescenceThicknessMapUv?`#define IRIDESCENCE_THICKNESSMAP_UV `+n.iridescenceThicknessMapUv:``,n.sheenColorMapUv?`#define SHEEN_COLORMAP_UV `+n.sheenColorMapUv:``,n.sheenRoughnessMapUv?`#define SHEEN_ROUGHNESSMAP_UV `+n.sheenRoughnessMapUv:``,n.specularMapUv?`#define SPECULARMAP_UV `+n.specularMapUv:``,n.specularColorMapUv?`#define SPECULAR_COLORMAP_UV `+n.specularColorMapUv:``,n.specularIntensityMapUv?`#define SPECULAR_INTENSITYMAP_UV `+n.specularIntensityMapUv:``,n.transmissionMapUv?`#define TRANSMISSIONMAP_UV `+n.transmissionMapUv:``,n.thicknessMapUv?`#define THICKNESSMAP_UV `+n.thicknessMapUv:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.flatShading?`#define FLAT_SHADED`:``,n.skinning?`#define USE_SKINNING`:``,n.morphTargets?`#define USE_MORPHTARGETS`:``,n.morphNormals&&n.flatShading===!1?`#define USE_MORPHNORMALS`:``,n.morphColors?`#define USE_MORPHCOLORS`:``,n.morphTargetsCount>0?`#define MORPHTARGETS_TEXTURE_STRIDE `+n.morphTextureStride:``,n.morphTargetsCount>0?`#define MORPHTARGETS_COUNT `+n.morphTargetsCount:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.sizeAttenuation?`#define USE_SIZEATTENUATION`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 modelMatrix;`,`uniform mat4 modelViewMatrix;`,`uniform mat4 projectionMatrix;`,`uniform mat4 viewMatrix;`,`uniform mat3 normalMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,`#ifdef USE_INSTANCING`,` attribute mat4 instanceMatrix;`,`#endif`,`#ifdef USE_INSTANCING_COLOR`,` attribute vec3 instanceColor;`,`#endif`,`#ifdef USE_INSTANCING_MORPH`,` uniform sampler2D morphTexture;`,`#endif`,`attribute vec3 position;`,`attribute vec3 normal;`,`attribute vec2 uv;`,`#ifdef USE_UV1`,` attribute vec2 uv1;`,`#endif`,`#ifdef USE_UV2`,` attribute vec2 uv2;`,`#endif`,`#ifdef USE_UV3`,` attribute vec2 uv3;`,`#endif`,`#ifdef USE_TANGENT`,` attribute vec4 tangent;`,`#endif`,`#if defined( USE_COLOR_ALPHA )`,` attribute vec4 color;`,`#elif defined( USE_COLOR )`,` attribute vec3 color;`,`#endif`,`#ifdef USE_SKINNING`,` attribute vec4 skinIndex;`,` attribute vec4 skinWeight;`,`#endif`,` -`].filter(fO).join(` -`),_=[SO(n),`#define SHADER_TYPE `+n.shaderType,`#define SHADER_NAME `+n.shaderName,m,n.useFog&&n.fog?`#define USE_FOG`:``,n.useFog&&n.fogExp2?`#define FOG_EXP2`:``,n.alphaToCoverage?`#define ALPHA_TO_COVERAGE`:``,n.map?`#define USE_MAP`:``,n.matcap?`#define USE_MATCAP`:``,n.envMap?`#define USE_ENVMAP`:``,n.envMap?`#define `+l:``,n.envMap?`#define `+u:``,n.envMap?`#define `+d:``,f?`#define CUBEUV_TEXEL_WIDTH `+f.texelWidth:``,f?`#define CUBEUV_TEXEL_HEIGHT `+f.texelHeight:``,f?`#define CUBEUV_MAX_MIP `+f.maxMip+`.0`:``,n.lightMap?`#define USE_LIGHTMAP`:``,n.aoMap?`#define USE_AOMAP`:``,n.bumpMap?`#define USE_BUMPMAP`:``,n.normalMap?`#define USE_NORMALMAP`:``,n.normalMapObjectSpace?`#define USE_NORMALMAP_OBJECTSPACE`:``,n.normalMapTangentSpace?`#define USE_NORMALMAP_TANGENTSPACE`:``,n.emissiveMap?`#define USE_EMISSIVEMAP`:``,n.anisotropy?`#define USE_ANISOTROPY`:``,n.anisotropyMap?`#define USE_ANISOTROPYMAP`:``,n.clearcoat?`#define USE_CLEARCOAT`:``,n.clearcoatMap?`#define USE_CLEARCOATMAP`:``,n.clearcoatRoughnessMap?`#define USE_CLEARCOAT_ROUGHNESSMAP`:``,n.clearcoatNormalMap?`#define USE_CLEARCOAT_NORMALMAP`:``,n.dispersion?`#define USE_DISPERSION`:``,n.iridescence?`#define USE_IRIDESCENCE`:``,n.iridescenceMap?`#define USE_IRIDESCENCEMAP`:``,n.iridescenceThicknessMap?`#define USE_IRIDESCENCE_THICKNESSMAP`:``,n.specularMap?`#define USE_SPECULARMAP`:``,n.specularColorMap?`#define USE_SPECULAR_COLORMAP`:``,n.specularIntensityMap?`#define USE_SPECULAR_INTENSITYMAP`:``,n.roughnessMap?`#define USE_ROUGHNESSMAP`:``,n.metalnessMap?`#define USE_METALNESSMAP`:``,n.alphaMap?`#define USE_ALPHAMAP`:``,n.alphaTest?`#define USE_ALPHATEST`:``,n.alphaHash?`#define USE_ALPHAHASH`:``,n.sheen?`#define USE_SHEEN`:``,n.sheenColorMap?`#define USE_SHEEN_COLORMAP`:``,n.sheenRoughnessMap?`#define USE_SHEEN_ROUGHNESSMAP`:``,n.transmission?`#define USE_TRANSMISSION`:``,n.transmissionMap?`#define USE_TRANSMISSIONMAP`:``,n.thicknessMap?`#define USE_THICKNESSMAP`:``,n.vertexTangents&&n.flatShading===!1?`#define USE_TANGENT`:``,n.vertexColors||n.instancingColor||n.batchingColor?`#define USE_COLOR`:``,n.vertexAlphas?`#define USE_COLOR_ALPHA`:``,n.vertexUv1s?`#define USE_UV1`:``,n.vertexUv2s?`#define USE_UV2`:``,n.vertexUv3s?`#define USE_UV3`:``,n.pointsUvs?`#define USE_POINTS_UV`:``,n.gradientMap?`#define USE_GRADIENTMAP`:``,n.flatShading?`#define FLAT_SHADED`:``,n.doubleSided?`#define DOUBLE_SIDED`:``,n.flipSided?`#define FLIP_SIDED`:``,n.shadowMapEnabled?`#define USE_SHADOWMAP`:``,n.shadowMapEnabled?`#define `+c:``,n.premultipliedAlpha?`#define PREMULTIPLIED_ALPHA`:``,n.numLightProbes>0?`#define USE_LIGHT_PROBES`:``,n.decodeVideoTexture?`#define DECODE_VIDEO_TEXTURE`:``,n.decodeVideoTextureEmissive?`#define DECODE_VIDEO_TEXTURE_EMISSIVE`:``,n.logarithmicDepthBuffer?`#define USE_LOGDEPTHBUF`:``,n.reverseDepthBuffer?`#define USE_REVERSEDEPTHBUF`:``,`uniform mat4 viewMatrix;`,`uniform vec3 cameraPosition;`,`uniform bool isOrthographic;`,n.toneMapping===0?``:`#define TONE_MAPPING`,n.toneMapping===0?``:hE.tonemapping_pars_fragment,n.toneMapping===0?``:oO(`toneMapping`,n.toneMapping),n.dithering?`#define DITHERING`:``,n.opaque?`#define OPAQUE`:``,hE.colorspace_pars_fragment,aO(`linearToOutputTexel`,n.outputColorSpace),cO(),n.useDepthPacking?`#define DEPTH_PACKING `+n.depthPacking:``,` -`].filter(fO).join(` -`)),o=gO(o),o=pO(o,n),o=mO(o,n),s=gO(s),s=pO(s,n),s=mO(s,n),o=bO(o),s=bO(s),n.isRawShaderMaterial!==!0&&(v=`#version 300 es -`,g=[p,`#define attribute in`,`#define varying out`,`#define texture2D texture`].join(` -`)+` -`+g,_=[`#define varying in`,n.glslVersion===`300 es`?``:`layout(location = 0) out highp vec4 pc_fragColor;`,n.glslVersion===`300 es`?``:`#define gl_FragColor pc_fragColor`,`#define gl_FragDepthEXT gl_FragDepth`,`#define texture2D texture`,`#define textureCube texture`,`#define texture2DProj textureProj`,`#define texture2DLodEXT textureLod`,`#define texture2DProjLodEXT textureProjLod`,`#define textureCubeLodEXT textureLod`,`#define texture2DGradEXT textureGrad`,`#define texture2DProjGradEXT textureProjGrad`,`#define textureCubeGradEXT textureGrad`].join(` -`)+` -`+_);let y=v+g+o,b=v+_+s,x=QD(i,i.VERTEX_SHADER,y),S=QD(i,i.FRAGMENT_SHADER,b);i.attachShader(h,x),i.attachShader(h,S),n.index0AttributeName===void 0?n.morphTargets===!0&&i.bindAttribLocation(h,0,`position`):i.bindAttribLocation(h,0,n.index0AttributeName),i.linkProgram(h);function C(t){if(e.debug.checkShaderErrors){let n=i.getProgramInfoLog(h).trim(),r=i.getShaderInfoLog(x).trim(),a=i.getShaderInfoLog(S).trim(),o=!0,s=!0;if(i.getProgramParameter(h,i.LINK_STATUS)===!1)if(o=!1,typeof e.debug.onShaderError==`function`)e.debug.onShaderError(i,h,x,S);else{let e=iO(i,x,`vertex`),r=iO(i,S,`fragment`);console.error(`THREE.WebGLProgram: Shader Error `+i.getError()+` - VALIDATE_STATUS `+i.getProgramParameter(h,i.VALIDATE_STATUS)+` - -Material Name: `+t.name+` -Material Type: `+t.type+` - -Program Info Log: `+n+` -`+e+` -`+r)}else n===``?(r===``||a===``)&&(s=!1):console.warn(`THREE.WebGLProgram: Program Info Log:`,n);s&&(t.diagnostics={runnable:o,programLog:n,vertexShader:{log:r,prefix:g},fragmentShader:{log:a,prefix:_}})}i.deleteShader(x),i.deleteShader(S),w=new ZD(i,h),T=dO(i,h)}let w;this.getUniforms=function(){return w===void 0&&C(this),w};let T;this.getAttributes=function(){return T===void 0&&C(this),T};let E=n.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return E===!1&&(E=i.getProgramParameter(h,$D)),E},this.destroy=function(){r.releaseStatesOfProgram(this),i.deleteProgram(h),this.program=void 0},this.type=n.shaderType,this.name=n.shaderName,this.id=eO++,this.cacheKey=t,this.usedTimes=1,this.program=h,this.vertexShader=x,this.fragmentShader=S,this}var kO=0,AO=class{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(e){let t=e.vertexShader,n=e.fragmentShader,r=this._getShaderStage(t),i=this._getShaderStage(n),a=this._getShaderCacheForMaterial(e);return a.has(r)===!1&&(a.add(r),r.usedTimes++),a.has(i)===!1&&(a.add(i),i.usedTimes++),this}remove(e){let t=this.materialCache.get(e);for(let e of t)e.usedTimes--,e.usedTimes===0&&this.shaderCache.delete(e.code);return this.materialCache.delete(e),this}getVertexShaderID(e){return this._getShaderStage(e.vertexShader).id}getFragmentShaderID(e){return this._getShaderStage(e.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(e){let t=this.materialCache,n=t.get(e);return n===void 0&&(n=new Set,t.set(e,n)),n}_getShaderStage(e){let t=this.shaderCache,n=t.get(e);return n===void 0&&(n=new jO(e),t.set(e,n)),n}},jO=class{constructor(e){this.id=kO++,this.code=e,this.usedTimes=0}};function MO(e,t,n,r,i,a,o){let s=new aS,c=new AO,l=new Set,u=[],d=i.logarithmicDepthBuffer,f=i.vertexTextures,p=i.precision,m={MeshDepthMaterial:`depth`,MeshDistanceMaterial:`distanceRGBA`,MeshNormalMaterial:`normal`,MeshBasicMaterial:`basic`,MeshLambertMaterial:`lambert`,MeshPhongMaterial:`phong`,MeshToonMaterial:`toon`,MeshStandardMaterial:`physical`,MeshPhysicalMaterial:`physical`,MeshMatcapMaterial:`matcap`,LineBasicMaterial:`basic`,LineDashedMaterial:`dashed`,PointsMaterial:`points`,ShadowMaterial:`shadow`,SpriteMaterial:`sprite`};function h(e){return l.add(e),e===0?`uv`:`uv${e}`}function g(a,s,u,g,_){let v=g.fog,y=_.geometry,b=a.isMeshStandardMaterial?g.environment:null,x=(a.isMeshStandardMaterial?n:t).get(a.envMap||b),S=x&&x.mapping===306?x.image.height:null,C=m[a.type];a.precision!==null&&(p=i.getMaxPrecision(a.precision),p!==a.precision&&console.warn(`THREE.WebGLProgram.getParameters:`,a.precision,`not supported, using`,p,`instead.`));let w=y.morphAttributes.position||y.morphAttributes.normal||y.morphAttributes.color,T=w===void 0?0:w.length,E=0;y.morphAttributes.position!==void 0&&(E=1),y.morphAttributes.normal!==void 0&&(E=2),y.morphAttributes.color!==void 0&&(E=3);let D,O,k,A;if(C){let e=gE[C];D=e.vertexShader,O=e.fragmentShader}else D=a.vertexShader,O=a.fragmentShader,c.update(a),k=c.getVertexShaderID(a),A=c.getFragmentShaderID(a);let j=e.getRenderTarget(),M=e.state.buffers.depth.getReversed(),N=_.isInstancedMesh===!0,P=_.isBatchedMesh===!0,F=!!a.map,I=!!a.matcap,ee=!!x,te=!!a.aoMap,ne=!!a.lightMap,re=!!a.bumpMap,ie=!!a.normalMap,ae=!!a.displacementMap,oe=!!a.emissiveMap,se=!!a.metalnessMap,ce=!!a.roughnessMap,le=a.anisotropy>0,ue=a.clearcoat>0,de=a.dispersion>0,L=a.iridescence>0,fe=a.sheen>0,pe=a.transmission>0,me=le&&!!a.anisotropyMap,R=ue&&!!a.clearcoatMap,he=ue&&!!a.clearcoatNormalMap,z=ue&&!!a.clearcoatRoughnessMap,ge=L&&!!a.iridescenceMap,_e=L&&!!a.iridescenceThicknessMap,ve=fe&&!!a.sheenColorMap,ye=fe&&!!a.sheenRoughnessMap,be=!!a.specularMap,xe=!!a.specularColorMap,Se=!!a.specularIntensityMap,Ce=pe&&!!a.transmissionMap,we=pe&&!!a.thicknessMap,Te=!!a.gradientMap,Ee=!!a.alphaMap,De=a.alphaTest>0,Oe=!!a.alphaHash,ke=!!a.extensions,Ae=0;a.toneMapped&&(j===null||j.isXRRenderTarget===!0)&&(Ae=e.toneMapping);let je={shaderID:C,shaderType:a.type,shaderName:a.name,vertexShader:D,fragmentShader:O,defines:a.defines,customVertexShaderID:k,customFragmentShaderID:A,isRawShaderMaterial:a.isRawShaderMaterial===!0,glslVersion:a.glslVersion,precision:p,batching:P,batchingColor:P&&_._colorsTexture!==null,instancing:N,instancingColor:N&&_.instanceColor!==null,instancingMorph:N&&_.morphTexture!==null,supportsVertexTextures:f,outputColorSpace:j===null?e.outputColorSpace:j.isXRRenderTarget===!0?j.texture.colorSpace:gb,alphaToCoverage:!!a.alphaToCoverage,map:F,matcap:I,envMap:ee,envMapMode:ee&&x.mapping,envMapCubeUVHeight:S,aoMap:te,lightMap:ne,bumpMap:re,normalMap:ie,displacementMap:f&&ae,emissiveMap:oe,normalMapObjectSpace:ie&&a.normalMapType===1,normalMapTangentSpace:ie&&a.normalMapType===0,metalnessMap:se,roughnessMap:ce,anisotropy:le,anisotropyMap:me,clearcoat:ue,clearcoatMap:R,clearcoatNormalMap:he,clearcoatRoughnessMap:z,dispersion:de,iridescence:L,iridescenceMap:ge,iridescenceThicknessMap:_e,sheen:fe,sheenColorMap:ve,sheenRoughnessMap:ye,specularMap:be,specularColorMap:xe,specularIntensityMap:Se,transmission:pe,transmissionMap:Ce,thicknessMap:we,gradientMap:Te,opaque:a.transparent===!1&&a.blending===1&&a.alphaToCoverage===!1,alphaMap:Ee,alphaTest:De,alphaHash:Oe,combine:a.combine,mapUv:F&&h(a.map.channel),aoMapUv:te&&h(a.aoMap.channel),lightMapUv:ne&&h(a.lightMap.channel),bumpMapUv:re&&h(a.bumpMap.channel),normalMapUv:ie&&h(a.normalMap.channel),displacementMapUv:ae&&h(a.displacementMap.channel),emissiveMapUv:oe&&h(a.emissiveMap.channel),metalnessMapUv:se&&h(a.metalnessMap.channel),roughnessMapUv:ce&&h(a.roughnessMap.channel),anisotropyMapUv:me&&h(a.anisotropyMap.channel),clearcoatMapUv:R&&h(a.clearcoatMap.channel),clearcoatNormalMapUv:he&&h(a.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:z&&h(a.clearcoatRoughnessMap.channel),iridescenceMapUv:ge&&h(a.iridescenceMap.channel),iridescenceThicknessMapUv:_e&&h(a.iridescenceThicknessMap.channel),sheenColorMapUv:ve&&h(a.sheenColorMap.channel),sheenRoughnessMapUv:ye&&h(a.sheenRoughnessMap.channel),specularMapUv:be&&h(a.specularMap.channel),specularColorMapUv:xe&&h(a.specularColorMap.channel),specularIntensityMapUv:Se&&h(a.specularIntensityMap.channel),transmissionMapUv:Ce&&h(a.transmissionMap.channel),thicknessMapUv:we&&h(a.thicknessMap.channel),alphaMapUv:Ee&&h(a.alphaMap.channel),vertexTangents:!!y.attributes.tangent&&(ie||le),vertexColors:a.vertexColors,vertexAlphas:a.vertexColors===!0&&!!y.attributes.color&&y.attributes.color.itemSize===4,pointsUvs:_.isPoints===!0&&!!y.attributes.uv&&(F||Ee),fog:!!v,useFog:a.fog===!0,fogExp2:!!v&&v.isFogExp2,flatShading:a.flatShading===!0,sizeAttenuation:a.sizeAttenuation===!0,logarithmicDepthBuffer:d,reverseDepthBuffer:M,skinning:_.isSkinnedMesh===!0,morphTargets:y.morphAttributes.position!==void 0,morphNormals:y.morphAttributes.normal!==void 0,morphColors:y.morphAttributes.color!==void 0,morphTargetsCount:T,morphTextureStride:E,numDirLights:s.directional.length,numPointLights:s.point.length,numSpotLights:s.spot.length,numSpotLightMaps:s.spotLightMap.length,numRectAreaLights:s.rectArea.length,numHemiLights:s.hemi.length,numDirLightShadows:s.directionalShadowMap.length,numPointLightShadows:s.pointShadowMap.length,numSpotLightShadows:s.spotShadowMap.length,numSpotLightShadowsWithMaps:s.numSpotLightShadowsWithMaps,numLightProbes:s.numLightProbes,numClippingPlanes:o.numPlanes,numClipIntersection:o.numIntersection,dithering:a.dithering,shadowMapEnabled:e.shadowMap.enabled&&u.length>0,shadowMapType:e.shadowMap.type,toneMapping:Ae,decodeVideoTexture:F&&a.map.isVideoTexture===!0&&ox.getTransfer(a.map.colorSpace)===`srgb`,decodeVideoTextureEmissive:oe&&a.emissiveMap.isVideoTexture===!0&&ox.getTransfer(a.emissiveMap.colorSpace)===`srgb`,premultipliedAlpha:a.premultipliedAlpha,doubleSided:a.side===2,flipSided:a.side===1,useDepthPacking:a.depthPacking>=0,depthPacking:a.depthPacking||0,index0AttributeName:a.index0AttributeName,extensionClipCullDistance:ke&&a.extensions.clipCullDistance===!0&&r.has(`WEBGL_clip_cull_distance`),extensionMultiDraw:(ke&&a.extensions.multiDraw===!0||P)&&r.has(`WEBGL_multi_draw`),rendererExtensionParallelShaderCompile:r.has(`KHR_parallel_shader_compile`),customProgramCacheKey:a.customProgramCacheKey()};return je.vertexUv1s=l.has(1),je.vertexUv2s=l.has(2),je.vertexUv3s=l.has(3),l.clear(),je}function _(t){let n=[];if(t.shaderID?n.push(t.shaderID):(n.push(t.customVertexShaderID),n.push(t.customFragmentShaderID)),t.defines!==void 0)for(let e in t.defines)n.push(e),n.push(t.defines[e]);return t.isRawShaderMaterial===!1&&(v(n,t),y(n,t),n.push(e.outputColorSpace)),n.push(t.customProgramCacheKey),n.join()}function v(e,t){e.push(t.precision),e.push(t.outputColorSpace),e.push(t.envMapMode),e.push(t.envMapCubeUVHeight),e.push(t.mapUv),e.push(t.alphaMapUv),e.push(t.lightMapUv),e.push(t.aoMapUv),e.push(t.bumpMapUv),e.push(t.normalMapUv),e.push(t.displacementMapUv),e.push(t.emissiveMapUv),e.push(t.metalnessMapUv),e.push(t.roughnessMapUv),e.push(t.anisotropyMapUv),e.push(t.clearcoatMapUv),e.push(t.clearcoatNormalMapUv),e.push(t.clearcoatRoughnessMapUv),e.push(t.iridescenceMapUv),e.push(t.iridescenceThicknessMapUv),e.push(t.sheenColorMapUv),e.push(t.sheenRoughnessMapUv),e.push(t.specularMapUv),e.push(t.specularColorMapUv),e.push(t.specularIntensityMapUv),e.push(t.transmissionMapUv),e.push(t.thicknessMapUv),e.push(t.combine),e.push(t.fogExp2),e.push(t.sizeAttenuation),e.push(t.morphTargetsCount),e.push(t.morphAttributeCount),e.push(t.numDirLights),e.push(t.numPointLights),e.push(t.numSpotLights),e.push(t.numSpotLightMaps),e.push(t.numHemiLights),e.push(t.numRectAreaLights),e.push(t.numDirLightShadows),e.push(t.numPointLightShadows),e.push(t.numSpotLightShadows),e.push(t.numSpotLightShadowsWithMaps),e.push(t.numLightProbes),e.push(t.shadowMapType),e.push(t.toneMapping),e.push(t.numClippingPlanes),e.push(t.numClipIntersection),e.push(t.depthPacking)}function y(e,t){s.disableAll(),t.supportsVertexTextures&&s.enable(0),t.instancing&&s.enable(1),t.instancingColor&&s.enable(2),t.instancingMorph&&s.enable(3),t.matcap&&s.enable(4),t.envMap&&s.enable(5),t.normalMapObjectSpace&&s.enable(6),t.normalMapTangentSpace&&s.enable(7),t.clearcoat&&s.enable(8),t.iridescence&&s.enable(9),t.alphaTest&&s.enable(10),t.vertexColors&&s.enable(11),t.vertexAlphas&&s.enable(12),t.vertexUv1s&&s.enable(13),t.vertexUv2s&&s.enable(14),t.vertexUv3s&&s.enable(15),t.vertexTangents&&s.enable(16),t.anisotropy&&s.enable(17),t.alphaHash&&s.enable(18),t.batching&&s.enable(19),t.dispersion&&s.enable(20),t.batchingColor&&s.enable(21),e.push(s.mask),s.disableAll(),t.fog&&s.enable(0),t.useFog&&s.enable(1),t.flatShading&&s.enable(2),t.logarithmicDepthBuffer&&s.enable(3),t.reverseDepthBuffer&&s.enable(4),t.skinning&&s.enable(5),t.morphTargets&&s.enable(6),t.morphNormals&&s.enable(7),t.morphColors&&s.enable(8),t.premultipliedAlpha&&s.enable(9),t.shadowMapEnabled&&s.enable(10),t.doubleSided&&s.enable(11),t.flipSided&&s.enable(12),t.useDepthPacking&&s.enable(13),t.dithering&&s.enable(14),t.transmission&&s.enable(15),t.sheen&&s.enable(16),t.opaque&&s.enable(17),t.pointsUvs&&s.enable(18),t.decodeVideoTexture&&s.enable(19),t.decodeVideoTextureEmissive&&s.enable(20),t.alphaToCoverage&&s.enable(21),e.push(s.mask)}function b(e){let t=m[e.type],n;if(t){let e=gE[t];n=wC.clone(e.uniforms)}else n=e.uniforms;return n}function x(t,n){let r;for(let e=0,t=u.length;e0?r.push(u):a.transparent===!0?i.push(u):n.push(u)}function c(e,t,a,s,c,l){let u=o(e,t,a,s,c,l);a.transmission>0?r.unshift(u):a.transparent===!0?i.unshift(u):n.unshift(u)}function l(e,t){n.length>1&&n.sort(e||PO),r.length>1&&r.sort(t||FO),i.length>1&&i.sort(t||FO)}function u(){for(let n=t,r=e.length;n=r.length?(i=new IO,r.push(i)):i=r[n],i}function n(){e=new WeakMap}return{get:t,dispose:n}}function RO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={direction:new J,color:new X};break;case`SpotLight`:n={position:new J,direction:new J,color:new X,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case`PointLight`:n={position:new J,color:new X,distance:0,decay:0};break;case`HemisphereLight`:n={direction:new J,skyColor:new X,groundColor:new X};break;case`RectAreaLight`:n={color:new X,position:new J,halfWidth:new J,halfHeight:new J};break}return e[t.id]=n,n}}}function zO(){let e={};return{get:function(t){if(e[t.id]!==void 0)return e[t.id];let n;switch(t.type){case`DirectionalLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub};break;case`SpotLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub};break;case`PointLight`:n={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ub,shadowCameraNear:1,shadowCameraFar:1e3};break}return e[t.id]=n,n}}}var BO=0;function VO(e,t){return(t.castShadow?2:0)-(e.castShadow?2:0)+ +!!t.map-!!e.map}function HO(e){let t=new RO,n=zO(),r={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let e=0;e<9;e++)r.probe.push(new J);let i=new J,a=new Y,o=new Y;function s(i){let a=0,o=0,s=0;for(let e=0;e<9;e++)r.probe[e].set(0,0,0);let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0;i.sort(VO);for(let e=0,y=i.length;e0&&(e.has(`OES_texture_float_linear`)===!0?(r.rectAreaLTC1=Z.LTC_FLOAT_1,r.rectAreaLTC2=Z.LTC_FLOAT_2):(r.rectAreaLTC1=Z.LTC_HALF_1,r.rectAreaLTC2=Z.LTC_HALF_2)),r.ambient[0]=a,r.ambient[1]=o,r.ambient[2]=s;let y=r.hash;(y.directionalLength!==c||y.pointLength!==l||y.spotLength!==u||y.rectAreaLength!==d||y.hemiLength!==f||y.numDirectionalShadows!==p||y.numPointShadows!==m||y.numSpotShadows!==h||y.numSpotMaps!==g||y.numLightProbes!==v)&&(r.directional.length=c,r.spot.length=u,r.rectArea.length=d,r.point.length=l,r.hemi.length=f,r.directionalShadow.length=p,r.directionalShadowMap.length=p,r.pointShadow.length=m,r.pointShadowMap.length=m,r.spotShadow.length=h,r.spotShadowMap.length=h,r.directionalShadowMatrix.length=p,r.pointShadowMatrix.length=m,r.spotLightMatrix.length=h+g-_,r.spotLightMap.length=g,r.numSpotLightShadowsWithMaps=_,r.numLightProbes=v,y.directionalLength=c,y.pointLength=l,y.spotLength=u,y.rectAreaLength=d,y.hemiLength=f,y.numDirectionalShadows=p,y.numPointShadows=m,y.numSpotShadows=h,y.numSpotMaps=g,y.numLightProbes=v,r.version=BO++)}function c(e,t){let n=0,s=0,c=0,l=0,u=0,d=t.matrixWorldInverse;for(let t=0,f=e.length;t=i.length?(a=new UO(e),i.push(a)):a=i[r],a}function r(){t=new WeakMap}return{get:n,dispose:r}}var GO=`void main() { - gl_Position = vec4( position, 1.0 ); -}`,KO=`uniform sampler2D shadow_pass; -uniform vec2 resolution; -uniform float radius; -#include -void main() { - const float samples = float( VSM_SAMPLES ); - float mean = 0.0; - float squared_mean = 0.0; - float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 ); - float uvStart = samples <= 1.0 ? 0.0 : - 1.0; - for ( float i = 0.0; i < samples; i ++ ) { - float uvOffset = uvStart + i * uvStride; - #ifdef HORIZONTAL_PASS - vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) ); - mean += distribution.x; - squared_mean += distribution.y * distribution.y + distribution.x * distribution.x; - #else - float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) ); - mean += depth; - squared_mean += depth * depth; - #endif - } - mean = mean / samples; - squared_mean = squared_mean / samples; - float std_dev = sqrt( squared_mean - mean * mean ); - gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) ); -}`;function qO(e,t,n){let r=new xw,i=new Ub,a=new Ub,o=new _x,s=new Qw({depthPacking:mb}),c=new dte,l={},u=n.maxTextureSize,d={0:1,1:0,2:2},f=new DC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ub},radius:{value:4}},vertexShader:GO,fragmentShader:KO}),p=f.clone();p.defines.HORIZONTAL_PASS=1;let m=new iC;m.setAttribute(`position`,new qS(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));let h=new gC(m,f),g=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=1;let _=this.type;this.render=function(t,n,s){if(g.enabled===!1||g.autoUpdate===!1&&g.needsUpdate===!1||t.length===0)return;let c=e.getRenderTarget(),l=e.getActiveCubeFace(),d=e.getActiveMipmapLevel(),f=e.state;f.setBlending(0),f.buffers.color.setClear(1,1,1,1),f.buffers.depth.setTest(!0),f.setScissorTest(!1);let p=_!==3&&this.type===3,m=_===3&&this.type!==3;for(let c=0,l=t.length;cu||i.y>u)&&(i.x>u&&(a.x=Math.floor(u/h.x),i.x=a.x*h.x,d.mapSize.x=a.x),i.y>u&&(a.y=Math.floor(u/h.y),i.y=a.y*h.y,d.mapSize.y=a.y)),d.map===null||p===!0||m===!0){let e=this.type===3?{}:{minFilter:ny,magFilter:ny};d.map!==null&&d.map.dispose(),d.map=new yx(i.x,i.y,e),d.map.texture.name=l.name+`.shadowMap`,d.camera.updateProjectionMatrix()}e.setRenderTarget(d.map),e.clear();let g=d.getViewportCount();for(let e=0;e0||n.map&&n.alphaTest>0||n.alphaToCoverage===!0){let e=a.uuid,t=n.uuid,r=l[e];r===void 0&&(r={},l[e]=r);let i=r[t];i===void 0&&(i=a.clone(),r[t]=i,n.addEventListener(`dispose`,x)),a=i}if(a.visible=n.visible,a.wireframe=n.wireframe,i===3?a.side=n.shadowSide===null?n.side:n.shadowSide:a.side=n.shadowSide===null?d[n.side]:n.shadowSide,a.alphaMap=n.alphaMap,a.alphaTest=n.alphaToCoverage===!0?.5:n.alphaTest,a.map=n.map,a.clipShadows=n.clipShadows,a.clippingPlanes=n.clippingPlanes,a.clipIntersection=n.clipIntersection,a.displacementMap=n.displacementMap,a.displacementScale=n.displacementScale,a.displacementBias=n.displacementBias,a.wireframeLinewidth=n.wireframeLinewidth,a.linewidth=n.linewidth,r.isPointLight===!0&&a.isMeshDistanceMaterial===!0){let t=e.properties.get(a);t.light=r}return a}function b(n,i,a,o,s){if(n.visible===!1)return;if(n.layers.test(i.layers)&&(n.isMesh||n.isLine||n.isPoints)&&(n.castShadow||n.receiveShadow&&s===3)&&(!n.frustumCulled||r.intersectsObject(n))){n.modelViewMatrix.multiplyMatrices(a.matrixWorldInverse,n.matrixWorld);let r=t.update(n),c=n.material;if(Array.isArray(c)){let t=r.groups;for(let l=0,u=t.length;l=2):(N=parseFloat(/^WebGL (\d)/.exec(P)[1]),M=N>=1);let F=null,I={},ee=e.getParameter(e.SCISSOR_BOX),te=e.getParameter(e.VIEWPORT),ne=new _x().fromArray(ee),re=new _x().fromArray(te);function ie(t,n,r,i){let a=new Uint8Array(4),o=e.createTexture();e.bindTexture(t,o),e.texParameteri(t,e.TEXTURE_MIN_FILTER,e.NEAREST),e.texParameteri(t,e.TEXTURE_MAG_FILTER,e.NEAREST);for(let o=0;o`u`?!1:/OculusBrowser/g.test(navigator.userAgent),l=new Ub,u=new WeakMap,d,f=new WeakMap,p=!1;try{p=typeof OffscreenCanvas<`u`&&new OffscreenCanvas(1,1).getContext(`2d`)!==null}catch{}function m(e,t){return p?new OffscreenCanvas(e,t):Xb(`canvas`)}function h(e,t,n){let r=1,i=ve(e);if((i.width>n||i.height>n)&&(r=n/Math.max(i.width,i.height)),r<1)if(typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement||typeof HTMLCanvasElement<`u`&&e instanceof HTMLCanvasElement||typeof ImageBitmap<`u`&&e instanceof ImageBitmap||typeof VideoFrame<`u`&&e instanceof VideoFrame){let n=Math.floor(r*i.width),a=Math.floor(r*i.height);d===void 0&&(d=m(n,a));let o=t?m(n,a):d;return o.width=n,o.height=a,o.getContext(`2d`).drawImage(e,0,0,n,a),console.warn(`THREE.WebGLRenderer: Texture has been resized from (`+i.width+`x`+i.height+`) to (`+n+`x`+a+`).`),o}else return`data`in e&&console.warn(`THREE.WebGLRenderer: Image in DataTexture is too big (`+i.width+`x`+i.height+`).`),e;return e}function g(e){return e.generateMipmaps}function _(t){e.generateMipmap(t)}function v(t){return t.isWebGLCubeRenderTarget?e.TEXTURE_CUBE_MAP:t.isWebGL3DRenderTarget?e.TEXTURE_3D:t.isWebGLArrayRenderTarget||t.isCompressedArrayTexture?e.TEXTURE_2D_ARRAY:e.TEXTURE_2D}function y(n,r,i,a,o=!1){if(n!==null){if(e[n]!==void 0)return e[n];console.warn(`THREE.WebGLRenderer: Attempt to use non-existing WebGL internal format '`+n+`'`)}let s=r;if(r===e.RED&&(i===e.FLOAT&&(s=e.R32F),i===e.HALF_FLOAT&&(s=e.R16F),i===e.UNSIGNED_BYTE&&(s=e.R8)),r===e.RED_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.R8UI),i===e.UNSIGNED_SHORT&&(s=e.R16UI),i===e.UNSIGNED_INT&&(s=e.R32UI),i===e.BYTE&&(s=e.R8I),i===e.SHORT&&(s=e.R16I),i===e.INT&&(s=e.R32I)),r===e.RG&&(i===e.FLOAT&&(s=e.RG32F),i===e.HALF_FLOAT&&(s=e.RG16F),i===e.UNSIGNED_BYTE&&(s=e.RG8)),r===e.RG_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RG8UI),i===e.UNSIGNED_SHORT&&(s=e.RG16UI),i===e.UNSIGNED_INT&&(s=e.RG32UI),i===e.BYTE&&(s=e.RG8I),i===e.SHORT&&(s=e.RG16I),i===e.INT&&(s=e.RG32I)),r===e.RGB_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGB8UI),i===e.UNSIGNED_SHORT&&(s=e.RGB16UI),i===e.UNSIGNED_INT&&(s=e.RGB32UI),i===e.BYTE&&(s=e.RGB8I),i===e.SHORT&&(s=e.RGB16I),i===e.INT&&(s=e.RGB32I)),r===e.RGBA_INTEGER&&(i===e.UNSIGNED_BYTE&&(s=e.RGBA8UI),i===e.UNSIGNED_SHORT&&(s=e.RGBA16UI),i===e.UNSIGNED_INT&&(s=e.RGBA32UI),i===e.BYTE&&(s=e.RGBA8I),i===e.SHORT&&(s=e.RGBA16I),i===e.INT&&(s=e.RGBA32I)),r===e.RGB&&i===e.UNSIGNED_INT_5_9_9_9_REV&&(s=e.RGB9_E5),r===e.RGBA){let t=o?_b:ox.getTransfer(a);i===e.FLOAT&&(s=e.RGBA32F),i===e.HALF_FLOAT&&(s=e.RGBA16F),i===e.UNSIGNED_BYTE&&(s=t===`srgb`?e.SRGB8_ALPHA8:e.RGBA8),i===e.UNSIGNED_SHORT_4_4_4_4&&(s=e.RGBA4),i===e.UNSIGNED_SHORT_5_5_5_1&&(s=e.RGB5_A1)}return(s===e.R16F||s===e.R32F||s===e.RG16F||s===e.RG32F||s===e.RGBA16F||s===e.RGBA32F)&&t.get(`EXT_color_buffer_float`),s}function b(t,n){let r;return t?n===null||n===1014||n===1020?r=e.DEPTH24_STENCIL8:n===1015?r=e.DEPTH32F_STENCIL8:n===1012&&(r=e.DEPTH24_STENCIL8,console.warn(`DepthTexture: 16 bit depth attachment is not supported with stencil. Using 24-bit attachment.`)):n===null||n===1014||n===1020?r=e.DEPTH_COMPONENT24:n===1015?r=e.DEPTH_COMPONENT32F:n===1012&&(r=e.DEPTH_COMPONENT16),r}function x(e,t){return g(e)===!0||e.isFramebufferTexture&&e.minFilter!==1003&&e.minFilter!==1006?Math.log2(Math.max(t.width,t.height))+1:e.mipmaps!==void 0&&e.mipmaps.length>0?e.mipmaps.length:e.isCompressedTexture&&Array.isArray(e.image)?t.mipmaps.length:1}function S(e){let t=e.target;t.removeEventListener(`dispose`,S),w(t),t.isVideoTexture&&u.delete(t)}function C(e){let t=e.target;t.removeEventListener(`dispose`,C),E(t)}function w(e){let t=r.get(e);if(t.__webglInit===void 0)return;let n=e.source,i=f.get(n);if(i){let r=i[t.__cacheKey];r.usedTimes--,r.usedTimes===0&&T(e),Object.keys(i).length===0&&f.delete(n)}r.remove(e)}function T(t){let n=r.get(t);e.deleteTexture(n.__webglTexture);let i=t.source,a=f.get(i);delete a[n.__cacheKey],o.memory.textures--}function E(t){let n=r.get(t);if(t.depthTexture&&(t.depthTexture.dispose(),r.remove(t.depthTexture)),t.isWebGLCubeRenderTarget)for(let t=0;t<6;t++){if(Array.isArray(n.__webglFramebuffer[t]))for(let r=0;r=i.maxTextures&&console.warn(`THREE.WebGLTextures: Trying to use `+e+` texture units while this GPU supports only `+i.maxTextures),D+=1,e}function A(e){let t=[];return t.push(e.wrapS),t.push(e.wrapT),t.push(e.wrapR||0),t.push(e.magFilter),t.push(e.minFilter),t.push(e.anisotropy),t.push(e.internalFormat),t.push(e.format),t.push(e.type),t.push(e.generateMipmaps),t.push(e.premultiplyAlpha),t.push(e.flipY),t.push(e.unpackAlignment),t.push(e.colorSpace),t.join()}function j(t,i){let a=r.get(t);if(t.isVideoTexture&&ge(t),t.isRenderTargetTexture===!1&&t.version>0&&a.__version!==t.version){let e=t.image;if(e===null)console.warn(`THREE.WebGLRenderer: Texture marked for update but no image data found.`);else if(e.complete===!1)console.warn(`THREE.WebGLRenderer: Texture marked for update but image is incomplete`);else{ae(a,t,i);return}}n.bindTexture(e.TEXTURE_2D,a.__webglTexture,e.TEXTURE0+i)}function M(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_2D_ARRAY,a.__webglTexture,e.TEXTURE0+i)}function N(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){ae(a,t,i);return}n.bindTexture(e.TEXTURE_3D,a.__webglTexture,e.TEXTURE0+i)}function P(t,i){let a=r.get(t);if(t.version>0&&a.__version!==t.version){oe(a,t,i);return}n.bindTexture(e.TEXTURE_CUBE_MAP,a.__webglTexture,e.TEXTURE0+i)}let F={[$v]:e.REPEAT,[ey]:e.CLAMP_TO_EDGE,[ty]:e.MIRRORED_REPEAT},I={[ny]:e.NEAREST,[ry]:e.NEAREST_MIPMAP_NEAREST,[iy]:e.NEAREST_MIPMAP_LINEAR,[ay]:e.LINEAR,[oy]:e.LINEAR_MIPMAP_NEAREST,[sy]:e.LINEAR_MIPMAP_LINEAR},ee={512:e.NEVER,519:e.ALWAYS,513:e.LESS,515:e.LEQUAL,514:e.EQUAL,518:e.GEQUAL,516:e.GREATER,517:e.NOTEQUAL};function te(n,a){if(a.type===1015&&t.has(`OES_texture_float_linear`)===!1&&(a.magFilter===1006||a.magFilter===1007||a.magFilter===1005||a.magFilter===1008||a.minFilter===1006||a.minFilter===1007||a.minFilter===1005||a.minFilter===1008)&&console.warn(`THREE.WebGLRenderer: Unable to use linear filtering with floating point textures. OES_texture_float_linear not supported on this device.`),e.texParameteri(n,e.TEXTURE_WRAP_S,F[a.wrapS]),e.texParameteri(n,e.TEXTURE_WRAP_T,F[a.wrapT]),(n===e.TEXTURE_3D||n===e.TEXTURE_2D_ARRAY)&&e.texParameteri(n,e.TEXTURE_WRAP_R,F[a.wrapR]),e.texParameteri(n,e.TEXTURE_MAG_FILTER,I[a.magFilter]),e.texParameteri(n,e.TEXTURE_MIN_FILTER,I[a.minFilter]),a.compareFunction&&(e.texParameteri(n,e.TEXTURE_COMPARE_MODE,e.COMPARE_REF_TO_TEXTURE),e.texParameteri(n,e.TEXTURE_COMPARE_FUNC,ee[a.compareFunction])),t.has(`EXT_texture_filter_anisotropic`)===!0){if(a.magFilter===1003||a.minFilter!==1005&&a.minFilter!==1008||a.type===1015&&t.has(`OES_texture_float_linear`)===!1)return;if(a.anisotropy>1||r.get(a).__currentAnisotropy){let o=t.get(`EXT_texture_filter_anisotropic`);e.texParameterf(n,o.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(a.anisotropy,i.getMaxAnisotropy())),r.get(a).__currentAnisotropy=a.anisotropy}}}function ne(t,n){let r=!1;t.__webglInit===void 0&&(t.__webglInit=!0,n.addEventListener(`dispose`,S));let i=n.source,a=f.get(i);a===void 0&&(a={},f.set(i,a));let s=A(n);if(s!==t.__cacheKey){a[s]===void 0&&(a[s]={texture:e.createTexture(),usedTimes:0},o.memory.textures++,r=!0),a[s].usedTimes++;let i=a[t.__cacheKey];i!==void 0&&(a[t.__cacheKey].usedTimes--,i.usedTimes===0&&T(n)),t.__cacheKey=s,t.__webglTexture=a[s].texture}return r}function re(e,t,n){return Math.floor(Math.floor(e/n)/t)}function ie(t,r,i,a){let o=t.updateRanges;if(o.length===0)n.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,i,a,r.data);else{o.sort((e,t)=>e.start-t.start);let s=0;for(let e=1;e0){T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let r=pE(C.width,C.height,o.format,o.type);for(let i of o.layerUpdates){let a=C.data.subarray(i*r/C.data.BYTES_PER_ELEMENT,(i+1)*r/C.data.BYTES_PER_ELEMENT);n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,i,C.width,C.height,1,m,a)}o.clearLayerUpdates()}else n.compressedTexSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,C.data)}else n.compressedTexImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,C.data,0,0);else console.warn(`THREE.WebGLRenderer: Attempt to load unsupported compressed texture format in .uploadTexture()`);else T?D&&n.texSubImage3D(e.TEXTURE_2D_ARRAY,t,0,0,0,C.width,C.height,p.depth,m,v,C.data):n.texImage3D(e.TEXTURE_2D_ARRAY,t,S,C.width,C.height,p.depth,0,m,v,C.data)}else{T&&E&&n.texStorage2D(e.TEXTURE_2D,O,S,w[0].width,w[0].height);for(let t=0,r=w.length;t0){let t=pE(p.width,p.height,o.format,o.type);for(let r of o.layerUpdates){let i=p.data.subarray(r*t/p.data.BYTES_PER_ELEMENT,(r+1)*t/p.data.BYTES_PER_ELEMENT);n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,r,p.width,p.height,1,m,v,i)}o.clearLayerUpdates()}else n.texSubImage3D(e.TEXTURE_2D_ARRAY,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)}else n.texImage3D(e.TEXTURE_2D_ARRAY,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isData3DTexture)T?(E&&n.texStorage3D(e.TEXTURE_3D,O,S,p.width,p.height,p.depth),D&&n.texSubImage3D(e.TEXTURE_3D,0,0,0,0,p.width,p.height,p.depth,m,v,p.data)):n.texImage3D(e.TEXTURE_3D,0,S,p.width,p.height,p.depth,0,m,v,p.data);else if(o.isFramebufferTexture){if(E)if(T)n.texStorage2D(e.TEXTURE_2D,O,S,p.width,p.height);else{let t=p.width,r=p.height;for(let i=0;i>=1,r>>=1}}else if(w.length>0){if(T&&E){let t=ve(w[0]);n.texStorage2D(e.TEXTURE_2D,O,S,t.width,t.height)}for(let t=0,r=w.length;t0&&D++;let t=ve(m[0]);n.texStorage2D(e.TEXTURE_CUBE_MAP,D,C,t.width,t.height)}for(let t=0;t<6;t++)if(p){w?E&&n.texSubImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,0,0,m[t].width,m[t].height,b,S,m[t].data):n.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,C,m[t].width,m[t].height,0,b,S,m[t].data);for(let r=0;r>u),r=Math.max(1,i.height>>u);l===e.TEXTURE_3D||l===e.TEXTURE_2D_ARRAY?n.texImage3D(l,u,p,t,r,i.depth,0,d,f,null):n.texImage2D(l,u,p,t,r,0,d,f,null)}n.bindFramebuffer(e.FRAMEBUFFER,t),z(i)?s.framebufferTexture2DMultisampleEXT(e.FRAMEBUFFER,c,l,h.__webglTexture,0,he(i)):(l===e.TEXTURE_2D||l>=e.TEXTURE_CUBE_MAP_POSITIVE_X&&l<=e.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&e.framebufferTexture2D(e.FRAMEBUFFER,c,l,h.__webglTexture,u),n.bindFramebuffer(e.FRAMEBUFFER,null)}function ce(t,n,r){if(e.bindRenderbuffer(e.RENDERBUFFER,t),n.depthBuffer){let i=n.depthTexture,a=i&&i.isDepthTexture?i.type:null,o=b(n.stencilBuffer,a),c=n.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,l=he(n);z(n)?s.renderbufferStorageMultisampleEXT(e.RENDERBUFFER,l,o,n.width,n.height):r?e.renderbufferStorageMultisample(e.RENDERBUFFER,l,o,n.width,n.height):e.renderbufferStorage(e.RENDERBUFFER,o,n.width,n.height),e.framebufferRenderbuffer(e.FRAMEBUFFER,c,e.RENDERBUFFER,t)}else{let t=n.textures;for(let i=0;i{delete i.__boundDepthTexture,delete i.__depthDisposeCallback,e.removeEventListener(`dispose`,t)};e.addEventListener(`dispose`,t),i.__depthDisposeCallback=t}i.__boundDepthTexture=e}if(t.depthTexture&&!i.__autoAllocateDepthBuffer){if(a)throw Error(`target.depthTexture not supported in Cube render targets`);let e=t.texture.mipmaps;e&&e.length>0?le(i.__webglFramebuffer[0],t):le(i.__webglFramebuffer,t)}else if(a){i.__webglDepthbuffer=[];for(let r=0;r<6;r++)if(n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[r]),i.__webglDepthbuffer[r]===void 0)i.__webglDepthbuffer[r]=e.createRenderbuffer(),ce(i.__webglDepthbuffer[r],t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,a=i.__webglDepthbuffer[r];e.bindRenderbuffer(e.RENDERBUFFER,a),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,a)}}else{let r=t.texture.mipmaps;if(r&&r.length>0?n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer[0]):n.bindFramebuffer(e.FRAMEBUFFER,i.__webglFramebuffer),i.__webglDepthbuffer===void 0)i.__webglDepthbuffer=e.createRenderbuffer(),ce(i.__webglDepthbuffer,t,!1);else{let n=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,r=i.__webglDepthbuffer;e.bindRenderbuffer(e.RENDERBUFFER,r),e.framebufferRenderbuffer(e.FRAMEBUFFER,n,e.RENDERBUFFER,r)}}n.bindFramebuffer(e.FRAMEBUFFER,null)}function de(t,n,i){let a=r.get(t);n!==void 0&&se(a.__webglFramebuffer,t,t.texture,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,0),i!==void 0&&ue(t)}function L(t){let i=t.texture,s=r.get(t),c=r.get(i);t.addEventListener(`dispose`,C);let l=t.textures,u=t.isWebGLCubeRenderTarget===!0,d=l.length>1;if(d||(c.__webglTexture===void 0&&(c.__webglTexture=e.createTexture()),c.__version=i.version,o.memory.textures++),u){s.__webglFramebuffer=[];for(let t=0;t<6;t++)if(i.mipmaps&&i.mipmaps.length>0){s.__webglFramebuffer[t]=[];for(let n=0;n0){s.__webglFramebuffer=[];for(let t=0;t0&&z(t)===!1){s.__webglMultisampledFramebuffer=e.createFramebuffer(),s.__webglColorRenderbuffer=[],n.bindFramebuffer(e.FRAMEBUFFER,s.__webglMultisampledFramebuffer);for(let n=0;n0)for(let r=0;r0)for(let n=0;n0){if(z(t)===!1){let i=t.textures,a=t.width,o=t.height,s=e.COLOR_BUFFER_BIT,l=t.stencilBuffer?e.DEPTH_STENCIL_ATTACHMENT:e.DEPTH_ATTACHMENT,u=r.get(t),d=i.length>1;if(d)for(let t=0;t0?n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer[0]):n.bindFramebuffer(e.DRAW_FRAMEBUFFER,u.__webglFramebuffer);for(let n=0;n0&&t.has(`WEBGL_multisampled_render_to_texture`)===!0&&n.__useRenderToTexture!==!1}function ge(e){let t=o.render.frame;u.get(e)!==t&&(u.set(e,t),e.update())}function _e(e,t){let n=e.colorSpace,r=e.format,i=e.type;return e.isCompressedTexture===!0||e.isVideoTexture===!0||n!==`srgb-linear`&&n!==``&&(ox.getTransfer(n)===`srgb`?(r!==1023||i!==1009)&&console.warn(`THREE.WebGLTextures: sRGB encoded textures have to use RGBAFormat and UnsignedByteType.`):console.error(`THREE.WebGLTextures: Unsupported texture color space:`,n)),t}function ve(e){return typeof HTMLImageElement<`u`&&e instanceof HTMLImageElement?(l.width=e.naturalWidth||e.width,l.height=e.naturalHeight||e.height):typeof VideoFrame<`u`&&e instanceof VideoFrame?(l.width=e.displayWidth,l.height=e.displayHeight):(l.width=e.width,l.height=e.height),l}this.allocateTextureUnit=k,this.resetTextureUnits=O,this.setTexture2D=j,this.setTexture2DArray=M,this.setTexture3D=N,this.setTextureCube=P,this.rebindTextures=de,this.setupRenderTarget=L,this.updateRenderTargetMipmap=fe,this.updateMultisampleRenderTarget=R,this.setupDepthRenderbuffer=ue,this.setupFrameBufferTexture=se,this.useMultisampledRTT=z}function ZO(e,t){function n(n,r=``){let i,a=ox.getTransfer(r);if(n===1009)return e.UNSIGNED_BYTE;if(n===1017)return e.UNSIGNED_SHORT_4_4_4_4;if(n===1018)return e.UNSIGNED_SHORT_5_5_5_1;if(n===35902)return e.UNSIGNED_INT_5_9_9_9_REV;if(n===1010)return e.BYTE;if(n===1011)return e.SHORT;if(n===1012)return e.UNSIGNED_SHORT;if(n===1013)return e.INT;if(n===1014)return e.UNSIGNED_INT;if(n===1015)return e.FLOAT;if(n===1016)return e.HALF_FLOAT;if(n===1021)return e.ALPHA;if(n===1022)return e.RGB;if(n===1023)return e.RGBA;if(n===1026)return e.DEPTH_COMPONENT;if(n===1027)return e.DEPTH_STENCIL;if(n===1028)return e.RED;if(n===1029)return e.RED_INTEGER;if(n===1030)return e.RG;if(n===1031)return e.RG_INTEGER;if(n===1033)return e.RGBA_INTEGER;if(n===33776||n===33777||n===33778||n===33779)if(a===`srgb`)if(i=t.get(`WEBGL_compressed_texture_s3tc_srgb`),i!==null){if(n===33776)return i.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(i=t.get(`WEBGL_compressed_texture_s3tc`),i!==null){if(n===33776)return i.COMPRESSED_RGB_S3TC_DXT1_EXT;if(n===33777)return i.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(n===33778)return i.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(n===33779)return i.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(n===35840||n===35841||n===35842||n===35843)if(i=t.get(`WEBGL_compressed_texture_pvrtc`),i!==null){if(n===35840)return i.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(n===35841)return i.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(n===35842)return i.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(n===35843)return i.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(n===36196||n===37492||n===37496)if(i=t.get(`WEBGL_compressed_texture_etc`),i!==null){if(n===36196||n===37492)return a===`srgb`?i.COMPRESSED_SRGB8_ETC2:i.COMPRESSED_RGB8_ETC2;if(n===37496)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:i.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(n===37808||n===37809||n===37810||n===37811||n===37812||n===37813||n===37814||n===37815||n===37816||n===37817||n===37818||n===37819||n===37820||n===37821)if(i=t.get(`WEBGL_compressed_texture_astc`),i!==null){if(n===37808)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:i.COMPRESSED_RGBA_ASTC_4x4_KHR;if(n===37809)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:i.COMPRESSED_RGBA_ASTC_5x4_KHR;if(n===37810)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:i.COMPRESSED_RGBA_ASTC_5x5_KHR;if(n===37811)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:i.COMPRESSED_RGBA_ASTC_6x5_KHR;if(n===37812)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:i.COMPRESSED_RGBA_ASTC_6x6_KHR;if(n===37813)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:i.COMPRESSED_RGBA_ASTC_8x5_KHR;if(n===37814)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:i.COMPRESSED_RGBA_ASTC_8x6_KHR;if(n===37815)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:i.COMPRESSED_RGBA_ASTC_8x8_KHR;if(n===37816)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:i.COMPRESSED_RGBA_ASTC_10x5_KHR;if(n===37817)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:i.COMPRESSED_RGBA_ASTC_10x6_KHR;if(n===37818)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:i.COMPRESSED_RGBA_ASTC_10x8_KHR;if(n===37819)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:i.COMPRESSED_RGBA_ASTC_10x10_KHR;if(n===37820)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:i.COMPRESSED_RGBA_ASTC_12x10_KHR;if(n===37821)return a===`srgb`?i.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:i.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(n===36492||n===36494||n===36495)if(i=t.get(`EXT_texture_compression_bptc`),i!==null){if(n===36492)return a===`srgb`?i.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:i.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(n===36494)return i.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(n===36495)return i.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(n===36283||n===36284||n===36285||n===36286)if(i=t.get(`EXT_texture_compression_rgtc`),i!==null){if(n===36492)return i.COMPRESSED_RED_RGTC1_EXT;if(n===36284)return i.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(n===36285)return i.COMPRESSED_RED_GREEN_RGTC2_EXT;if(n===36286)return i.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return n===1020?e.UNSIGNED_INT_24_8:e[n]===void 0?null:e[n]}return{convert:n}}var QO=` -void main() { - - gl_Position = vec4( position, 1.0 ); - -}`,$O=` -uniform sampler2DArray depthColor; -uniform float depthWidth; -uniform float depthHeight; - -void main() { - - vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight ); - - if ( coord.x >= 1.0 ) { - - gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r; - - } else { - - gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r; - - } - -}`,ek=class{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(e,t,n){if(this.texture===null){let r=new gx,i=e.properties.get(r);i.__webglTexture=t.texture,(t.depthNear!==n.depthNear||t.depthFar!==n.depthFar)&&(this.depthNear=t.depthNear,this.depthFar=t.depthFar),this.texture=r}}getMesh(e){if(this.texture!==null&&this.mesh===null){let t=e.cameras[0].viewport,n=new DC({vertexShader:QO,fragmentShader:$O,uniforms:{depthColor:{value:this.texture},depthWidth:{value:t.z},depthHeight:{value:t.w}}});this.mesh=new gC(new Gw(20,20),n)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}},tk=class extends Sb{constructor(e,t){super();let n=this,r=null,i=1,a=null,o=`local-floor`,s=1,c=null,l=null,u=null,d=null,f=null,p=null,m=new ek,h=t.getContextAttributes(),g=null,_=null,v=[],y=[],b=new Ub,x=null,S=new MC;S.viewport=new _x;let C=new MC;C.viewport=new _x;let w=[S,C],T=new YT,E=null,D=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getTargetRaySpace()},this.getControllerGrip=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getGripSpace()},this.getHand=function(e){let t=v[e];return t===void 0&&(t=new BC,v[e]=t),t.getHandSpace()};function O(e){let t=y.indexOf(e.inputSource);if(t===-1)return;let n=v[t];n!==void 0&&(n.update(e.inputSource,e.frame,c||a),n.dispatchEvent({type:e.type,data:e.inputSource}))}function k(){r.removeEventListener(`select`,O),r.removeEventListener(`selectstart`,O),r.removeEventListener(`selectend`,O),r.removeEventListener(`squeeze`,O),r.removeEventListener(`squeezestart`,O),r.removeEventListener(`squeezeend`,O),r.removeEventListener(`end`,k),r.removeEventListener(`inputsourceschange`,A);for(let e=0;e=0&&(y[r]=null,v[r].disconnect(n))}for(let t=0;t=y.length){y.push(n),r=e;break}else if(y[e]===null){y[e]=n,r=e;break}if(r===-1)break}let i=v[r];i&&i.connect(n)}}let j=new J,M=new J;function N(e,t,n){j.setFromMatrixPosition(t.matrixWorld),M.setFromMatrixPosition(n.matrixWorld);let r=j.distanceTo(M),i=t.projectionMatrix.elements,a=n.projectionMatrix.elements,o=i[14]/(i[10]-1),s=i[14]/(i[10]+1),c=(i[9]+1)/i[5],l=(i[9]-1)/i[5],u=(i[8]-1)/i[0],d=(a[8]+1)/a[0],f=o*u,p=o*d,m=r/(-u+d),h=m*-u;if(t.matrixWorld.decompose(e.position,e.quaternion,e.scale),e.translateX(h),e.translateZ(m),e.matrixWorld.compose(e.position,e.quaternion,e.scale),e.matrixWorldInverse.copy(e.matrixWorld).invert(),i[10]===-1)e.projectionMatrix.copy(t.projectionMatrix),e.projectionMatrixInverse.copy(t.projectionMatrixInverse);else{let t=o+m,n=s+m,i=f-h,a=p+(r-h),u=c*s/n*t,d=l*s/n*t;e.projectionMatrix.makePerspective(i,a,u,d,t,n),e.projectionMatrixInverse.copy(e.projectionMatrix).invert()}}function P(e,t){t===null?e.matrixWorld.copy(e.matrix):e.matrixWorld.multiplyMatrices(t.matrixWorld,e.matrix),e.matrixWorldInverse.copy(e.matrixWorld).invert()}this.updateCamera=function(e){if(r===null)return;let t=e.near,n=e.far;m.texture!==null&&(m.depthNear>0&&(t=m.depthNear),m.depthFar>0&&(n=m.depthFar)),T.near=C.near=S.near=t,T.far=C.far=S.far=n,(E!==T.near||D!==T.far)&&(r.updateRenderState({depthNear:T.near,depthFar:T.far}),E=T.near,D=T.far),S.layers.mask=e.layers.mask|2,C.layers.mask=e.layers.mask|4,T.layers.mask=S.layers.mask|C.layers.mask;let i=e.parent,a=T.cameras;P(T,i);for(let e=0;e0&&(e.alphaTest.value=r.alphaTest);let i=t.get(r),a=i.envMap,o=i.envMapRotation;a&&(e.envMap.value=a,nk.copy(o),nk.x*=-1,nk.y*=-1,nk.z*=-1,a.isCubeTexture&&a.isRenderTargetTexture===!1&&(nk.y*=-1,nk.z*=-1),e.envMapRotation.value.setFromMatrix4(rk.makeRotationFromEuler(nk)),e.flipEnvMap.value=a.isCubeTexture&&a.isRenderTargetTexture===!1?-1:1,e.reflectivity.value=r.reflectivity,e.ior.value=r.ior,e.refractionRatio.value=r.refractionRatio),r.lightMap&&(e.lightMap.value=r.lightMap,e.lightMapIntensity.value=r.lightMapIntensity,n(r.lightMap,e.lightMapTransform)),r.aoMap&&(e.aoMap.value=r.aoMap,e.aoMapIntensity.value=r.aoMapIntensity,n(r.aoMap,e.aoMapTransform))}function o(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform))}function s(e,t){e.dashSize.value=t.dashSize,e.totalSize.value=t.dashSize+t.gapSize,e.scale.value=t.scale}function c(e,t,r,i){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.size.value=t.size*r,e.scale.value=i*.5,t.map&&(e.map.value=t.map,n(t.map,e.uvTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function l(e,t){e.diffuse.value.copy(t.color),e.opacity.value=t.opacity,e.rotation.value=t.rotation,t.map&&(e.map.value=t.map,n(t.map,e.mapTransform)),t.alphaMap&&(e.alphaMap.value=t.alphaMap,n(t.alphaMap,e.alphaMapTransform)),t.alphaTest>0&&(e.alphaTest.value=t.alphaTest)}function u(e,t){e.specular.value.copy(t.specular),e.shininess.value=Math.max(t.shininess,1e-4)}function d(e,t){t.gradientMap&&(e.gradientMap.value=t.gradientMap)}function f(e,t){e.metalness.value=t.metalness,t.metalnessMap&&(e.metalnessMap.value=t.metalnessMap,n(t.metalnessMap,e.metalnessMapTransform)),e.roughness.value=t.roughness,t.roughnessMap&&(e.roughnessMap.value=t.roughnessMap,n(t.roughnessMap,e.roughnessMapTransform)),t.envMap&&(e.envMapIntensity.value=t.envMapIntensity)}function p(e,t,r){e.ior.value=t.ior,t.sheen>0&&(e.sheenColor.value.copy(t.sheenColor).multiplyScalar(t.sheen),e.sheenRoughness.value=t.sheenRoughness,t.sheenColorMap&&(e.sheenColorMap.value=t.sheenColorMap,n(t.sheenColorMap,e.sheenColorMapTransform)),t.sheenRoughnessMap&&(e.sheenRoughnessMap.value=t.sheenRoughnessMap,n(t.sheenRoughnessMap,e.sheenRoughnessMapTransform))),t.clearcoat>0&&(e.clearcoat.value=t.clearcoat,e.clearcoatRoughness.value=t.clearcoatRoughness,t.clearcoatMap&&(e.clearcoatMap.value=t.clearcoatMap,n(t.clearcoatMap,e.clearcoatMapTransform)),t.clearcoatRoughnessMap&&(e.clearcoatRoughnessMap.value=t.clearcoatRoughnessMap,n(t.clearcoatRoughnessMap,e.clearcoatRoughnessMapTransform)),t.clearcoatNormalMap&&(e.clearcoatNormalMap.value=t.clearcoatNormalMap,n(t.clearcoatNormalMap,e.clearcoatNormalMapTransform),e.clearcoatNormalScale.value.copy(t.clearcoatNormalScale),t.side===1&&e.clearcoatNormalScale.value.negate())),t.dispersion>0&&(e.dispersion.value=t.dispersion),t.iridescence>0&&(e.iridescence.value=t.iridescence,e.iridescenceIOR.value=t.iridescenceIOR,e.iridescenceThicknessMinimum.value=t.iridescenceThicknessRange[0],e.iridescenceThicknessMaximum.value=t.iridescenceThicknessRange[1],t.iridescenceMap&&(e.iridescenceMap.value=t.iridescenceMap,n(t.iridescenceMap,e.iridescenceMapTransform)),t.iridescenceThicknessMap&&(e.iridescenceThicknessMap.value=t.iridescenceThicknessMap,n(t.iridescenceThicknessMap,e.iridescenceThicknessMapTransform))),t.transmission>0&&(e.transmission.value=t.transmission,e.transmissionSamplerMap.value=r.texture,e.transmissionSamplerSize.value.set(r.width,r.height),t.transmissionMap&&(e.transmissionMap.value=t.transmissionMap,n(t.transmissionMap,e.transmissionMapTransform)),e.thickness.value=t.thickness,t.thicknessMap&&(e.thicknessMap.value=t.thicknessMap,n(t.thicknessMap,e.thicknessMapTransform)),e.attenuationDistance.value=t.attenuationDistance,e.attenuationColor.value.copy(t.attenuationColor)),t.anisotropy>0&&(e.anisotropyVector.value.set(t.anisotropy*Math.cos(t.anisotropyRotation),t.anisotropy*Math.sin(t.anisotropyRotation)),t.anisotropyMap&&(e.anisotropyMap.value=t.anisotropyMap,n(t.anisotropyMap,e.anisotropyMapTransform))),e.specularIntensity.value=t.specularIntensity,e.specularColor.value.copy(t.specularColor),t.specularColorMap&&(e.specularColorMap.value=t.specularColorMap,n(t.specularColorMap,e.specularColorMapTransform)),t.specularIntensityMap&&(e.specularIntensityMap.value=t.specularIntensityMap,n(t.specularIntensityMap,e.specularIntensityMapTransform))}function m(e,t){t.matcap&&(e.matcap.value=t.matcap)}function h(e,n){let r=t.get(n).light;e.referencePosition.value.setFromMatrixPosition(r.matrixWorld),e.nearDistance.value=r.shadow.camera.near,e.farDistance.value=r.shadow.camera.far}return{refreshFogUniforms:r,refreshMaterialUniforms:i}}function ak(e,t,n,r){let i={},a={},o=[],s=e.getParameter(e.MAX_UNIFORM_BUFFER_BINDINGS);function c(e,t){let n=t.program;r.uniformBlockBinding(e,n)}function l(e,n){let o=i[e.id];o===void 0&&(m(e),o=u(e),i[e.id]=o,e.addEventListener(`dispose`,g));let s=n.program;r.updateUBOMapping(e,s);let c=t.render.frame;a[e.id]!==c&&(f(e),a[e.id]=c)}function u(t){let n=d();t.__bindingPointIndex=n;let r=e.createBuffer(),i=t.__size,a=t.usage;return e.bindBuffer(e.UNIFORM_BUFFER,r),e.bufferData(e.UNIFORM_BUFFER,i,a),e.bindBuffer(e.UNIFORM_BUFFER,null),e.bindBufferBase(e.UNIFORM_BUFFER,n,r),r}function d(){for(let e=0;e0&&(n+=16-r),e.__size=n,e.__cache={},this}function h(e){let t={boundary:0,storage:0};return typeof e==`number`||typeof e==`boolean`?(t.boundary=4,t.storage=4):e.isVector2?(t.boundary=8,t.storage=8):e.isVector3||e.isColor?(t.boundary=16,t.storage=12):e.isVector4?(t.boundary=16,t.storage=16):e.isMatrix3?(t.boundary=48,t.storage=48):e.isMatrix4?(t.boundary=64,t.storage=64):e.isTexture?console.warn(`THREE.WebGLRenderer: Texture samplers can not be part of an uniforms group.`):console.warn(`THREE.WebGLRenderer: Unsupported uniform value type.`,e),t}function g(t){let n=t.target;n.removeEventListener(`dispose`,g);let r=o.indexOf(n.__bindingPointIndex);o.splice(r,1),e.deleteBuffer(i[n.id]),delete i[n.id],delete a[n.id]}function _(){for(let t in i)e.deleteBuffer(i[t]);o=[],i={},a={}}return{bind:c,update:l,dispose:_}}var ok=class{constructor(e={}){let{canvas:t=Zb(),context:n=null,depth:r=!0,stencil:i=!1,alpha:a=!1,antialias:o=!1,premultipliedAlpha:s=!0,preserveDrawingBuffer:c=!1,powerPreference:l=`default`,failIfMajorPerformanceCaveat:u=!1,reverseDepthBuffer:d=!1}=e;this.isWebGLRenderer=!0;let f;if(n!==null){if(typeof WebGLRenderingContext<`u`&&n instanceof WebGLRenderingContext)throw Error(`THREE.WebGLRenderer: WebGL 1 is not supported since r163.`);f=n.getContextAttributes().alpha}else f=a;let p=new Uint32Array(4),m=new Int32Array(4),h=null,g=null,_=[],v=[];this.domElement=t,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=0,this.toneMappingExposure=1,this.transmissionResolutionScale=1;let y=this,b=!1;this._outputColorSpace=hb;let x=0,S=0,C=null,w=-1,T=null,E=new _x,D=new _x,O=null,k=new X(0),A=0,j=t.width,M=t.height,N=1,P=null,F=null,I=new _x(0,0,j,M),ee=new _x(0,0,j,M),te=!1,ne=new xw,re=!1,ie=!1,ae=new Y,oe=new Y,se=new J,ce=new _x,le={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0},ue=!1;function de(){return C===null?N:1}let L=n;function fe(e,n){return t.getContext(e,n)}try{let e={alpha:!0,depth:r,stencil:i,antialias:o,premultipliedAlpha:s,preserveDrawingBuffer:c,powerPreference:l,failIfMajorPerformanceCaveat:u};if(`setAttribute`in t&&t.setAttribute(`data-engine`,`three.js r177`),t.addEventListener(`webglcontextlost`,Le,!1),t.addEventListener(`webglcontextrestored`,Re,!1),t.addEventListener(`webglcontextcreationerror`,ze,!1),L===null){let t=`webgl2`;if(L=fe(t,e),L===null)throw fe(t)?Error(`Error creating WebGL context with your selected attributes.`):Error(`Error creating WebGL context.`)}}catch(e){throw console.error(`THREE.WebGLRenderer: `+e.message),e}let pe,me,R,he,z,ge,_e,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe;function Fe(){pe=new zE(L),pe.init(),Me=new ZO(L,pe),me=new yte(L,pe,e,Me),R=new YO(L,pe),me.reverseDepthBuffer&&d&&R.buffers.depth.setReversed(!0),he=new HE(L),z=new NO,ge=new XO(L,pe,R,z,me,Me,he),_e=new xte(y),ve=new RE(y),ye=new mte(L),Ne=new _te(L,ye),be=new BE(L,ye,he,Ne),xe=new WE(L,be,ye,he),ke=new UE(L,me,ge),Ee=new bte(z),Se=new MO(y,_e,ve,pe,me,Ne,Ee),Ce=new ik(y,z),we=new LO,Te=new WO(pe),Oe=new gte(y,_e,ve,R,xe,f,s),De=new qO(y,xe,me),Pe=new ak(L,he,me,R),Ae=new vte(L,pe,he),je=new VE(L,pe,he),he.programs=Se.programs,y.capabilities=me,y.extensions=pe,y.properties=z,y.renderLists=we,y.shadowMap=De,y.state=R,y.info=he}Fe();let Ie=new tk(y,L);this.xr=Ie,this.getContext=function(){return L},this.getContextAttributes=function(){return L.getContextAttributes()},this.forceContextLoss=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.loseContext()},this.forceContextRestore=function(){let e=pe.get(`WEBGL_lose_context`);e&&e.restoreContext()},this.getPixelRatio=function(){return N},this.setPixelRatio=function(e){e!==void 0&&(N=e,this.setSize(j,M,!1))},this.getSize=function(e){return e.set(j,M)},this.setSize=function(e,n,r=!0){if(Ie.isPresenting){console.warn(`THREE.WebGLRenderer: Can't change size while VR device is presenting.`);return}j=e,M=n,t.width=Math.floor(e*N),t.height=Math.floor(n*N),r===!0&&(t.style.width=e+`px`,t.style.height=n+`px`),this.setViewport(0,0,e,n)},this.getDrawingBufferSize=function(e){return e.set(j*N,M*N).floor()},this.setDrawingBufferSize=function(e,n,r){j=e,M=n,N=r,t.width=Math.floor(e*r),t.height=Math.floor(n*r),this.setViewport(0,0,e,n)},this.getCurrentViewport=function(e){return e.copy(E)},this.getViewport=function(e){return e.copy(I)},this.setViewport=function(e,t,n,r){e.isVector4?I.set(e.x,e.y,e.z,e.w):I.set(e,t,n,r),R.viewport(E.copy(I).multiplyScalar(N).round())},this.getScissor=function(e){return e.copy(ee)},this.setScissor=function(e,t,n,r){e.isVector4?ee.set(e.x,e.y,e.z,e.w):ee.set(e,t,n,r),R.scissor(D.copy(ee).multiplyScalar(N).round())},this.getScissorTest=function(){return te},this.setScissorTest=function(e){R.setScissorTest(te=e)},this.setOpaqueSort=function(e){P=e},this.setTransparentSort=function(e){F=e},this.getClearColor=function(e){return e.copy(Oe.getClearColor())},this.setClearColor=function(){Oe.setClearColor(...arguments)},this.getClearAlpha=function(){return Oe.getClearAlpha()},this.setClearAlpha=function(){Oe.setClearAlpha(...arguments)},this.clear=function(e=!0,t=!0,n=!0){let r=0;if(e){let e=!1;if(C!==null){let t=C.texture.format;e=t===1033||t===1031||t===1029}if(e){let e=C.texture.type,t=e===1009||e===1014||e===1012||e===1020||e===1017||e===1018,n=Oe.getClearColor(),r=Oe.getClearAlpha(),i=n.r,a=n.g,o=n.b;t?(p[0]=i,p[1]=a,p[2]=o,p[3]=r,L.clearBufferuiv(L.COLOR,0,p)):(m[0]=i,m[1]=a,m[2]=o,m[3]=r,L.clearBufferiv(L.COLOR,0,m))}else r|=L.COLOR_BUFFER_BIT}t&&(r|=L.DEPTH_BUFFER_BIT),n&&(r|=L.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),L.clear(r)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){t.removeEventListener(`webglcontextlost`,Le,!1),t.removeEventListener(`webglcontextrestored`,Re,!1),t.removeEventListener(`webglcontextcreationerror`,ze,!1),Oe.dispose(),we.dispose(),Te.dispose(),z.dispose(),_e.dispose(),ve.dispose(),xe.dispose(),Ne.dispose(),Pe.dispose(),Se.dispose(),Ie.dispose(),Ie.removeEventListener(`sessionstart`,Ke),Ie.removeEventListener(`sessionend`,qe),Je.stop()};function Le(e){e.preventDefault(),console.log(`THREE.WebGLRenderer: Context Lost.`),b=!0}function Re(){console.log(`THREE.WebGLRenderer: Context Restored.`),b=!1;let e=he.autoReset,t=De.enabled,n=De.autoUpdate,r=De.needsUpdate,i=De.type;Fe(),he.autoReset=e,De.enabled=t,De.autoUpdate=n,De.needsUpdate=r,De.type=i}function ze(e){console.error(`THREE.WebGLRenderer: A WebGL context could not be created. Reason: `,e.statusMessage)}function Be(e){let t=e.target;t.removeEventListener(`dispose`,Be),Ve(t)}function Ve(e){He(e),z.remove(e)}function He(e){let t=z.get(e).programs;t!==void 0&&(t.forEach(function(e){Se.releaseProgram(e)}),e.isShaderMaterial&&Se.releaseShaderCache(e))}this.renderBufferDirect=function(e,t,n,r,i,a){t===null&&(t=le);let o=i.isMesh&&i.matrixWorld.determinant()<0,s=rt(e,t,n,r,i);R.setMaterial(r,o);let c=n.index,l=1;if(r.wireframe===!0){if(c=be.getWireframeAttribute(n),c===void 0)return;l=2}let u=n.drawRange,d=n.attributes.position,f=u.start*l,p=(u.start+u.count)*l;a!==null&&(f=Math.max(f,a.start*l),p=Math.min(p,(a.start+a.count)*l)),c===null?d!=null&&(f=Math.max(f,0),p=Math.min(p,d.count)):(f=Math.max(f,0),p=Math.min(p,c.count));let m=p-f;if(m<0||m===1/0)return;Ne.setup(i,r,s,n,c);let h,g=Ae;if(c!==null&&(h=ye.get(c),g=je,g.setIndex(h)),i.isMesh)r.wireframe===!0?(R.setLineWidth(r.wireframeLinewidth*de()),g.setMode(L.LINES)):g.setMode(L.TRIANGLES);else if(i.isLine){let e=r.linewidth;e===void 0&&(e=1),R.setLineWidth(e*de()),i.isLineSegments?g.setMode(L.LINES):i.isLineLoop?g.setMode(L.LINE_LOOP):g.setMode(L.LINE_STRIP)}else i.isPoints?g.setMode(L.POINTS):i.isSprite&&g.setMode(L.TRIANGLES);if(i.isBatchedMesh)if(i._multiDrawInstances!==null)$b(`THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection.`),g.renderMultiDrawInstances(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount,i._multiDrawInstances);else if(pe.get(`WEBGL_multi_draw`))g.renderMultiDraw(i._multiDrawStarts,i._multiDrawCounts,i._multiDrawCount);else{let e=i._multiDrawStarts,t=i._multiDrawCounts,n=i._multiDrawCount,a=c?ye.get(c).bytesPerElement:1,o=z.get(r).currentProgram.getUniforms();for(let r=0;r{function n(){if(r.forEach(function(e){z.get(e).currentProgram.isReady()&&r.delete(e)}),r.size===0){t(e);return}setTimeout(n,10)}pe.get(`KHR_parallel_shader_compile`)===null?setTimeout(n,10):n()})};let We=null;function Ge(e){We&&We(e)}function Ke(){Je.stop()}function qe(){Je.start()}let Je=new mE;Je.setAnimationLoop(Ge),typeof self<`u`&&Je.setContext(self),this.setAnimationLoop=function(e){We=e,Ie.setAnimationLoop(e),e===null?Je.stop():Je.start()},Ie.addEventListener(`sessionstart`,Ke),Ie.addEventListener(`sessionend`,qe),this.render=function(e,t){if(t!==void 0&&t.isCamera!==!0){console.error(`THREE.WebGLRenderer.render: camera is not an instance of THREE.Camera.`);return}if(b===!0)return;if(e.matrixWorldAutoUpdate===!0&&e.updateMatrixWorld(),t.parent===null&&t.matrixWorldAutoUpdate===!0&&t.updateMatrixWorld(),Ie.enabled===!0&&Ie.isPresenting===!0&&(Ie.cameraAutoUpdate===!0&&Ie.updateCamera(t),t=Ie.getCamera()),e.isScene===!0&&e.onBeforeRender(y,e,t,C),g=Te.get(e,v.length),g.init(t),v.push(g),oe.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),ne.setFromProjectionMatrix(oe),ie=this.localClippingEnabled,re=Ee.init(this.clippingPlanes,ie),h=we.get(e,_.length),h.init(),_.push(h),Ie.enabled===!0&&Ie.isPresenting===!0){let e=y.xr.getDepthSensingMesh();e!==null&&Ye(e,t,-1/0,y.sortObjects)}Ye(e,t,0,y.sortObjects),h.finish(),y.sortObjects===!0&&h.sort(P,F),ue=Ie.enabled===!1||Ie.isPresenting===!1||Ie.hasDepthSensing()===!1,ue&&Oe.addToRenderList(h,e),this.info.render.frame++,re===!0&&Ee.beginShadows();let n=g.state.shadowsArray;De.render(n,e,t),re===!0&&Ee.endShadows(),this.info.autoReset===!0&&this.info.reset();let r=h.opaque,i=h.transmissive;if(g.setupLights(),t.isArrayCamera){let n=t.cameras;if(i.length>0)for(let t=0,a=n.length;t0&&Ze(r,i,e,t),ue&&Oe.render(e),Xe(h,e,t);C!==null&&S===0&&(ge.updateMultisampleRenderTarget(C),ge.updateRenderTargetMipmap(C)),e.isScene===!0&&e.onAfterRender(y,e,t),Ne.resetDefaultState(),w=-1,T=null,v.pop(),v.length>0?(g=v[v.length-1],re===!0&&Ee.setGlobalState(y.clippingPlanes,g.state.camera)):g=null,_.pop(),h=_.length>0?_[_.length-1]:null};function Ye(e,t,n,r){if(e.visible===!1)return;if(e.layers.test(t.layers)){if(e.isGroup)n=e.renderOrder;else if(e.isLOD)e.autoUpdate===!0&&e.update(t);else if(e.isLight)g.pushLight(e),e.castShadow&&g.pushShadow(e);else if(e.isSprite){if(!e.frustumCulled||ne.intersectsSprite(e)){r&&ce.setFromMatrixPosition(e.matrixWorld).applyMatrix4(oe);let t=xe.update(e),i=e.material;i.visible&&h.push(e,t,i,n,ce.z,null)}}else if((e.isMesh||e.isLine||e.isPoints)&&(!e.frustumCulled||ne.intersectsObject(e))){let t=xe.update(e),i=e.material;if(r&&(e.boundingSphere===void 0?(t.boundingSphere===null&&t.computeBoundingSphere(),ce.copy(t.boundingSphere.center)):(e.boundingSphere===null&&e.computeBoundingSphere(),ce.copy(e.boundingSphere.center)),ce.applyMatrix4(e.matrixWorld).applyMatrix4(oe)),Array.isArray(i)){let r=t.groups;for(let a=0,o=r.length;a0&&Qe(i,t,n),a.length>0&&Qe(a,t,n),o.length>0&&Qe(o,t,n),R.buffers.depth.setTest(!0),R.buffers.depth.setMask(!0),R.buffers.color.setMask(!0),R.setPolygonOffset(!1)}function Ze(e,t,n,r){if((n.isScene===!0?n.overrideMaterial:null)!==null)return;g.state.transmissionRenderTarget[r.id]===void 0&&(g.state.transmissionRenderTarget[r.id]=new yx(1,1,{generateMipmaps:!0,type:pe.has(`EXT_color_buffer_half_float`)||pe.has(`EXT_color_buffer_float`)?hy:cy,minFilter:sy,samples:4,stencilBuffer:i,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:ox.workingColorSpace}));let a=g.state.transmissionRenderTarget[r.id],o=r.viewport||E;a.setSize(o.z*y.transmissionResolutionScale,o.w*y.transmissionResolutionScale);let s=y.getRenderTarget();y.setRenderTarget(a),y.getClearColor(k),A=y.getClearAlpha(),A<1&&y.setClearColor(16777215,.5),y.clear(),ue&&Oe.render(n);let c=y.toneMapping;y.toneMapping=0;let l=r.viewport;if(r.viewport!==void 0&&(r.viewport=void 0),g.setupLightsView(r),re===!0&&Ee.setGlobalState(y.clippingPlanes,r),Qe(e,n,r),ge.updateMultisampleRenderTarget(a),ge.updateRenderTargetMipmap(a),pe.has(`WEBGL_multisampled_render_to_texture`)===!1){let e=!1;for(let i=0,a=t.length;i0),d=!!n.morphAttributes.position,f=!!n.morphAttributes.normal,p=!!n.morphAttributes.color,m=0;r.toneMapped&&(C===null||C.isXRRenderTarget===!0)&&(m=y.toneMapping);let h=n.morphAttributes.position||n.morphAttributes.normal||n.morphAttributes.color,_=h===void 0?0:h.length,v=z.get(r),b=g.state.lights;if(re===!0&&(ie===!0||e!==T)){let t=e===T&&r.id===w;Ee.setState(r,e,t)}let x=!1;r.version===v.__version?v.needsLights&&v.lightsStateVersion!==b.state.version?x=!0:v.outputColorSpace===s?i.isBatchedMesh&&v.batching===!1||!i.isBatchedMesh&&v.batching===!0||i.isBatchedMesh&&v.batchingColor===!0&&i.colorTexture===null||i.isBatchedMesh&&v.batchingColor===!1&&i.colorTexture!==null||i.isInstancedMesh&&v.instancing===!1||!i.isInstancedMesh&&v.instancing===!0||i.isSkinnedMesh&&v.skinning===!1||!i.isSkinnedMesh&&v.skinning===!0||i.isInstancedMesh&&v.instancingColor===!0&&i.instanceColor===null||i.isInstancedMesh&&v.instancingColor===!1&&i.instanceColor!==null||i.isInstancedMesh&&v.instancingMorph===!0&&i.morphTexture===null||i.isInstancedMesh&&v.instancingMorph===!1&&i.morphTexture!==null?x=!0:v.envMap===c?r.fog===!0&&v.fog!==a||v.numClippingPlanes!==void 0&&(v.numClippingPlanes!==Ee.numPlanes||v.numIntersection!==Ee.numIntersection)?x=!0:v.vertexAlphas===l&&v.vertexTangents===u&&v.morphTargets===d&&v.morphNormals===f&&v.morphColors===p&&v.toneMapping===m?v.morphTargetsCount!==_&&(x=!0):x=!0:x=!0:x=!0:(x=!0,v.__version=r.version);let S=v.currentProgram;x===!0&&(S=et(r,t,i));let E=!1,D=!1,O=!1,k=S.getUniforms(),A=v.uniforms;if(R.useProgram(S.program)&&(E=!0,D=!0,O=!0),r.id!==w&&(w=r.id,D=!0),E||T!==e){R.buffers.depth.getReversed()?(ae.copy(e.projectionMatrix),tx(ae),nx(ae),k.setValue(L,`projectionMatrix`,ae)):k.setValue(L,`projectionMatrix`,e.projectionMatrix),k.setValue(L,`viewMatrix`,e.matrixWorldInverse);let t=k.map.cameraPosition;t!==void 0&&t.setValue(L,se.setFromMatrixPosition(e.matrixWorld)),me.logarithmicDepthBuffer&&k.setValue(L,`logDepthBufFC`,2/(Math.log(e.far+1)/Math.LN2)),(r.isMeshPhongMaterial||r.isMeshToonMaterial||r.isMeshLambertMaterial||r.isMeshBasicMaterial||r.isMeshStandardMaterial||r.isShaderMaterial)&&k.setValue(L,`isOrthographic`,e.isOrthographicCamera===!0),T!==e&&(T=e,D=!0,O=!0)}if(i.isSkinnedMesh){k.setOptional(L,i,`bindMatrix`),k.setOptional(L,i,`bindMatrixInverse`);let e=i.skeleton;e&&(e.boneTexture===null&&e.computeBoneTexture(),k.setValue(L,`boneTexture`,e.boneTexture,ge))}i.isBatchedMesh&&(k.setOptional(L,i,`batchingTexture`),k.setValue(L,`batchingTexture`,i._matricesTexture,ge),k.setOptional(L,i,`batchingIdTexture`),k.setValue(L,`batchingIdTexture`,i._indirectTexture,ge),k.setOptional(L,i,`batchingColorTexture`),i._colorsTexture!==null&&k.setValue(L,`batchingColorTexture`,i._colorsTexture,ge));let j=n.morphAttributes;if((j.position!==void 0||j.normal!==void 0||j.color!==void 0)&&ke.update(i,n,S),(D||v.receiveShadow!==i.receiveShadow)&&(v.receiveShadow=i.receiveShadow,k.setValue(L,`receiveShadow`,i.receiveShadow)),r.isMeshGouraudMaterial&&r.envMap!==null&&(A.envMap.value=c,A.flipEnvMap.value=c.isCubeTexture&&c.isRenderTargetTexture===!1?-1:1),r.isMeshStandardMaterial&&r.envMap===null&&t.environment!==null&&(A.envMapIntensity.value=t.environmentIntensity),D&&(k.setValue(L,`toneMappingExposure`,y.toneMappingExposure),v.needsLights&&it(A,O),a&&r.fog===!0&&Ce.refreshFogUniforms(A,a),Ce.refreshMaterialUniforms(A,r,N,M,g.state.transmissionRenderTarget[e.id]),ZD.upload(L,tt(v),A,ge)),r.isShaderMaterial&&r.uniformsNeedUpdate===!0&&(ZD.upload(L,tt(v),A,ge),r.uniformsNeedUpdate=!1),r.isSpriteMaterial&&k.setValue(L,`center`,i.center),k.setValue(L,`modelViewMatrix`,i.modelViewMatrix),k.setValue(L,`normalMatrix`,i.normalMatrix),k.setValue(L,`modelMatrix`,i.matrixWorld),r.isShaderMaterial||r.isRawShaderMaterial){let e=r.uniformsGroups;for(let t=0,n=e.length;t0&&ge.useMultisampledRTT(e)===!1?z.get(e).__webglMultisampledFramebuffer:Array.isArray(l)?l[n]:l,E.copy(e.viewport),D.copy(e.scissor),O=e.scissorTest}else E.copy(I).multiplyScalar(N).floor(),D.copy(ee).multiplyScalar(N).floor(),O=te;if(n!==0&&(i=ot),R.bindFramebuffer(L.FRAMEBUFFER,i)&&r&&R.drawBuffers(e,i),R.viewport(E),R.scissor(D),R.setScissorTest(O),a){let r=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_CUBE_MAP_POSITIVE_X+t,r.__webglTexture,n)}else if(o){let r=z.get(e.texture),i=t;L.framebufferTextureLayer(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,r.__webglTexture,n,i)}else if(e!==null&&n!==0){let t=z.get(e.texture);L.framebufferTexture2D(L.FRAMEBUFFER,L.COLOR_ATTACHMENT0,L.TEXTURE_2D,t.__webglTexture,n)}w=-1},this.readRenderTargetPixels=function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);return}let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c){R.bindFramebuffer(L.FRAMEBUFFER,c);try{let o=e.textures[s],c=o.format,l=o.type;if(!me.textureFormatReadable(c)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in RGBA or implementation defined format.`);return}if(!me.textureTypeReadable(l)){console.error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.`);return}t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i&&(e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(c),Me.convert(l),a))}finally{let e=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,e)}}},this.readRenderTargetPixelsAsync=async function(e,t,n,r,i,a,o,s=0){if(!(e&&e.isWebGLRenderTarget))throw Error(`THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.`);let c=z.get(e).__webglFramebuffer;if(e.isWebGLCubeRenderTarget&&o!==void 0&&(c=c[o]),c)if(t>=0&&t<=e.width-r&&n>=0&&n<=e.height-i){R.bindFramebuffer(L.FRAMEBUFFER,c);let o=e.textures[s],l=o.format,u=o.type;if(!me.textureFormatReadable(l))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.`);if(!me.textureTypeReadable(u))throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.`);let d=L.createBuffer();L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.bufferData(L.PIXEL_PACK_BUFFER,a.byteLength,L.STREAM_READ),e.textures.length>1&&L.readBuffer(L.COLOR_ATTACHMENT0+s),L.readPixels(t,n,r,i,Me.convert(l),Me.convert(u),0);let f=C===null?null:z.get(C).__webglFramebuffer;R.bindFramebuffer(L.FRAMEBUFFER,f);let p=L.fenceSync(L.SYNC_GPU_COMMANDS_COMPLETE,0);return L.flush(),await ex(L,p,4),L.bindBuffer(L.PIXEL_PACK_BUFFER,d),L.getBufferSubData(L.PIXEL_PACK_BUFFER,0,a),L.deleteBuffer(d),L.deleteSync(p),a}else throw Error(`THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.`)},this.copyFramebufferToTexture=function(e,t=null,n=0){let r=2**-n,i=Math.floor(e.image.width*r),a=Math.floor(e.image.height*r),o=t===null?0:t.x,s=t===null?0:t.y;ge.setTexture2D(e,0),L.copyTexSubImage2D(L.TEXTURE_2D,n,0,0,o,s,i,a),R.unbindTexture()};let st=L.createFramebuffer(),ct=L.createFramebuffer();this.copyTextureToTexture=function(e,t,n=null,r=null,i=0,a=null){a===null&&(i===0?a=0:($b(`WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels.`),a=i,i=0));let o,s,c,l,u,d,f,p,m,h=e.isCompressedTexture?e.mipmaps[a]:e.image;if(n!==null)o=n.max.x-n.min.x,s=n.max.y-n.min.y,c=n.isBox3?n.max.z-n.min.z:1,l=n.min.x,u=n.min.y,d=n.isBox3?n.min.z:0;else{let t=2**-i;o=Math.floor(h.width*t),s=Math.floor(h.height*t),c=e.isDataArrayTexture?h.depth:e.isData3DTexture?Math.floor(h.depth*t):1,l=0,u=0,d=0}r===null?(f=0,p=0,m=0):(f=r.x,p=r.y,m=r.z);let g=Me.convert(t.format),_=Me.convert(t.type),v;t.isData3DTexture?(ge.setTexture3D(t,0),v=L.TEXTURE_3D):t.isDataArrayTexture||t.isCompressedArrayTexture?(ge.setTexture2DArray(t,0),v=L.TEXTURE_2D_ARRAY):(ge.setTexture2D(t,0),v=L.TEXTURE_2D),L.pixelStorei(L.UNPACK_FLIP_Y_WEBGL,t.flipY),L.pixelStorei(L.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha),L.pixelStorei(L.UNPACK_ALIGNMENT,t.unpackAlignment);let y=L.getParameter(L.UNPACK_ROW_LENGTH),b=L.getParameter(L.UNPACK_IMAGE_HEIGHT),x=L.getParameter(L.UNPACK_SKIP_PIXELS),S=L.getParameter(L.UNPACK_SKIP_ROWS),C=L.getParameter(L.UNPACK_SKIP_IMAGES);L.pixelStorei(L.UNPACK_ROW_LENGTH,h.width),L.pixelStorei(L.UNPACK_IMAGE_HEIGHT,h.height),L.pixelStorei(L.UNPACK_SKIP_PIXELS,l),L.pixelStorei(L.UNPACK_SKIP_ROWS,u),L.pixelStorei(L.UNPACK_SKIP_IMAGES,d);let w=e.isDataArrayTexture||e.isData3DTexture,T=t.isDataArrayTexture||t.isData3DTexture;if(e.isDepthTexture){let n=z.get(e),r=z.get(t),h=z.get(n.__renderTarget),g=z.get(r.__renderTarget);R.bindFramebuffer(L.READ_FRAMEBUFFER,h.__webglFramebuffer),R.bindFramebuffer(L.DRAW_FRAMEBUFFER,g.__webglFramebuffer);for(let n=0;nMath.PI&&(n-=mk),r<-Math.PI?r+=mk:r>Math.PI&&(r-=mk),n<=r?this._spherical.theta=Math.max(n,Math.min(r,this._spherical.theta)):this._spherical.theta=this._spherical.theta>(n+r)/2?Math.max(n,this._spherical.theta):Math.min(r,this._spherical.theta)),this._spherical.phi=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,this._spherical.phi)),this._spherical.makeSafe(),this.enableDamping===!0?this.target.addScaledVector(this._panOffset,this.dampingFactor):this.target.add(this._panOffset),this.target.sub(this.cursor),this.target.clampLength(this.minTargetRadius,this.maxTargetRadius),this.target.add(this.cursor);let i=!1;if(this.zoomToCursor&&this._performCursorZoom||this.object.isOrthographicCamera)this._spherical.radius=this._clampDistance(this._spherical.radius);else{let e=this._spherical.radius;this._spherical.radius=this._clampDistance(this._spherical.radius*this._scale),i=e!=this._spherical.radius}if(pk.setFromSpherical(this._spherical),pk.applyQuaternion(this._quatInverse),t.copy(this.target).add(pk),this.object.lookAt(this.target),this.enableDamping===!0?(this._sphericalDelta.theta*=1-this.dampingFactor,this._sphericalDelta.phi*=1-this.dampingFactor,this._panOffset.multiplyScalar(1-this.dampingFactor)):(this._sphericalDelta.set(0,0,0),this._panOffset.set(0,0,0)),this.zoomToCursor&&this._performCursorZoom){let e=null;if(this.object.isPerspectiveCamera){let t=pk.length();e=this._clampDistance(t*this._scale);let n=t-e;this.object.position.addScaledVector(this._dollyDirection,n),this.object.updateMatrixWorld(),i=!!n}else if(this.object.isOrthographicCamera){let t=new J(this._mouse.x,this._mouse.y,0);t.unproject(this.object);let n=this.object.zoom;this.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/this._scale)),this.object.updateProjectionMatrix(),i=n!==this.object.zoom;let r=new J(this._mouse.x,this._mouse.y,0);r.unproject(this.object),this.object.position.sub(r).add(t),this.object.updateMatrixWorld(),e=pk.length()}else console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - zoom to cursor disabled.`),this.zoomToCursor=!1;e!==null&&(this.screenSpacePanning?this.target.set(0,0,-1).transformDirection(this.object.matrix).multiplyScalar(e).add(this.object.position):(uk.origin.copy(this.object.position),uk.direction.set(0,0,-1).transformDirection(this.object.matrix),Math.abs(this.object.up.dot(uk.direction))gk||8*(1-this._lastQuaternion.dot(this.object.quaternion))>gk||this._lastTargetPosition.distanceToSquared(this.target)>gk?(this.dispatchEvent(sk),this._lastPosition.copy(this.object.position),this._lastQuaternion.copy(this.object.quaternion),this._lastTargetPosition.copy(this.target),!0):!1}_getAutoRotationAngle(e){return e===null?mk/60/60*this.autoRotateSpeed:mk/60*this.autoRotateSpeed*e}_getZoomScale(e){let t=Math.abs(e*.01);return .95**(this.zoomSpeed*t)}_rotateLeft(e){this._sphericalDelta.theta-=e}_rotateUp(e){this._sphericalDelta.phi-=e}_panLeft(e,t){pk.setFromMatrixColumn(t,0),pk.multiplyScalar(-e),this._panOffset.add(pk)}_panUp(e,t){this.screenSpacePanning===!0?pk.setFromMatrixColumn(t,1):(pk.setFromMatrixColumn(t,0),pk.crossVectors(this.object.up,pk)),pk.multiplyScalar(e),this._panOffset.add(pk)}_pan(e,t){let n=this.domElement;if(this.object.isPerspectiveCamera){let r=this.object.position;pk.copy(r).sub(this.target);let i=pk.length();i*=Math.tan(this.object.fov/2*Math.PI/180),this._panLeft(2*e*i/n.clientHeight,this.object.matrix),this._panUp(2*t*i/n.clientHeight,this.object.matrix)}else this.object.isOrthographicCamera?(this._panLeft(e*(this.object.right-this.object.left)/this.object.zoom/n.clientWidth,this.object.matrix),this._panUp(t*(this.object.top-this.object.bottom)/this.object.zoom/n.clientHeight,this.object.matrix)):(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.`),this.enablePan=!1)}_dollyOut(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale/=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_dollyIn(e){this.object.isPerspectiveCamera||this.object.isOrthographicCamera?this._scale*=e:(console.warn(`WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.`),this.enableZoom=!1)}_updateZoomParameters(e,t){if(!this.zoomToCursor)return;this._performCursorZoom=!0;let n=this.domElement.getBoundingClientRect(),r=e-n.left,i=t-n.top,a=n.width,o=n.height;this._mouse.x=r/a*2-1,this._mouse.y=-(i/o)*2+1,this._dollyDirection.set(this._mouse.x,this._mouse.y,1).unproject(this.object).sub(this.object.position).normalize()}_clampDistance(e){return Math.max(this.minDistance,Math.min(this.maxDistance,e))}_handleMouseDownRotate(e){this._rotateStart.set(e.clientX,e.clientY)}_handleMouseDownDolly(e){this._updateZoomParameters(e.clientX,e.clientX),this._dollyStart.set(e.clientX,e.clientY)}_handleMouseDownPan(e){this._panStart.set(e.clientX,e.clientY)}_handleMouseMoveRotate(e){this._rotateEnd.set(e.clientX,e.clientY),this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(mk*this._rotateDelta.x/t.clientHeight),this._rotateUp(mk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd),this.update()}_handleMouseMoveDolly(e){this._dollyEnd.set(e.clientX,e.clientY),this._dollyDelta.subVectors(this._dollyEnd,this._dollyStart),this._dollyDelta.y>0?this._dollyOut(this._getZoomScale(this._dollyDelta.y)):this._dollyDelta.y<0&&this._dollyIn(this._getZoomScale(this._dollyDelta.y)),this._dollyStart.copy(this._dollyEnd),this.update()}_handleMouseMovePan(e){this._panEnd.set(e.clientX,e.clientY),this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd),this.update()}_handleMouseWheel(e){this._updateZoomParameters(e.clientX,e.clientY),e.deltaY<0?this._dollyIn(this._getZoomScale(e.deltaY)):e.deltaY>0&&this._dollyOut(this._getZoomScale(e.deltaY)),this.update()}_handleKeyDown(e){let t=!1;switch(e.code){case this.keys.UP:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,this.keyPanSpeed),t=!0;break;case this.keys.BOTTOM:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateUp(-mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(0,-this.keyPanSpeed),t=!0;break;case this.keys.LEFT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(this.keyPanSpeed,0),t=!0;break;case this.keys.RIGHT:e.ctrlKey||e.metaKey||e.shiftKey?this.enableRotate&&this._rotateLeft(-mk*this.keyRotateSpeed/this.domElement.clientHeight):this.enablePan&&this._pan(-this.keyPanSpeed,0),t=!0;break}t&&(e.preventDefault(),this.update())}_handleTouchStartRotate(e){if(this._pointers.length===1)this._rotateStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateStart.set(n,r)}}_handleTouchStartPan(e){if(this._pointers.length===1)this._panStart.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panStart.set(n,r)}}_handleTouchStartDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyStart.set(0,i)}_handleTouchStartDollyPan(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enablePan&&this._handleTouchStartPan(e)}_handleTouchStartDollyRotate(e){this.enableZoom&&this._handleTouchStartDolly(e),this.enableRotate&&this._handleTouchStartRotate(e)}_handleTouchMoveRotate(e){if(this._pointers.length==1)this._rotateEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._rotateEnd.set(n,r)}this._rotateDelta.subVectors(this._rotateEnd,this._rotateStart).multiplyScalar(this.rotateSpeed);let t=this.domElement;this._rotateLeft(mk*this._rotateDelta.x/t.clientHeight),this._rotateUp(mk*this._rotateDelta.y/t.clientHeight),this._rotateStart.copy(this._rotateEnd)}_handleTouchMovePan(e){if(this._pointers.length===1)this._panEnd.set(e.pageX,e.pageY);else{let t=this._getSecondPointerPosition(e),n=.5*(e.pageX+t.x),r=.5*(e.pageY+t.y);this._panEnd.set(n,r)}this._panDelta.subVectors(this._panEnd,this._panStart).multiplyScalar(this.panSpeed),this._pan(this._panDelta.x,this._panDelta.y),this._panStart.copy(this._panEnd)}_handleTouchMoveDolly(e){let t=this._getSecondPointerPosition(e),n=e.pageX-t.x,r=e.pageY-t.y,i=Math.sqrt(n*n+r*r);this._dollyEnd.set(0,i),this._dollyDelta.set(0,(this._dollyEnd.y/this._dollyStart.y)**+this.zoomSpeed),this._dollyOut(this._dollyDelta.y),this._dollyStart.copy(this._dollyEnd);let a=(e.pageX+t.x)*.5,o=(e.pageY+t.y)*.5;this._updateZoomParameters(a,o)}_handleTouchMoveDollyPan(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enablePan&&this._handleTouchMovePan(e)}_handleTouchMoveDollyRotate(e){this.enableZoom&&this._handleTouchMoveDolly(e),this.enableRotate&&this._handleTouchMoveRotate(e)}_addPointer(e){this._pointers.push(e.pointerId)}_removePointer(e){delete this._pointerPositions[e.pointerId];for(let t=0;t>5&31)/31,a=(e>>10&31)/31)}for(let c=1;c<=3;c++){let l=n+c*12,u=e*3*3+(c-1)*3;p[u]=t.getFloat32(l,!0),p[u+1]=t.getFloat32(l+4,!0),p[u+2]=t.getFloat32(l+8,!0),m[u]=d,m[u+1]=f,m[u+2]=g,o&&(h.setRGB(r,i,a,hb),s[u]=h.r,s[u+1]=h.g,s[u+2]=h.b)}}return f.setAttribute(`position`,new qS(p,3)),f.setAttribute(`normal`,new qS(m,3)),o&&(f.setAttribute(`color`,new qS(s,3)),f.hasColors=!0,f.alpha=d),f}function i(e){let t=new iC,n=/solid([\s\S]*?)endsolid/g,r=/facet([\s\S]*?)endfacet/g,i=/solid\s(.+)/,a=0,o=RegExp(`vertex[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),s=RegExp(`normal[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)[\\s]+([+-]?(?:\\d*)(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)`,`g`),c=[],l=[],u=[],d=new J,f,p=0,m=0,h=0;for(;(f=n.exec(e))!==null;){m=h;let e=f[0],n=(f=i.exec(e))===null?``:f[1];for(u.push(n);(f=r.exec(e))!==null;){let e=0,t=0,n=f[0];for(;(f=s.exec(n))!==null;)d.x=parseFloat(f[1]),d.y=parseFloat(f[2]),d.z=parseFloat(f[3]),t++;for(;(f=o.exec(n))!==null;)c.push(parseFloat(f[1]),parseFloat(f[2]),parseFloat(f[3])),l.push(d.x,d.y,d.z),e++,h++;t!==1&&console.error(`THREE.STLLoader: Something isn't right with the normal of face number `+a),e!==3&&console.error(`THREE.STLLoader: Something isn't right with the vertices of face number `+a),a++}let g=m,_=h-m;t.userData.groupNames=u,t.addGroup(g,_,p),p++}return t.setAttribute(`position`,new XS(c,3)),t.setAttribute(`normal`,new XS(l,3)),t}function a(e){return typeof e==`string`?e:new TextDecoder().decode(e)}function o(e){if(typeof e==`string`){let t=new Uint8Array(e.length);for(let n=0;n256||e.colormap_size!==24||e.colormap_type!==1)throw Error(`THREE.TGALoader: Invalid type colormap data for indexed type.`);break;case f:case p:case h:case g:if(e.colormap_type)throw Error(`THREE.TGALoader: Invalid type colormap data for colormap type.`);break;case u:throw Error(`THREE.TGALoader: No data.`);default:throw Error(`THREE.TGALoader: Invalid type `+e.image_type)}if(e.width<=0||e.height<=0)throw Error(`THREE.TGALoader: Invalid image size.`);if(e.pixel_size!==8&&e.pixel_size!==16&&e.pixel_size!==24&&e.pixel_size!==32)throw Error(`THREE.TGALoader: Invalid pixel size `+e.pixel_size)}function n(e,t,n,r,i){let a,o,s=n.pixel_size>>3,c=n.width*n.height*s;if(t&&(o=i.subarray(r,r+=n.colormap_length*(n.colormap_size>>3))),e){a=new Uint8Array(c);let e,t,n,o=0,l=new Uint8Array(s);for(;o>7,e[(u+f*d)*4+1]=(c&992)>>2,e[(u+f*d)*4+2]=(c&31)<<3,e[(u+f*d)*4+3]=c&32768?0:255;return e}function a(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=3)e[(l+d*u)*4+3]=255,e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2];return e}function o(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=4)e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+1]=s[c+1],e[(l+d*u)*4+0]=s[c+2],e[(l+d*u)*4+3]=s[c+3];return e}function s(e,t,n,r,i,a,o,s){let c,l=0,u,d,f=T.width;for(d=t;d!==r;d+=n)for(u=i;u!==o;u+=a,l++)c=s[l],e[(u+f*d)*4+0]=c,e[(u+f*d)*4+1]=c,e[(u+f*d)*4+2]=c,e[(u+f*d)*4+3]=255;return e}function c(e,t,n,r,i,a,o,s){let c=0,l,u,d=T.width;for(u=t;u!==r;u+=n)for(l=i;l!==o;l+=a,c+=2)e[(l+d*u)*4+0]=s[c+0],e[(l+d*u)*4+1]=s[c+0],e[(l+d*u)*4+2]=s[c+0],e[(l+d*u)*4+3]=s[c+1];return e}function l(e,t,n,l,u){let d,f,p,m,h,g;switch((T.flags&_)>>v){default:case x:d=0,p=1,h=t,f=0,m=1,g=n;break;case y:d=0,p=1,h=t,f=n-1,m=-1,g=-1;break;case S:d=t-1,p=-1,h=-1,f=0,m=1,g=n;break;case b:d=t-1,p=-1,h=-1,f=n-1,m=-1,g=-1;break}if(O)switch(T.pixel_size){case 8:s(e,f,m,g,d,p,h,l);break;case 16:c(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}else switch(T.pixel_size){case 8:r(e,f,m,g,d,p,h,l,u);break;case 16:i(e,f,m,g,d,p,h,l);break;case 24:a(e,f,m,g,d,p,h,l);break;case 32:o(e,f,m,g,d,p,h,l);break;default:throw Error(`THREE.TGALoader: Format not supported.`)}return e}let u=0,d=1,f=2,p=3,m=9,h=10,g=11,_=48,v=4,y=0,b=1,x=2,S=3;if(e.length<19)throw Error(`THREE.TGALoader: Not enough data to contain header.`);let C=0,w=new Uint8Array(e),T={id_length:w[C++],colormap_type:w[C++],image_type:w[C++],colormap_index:w[C++]|w[C++]<<8,colormap_length:w[C++]|w[C++]<<8,colormap_size:w[C++],origin:[w[C++]|w[C++]<<8,w[C++]|w[C++]<<8],width:w[C++]|w[C++]<<8,height:w[C++]|w[C++]<<8,pixel_size:w[C++],flags:w[C++]};if(t(T),T.id_length+C>e.length)throw Error(`THREE.TGALoader: No data.`);C+=T.id_length;let E=!1,D=!1,O=!1;switch(T.image_type){case 9:E=!0,D=!0;break;case 1:D=!0;break;case 10:E=!0;break;case 2:break;case 11:E=!0,O=!0;break;case 3:O=!0;break}let k=new Uint8Array(T.width*T.height*4),A=n(E,D,T,C,w);return l(k,T.width,T.height,A.pixel_data,A.palettes),{data:k,width:T.width,height:T.height,flipY:!0,generateMipmaps:!0,minFilter:sy}}},Mk=class extends ST{load(e,t,n,r){let i=this,a=i.path===``?KT.extractUrlBase(e):i.path,o=new TT(i.manager);o.setPath(i.path),o.setRequestHeader(i.requestHeader),o.setWithCredentials(i.withCredentials),o.load(e,function(n){try{t(i.parse(n,a))}catch(t){r?r(t):console.error(t),i.manager.itemError(e)}},n,r)}parse(e,t){function n(e,t){let n=[],r=e.childNodes;for(let e=0,i=r.length;e0&&t.push(new hT(r+`.position`,i,a)),o.length>0&&t.push(new pT(r+`.quaternion`,i,o)),s.length>0&&t.push(new hT(r+`.scale`,i,s)),t}function E(e,t,n){let r,i=!0,a,o;for(a=0,o=e.length;a=0;){let r=e[t];if(r.value[n]!==null)return r;t--}return null}function k(e,t,n){for(;t>>0)+2);switch(n=n.toLowerCase(),n){case`tga`:t=Ft;break;default:t=Pt}return t}function Se(e){let t=ye(e.url),n=t.profile.technique,r;switch(n.type){case`phong`:case`blinn`:r=new Xw;break;case`lambert`:r=new Zw;break;default:r=new US;break}r.name=e.name||``;function i(e,n=null){let r=t.profile.samplers[e.id],i=null;if(r!==void 0){let e=t.profile.surfaces[r.source];i=oe(e.init_from)}else console.warn(`THREE.ColladaLoader: Undefined sampler. Access image directly (see #12530).`),i=oe(e.id);if(i!==null){let t=xe(i);if(t!==void 0){let r=t.load(i),a=e.extra;if(a!==void 0&&a.technique!==void 0&&c(a.technique)===!1){let e=a.technique;r.wrapS=e.wrapU?$v:ey,r.wrapT=e.wrapV?$v:ey,r.offset.set(e.offsetU||0,e.offsetV||0),r.repeat.set(e.repeatU||1,e.repeatV||1)}else r.wrapS=$v,r.wrapT=$v;return n!==null&&(r.colorSpace=n),r}else return console.warn(`THREE.ColladaLoader: Loader for texture %s not found.`,i),null}else return console.warn(`THREE.ColladaLoader: Couldn't create texture with ID:`,e.id),null}let a=n.parameters;for(let e in a){let t=a[e];switch(e){case`diffuse`:t.color&&r.color.fromArray(t.color),t.texture&&(r.map=i(t.texture,hb));break;case`specular`:t.color&&r.specular&&r.specular.fromArray(t.color),t.texture&&(r.specularMap=i(t.texture));break;case`bump`:t.texture&&(r.normalMap=i(t.texture));break;case`ambient`:t.texture&&(r.lightMap=i(t.texture,hb));break;case`shininess`:t.float&&r.shininess&&(r.shininess=t.float);break;case`emission`:t.color&&r.emissive&&r.emissive.fromArray(t.color),t.texture&&(r.emissiveMap=i(t.texture,hb));break}}ox.colorSpaceToWorking(r.color,hb),r.specular&&ox.colorSpaceToWorking(r.specular,hb),r.emissive&&ox.colorSpaceToWorking(r.emissive,hb);let o=a.transparent,s=a.transparency;if(s===void 0&&o&&(s={float:1}),o===void 0&&s&&(o={opaque:`A_ONE`,data:{color:[1,1,1,1]}}),o&&s)if(o.data.texture)r.transparent=!0;else{let e=o.data.color;switch(o.opaque){case`A_ONE`:r.opacity=e[3]*s.float;break;case`RGB_ZERO`:r.opacity=1-e[0]*s.float;break;case`A_ZERO`:r.opacity=1-e[3]*s.float;break;case`RGB_ONE`:r.opacity=e[0]*s.float;break;default:console.warn(`THREE.ColladaLoader: Invalid opaque type "%s" of transparent tag.`,o.opaque)}r.opacity<1&&(r.transparent=!0)}if(n.extra!==void 0&&n.extra.technique!==void 0){let e=n.extra.technique;for(let t in e){let n=e[t];switch(t){case`double_sided`:r.side=n===1?2:0;break;case`bump`:r.normalMap=i(n.texture),r.normalScale=new Ub(1,1);break}}}return r}function Ce(e){return m(B.materials[e],Se)}function we(e){let t={name:e.getAttribute(`name`)};for(let n=0,r=e.childNodes.length;n0?n+s:n;t.inputs[c]={id:e,offset:i},t.stride=Math.max(t.stride,i+1),n===`TEXCOORD`&&(t.hasUV=!0);break;case`vcount`:t.vcount=a(r.textContent);break;case`p`:t.p=a(r.textContent);break}}return t}function ze(e){let t={};for(let n=0;n0&&t0&&d.setAttribute(`position`,new XS(i.array,i.stride)),a.array.length>0&&d.setAttribute(`normal`,new XS(a.array,a.stride)),c.array.length>0&&d.setAttribute(`color`,new XS(c.array,c.stride)),o.array.length>0&&d.setAttribute(`uv`,new XS(o.array,o.stride)),s.array.length>0&&d.setAttribute(`uv1`,new XS(s.array,s.stride)),l.array.length>0&&d.setAttribute(`skinIndex`,new XS(l.array,l.stride)),u.array.length>0&&d.setAttribute(`skinWeight`,new XS(u.array,u.stride)),r.data=d,r.type=e[0].type,r.materialKeys=f,r}function Ue(e,t,n,r,i=!1){let a=e.p,o=e.stride,s=e.vcount;function c(e){let t=a[e+n]*u,o=t+u;for(;t4)for(let t=1,r=n-2;t<=r;t++){let n=e+o*0,r=e+o*t,i=e+o*(t+1);c(n),c(r),c(i)}e+=o*n}}else for(let e=0,t=a.length;e=t.limits.max&&(t.static=!0),t.middlePosition=(t.limits.min+t.limits.max)/2,t}function Ze(e){let t={sid:e.getAttribute(`sid`),name:e.getAttribute(`name`)||``,attachments:[],transforms:[]};for(let n=0;nr.limits.max||te===null?null:parseFloat(e)),(!this.origPosition||!this.origQuaternion)&&(this.origPosition=this.position.clone(),this.origQuaternion=this.quaternion.clone());let t=!1;switch(this.mimicJoints.forEach(n=>{t=n.updateFromMimickedJoint(...e)||t}),this.jointType){case`fixed`:return t;case`continuous`:case`revolute`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(!this.ignoreLimits&&this.jointType===`revolute`&&(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.quaternion.setFromAxisAngle(this.axis,n).premultiply(this.origQuaternion),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`prismatic`:{let n=e[0];return n==null||n===this.jointValue[0]?t:(this.ignoreLimits||(n=Math.min(this.limit.upper,n),n=Math.max(this.limit.lower,n)),this.position.copy(this.origPosition),Nk.copy(this.axis).applyEuler(this.rotation),this.position.addScaledVector(Nk,n),this.jointValue[0]===n?t:(this.jointValue[0]=n,this.matrixWorldNeedsUpdate=!0,!0))}case`floating`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],this.jointValue[3]=e[3]===null?this.jointValue[3]:e[3],this.jointValue[4]=e[4]===null?this.jointValue[4]:e[4],this.jointValue[5]=e[5]===null?this.jointValue[5]:e[5],Ik.compose(this.origPosition,this.origQuaternion,Rk),Lk.setFromEuler(Pk.set(this.jointValue[3],this.jointValue[4],this.jointValue[5],`XYZ`)),zk.set(this.jointValue[0],this.jointValue[1],this.jointValue[2]),Fk.compose(zk,Lk,Rk),Ik.premultiply(Fk),this.position.setFromMatrixPosition(Ik),this.rotation.setFromRotationMatrix(Ik),this.matrixWorldNeedsUpdate=!0,!0);case`planar`:return this.jointValue.every((t,n)=>e[n]===t||e[n]===null)?t:(this.jointValue[0]=e[0]===null?this.jointValue[0]:e[0],this.jointValue[1]=e[1]===null?this.jointValue[1]:e[1],this.jointValue[2]=e[2]===null?this.jointValue[2]:e[2],Ik.compose(this.origPosition,this.origQuaternion,Rk),Lk.setFromAxisAngle(this.axis,this.jointValue[2]),zk.set(this.jointValue[0],this.jointValue[1],0),Fk.compose(zk,Lk,Rk),Ik.premultiply(Fk),this.position.setFromMatrixPosition(Ik),this.rotation.setFromRotationMatrix(Ik),this.matrixWorldNeedsUpdate=!0,!0)}return t}},Gk=class extends Wk{constructor(...e){super(...e),this.type=`URDFMimicJoint`,this.mimicJoint=null,this.offset=0,this.multiplier=1}updateFromMimickedJoint(...e){let t=e.map(e=>e===null?null:e*this.multiplier+this.offset);return super.setJointValue(...t)}copy(e,t){return super.copy(e,t),this.mimicJoint=e.mimicJoint,this.offset=e.offset,this.multiplier=e.multiplier,this}},Kk=class extends Uk{constructor(...e){super(...e),this.isURDFRobot=!0,this.urdfNode=null,this.urdfRobotNode=null,this.robotName=null,this.links=null,this.joints=null,this.colliders=null,this.visual=null,this.frames=null}copy(e,t){super.copy(e,t),this.urdfRobotNode=e.urdfRobotNode,this.robotName=e.robotName,this.links={},this.joints={},this.colliders={},this.visual={},this.traverse(t=>{t.isURDFJoint&&t.urdfName in e.joints&&(this.joints[t.urdfName]=t),t.isURDFLink&&t.urdfName in e.links&&(this.links[t.urdfName]=t),t.isURDFCollider&&t.urdfName in e.colliders&&(this.colliders[t.urdfName]=t),t.isURDFVisual&&t.urdfName in e.visual&&(this.visual[t.urdfName]=t)});for(let e in this.joints)this.joints[e].mimicJoints=this.joints[e].mimicJoints.map(e=>this.joints[e.name]);return this.frames={...this.colliders,...this.visual,...this.links,...this.joints},this}getFrame(e){return this.frames[e]}setJointValue(e,...t){let n=this.joints[e];return n?n.setJointValue(...t):!1}setJointValues(e){let t=!1;for(let n in e){let r=e[n];t=Array.isArray(r)?this.setJointValue(n,...r)||t:this.setJointValue(n,r)||t}return t}},qk=new Wb,Jk=new iS;function Yk(e){return e?e.trim().split(/\s+/g).map(e=>parseFloat(e)):[0,0,0]}function Xk(e,t,n=!1){n||e.rotation.set(0,0,0),Jk.set(t[0],t[1],t[2],`ZYX`),qk.setFromEuler(Jk),qk.multiply(e.quaternion),e.quaternion.copy(qk)}var Zk=class{constructor(e){this.manager=e||xT,this.loadMeshCb=this.defaultMeshLoader.bind(this),this.parseVisual=!0,this.parseCollision=!1,this.packages=``,this.workingPath=``,this.fetchOptions={}}loadAsync(e){return new Promise((t,n)=>{this.load(e,t,null,n)})}load(e,t,n,r){let i=this.manager,a=KT.extractUrlBase(e),o=this.manager.resolveURL(e);i.itemStart(o),fetch(o,this.fetchOptions).then(e=>{if(e.ok)return n&&n(null),e.text();throw Error(`URDFLoader: Failed to load url '${o}' with error code ${e.status} : ${e.statusText}.`)}).then(e=>{t(this.parse(e,this.workingPath||a)),i.itemEnd(o)}).catch(e=>{r?r(e):console.error(`URDFLoader: Error loading file.`,e),i.itemError(o),i.itemEnd(o)})}parse(e,t=this.workingPath){let n=this.packages,r=this.loadMeshCb,i=this.parseVisual,a=this.parseCollision,o=this.manager,s={},c={},l={};function u(e){if(!/^package:\/\//.test(e))return t?t+e:e;let[r,i]=e.replace(/^package:\/\//,``).split(/\/(.+)/);if(typeof n==`string`)return n.endsWith(r)?n+`/`+i:n+`/`+r+`/`+i;if(typeof n==`function`)return n(r)+`/`+i;if(typeof n==`object`)return r in n?n[r]+`/`+i:(console.error(`URDFLoader : ${r} not found in provided package list.`),null)}function d(e){let t;return t=e instanceof Document?[...e.children]:e instanceof Element?[e]:[...new DOMParser().parseFromString(e,`text/xml`).children],f(t.filter(e=>e.nodeName===`robot`).pop())}function f(e){let t=[...e.children],n=t.filter(e=>e.nodeName.toLowerCase()===`link`),r=t.filter(e=>e.nodeName.toLowerCase()===`joint`),i=t.filter(e=>e.nodeName.toLowerCase()===`material`),a=new Kk;a.robotName=e.getAttribute(`name`),a.urdfRobotNode=e,i.forEach(e=>{let t=e.getAttribute(`name`);l[t]=h(e)});let o={},u={};n.forEach(t=>{let n=t.getAttribute(`name`);s[n]=m(t,o,u,e.querySelector(`child[link="${n}"]`)===null?a:null)}),r.forEach(e=>{let t=e.getAttribute(`name`);c[t]=p(e)}),a.joints=c,a.links=s,a.colliders=u,a.visual=o;let d=Object.values(c);return d.forEach(e=>{e instanceof Gk&&c[e.mimicJoint].mimicJoints.push(e)}),d.forEach(e=>{let t=new Set,n=e=>{if(t.has(e))throw Error(`URDFLoader: Detected an infinite loop of mimic joints.`);t.add(e),e.mimicJoints.forEach(e=>{n(e)})};n(e)}),a.frames={...u,...o,...s,...c},a}function p(e){let t=[...e.children],n=e.getAttribute(`type`),r,i=t.find(e=>e.nodeName.toLowerCase()===`mimic`);i?(r=new Gk,r.mimicJoint=i.getAttribute(`joint`),r.multiplier=parseFloat(i.getAttribute(`multiplier`)||1),r.offset=parseFloat(i.getAttribute(`offset`)||0)):r=new Wk,r.urdfNode=e,r.name=e.getAttribute(`name`),r.urdfName=r.name,r.jointType=n;let a=null,o=null,c=[0,0,0],l=[0,0,0];t.forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(c=Yk(e.getAttribute(`xyz`)),l=Yk(e.getAttribute(`rpy`))):t===`child`?o=s[e.getAttribute(`link`)]:t===`parent`?a=s[e.getAttribute(`link`)]:t===`limit`&&(r.limit.lower=parseFloat(e.getAttribute(`lower`)||r.limit.lower),r.limit.upper=parseFloat(e.getAttribute(`upper`)||r.limit.upper),r.limit.effort=parseFloat(e.getAttribute(`effort`)||r.limit.effort),r.limit.velocity=parseFloat(e.getAttribute(`velocity`)||r.limit.velocity))}),a.add(r),r.add(o),Xk(r,l),r.position.set(c[0],c[1],c[2]);let u=t.filter(e=>e.nodeName.toLowerCase()===`axis`)[0];if(u){let e=u.getAttribute(`xyz`).split(/\s+/g).map(e=>parseFloat(e));r.axis=new J(e[0],e[1],e[2]),r.axis.normalize()}return r}function m(e,t,n,r=null){r===null&&(r=new Uk);let o=[...e.children];r.name=e.getAttribute(`name`),r.urdfName=r.name,r.urdfNode=e;let s=o.find(e=>e.nodeName.toLowerCase()===`inertial`);return s&&[...s.children].forEach(e=>{let t=e.nodeName.toLowerCase();t===`origin`?(r.inertial.origin.xyz=Yk(e.getAttribute(`xyz`)),r.inertial.origin.rpy=Yk(e.getAttribute(`rpy`))):t===`mass`?r.inertial.mass=parseFloat(e.getAttribute(`value`))||0:t===`inertia`&&(r.inertial.inertia.ixx=parseFloat(e.getAttribute(`ixx`))||0,r.inertial.inertia.ixy=parseFloat(e.getAttribute(`ixy`))||0,r.inertial.inertia.ixz=parseFloat(e.getAttribute(`ixz`))||0,r.inertial.inertia.iyy=parseFloat(e.getAttribute(`iyy`))||0,r.inertial.inertia.iyz=parseFloat(e.getAttribute(`iyz`))||0,r.inertial.inertia.izz=parseFloat(e.getAttribute(`izz`))||0)}),i&&o.filter(e=>e.nodeName.toLowerCase()===`visual`).forEach(e=>{let n=g(e,l);if(r.add(n),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);n.name=r,n.urdfName=r,t[r]=n}}),a&&o.filter(e=>e.nodeName.toLowerCase()===`collision`).forEach(e=>{let t=g(e);if(r.add(t),e.hasAttribute(`name`)){let r=e.getAttribute(`name`);t.name=r,t.urdfName=r,n[r]=t}}),r}function h(e){let t=[...e.children],n=new Xw;return n.name=e.getAttribute(`name`)||``,t.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`color`){let t=e.getAttribute(`rgba`).split(/\s/g).map(e=>parseFloat(e));n.color.setRGB(t[0],t[1],t[2]),n.opacity=t[3],n.transparent=t[3]<1,n.depthWrite=!n.transparent}else if(t===`texture`){let t=e.getAttribute(`filename`);if(t){let e=new OT(o),r=u(t);n.map=e.load(r),n.map.colorSpace=hb}}}),n}function g(e,t={}){let n=e.nodeName.toLowerCase()===`collision`,i=[...e.children],a=null,s=i.filter(e=>e.nodeName.toLowerCase()===`material`)[0];if(s){let e=s.getAttribute(`name`);a=e&&e in t?t[e]:h(s)}else a=new Xw;let c=n?new Vk:new Hk;return c.urdfNode=e,i.forEach(e=>{let t=e.nodeName.toLowerCase();if(t===`geometry`){let t=e.children[0].nodeName.toLowerCase();if(t===`mesh`){let t=u(e.children[0].getAttribute(`filename`));if(t!==null){let n=e.children[0].getAttribute(`scale`);if(n){let e=Yk(n);c.scale.set(e[0],e[1],e[2])}r(t,o,(e,t)=>{t?console.error(`URDFLoader: Error loading mesh.`,t):e&&(e instanceof gC&&(e.material=a),e.position.set(0,0,0),e.quaternion.identity(),c.add(e))})}}else if(t===`box`){let t=new gC;t.geometry=new yC(1,1,1),t.material=a;let n=Yk(e.children[0].getAttribute(`size`));t.scale.set(n[0],n[1],n[2]),c.add(t)}else if(t===`sphere`){let t=new gC;t.geometry=new Kw(1,30,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0;t.scale.set(n,n,n),c.add(t)}else if(t===`cylinder`){let t=new gC;t.geometry=new Ww(1,1,1,30),t.material=a;let n=parseFloat(e.children[0].getAttribute(`radius`))||0,r=parseFloat(e.children[0].getAttribute(`length`))||0;t.scale.set(n,r,n),t.rotation.set(Math.PI/2,0,0),c.add(t)}}else if(t===`origin`){let t=Yk(e.getAttribute(`xyz`)),n=Yk(e.getAttribute(`rpy`));c.position.set(t[0],t[1],t[2]),c.rotation.set(0,0,0),Xk(c,n)}}),c}return d(e)}defaultMeshLoader(e,t,n){/\.stl$/i.test(e)?new Ak(t).load(e,e=>{n(new gC(e,new Xw))},null,e=>n(null,e)):/\.dae$/i.test(e)?new Mk(t).load(e,e=>n(e.scene),null,e=>n(null,e)):console.warn(`URDFLoader: Could not load model at ${e}.\nNo loader available`)}},Qk=new Ub,$k=()=>{},eA=class extends HTMLElement{static get observedAttributes(){return[`package`,`urdf`,`up`,`display-shadow`,`ambient-color`,`ignore-limits`,`show-collision`]}get package(){return this.getAttribute(`package`)||``}set package(e){this.setAttribute(`package`,e)}get urdf(){return this.getAttribute(`urdf`)||``}set urdf(e){this.setAttribute(`urdf`,e)}get ignoreLimits(){return this.hasAttribute(`ignore-limits`)||!1}set ignoreLimits(e){e?this.setAttribute(`ignore-limits`,e):this.removeAttribute(`ignore-limits`)}get up(){return this.getAttribute(`up`)||`+Z`}set up(e){this.setAttribute(`up`,e)}get displayShadow(){return this.hasAttribute(`display-shadow`)||!1}set displayShadow(e){e?this.setAttribute(`display-shadow`,``):this.removeAttribute(`display-shadow`)}get ambientColor(){return this.getAttribute(`ambient-color`)||`#8ea0a8`}set ambientColor(e){e?this.setAttribute(`ambient-color`,e):this.removeAttribute(`ambient-color`)}get autoRedraw(){return this.hasAttribute(`auto-redraw`)||!1}set autoRedraw(e){e?this.setAttribute(`auto-redraw`,!0):this.removeAttribute(`auto-redraw`)}get noAutoRecenter(){return this.hasAttribute(`no-auto-recenter`)||!1}set noAutoRecenter(e){e?this.setAttribute(`no-auto-recenter`,!0):this.removeAttribute(`no-auto-recenter`)}get showCollision(){return this.hasAttribute(`show-collision`)||!1}set showCollision(e){e?this.setAttribute(`show-collision`,!0):this.removeAttribute(`show-collision`)}get jointValues(){let e={};if(this.robot)for(let t in this.robot.joints){let n=this.robot.joints[t];e[t]=n.jointValue.length===1?n.angle:[...n.jointValue]}return e}set jointValues(e){this.setJointValues(e)}get angles(){return this.jointValues}set angles(e){this.jointValues=e}constructor(){super(),this._requestId=0,this._dirty=!1,this._loadScheduled=!1,this.robot=null,this.loadMeshFunc=null,this.urlModifierFunc=null;let e=new VC,t=new AT(this.ambientColor,`#000`);t.groundColor.lerp(t.color,.5*Math.PI),t.intensity=.5,t.position.set(0,1,0),e.add(t);let n=new WT(16777215,Math.PI);n.position.set(4,10,1),n.shadow.mapSize.width=2048,n.shadow.mapSize.height=2048,n.shadow.normalBias=.001,n.castShadow=!0,e.add(n),e.add(n.target);let r=new ok({antialias:!0,alpha:!0});r.setClearColor(16777215),r.setClearAlpha(0),r.shadowMap.enabled=!0,r.shadowMap.type=2,r.outputColorSpace=hb;let i=new MC(75,1,.1,1e3);i.position.z=-10;let a=new xS;e.add(a);let o=new gC(new Gw(40,40),new qw({side:2,transparent:!0,opacity:.25}));o.rotation.x=-Math.PI/2,o.position.y=-.5,o.receiveShadow=!0,o.scale.set(10,10,10),e.add(o);let s=new _k(i,r.domElement);s.rotateSpeed=2,s.zoomSpeed=5,s.panSpeed=2,s.enableZoom=!0,s.enableDamping=!1,s.maxDistance=50,s.minDistance=.25,s.addEventListener(`change`,()=>this.recenter()),this.scene=e,this.world=a,this.renderer=r,this.camera=i,this.controls=s,this.plane=o,this.directionalLight=n,this.ambientLight=t,this._setUp(this.up),this._collisionMaterial=new Xw({transparent:!0,opacity:.35,shininess:2.5,premultipliedAlpha:!0,color:16760376,polygonOffset:!0,polygonOffsetFactor:-1,polygonOffsetUnits:-1});let c=()=>{this.parentNode&&(this.updateSize(),(this._dirty||this.autoRedraw)&&(this.noAutoRecenter||this._updateEnvironment(),this.renderer.render(e,i),this._dirty=!1),this.controls.update()),this._renderLoopId=requestAnimationFrame(c)};c()}connectedCallback(){if(!this.constructor._styletag){let e=document.createElement(`style`);e.innerHTML=` - ${this.tagName} { display: block; } - ${this.tagName} canvas { - width: 100%; - height: 100%; - } - `,document.head.appendChild(e),this.constructor._styletag=e}this.childElementCount===0&&this.appendChild(this.renderer.domElement),this.updateSize(),requestAnimationFrame(()=>this.updateSize())}disconnectedCallback(){cancelAnimationFrame(this._renderLoopId)}attributeChangedCallback(e,t,n){switch(this._updateCollisionVisibility(),this.noAutoRecenter||this.recenter(),e){case`package`:case`urdf`:this._scheduleLoad();break;case`up`:this._setUp(this.up);break;case`ambient-color`:this.ambientLight.color.set(this.ambientColor),this.ambientLight.groundColor.set(`#000`).lerp(this.ambientLight.color,.5);break;case`ignore-limits`:this._setIgnoreLimits(this.ignoreLimits,!0);break}}updateSize(){let e=this.renderer,t=this.clientWidth,n=this.clientHeight,r=e.getSize(Qk);(r.width!==t||r.height!==n)&&this.recenter(),e.setPixelRatio(window.devicePixelRatio),e.setSize(t,n,!1),this.camera.aspect=t/n,this.camera.updateProjectionMatrix()}redraw(){this._dirty=!0}recenter(){this._updateEnvironment(),this.redraw()}setJointValue(e,...t){this.robot&&this.robot.joints[e]&&this.robot.joints[e].setJointValue(...t)&&(this.redraw(),this.dispatchEvent(new CustomEvent(`angle-change`,{bubbles:!0,cancelable:!0,detail:e})))}setJointValues(e){for(let t in e)Array.isArray(e[t])?this.setJointValue(t,...e[t]):this.setJointValue(t,e[t])}_updateEnvironment(){let e=this.robot;if(!e)return;this.world.updateMatrixWorld();let t=new Sx;t.makeEmpty(),e.traverse(e=>{e.isURDFVisual&&t.expandByObject(e)});let n=t.getCenter(new J);this.controls.target.y=n.y,this.plane.position.y=t.min.y-.001;let r=this.directionalLight;if(r.castShadow=this.displayShadow,this.displayShadow){let e=t.getBoundingSphere(new Bx).radius,i=r.shadow.camera;i.left=i.bottom=-e,i.right=i.top=e;let a=r.position.clone().sub(r.target.position);r.target.position.copy(n),r.position.copy(n).add(a),i.updateProjectionMatrix()}}_scheduleLoad(){this._prevload!==`${this.package}|${this.urdf}`&&(this._prevload=`${this.package}|${this.urdf}`,!this._loadScheduled&&(this._loadScheduled=!0,this.robot&&=(this.robot.traverse(e=>e.dispose&&e.dispose()),this.robot.parent.remove(this.robot),null),requestAnimationFrame(()=>{this._loadUrdf(this.package,this.urdf),this._loadScheduled=!1})))}_loadUrdf(e,t){if(this.dispatchEvent(new CustomEvent(`urdf-change`,{bubbles:!0,cancelable:!0,composed:!0})),t){this._requestId++;let n=this._requestId,r=e=>{e.traverse(e=>{if(e.isMesh&&(e.castShadow=!0,e.receiveShadow=!0,e.material)){let t=(Array.isArray(e.material)?e.material:[e.material]).map(e=>(e instanceof US&&(e=new Xw),e.map&&(e.map.colorSpace=hb),e));e.material=t.length===1?t[0]:t}})};e.includes(`:`)&&e.split(`:`)[1].substring(0,2)!==`//`&&(e=e.split(`,`).reduce((e,t)=>{let n=t.split(/:/).filter(e=>!!e),r=n.shift().trim();return e[r]=n.join(`:`).trim(),e},{}));let i=null,a=new bT;a.onLoad=()=>{if(this._requestId!==n){i.traverse(e=>e.dispose&&e.dispose());return}this.robot=i,this.world.add(i),r(i),this._setIgnoreLimits(this.ignoreLimits),this._updateCollisionVisibility(),this.dispatchEvent(new CustomEvent(`urdf-processed`,{bubbles:!0,cancelable:!0,composed:!0})),this.dispatchEvent(new CustomEvent(`geometry-loaded`,{bubbles:!0,cancelable:!0,composed:!0})),this.recenter()},this.urlModifierFunc&&a.setURLModifier(this.urlModifierFunc);let o=new Zk(a);o.packages=e,o.loadMeshCb=this.loadMeshFunc,o.fetchOptions={mode:`cors`,credentials:`same-origin`},o.parseCollision=!0,o.load(t,e=>i=e)}}_updateCollisionVisibility(){let e=this.showCollision,t=this._collisionMaterial,n=this.robot;if(n===null)return;let r=[];n.traverse(t=>{t.isURDFCollider&&(t.visible=e,r.push(t))}),r.forEach(e=>{e.traverse(e=>{e.isMesh&&(e.raycast=$k,e.material=t,e.castShadow=!1)})})}_setUp(e){e||=`+Z`,e=e.toUpperCase();let t=e.replace(/[^-+]/g,``)[0]||`+`,n=e.replace(/[^XYZ]/gi,``)[0]||`Z`,r=Math.PI,i=r/2;n===`X`&&this.world.rotation.set(0,0,t===`+`?i:-i),n===`Z`&&this.world.rotation.set(t===`+`?-i:i,0,0),n===`Y`&&this.world.rotation.set(t===`+`?0:r,0,0)}_setIgnoreLimits(e,t=!1){this.robot&&Object.values(this.robot.joints).forEach(t=>{t.ignoreLimits=e,t.setJointValue(...t.jointValue)}),t&&this.dispatchEvent(new CustomEvent(`ignore-limits-change`,{bubbles:!0,cancelable:!0,composed:!0}))}};function tA(e){return e.isURDFJoint&&e.jointType!==`fixed`}function nA(e){let t=e;for(;t;){if(tA(t))return t;t=t.parent}return t}var rA=new J,iA=new J,aA=new J,oA=new J,sA=new J,cA=new J,lA=new J,uA=new vw,dA=class{constructor(e){this.enabled=!0,this.scene=e,this.raycaster=new lE,this.initialGrabPoint=new J,this.hitDistance=-1,this.hovered=null,this.manipulating=null}update(){let{raycaster:e,hovered:t,manipulating:n,scene:r}=this;if(n)return;let i=null,a=e.intersectObject(r,!0);if(a.length!==0){let e=a[0];this.hitDistance=e.distance,i=nA(e.object),this.initialGrabPoint.copy(e.point)}i!==t&&(t&&this.onUnhover(t),this.hovered=i,i&&this.onHover(i))}updateJoint(e,t){e.setJointValue(t)}onDragStart(e){}onDragEnd(e){}onHover(e){}onUnhover(e){}getRevoluteDelta(e,t,n){return oA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),aA.set(0,0,0).applyMatrix4(e.matrixWorld),uA.setFromNormalAndCoplanarPoint(oA,aA),uA.projectPoint(t,cA),uA.projectPoint(n,lA),cA.sub(aA),lA.sub(aA),oA.crossVectors(cA,lA),Math.sign(oA.dot(uA.normal))*lA.angleTo(cA)}getPrismaticDelta(e,t,n){return oA.subVectors(n,t),uA.normal.copy(e.axis).transformDirection(e.parent.matrixWorld).normalize(),oA.dot(uA.normal)}moveRay(e){let{raycaster:t,hitDistance:n,manipulating:r}=this,{ray:i}=t;if(r){i.at(n,rA),e.at(n,iA);let t=0;r.jointType===`revolute`||r.jointType===`continuous`?t=this.getRevoluteDelta(r,rA,iA):r.jointType===`prismatic`&&(t=this.getPrismaticDelta(r,rA,iA)),t&&this.updateJoint(r,r.angle+t)}this.raycaster.ray.copy(e),this.update()}setGrabbed(e){let{hovered:t,manipulating:n}=this;if(e){if(n!==null||t===null)return;this.manipulating=t,this.onDragStart(t)}else{if(this.manipulating===null)return;this.onDragEnd(this.manipulating),this.manipulating=null,this.update()}}},fA=class extends dA{constructor(e,t,n){super(e),this.camera=t,this.domElement=n;let r=new lE,i=new Ub;function a(e){let t=n.getBoundingClientRect();i.x=(e.clientX-t.left)/t.width*2-1,i.y=-((e.clientY-t.top)/t.height)*2+1}this._mouseDown=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!0)},this._mouseMove=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray)},this._mouseUp=e=>{a(e),r.setFromCamera(i,this.camera),this.moveRay(r.ray),this.setGrabbed(!1)},n.addEventListener(`mousedown`,this._mouseDown),n.addEventListener(`mousemove`,this._mouseMove),n.addEventListener(`mouseup`,this._mouseUp)}getRevoluteDelta(e,t,n){let{camera:r,initialGrabPoint:i}=this;return oA.copy(e.axis).transformDirection(e.matrixWorld).normalize(),aA.set(0,0,0).applyMatrix4(e.matrixWorld),uA.setFromNormalAndCoplanarPoint(oA,aA),oA.copy(r.position).sub(i).normalize(),Math.abs(oA.dot(uA.normal))>.3?super.getRevoluteDelta(e,t,n):(oA.set(0,1,0).transformDirection(r.matrixWorld),uA.projectPoint(t,cA),uA.projectPoint(n,lA),oA.set(0,0,-1).transformDirection(r.matrixWorld),oA.cross(uA.normal),sA.subVectors(n,t),oA.dot(sA))}dispose(){let{domElement:e}=this;e.removeEventListener(`mousedown`,this._mouseDown),e.removeEventListener(`mousemove`,this._mouseMove),e.removeEventListener(`mouseup`,this._mouseUp)}},pA=class extends eA{static get observedAttributes(){return[`highlight-color`,...super.observedAttributes]}get disableDragging(){return this.hasAttribute(`disable-dragging`)}set disableDragging(e){e?this.setAttribute(`disable-dragging`,!!e):this.removeAttribute(`disable-dragging`)}get highlightColor(){return this.getAttribute(`highlight-color`)||`#FFFFFF`}set highlightColor(e){e?this.setAttribute(`highlight-color`,e):this.removeAttribute(`highlight-color`)}constructor(...e){super(...e),this.highlightMaterial=new Xw({shininess:10,color:this.highlightColor,emissive:this.highlightColor,emissiveIntensity:.25});let t=e=>e.isURDFJoint&&e.jointType!==`fixed`,n=(e,n)=>{let r=i=>{if(i.type===`Mesh`&&(n?(i.material=i.__origMaterial,delete i.__origMaterial):(i.__origMaterial=i.material,i.material=this.highlightMaterial)),i===e||!t(i))for(let e=0;e{this.dispatchEvent(new CustomEvent(`manipulate-start`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!1,this.redraw()},i.onDragEnd=e=>{this.dispatchEvent(new CustomEvent(`manipulate-end`,{bubbles:!0,cancelable:!0,detail:e.name})),this.controls.enabled=!0,this.redraw()},i.updateJoint=(e,t)=>{this.setJointValue(e.name,t)},i.onHover=e=>{n(e,!1),this.dispatchEvent(new CustomEvent(`joint-mouseover`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},i.onUnhover=e=>{n(e,!0),this.dispatchEvent(new CustomEvent(`joint-mouseout`,{bubbles:!0,cancelable:!0,detail:e.name})),this.redraw()},this.dragControls=i}disconnectedCallback(){super.disconnectedCallback(),this.dragControls.dispose()}attributeChangedCallback(e,t,n){switch(super.attributeChangedCallback(e,t,n),e){case`highlight-color`:this.highlightMaterial.color.set(this.highlightColor),this.highlightMaterial.emissive.set(this.highlightColor);break}}},mA=1e3,hA=3e4,gA=({viewerRef:e,enabled:t=!0,websocketUrl:n})=>{let{wsBaseUrl:r}=Rs(),i=n||`${r}/ws/joint-data`,a=(0,_.useRef)(null),o=(0,_.useRef)(null),s=(0,_.useRef)(mA),c=(0,_.useRef)(!1),[l,u]=(0,_.useState)(!1),d=(0,_.useCallback)(t=>{let n=e.current;!n||typeof n.setJointValue!=`function`||Object.entries(t).forEach(([e,t])=>{try{n.setJointValue(e,t)}catch(t){console.warn(`Failed to set joint ${e}:`,t)}})},[e]);return(0,_.useEffect)(()=>{if(!t)return;c.current=!1;let e=()=>{if(c.current)return;let e;try{e=new WebSocket(i)}catch(e){console.error(`Failed to create WebSocket:`,e),n();return}a.current=e,e.onopen=()=>{u(!0),s.current=mA,o.current&&=(clearTimeout(o.current),null)},e.onmessage=e=>{try{let t=JSON.parse(e.data);t.type===`joint_update`&&t.joints&&d(t.joints)}catch(e){console.error(`Error parsing WebSocket message:`,e)}},e.onclose=e=>{u(!1),a.current=null,!c.current&&e.code!==1e3&&n()},e.onerror=()=>{u(!1)}},n=()=>{if(o.current)return;let t=s.current;s.current=Math.min(t*2,hA),o.current=setTimeout(()=>{o.current=null,e()},t)};return e(),()=>{c.current=!0,o.current&&=(clearTimeout(o.current),null),a.current&&=(a.current.close(1e3),null),u(!1)}},[t,i,d]),{isConnected:l}},_A=[`light`,`dark`],vA=`(prefers-color-scheme: dark)`;_.createContext(void 0),_.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:r,enableColorScheme:i,defaultTheme:a,value:o,attrs:s,nonce:c})=>{let l=a===`system`,u=n===`class`?`var d=document.documentElement,c=d.classList;${`c.remove(${s.map(e=>`'${e}'`).join(`,`)})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,d=i?_A.includes(a)&&a?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${a}'`:`if(e==='light'||e==='dark')d.style.colorScheme=e`:``,f=(e,t=!1,r=!0)=>{let a=o?o[e]:e,s=t?e+`|| ''`:`'${a}'`,c=``;return i&&r&&!t&&_A.includes(e)&&(c+=`d.style.colorScheme = '${e}';`),n===`class`?t||a?c+=`c.add(${s})`:c+=`null`:a&&(c+=`d[s](n,${s})`),c},p=e?`!function(){${u}${f(e)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${l})){var t='${vA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${f(`dark`)}}else{${f(`light`)}}}else if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}${l?``:`else{`+f(a,!1,!1)+`}`}${d}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${t}');if(e){${o?`var x=${JSON.stringify(o)};`:``}${f(o?`x[e]`:`e`,!0)}}else{${f(a,!1,!1)};}${d}}catch(t){}}();`;return _.createElement(`script`,{nonce:c,dangerouslySetInnerHTML:{__html:p}})});function yA(e,t){if(t===0)return console.warn(`THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles.`),e;if(t===2||t===1){let n=e.getIndex();if(n===null){let t=[],r=e.getAttribute(`position`);if(r!==void 0){for(let e=0;e=2.0 are supported.`));return}let c=new gj(i,{path:t||this.resourcePath||``,crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let e=0;e=0&&o[t]===void 0&&console.warn(`THREE.GLTFLoader: Unknown extension "`+t+`".`)}}c.setExtensions(a),c.setPlugins(o),c.parse(n,r)}parseAsync(e,t){let n=this;return new Promise(function(r,i){n.parse(e,t,r,i)})}};function xA(){let e={};return{get:function(t){return e[t]},add:function(t,n){e[t]=n},remove:function(t){delete e[t]},removeAll:function(){e={}}}}var SA={KHR_BINARY_GLTF:`KHR_binary_glTF`,KHR_DRACO_MESH_COMPRESSION:`KHR_draco_mesh_compression`,KHR_LIGHTS_PUNCTUAL:`KHR_lights_punctual`,KHR_MATERIALS_CLEARCOAT:`KHR_materials_clearcoat`,KHR_MATERIALS_DISPERSION:`KHR_materials_dispersion`,KHR_MATERIALS_IOR:`KHR_materials_ior`,KHR_MATERIALS_SHEEN:`KHR_materials_sheen`,KHR_MATERIALS_SPECULAR:`KHR_materials_specular`,KHR_MATERIALS_TRANSMISSION:`KHR_materials_transmission`,KHR_MATERIALS_IRIDESCENCE:`KHR_materials_iridescence`,KHR_MATERIALS_ANISOTROPY:`KHR_materials_anisotropy`,KHR_MATERIALS_UNLIT:`KHR_materials_unlit`,KHR_MATERIALS_VOLUME:`KHR_materials_volume`,KHR_TEXTURE_BASISU:`KHR_texture_basisu`,KHR_TEXTURE_TRANSFORM:`KHR_texture_transform`,KHR_MESH_QUANTIZATION:`KHR_mesh_quantization`,KHR_MATERIALS_EMISSIVE_STRENGTH:`KHR_materials_emissive_strength`,EXT_MATERIALS_BUMP:`EXT_materials_bump`,EXT_TEXTURE_WEBP:`EXT_texture_webp`,EXT_TEXTURE_AVIF:`EXT_texture_avif`,EXT_MESHOPT_COMPRESSION:`EXT_meshopt_compression`,EXT_MESH_GPU_INSTANCING:`EXT_mesh_gpu_instancing`},CA=class{constructor(e){this.parser=e,this.name=SA.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){let e=this.parser,t=this.parser.json.nodes||[];for(let n=0,r=t.length;n=0)throw Error(`THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures`);return null}return t.loadTextureImage(e,i.source,a)}},LA=class{constructor(e){this.parser=e,this.name=SA.EXT_TEXTURE_WEBP}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},RA=class{constructor(e){this.parser=e,this.name=SA.EXT_TEXTURE_AVIF}loadTexture(e){let t=this.name,n=this.parser,r=n.json,i=r.textures[e];if(!i.extensions||!i.extensions[t])return null;let a=i.extensions[t],o=r.images[a.source],s=n.textureLoader;if(o.uri){let e=n.options.manager.getHandler(o.uri);e!==null&&(s=e)}return n.loadTextureImage(e,a.source,s)}},zA=class{constructor(e){this.name=SA.EXT_MESHOPT_COMPRESSION,this.parser=e}loadBufferView(e){let t=this.parser.json,n=t.bufferViews[e];if(n.extensions&&n.extensions[this.name]){let e=n.extensions[this.name],r=this.parser.getDependency(`buffer`,e.buffer),i=this.parser.options.meshoptDecoder;if(!i||!i.supported){if(t.extensionsRequired&&t.extensionsRequired.indexOf(this.name)>=0)throw Error(`THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files`);return null}return r.then(function(t){let n=e.byteOffset||0,r=e.byteLength||0,a=e.count,o=e.byteStride,s=new Uint8Array(t,n,r);return i.decodeGltfBufferAsync?i.decodeGltfBufferAsync(a,o,s,e.mode,e.filter).then(function(e){return e.buffer}):i.ready.then(function(){let t=new ArrayBuffer(a*o);return i.decodeGltfBuffer(new Uint8Array(t),a,o,s,e.mode,e.filter),t})})}else return null}},BA=class{constructor(e){this.name=SA.EXT_MESH_GPU_INSTANCING,this.parser=e}createNodeMesh(e){let t=this.parser.json,n=t.nodes[e];if(!n.extensions||!n.extensions[this.name]||n.mesh===void 0)return null;let r=t.meshes[n.mesh];for(let e of r.primitives)if(e.mode!==ZA.TRIANGLES&&e.mode!==ZA.TRIANGLE_STRIP&&e.mode!==ZA.TRIANGLE_FAN&&e.mode!==void 0)return null;let i=n.extensions[this.name].attributes,a=[],o={};for(let e in i)a.push(this.parser.getDependency(`accessor`,i[e]).then(t=>(o[e]=t,o[e])));return a.length<1?null:(a.push(this.parser.createNodeMesh(e)),Promise.all(a).then(e=>{let t=e.pop(),n=t.isGroup?t.children:[t],r=e[0].count,i=[];for(let e of n){let t=new Y,n=new J,a=new Wb,s=new J(1,1,1),c=new mw(e.geometry,e.material,r);for(let e=0;e0||e.search(/^data\:image\/jpeg/)===0?`image/jpeg`:e.search(/\.webp($|\?)/i)>0||e.search(/^data\:image\/webp/)===0?`image/webp`:e.search(/\.ktx2($|\?)/i)>0||e.search(/^data\:image\/ktx2/)===0?`image/ktx2`:`image/png`}var hj=new Y,gj=class{constructor(e={},t={}){this.json=e,this.extensions={},this.plugins={},this.options=t,this.cache=new xA,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let n=!1,r=-1,i=!1,a=-1;if(typeof navigator<`u`){let e=navigator.userAgent;n=/^((?!chrome|android).)*safari/i.test(e)===!0;let t=e.match(/Version\/(\d+)/);r=n&&t?parseInt(t[1],10):-1,i=e.indexOf(`Firefox`)>-1,a=i?e.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>`u`||n&&r<17||i&&a<98?this.textureLoader=new OT(this.options.manager):this.textureLoader=new JT(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new TT(this.options.manager),this.fileLoader.setResponseType(`arraybuffer`),this.options.crossOrigin===`use-credentials`&&this.fileLoader.setWithCredentials(!0)}setExtensions(e){this.extensions=e}setPlugins(e){this.plugins=e}parse(e,t){let n=this,r=this.json,i=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(e){return e._markDefs&&e._markDefs()}),Promise.all(this._invokeAll(function(e){return e.beforeRoot&&e.beforeRoot()})).then(function(){return Promise.all([n.getDependencies(`scene`),n.getDependencies(`animation`),n.getDependencies(`camera`)])}).then(function(t){let a={scene:t[0][r.scene||0],scenes:t[0],animations:t[1],cameras:t[2],asset:r.asset,parser:n,userData:{}};return sj(i,a,r),cj(a,r),Promise.all(n._invokeAll(function(e){return e.afterRoot&&e.afterRoot(a)})).then(function(){for(let e of a.scenes)e.updateMatrixWorld();e(a)})}).catch(t)}_markDefs(){let e=this.json.nodes||[],t=this.json.skins||[],n=this.json.meshes||[];for(let n=0,r=t.length;n{let n=this.associations.get(e);n!=null&&this.associations.set(t,n);for(let[n,r]of e.children.entries())i(r,t.children[n])};return i(n,r),r.name+=`_instance_`+ e.uses[t]++,r}_invokeOne(e){let t=Object.values(this.plugins);t.push(this);for(let n=0;n=2&&p.setY(t,u[e*a+1]),a>=3&&p.setZ(t,u[e*a+2]),a>=4&&p.setW(t,u[e*a+3]),a>=5)throw Error(`THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.`)}p.normalized=d}return p})}loadTexture(e){let t=this.json,n=this.options,r=t.textures[e].source,i=t.images[r],a=this.textureLoader;if(i.uri){let e=n.manager.getHandler(i.uri);e!==null&&(a=e)}return this.loadTextureImage(e,r,a)}loadTextureImage(e,t,n){let r=this,i=this.json,a=i.textures[e],o=i.images[t],s=(o.uri||o.bufferView)+`:`+a.sampler;if(this.textureCache[s])return this.textureCache[s];let c=this.loadImageSource(t,n).then(function(t){t.flipY=!1,t.name=a.name||o.name||``,t.name===``&&typeof o.uri==`string`&&o.uri.startsWith(`data:image/`)===!1&&(t.name=o.uri);let n=(i.samplers||{})[a.sampler]||{};return t.magFilter=$A[n.magFilter]||1006,t.minFilter=$A[n.minFilter]||1008,t.wrapS=ej[n.wrapS]||1e3,t.wrapT=ej[n.wrapT]||1e3,t.generateMipmaps=!t.isCompressedTexture&&t.minFilter!==1003&&t.minFilter!==1006,r.associations.set(t,{textures:e}),t}).catch(function(){return null});return this.textureCache[s]=c,c}loadImageSource(e,t){let n=this,r=this.json,i=this.options;if(this.sourceCache[e]!==void 0)return this.sourceCache[e].then(e=>e.clone());let a=r.images[e],o=self.URL||self.webkitURL,s=a.uri||``,c=!1;if(a.bufferView!==void 0)s=n.getDependency(`bufferView`,a.bufferView).then(function(e){c=!0;let t=new Blob([e],{type:a.mimeType});return s=o.createObjectURL(t),s});else if(a.uri===void 0)throw Error(`THREE.GLTFLoader: Image `+e+` is missing URI and bufferView`);let l=Promise.resolve(s).then(function(e){return new Promise(function(n,r){let a=n;t.isImageBitmapLoader===!0&&(a=function(e){let t=new gx(e);t.needsUpdate=!0,n(t)}),t.load(KT.resolveURL(e,i.path),a,void 0,r)})}).then(function(e){return c===!0&&o.revokeObjectURL(s),cj(e,a),e.userData.mimeType=a.mimeType||mj(a.uri),e}).catch(function(e){throw console.error(`THREE.GLTFLoader: Couldn't load texture`,s),e});return this.sourceCache[e]=l,l}assignTexture(e,t,n,r){let i=this;return this.getDependency(`texture`,n.index).then(function(a){if(!a)return null;if(n.texCoord!==void 0&&n.texCoord>0&&(a=a.clone(),a.channel=n.texCoord),i.extensions[SA.KHR_TEXTURE_TRANSFORM]){let e=n.extensions===void 0?void 0:n.extensions[SA.KHR_TEXTURE_TRANSFORM];if(e){let t=i.associations.get(a);a=i.extensions[SA.KHR_TEXTURE_TRANSFORM].extendTexture(a,e),i.associations.set(a,t)}}return r!==void 0&&(a.colorSpace=r),e[t]=a,a})}assignFinalMaterial(e){let t=e.geometry,n=e.material,r=t.attributes.tangent===void 0,i=t.attributes.color!==void 0,a=t.attributes.normal===void 0;if(e.isPoints){let e=`PointsMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Iw,HS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,t.sizeAttenuation=!1,this.cache.add(e,t)),n=t}else if(e.isLine){let e=`LineBasicMaterial:`+n.uuid,t=this.cache.get(e);t||(t=new Sw,HS.prototype.copy.call(t,n),t.color.copy(n.color),t.map=n.map,this.cache.add(e,t)),n=t}if(r||i||a){let e=`ClonedMaterial:`+n.uuid+`:`;r&&(e+=`derivative-tangents:`),i&&(e+=`vertex-colors:`),a&&(e+=`flat-shading:`);let t=this.cache.get(e);t||(t=n.clone(),i&&(t.vertexColors=!0),a&&(t.flatShading=!0),r&&(t.normalScale&&(t.normalScale.y*=-1),t.clearcoatNormalScale&&(t.clearcoatNormalScale.y*=-1)),this.cache.add(e,t),this.associations.set(t,this.associations.get(n))),n=t}e.material=n}getMaterialType(){return Jw}loadMaterial(e){let t=this,n=this.json,r=this.extensions,i=n.materials[e],a,o={},s=i.extensions||{},c=[];if(s[SA.KHR_MATERIALS_UNLIT]){let e=r[SA.KHR_MATERIALS_UNLIT];a=e.getMaterialType(),c.push(e.extendParams(o,i,t))}else{let n=i.pbrMetallicRoughness||{};if(o.color=new X(1,1,1),o.opacity=1,Array.isArray(n.baseColorFactor)){let e=n.baseColorFactor;o.color.setRGB(e[0],e[1],e[2],gb),o.opacity=e[3]}n.baseColorTexture!==void 0&&c.push(t.assignTexture(o,`map`,n.baseColorTexture,hb)),o.metalness=n.metallicFactor===void 0?1:n.metallicFactor,o.roughness=n.roughnessFactor===void 0?1:n.roughnessFactor,n.metallicRoughnessTexture!==void 0&&(c.push(t.assignTexture(o,`metalnessMap`,n.metallicRoughnessTexture)),c.push(t.assignTexture(o,`roughnessMap`,n.metallicRoughnessTexture))),a=this._invokeOne(function(t){return t.getMaterialType&&t.getMaterialType(e)}),c.push(Promise.all(this._invokeAll(function(t){return t.extendMaterialParams&&t.extendMaterialParams(e,o)})))}i.doubleSided===!0&&(o.side=2);let l=i.alphaMode||aj.OPAQUE;if(l===aj.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,l===aj.MASK&&(o.alphaTest=i.alphaCutoff===void 0?.5:i.alphaCutoff)),i.normalTexture!==void 0&&a!==US&&(c.push(t.assignTexture(o,`normalMap`,i.normalTexture)),o.normalScale=new Ub(1,1),i.normalTexture.scale!==void 0)){let e=i.normalTexture.scale;o.normalScale.set(e,e)}if(i.occlusionTexture!==void 0&&a!==US&&(c.push(t.assignTexture(o,`aoMap`,i.occlusionTexture)),i.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=i.occlusionTexture.strength)),i.emissiveFactor!==void 0&&a!==US){let e=i.emissiveFactor;o.emissive=new X().setRGB(e[0],e[1],e[2],gb)}return i.emissiveTexture!==void 0&&a!==US&&c.push(t.assignTexture(o,`emissiveMap`,i.emissiveTexture,hb)),Promise.all(c).then(function(){let n=new a(o);return i.name&&(n.name=i.name),cj(n,i),t.associations.set(n,{materials:e}),i.extensions&&sj(r,n,i),n})}createUniqueName(e){let t=sE.sanitizeNodeName(e||``);return t in this.nodeNamesUsed?t+`_`+ ++this.nodeNamesUsed[t]:(this.nodeNamesUsed[t]=0,t)}loadGeometries(e){let t=this,n=this.extensions,r=this.primitiveCache;function i(e){return n[SA.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(e,t).then(function(n){return vj(n,e,t)})}let a=[];for(let n=0,o=e.length;n0&&uj(d,i),d.name=t.createUniqueName(i.name||`mesh_`+e),cj(d,i),u.extensions&&sj(r,d,u),t.assignFinalMaterial(d),c.push(d)}for(let n=0,r=c.length;n1?new RC:t.length===1?t[0]:new xS,o!==t[0])for(let e=0,n=t.length;e1){let e=r.associations.get(o);r.associations.set(o,{...e})}return r.associations.get(o).nodes=e,o}),this.nodeCache[e]}loadScene(e){let t=this.extensions,n=this.json.scenes[e],r=this,i=new RC;n.name&&(i.name=r.createUniqueName(n.name)),cj(i,n),n.extensions&&sj(t,i,n);let a=n.nodes||[],o=[];for(let e=0,t=a.length;e{let t=new Map;for(let[e,n]of r.associations)(e instanceof HS||e instanceof gx)&&t.set(e,n);return e.traverse(e=>{let n=r.associations.get(e);n!=null&&t.set(e,n)}),t})(i),i})}_createAnimationTracks(e,t,n,r,i){let a=[],o=e.name?e.name:e.uuid,s=[];rj[i.path]===rj.weights?e.traverse(function(e){e.morphTargetInfluences&&s.push(e.name?e.name:e.uuid)}):s.push(o);let c;switch(rj[i.path]){case rj.weights:c=dT;break;case rj.rotation:c=pT;break;case rj.translation:case rj.scale:c=hT;break;default:switch(n.itemSize){case 1:c=dT;break;default:c=hT;break}break}let l=r.interpolation===void 0?sb:ij[r.interpolation],u=this._getArrayFromAccessor(n);for(let e=0,n=s.length;e0?t[t.length-1]:``,smooth:n===void 0?this.smooth:n.smooth,groupStart:n===void 0?0:n.groupEnd,groupEnd:-1,groupCount:-1,inherited:!1,clone:function(e){let t={index:typeof e==`number`?e:this.index,name:this.name,mtllib:this.mtllib,smooth:this.smooth,groupStart:0,groupEnd:-1,groupCount:-1,inherited:!1};return t.clone=this.clone.bind(t),t}};return this.materials.push(r),r},currentMaterial:function(){if(this.materials.length>0)return this.materials[this.materials.length-1]},_finalize:function(e){let t=this.currentMaterial();if(t&&t.groupEnd===-1&&(t.groupEnd=this.geometry.vertices.length/3,t.groupCount=t.groupEnd-t.groupStart,t.inherited=!1),e&&this.materials.length>1)for(let e=this.materials.length-1;e>=0;e--)this.materials[e].groupCount<=0&&this.materials.splice(e,1);return e&&this.materials.length===0&&this.materials.push({name:``,smooth:this.smooth}),t}},n&&n.name&&typeof n.clone==`function`){let e=n.clone(0);e.inherited=!0,this.object.materials.push(e)}this.objects.push(this.object)},finalize:function(){this.object&&typeof this.object._finalize==`function`&&this.object._finalize(!0)},parseVertexIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseNormalIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/3)*3},parseUVIndex:function(e,t){let n=parseInt(e,10);return(n>=0?n-1:n+t/2)*2},addVertex:function(e,t,n){let r=this.vertices,i=this.object.geometry.vertices;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addVertexPoint:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addVertexLine:function(e){let t=this.vertices;this.object.geometry.vertices.push(t[e+0],t[e+1],t[e+2])},addNormal:function(e,t,n){let r=this.normals,i=this.object.geometry.normals;i.push(r[e+0],r[e+1],r[e+2]),i.push(r[t+0],r[t+1],r[t+2]),i.push(r[n+0],r[n+1],r[n+2])},addFaceNormal:function(e,t,n){let r=this.vertices,i=this.object.geometry.normals;wj.fromArray(r,e),Tj.fromArray(r,t),Ej.fromArray(r,n),Oj.subVectors(Ej,Tj),Dj.subVectors(wj,Tj),Oj.cross(Dj),Oj.normalize(),i.push(Oj.x,Oj.y,Oj.z),i.push(Oj.x,Oj.y,Oj.z),i.push(Oj.x,Oj.y,Oj.z)},addColor:function(e,t,n){let r=this.colors,i=this.object.geometry.colors;r[e]!==void 0&&i.push(r[e+0],r[e+1],r[e+2]),r[t]!==void 0&&i.push(r[t+0],r[t+1],r[t+2]),r[n]!==void 0&&i.push(r[n+0],r[n+1],r[n+2])},addUV:function(e,t,n){let r=this.uvs,i=this.object.geometry.uvs;i.push(r[e+0],r[e+1]),i.push(r[t+0],r[t+1]),i.push(r[n+0],r[n+1])},addDefaultUV:function(){let e=this.object.geometry.uvs;e.push(0,0),e.push(0,0),e.push(0,0)},addUVLine:function(e){let t=this.uvs;this.object.geometry.uvs.push(t[e+0],t[e+1])},addFace:function(e,t,n,r,i,a,o,s,c){let l=this.vertices.length,u=this.parseVertexIndex(e,l),d=this.parseVertexIndex(t,l),f=this.parseVertexIndex(n,l);if(this.addVertex(u,d,f),this.addColor(u,d,f),o!==void 0&&o!==``){let e=this.normals.length;u=this.parseNormalIndex(o,e),d=this.parseNormalIndex(s,e),f=this.parseNormalIndex(c,e),this.addNormal(u,d,f)}else this.addFaceNormal(u,d,f);if(r!==void 0&&r!==``){let e=this.uvs.length;u=this.parseUVIndex(r,e),d=this.parseUVIndex(i,e),f=this.parseUVIndex(a,e),this.addUV(u,d,f),this.object.geometry.hasUVIndices=!0}else this.addDefaultUV()},addPointGeometry:function(e){this.object.geometry.type=`Points`;let t=this.vertices.length;for(let n=0,r=e.length;n=7?(kj.setRGB(parseFloat(e[4]),parseFloat(e[5]),parseFloat(e[6]),hb),t.colors.push(kj.r,kj.g,kj.b)):t.colors.push(void 0,void 0,void 0);break;case`vn`:t.normals.push(parseFloat(e[1]),parseFloat(e[2]),parseFloat(e[3]));break;case`vt`:t.uvs.push(parseFloat(e[1]),parseFloat(e[2]));break}}else if(a===`f`){let e=i.slice(1).trim().split(Cj),n=[];for(let t=0,r=e.length;t0){let e=r.split(`/`);n.push(e)}}let r=n[0];for(let e=1,i=n.length-1;e1){let e=r[1].trim().toLowerCase();t.object.smooth=e!==`0`&&e!==`off`}else t.object.smooth=!0;let e=t.object.currentMaterial();e&&(e.smooth=t.object.smooth)}else{if(i===`\0`)continue;console.warn(`THREE.OBJLoader: Unexpected line: "`+i+`"`)}}t.finalize();let i=new RC;if(i.materialLibraries=[].concat(t.materialLibraries),!(t.objects.length===1&&t.objects[0].geometry.vertices.length===0))for(let e=0,n=t.objects.length;e0&&l.setAttribute(`normal`,new XS(r.normals,3)),r.colors.length>0&&(c=!0,l.setAttribute(`color`,new XS(r.colors,3))),r.hasUVIndices===!0&&l.setAttribute(`uv`,new XS(r.uvs,2));let u=[];for(let e=0,n=a.length;e1){for(let e=0,t=a.length;e0){let e=new Iw({size:1,sizeAttenuation:!1}),n=new iC;n.setAttribute(`position`,new XS(t.vertices,3)),t.colors.length>0&&t.colors[0]!==void 0&&(n.setAttribute(`color`,new XS(t.colors,3)),e.vertexColors=!0);let r=new Vw(n,e);i.add(r)}return i}},Mj=(e,t,n)=>{let r=e.split(/\./g).pop()?.toLowerCase();if(e.startsWith(`blob:`)&&e.includes(`#.`)){let t=e.split(`#.`).pop();t&&(r=t.toLowerCase())}if(!r){console.error(`Could not determine file extension for: ${e}`),n(null,Error(`Unsupported file format: ${e}`));return}switch(r){case`gltf`:case`glb`:new bA(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`obj`:new jj(t).load(e,e=>n(e),()=>{},e=>n(null,e));break;case`dae`:new Mk(t).load(e,e=>n(e.scene),void 0,e=>n(null,e));break;case`stl`:console.log(`🔧 Loading STL file: ${e}`),new Ak(t).load(e,t=>{console.log(`✅ STL loaded successfully: ${e}`),n(new gC(t,new Xw))},t=>{console.log(`📊 STL loading progress: ${e}`,t)},t=>{console.error(`❌ STL loading failed: ${e}`,t),console.log(`🔄 Creating fallback geometry for: ${e}`),n(new gC(new yC(.05,.05,.05),new Xw({color:16739125,transparent:!0,opacity:.7})))});break;default:n(null,Error(`Unsupported file format: ${r}`))}};function Nj(e,t){e.innerHTML=``;let n=document.createElement(`urdf-viewer`);n.classList.add(`w-full`,`h-full`),e.appendChild(n),n.setAttribute(`up`,`Z`),Lj(n,t?`#2c2b3a`:`#eff4ff`),n.setAttribute(`highlight-color`,t?`#df6dd4`:`#b05ffe`),n.setAttribute(`auto-redraw`,`true`);let r=new GT(14079702,1);n.scene.add(r);let i=new WT(16777215,.8);return i.position.set(5,30,5),i.castShadow=!0,n.scene.add(i),n}function Pj(e,t){`loadMeshFunc`in e&&(e.loadMeshFunc=(e,n,r)=>{let i=t?t(e):e;try{Mj(i,n,(e,t)=>{t?(console.warn(`Error loading mesh ${i}:`,t),r(null)):r(e)})}catch(e){console.error(`Exception loading mesh ${i}:`,e),r(null,e)}})}function Fj(e,t){let n=e=>{t(e.detail)},r=()=>{t(null)};return e.addEventListener(`joint-mouseover`,n),e.addEventListener(`joint-mouseout`,r),()=>{e.removeEventListener(`joint-mouseover`,n),e.removeEventListener(`joint-mouseout`,r)}}function Ij(e,t,n,r,i=[]){let a=t.startsWith(`blob:`)&&!t.includes(`#.`)?t+`#.urdf`:t;e.setAttribute(`urdf`,a),e.setAttribute(`package`,n);let o=()=>{if(i.length>0){let e=i[0];e&&(r(e),Nn.info(`Trying alternative model...`,{description:`First model failed to load. Trying ${e.split(`/`).pop()||`alternative model`}`,duration:2e3}))}};return e.addEventListener(`error`,o),()=>{e.removeEventListener(`error`,o)}}function Lj(e,t){let n=e.parentElement;n&&(n.style.backgroundColor=t)}typeof window<`u`&&!customElements.get(`urdf-viewer`)&&customElements.define(`urdf-viewer`,pA);var Rj=(0,_.memo)(()=>{let e=(0,_.useRef)(null),[t,n]=(0,_.useState)(null),{registerUrdfProcessor:r,alternativeUrdfModels:i,isDefaultModel:a}=rr(),o=(0,_.useRef)(null),s=(0,_.useRef)(null),c=(0,_.useRef)(!1),{isConnected:l}=gA({viewerRef:s,enabled:a}),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(null),m=(0,_.useRef)(``),h=(0,_.useMemo)(()=>({loadUrdf:e=>{d(e)},setUrlModifierFunc:e=>{p(()=>e)},getPackage:()=>m.current}),[]);(0,_.useEffect)(()=>{r(h)},[r,h]);let g=(0,_.useCallback)(e=>{if(console.log(`🔗 defaultUrlModifier called with: ${e}`),e.startsWith(`package://so_arm_description/meshes/`)){let t=e.replace(`package://so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (package): ${t}`),t}if(e.includes(`so_arm_description/meshes/`)){let t=e.replace(/.*so_arm_description\/meshes\//,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (partial): ${t}`),t}if(e.includes(`/so-101-urdf/so_arm_description/meshes/`)){let t=e.replace(`/so-101-urdf/so_arm_description/meshes/`,`/so-101-urdf/meshes/`);return console.log(`🔗 Modified URL (problematic path): ${t}`),t}if(e.endsWith(`.stl`)&&!e.startsWith(`/`)&&!e.startsWith(`http`)){let t=`/so-101-urdf/meshes/${e}`;return console.log(`🔗 Modified URL (relative): ${t}`),t}return console.log(`🔗 Unmodified URL: ${e}`),e},[]);return(0,_.useEffect)(()=>{if(!e.current)return;let t=Nj(e.current,!0);s.current=t,Pj(t,a?g:f);let r=a?`/so-101-urdf/urdf/so101_new_calib.urdf`:u||``;a&&(m.current=`/`);let l=()=>{};r&&(l=Ij(t,r,m.current,d,i));let p=Fj(t,n),h=e=>{if(!e||!e.robot){console.log(`[RobotViewer] Cannot fit to view: No viewer or robot available`);return}try{let t=new Sx().setFromObject(e.robot),n=new J;t.getCenter(n);let r=new J;t.getSize(r);let i=Math.max(r.x,r.y,r.z);e.camera.position.copy(n);let a=new J;e.up===`+Z`||e.up===`Z`||e.up===`+Y`||e.up,a.set(1,1,1),a.normalize().multiplyScalar(i*1.3),e.camera.position.add(a),e.controls.target.copy(n),e.controls.update(),e.redraw(),console.log(`[RobotViewer] Robot auto-fitted to view`)}catch(e){console.error(`[RobotViewer] Error fitting robot to view:`,e)}},_=()=>{h(t)},v=()=>{c.current=!0,`setJointValue`in t&&(o.current&&=(o.current(),null)),_()};return t.addEventListener(`urdf-processed`,v),()=>{o.current&&=(o.current(),null),c.current=!1,p(),l(),t.removeEventListener(`urdf-processed`,v)}},[a,u,f,g,i]),(0,V.jsxs)(`div`,{className:W(`w-full h-full transition-all duration-300 ease-in-out relative`,`bg-gradient-to-br from-gray-900 to-gray-800`),children:[(0,V.jsx)(`div`,{ref:e,className:`w-full h-full`}),t&&(0,V.jsxs)(`div`,{className:`absolute bottom-4 right-4 bg-black/70 text-white px-3 py-2 rounded-md text-sm font-mono z-10`,children:[`Joint: `,t]}),a&&(0,V.jsx)(`div`,{className:`absolute top-4 right-4 z-10`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 rounded-md text-sm font-mono ${l?`bg-green-900/70 text-green-300`:`bg-red-900/70 text-red-300`}`,children:[(0,V.jsx)(`div`,{className:`w-2 h-2 rounded-full ${l?`bg-green-400`:`bg-red-400`}`}),l?`Live Robot Data`:`Disconnected`]})})]})}),zj=({className:e,iconOnly:t=!1})=>(0,V.jsxs)(`div`,{className:W(`flex items-center gap-2`,e),children:[(0,V.jsx)(`img`,{src:`/lovable-uploads/5e648747-34b7-4d8f-93fd-4dbd00aeeefc.png`,alt:`LeLab Logo`,className:`h-8 w-8`}),!t&&(0,V.jsx)(`span`,{className:`font-bold text-white text-2xl`,children:`LeLab`})]}),Bj=({onGoBack:e,className:t,rightSlot:n})=>(0,V.jsxs)(`div`,{className:W(`w-full p-2 sm:p-4 space-y-4 lg:space-y-0 lg:space-x-4 flex flex-col lg:flex-row`,t),children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex-1 flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-4`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:e,className:`text-gray-400 hover:text-white hover:bg-gray-800 flex-shrink-0`,children:(0,V.jsx)(Ca,{className:`h-5 w-5`})}),(0,V.jsx)(zj,{iconOnly:!0}),(0,V.jsx)(`div`,{className:`w-px h-6 bg-gray-700`}),(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Teleoperation`})]}),(0,V.jsx)(`div`,{className:`flex-1 bg-black rounded border border-gray-800 min-h-[50vh] lg:min-h-0`,children:(0,V.jsx)(Rj,{})})]}),n&&(0,V.jsx)(`div`,{className:`lg:w-96 flex flex-col`,children:n})]}),Vj=`Switch`,[Hj,wte]=Sr(Vj),[Uj,Wj]=Hj(Vj),Gj=_.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c=`on`,onCheckedChange:l,form:u,...d}=e,[f,p]=_.useState(null),m=br(t,e=>p(e)),h=_.useRef(!1),g=f?u||!!f.closest(`form`):!0,[v,y]=ui({prop:i,defaultProp:a??!1,onChange:l,caller:Vj});return(0,V.jsxs)(Uj,{scope:n,checked:v,disabled:s,children:[(0,V.jsx)(U.button,{type:`button`,role:`switch`,"aria-checked":v,"aria-required":o,"data-state":Xj(v),"data-disabled":s?``:void 0,disabled:s,value:c,...d,ref:m,onClick:H(e.onClick,e=>{y(e=>!e),g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})}),g&&(0,V.jsx)(Yj,{control:f,bubbles:!h.current,name:r,value:c,checked:v,required:o,disabled:s,form:u,style:{transform:`translateX(-100%)`}})]})});Gj.displayName=Vj;var Kj=`SwitchThumb`,qj=_.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=Wj(Kj,n);return(0,V.jsx)(U.span,{"data-state":Xj(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});qj.displayName=Kj;var Jj=`SwitchBubbleInput`,Yj=_.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:r=!0,...i},a)=>{let o=_.useRef(null),s=br(o,a),c=Mh(n),l=Hf(t);return _.useEffect(()=>{let e=o.current;if(!e)return;let t=window.HTMLInputElement.prototype,i=Object.getOwnPropertyDescriptor(t,`checked`).set;if(c!==n&&i){let t=new Event(`click`,{bubbles:r});i.call(e,n),e.dispatchEvent(t)}},[c,n,r]),(0,V.jsx)(`input`,{type:`checkbox`,"aria-hidden":!0,defaultChecked:n,...i,tabIndex:-1,ref:s,style:{...i.style,...l,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0}})});Yj.displayName=Jj;function Xj(e){return e?`checked`:`unchecked`}var Zj=Gj,Qj=qj,$j=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(Zj,{className:W(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,e),...t,ref:n,children:(0,V.jsx)(Qj,{className:W(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)})}));$j.displayName=Zj.displayName;var eM=({deviceId:e,label:t})=>{let{videoRef:n,hasError:r}=cv(e,!1);return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 overflow-hidden`,children:[(0,V.jsx)(`div`,{className:`aspect-[4/3] bg-gray-800 relative`,children:e&&!r?(0,V.jsx)(`video`,{ref:n,autoPlay:!0,muted:!0,playsInline:!0,className:`w-full h-full object-cover`}):(0,V.jsxs)(`div`,{className:`w-full h-full flex flex-col items-center justify-center`,children:[(0,V.jsx)(uo,{className:`w-8 h-8 text-gray-500 mb-2`}),(0,V.jsx)(`span`,{className:`text-gray-500 text-sm`,children:e?`Preview failed`:`No camera selected`})]})}),t&&(0,V.jsx)(`div`,{className:`p-2 text-sm text-gray-300 truncate border-t border-gray-800`,children:t})]})},tM=()=>{let[e,t]=(0,_.useState)(!1),[n,r]=(0,_.useState)(0),{selectedRecord:i,isLoading:a}=Lv(),o=(i?.cameras??[]).map(e=>({key:e.id,name:e.name,deviceId:e.device_id}));return(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-4 flex flex-col gap-4 h-full`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-medium text-gray-200`,children:`Cameras`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e&&o.length>0&&(0,V.jsx)(G,{type:`button`,variant:`ghost`,size:`icon`,onClick:()=>r(e=>e+1),className:`h-9 w-9 text-gray-400 hover:text-white flex-shrink-0`,title:`Retry camera feeds (e.g. after reconnecting a camera)`,"aria-label":`Retry camera feeds`,children:(0,V.jsx)(Qa,{className:`w-4 h-4`})}),(0,V.jsx)(q,{htmlFor:`teleop-camera-toggle`,className:`text-sm text-gray-400`,children:e?`On`:`Off`}),(0,V.jsx)($j,{id:`teleop-camera-toggle`,checked:e,onCheckedChange:t})]})]}),e?o.length>0?(0,V.jsx)(`div`,{className:`flex flex-col gap-3 overflow-y-auto`,children:o.map(e=>(0,V.jsx)(eM,{deviceId:e.deviceId,label:e.name},`${e.key}:${n}`))}):(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:a?`Loading robot...`:`No cameras configured for this robot. Add them during calibration to see live feeds here.`}):(0,V.jsx)(`p`,{className:`text-sm text-gray-500`,children:`Turn on to watch your cameras while you teleoperate.`})]})},nM=()=>{let e=Re(),{toast:t}=_r(),{baseUrl:n,fetchWithHeaders:r}=Rs(),i=(0,_.useRef)(!1),a=(0,_.useCallback)(async()=>{if(!i.current){i.current=!0;try{(await(await r(`${n}/stop-teleoperation`,{method:`POST`})).json())?.success&&t({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly.`})}catch{}}},[n,r,t]);return(0,_.useEffect)(()=>{let e=()=>{try{sessionStorage.setItem(`lelab:teleop-stopped`,`1`)}catch{}fetch(`${n}/stop-teleoperation`,{method:`POST`,keepalive:!0}).catch(()=>{})};return window.addEventListener(`pagehide`,e),()=>{window.removeEventListener(`pagehide`,e),a()}},[n,a]),(0,V.jsx)(`div`,{className:`min-h-screen bg-black flex items-center justify-center p-2 sm:p-4`,children:(0,V.jsx)(`div`,{className:`w-full h-[95vh] flex`,children:(0,V.jsx)(Bj,{onGoBack:async()=>{await a(),e(`/`)},className:`lg:w-full`,rightSlot:(0,V.jsx)(tM,{})})})})},rM=ga(`inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2`,{variants:{variant:{default:`border-transparent bg-primary text-primary-foreground hover:bg-primary/80`,secondary:`border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80`,destructive:`border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80`,outline:`text-foreground`}},defaultVariants:{variant:`default`}});function iM({className:e,variant:t,...n}){return(0,V.jsx)(`div`,{className:W(rM({variant:t}),e),...n})}var aM=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=ws(`Primitive.${t}`),r=_.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{}),oM=`Separator`,sM=`horizontal`,cM=[`horizontal`,`vertical`],lM=_.forwardRef((e,t)=>{let{decorative:n,orientation:r=sM,...i}=e,a=uM(r)?r:sM,o=n?{role:`none`}:{"aria-orientation":a===`vertical`?a:void 0,role:`separator`};return(0,V.jsx)(aM.div,{"data-orientation":a,...o,...i,ref:t})});lM.displayName=oM;function uM(e){return cM.includes(e)}var dM=lM,fM=_.forwardRef(({className:e,orientation:t=`horizontal`,decorative:n=!0,...r},i)=>(0,V.jsx)(dM,{ref:i,decorative:n,orientation:t,className:W(`shrink-0 bg-border`,t===`horizontal`?`h-[1px] w-full`:`h-full w-[1px]`,e),...r}));fM.displayName=dM.displayName;var pM=({onClick:e,robotType:t,className:n=``})=>(0,V.jsxs)(G,{type:`button`,onClick:e,variant:`outline`,size:`sm`,className:` - h-8 px-2 - border-gray-600 hover:border-blue-500 - text-gray-400 hover:text-blue-400 - bg-gray-800 hover:bg-gray-700 - transition-all duration-200 - ${n} - `,title:`Find ${t||`robot`} port automatically`,children:[(0,V.jsx)(eo,{className:`w-3 h-3 mr-1`}),`Find`]}),mM=2e3,hM=({open:e,onOpenChange:t,robotType:n,onPortDetected:r})=>{let[i,a]=(0,_.useState)(`detecting`),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(``),u=(0,_.useRef)(!1),d=(0,_.useRef)(null),f=(0,_.useRef)(null),{toast:p}=_r(),{baseUrl:m,fetchWithHeaders:h}=Rs(),g=async()=>{try{d.current=new AbortController;let e=await(await h(`${m}/start-port-detection`,{method:`POST`,body:JSON.stringify({robot_type:n}),signal:d.current.signal})).json();if(u.current)return;if(e.status!==`success`)throw Error(e.message||`Failed to start port detection`);let i=e.data.ports_before;for(;!u.current;){d.current=new AbortController;let e=await(await h(`${m}/detect-port-after-disconnect`,{method:`POST`,body:JSON.stringify({ports_before:i}),signal:d.current.signal})).json();if(u.current)return;if(e.status===`success`){if(s(e.port),await v(e.port),u.current)return;a(`success`),p({title:`Port Detected Successfully`,description:`${n} port detected: ${e.port}`}),f.current=window.setTimeout(()=>{u.current||(r(e.port),t(!1))},mM);return}let o=typeof e.message==`string`?e.message:``;if(!o.includes(`Timed out`))throw Error(o||`Failed to detect port`)}}catch(e){if(u.current||e instanceof DOMException&&e.name===`AbortError`)return;console.error(`Port detection failed:`,e),l(e instanceof Error?e.message:`Unknown error`),a(`error`)}},v=async e=>{try{await h(`${m}/save-robot-port`,{method:`POST`,body:JSON.stringify({robot_type:n,port:e})})}catch(e){console.error(`Error saving port:`,e)}};(0,_.useEffect)(()=>{if(e)return u.current=!1,a(`detecting`),l(``),s(``),g(),()=>{u.current=!0,d.current?.abort(),f.current!==null&&(window.clearTimeout(f.current),f.current=null)}},[e]);let y=()=>{t(!1)},b=()=>{u.current=!1,d.current?.abort(),a(`detecting`),l(``),s(``),g()};return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-gray-900 border-gray-800 text-white sm:max-w-[500px] p-8`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsx)(Du,{className:`text-white text-center text-xl font-bold`,children:`Port Detection`}),(0,V.jsxs)(Ou,{className:`text-gray-400 text-center`,children:[`Detect the USB port for your `,n,` arm`]})]}),(0,V.jsx)(`div`,{className:`py-4`,children:(()=>{switch(i){case`detecting`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(qa,{className:`w-16 h-16 text-blue-500 mx-auto animate-spin`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`h3`,{className:`text-lg font-semibold text-white`,children:[`Unplug the `,n,` arm`]}),(0,V.jsxs)(`p`,{className:`text-gray-400`,children:[`Disconnect the `,n,` robot arm from USB. The port will be detected automatically.`]})]}),(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})})]});case`success`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(Ma,{className:`w-16 h-16 text-green-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Port Detected`}),(0,V.jsx)(`p`,{className:`text-xl font-mono text-green-400 bg-gray-800 px-4 py-2 rounded inline-block`,children:o})]})]});case`error`:return(0,V.jsxs)(`div`,{className:`space-y-6 text-center`,children:[(0,V.jsx)(ja,{className:`w-16 h-16 text-red-500 mx-auto`}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`h3`,{className:`text-lg font-semibold text-white`,children:`Detection Failed`}),(0,V.jsx)(`div`,{className:`bg-red-900/20 border border-red-800 rounded-lg p-3`,children:(0,V.jsx)(`p`,{className:`text-red-400 text-sm`,children:c})})]}),(0,V.jsxs)(`div`,{className:`flex gap-4 justify-center`,children:[(0,V.jsx)(G,{onClick:b,className:`bg-blue-500 hover:bg-blue-600 text-white px-8 py-2`,children:`Try Again`}),(0,V.jsx)(G,{onClick:y,variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white px-8 py-2`,children:`Cancel`})]})]});default:return null}})()})]})})},gM={teleop:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1150},robot:{shoulder_pan:2400,shoulder_lift:2300,elbow_flex:2150,wrist_flex:2250,wrist_roll:3700,gripper:1400}},_M=.98;function vM(e,t,n){if(!e)return!1;let r=gM[e]?.[t];return r?n>=r*_M:!1}var yM=`Motor discontinuity detected`,bM=()=>{let e=Re(),t=Ie().state?.robot_name??null,{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs();(0,_.useRef)(null);let a=(0,_.useRef)(null),[o,s]=(0,_.useState)(`teleop`),[c,l]=(0,_.useState)(``),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)([]),[m,h]=(0,_.useState)(!1),g=(0,_.useRef)(null),v=(0,_.useCallback)(async()=>{if(!t)return null;try{let e=await i(`${r}/robots/${encodeURIComponent(t)}`);if(!e.ok)return null;let n=(await e.json()).robot??null;return d(n),n}catch(e){return console.error(`Failed to load robot record:`,e),null}},[t,r,i]);(0,_.useEffect)(()=>{if(!t)return;let e=!1;return(async()=>{let t=await v();if(!t||e)return;let n=t.leader_config?t.follower_config?`teleop`:`robot`:`teleop`;s(n),l(n===`teleop`?t.leader_port||``:t.follower_port||``),p(t.cameras??[])})(),()=>{e=!0}},[t,v]);let y=e=>{p(e),t&&(g.current&&clearTimeout(g.current),g.current=setTimeout(async()=>{try{await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cameras:e})})}catch(e){console.error(`Failed to save cameras to robot record:`,e)}},500))};(0,_.useEffect)(()=>()=>{g.current&&clearTimeout(g.current)},[]);let[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(`leader`),[w,T]=(0,_.useState)({calibration_active:!1,status:`idle`,device_type:null,error:null,message:``,step:0,total_steps:1,current_positions:null,recorded_ranges:null}),[E,D]=(0,_.useState)(!1),O=(0,_.useRef)(!1);(0,_.useEffect)(()=>{O.current=w.calibration_active},[w.calibration_active]),(0,_.useEffect)(()=>()=>{O.current&&i(`${r}/stop-calibration`,{method:`POST`}).catch(e=>console.error(`Failed to stop calibration on unmount:`,e))},[r,i]);let k=async()=>{try{let e=await i(`${r}/calibration-status`);if(e.ok){let t=await e.json();T(t),!t.calibration_active&&(t.status===`completed`||t.status===`error`||t.status===`idle`)&&D(!1)}}catch(e){console.error(`Error polling status:`,e)}},A=async()=>{if(!t){n({title:`No robot selected`,description:`Open Calibration from a robot's gear icon on the Landing page.`,variant:`destructive`});return}if(!c){n({title:`Missing port`,description:`Set the device's serial port before starting.`,variant:`destructive`});return}let e={device_type:o,port:c,config_file:t,robot_name:t};O.current=!0;try{let t=await(await i(`${r}/start-calibration`,{method:`POST`,body:JSON.stringify(e)})).json();t.success?(n({title:`Calibration Started`,description:`Calibration started for ${o}`}),D(!0)):(O.current=!1,n({title:`Calibration Failed`,description:t.message||`Failed to start calibration`,variant:`destructive`}))}catch(e){O.current=!1,console.error(`Error starting calibration:`,e),n({title:`Error`,description:`Failed to start calibration`,variant:`destructive`})}},j=async()=>{try{let e=await(await i(`${r}/stop-calibration`,{method:`POST`})).json();e.success?n({title:`Calibration Stopped`,description:`Calibration has been stopped`}):n({title:`Error`,description:e.message||`Failed to stop calibration`,variant:`destructive`})}catch(e){console.error(`Error stopping calibration:`,e),n({title:`Error`,description:`Failed to stop calibration`,variant:`destructive`})}},M=async()=>{if(w.calibration_active)try{let e=await(await i(`${r}/complete-calibration-step`,{method:`POST`})).json();e.success?n({title:`Step Completed`,description:e.message}):n({title:`Step Failed`,description:e.message||`Could not complete step`,variant:`destructive`})}catch(e){console.error(`Error completing step:`,e),n({title:`Error`,description:`Could not complete calibration step`,variant:`destructive`})}};(0,_.useEffect)(()=>{w.status===`error`&&w.error?.startsWith(yM)&&a.current?.scrollIntoView({behavior:`smooth`,block:`center`})},[w.status,w.error]),(0,_.useEffect)(()=>{if(!E)return;k();let e=setInterval(()=>{k()},200);return()=>clearInterval(e)},[E]),(0,_.useEffect)(()=>{(async()=>{if(o&&!t)try{let e=await(await i(`${r}/robot-port/${o===`robot`?`follower`:`leader`}`)).json();if(e.status===`success`){let t=e.saved_port||e.default_port;t&&l(t)}}catch(e){console.error(`Error loading default port:`,e)}})()},[o,t,r,i]);let N=e=>{s(e),u&&l(e===`teleop`?u.leader_port||``:u.follower_port||``)};(0,_.useEffect)(()=>{w.status===`completed`&&(async()=>{let e=await v();if(!e)return;let t=e.leader_config?e.follower_config?`teleop`:`robot`:`teleop`;s(t),l(t===`teleop`?e.leader_port||``:e.follower_port||``)})()},[w.status,v]);let P=()=>{C(o===`robot`?`follower`:`leader`),x(!0)},F=(0,_.useCallback)(async e=>{if(!t||!e)return;let n=o===`robot`?`follower_port`:`leader_port`;if(!(u&&u[n]===e))try{let a=await(await i(`${r}/robots/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({[n]:e})})).json();a.robot&&d(a.robot)}catch(e){console.error(`Failed to save port to robot record:`,e)}},[t,o,u,r,i]),I=e=>{l(e),F(e)},ee=(()=>{switch(w.status){case`idle`:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Idle`};case`connecting`:return{color:`bg-yellow-500`,icon:(0,V.jsx)(qa,{className:`w-4 h-4 animate-spin`}),text:`Connecting`};case`recording`:return{color:`bg-purple-500`,icon:(0,V.jsx)(Sa,{className:`w-4 h-4`}),text:`Recording Ranges`};case`completed`:return{color:`bg-green-500`,icon:(0,V.jsx)(Ma,{className:`w-4 h-4`}),text:`Completed`};case`error`:return{color:`bg-red-500`,icon:(0,V.jsx)(Fa,{className:`w-4 h-4`}),text:`Error`};case`stopping`:return{color:`bg-orange-500`,icon:(0,V.jsx)(ao,{className:`w-4 h-4`}),text:`Stopping`};default:return{color:`bg-slate-500`,icon:(0,V.jsx)(to,{className:`w-4 h-4`}),text:`Unknown`}}})();return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-6`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(-1),className:`text-slate-400 hover:text-white hover:bg-slate-800`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(zj,{iconOnly:!0}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:t?`Calibrate "${t}"`:`Device Calibration`})]})]}),!t&&(0,V.jsxs)(ug,{className:`mb-6 bg-amber-900/40 border-amber-700 text-amber-100`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Open Calibration from a robot's gear icon on the Landing page. Each robot has its own calibration; running this page directly is not supported.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Configuration`]})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`deviceType`,className:`text-sm font-medium text-slate-300`,children:`Device Type *`}),(0,V.jsxs)(J_,{value:o,onValueChange:N,children:[(0,V.jsx)(X_,{className:`bg-slate-700 border-slate-600 text-white rounded-md`,children:(0,V.jsx)(Y_,{placeholder:`Select device type`})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-700 text-white`,children:[(0,V.jsx)(tv,{value:`teleop`,className:`hover:bg-slate-700`,children:`Teleoperator (Leader)`}),(0,V.jsx)(tv,{value:`robot`,className:`hover:bg-slate-700`,children:`Robot (Follower)`})]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(q,{htmlFor:`port`,className:`text-sm font-medium text-slate-300`,children:`Port *`}),(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Th,{id:`port`,value:c,onChange:e=>l(e.target.value),onBlur:e=>F(e.target.value),placeholder:`/dev/tty.usbmodem...`,className:`bg-slate-700 border-slate-600 text-white rounded-md flex-1`}),(0,V.jsx)(pM,{onClick:P,robotType:o===`robot`?`follower`:`leader`,className:`border-slate-600 hover:border-blue-500 text-slate-400 hover:text-blue-400 bg-slate-700 hover:bg-slate-600`})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3`,children:w.calibration_active?(0,V.jsxs)(G,{onClick:j,variant:`destructive`,className:`w-full rounded-full py-6 text-lg`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Cancel Calibration`]}):(0,V.jsxs)(G,{onClick:A,className:`w-full bg-blue-600 hover:bg-blue-700 text-white rounded-full py-6 text-lg`,disabled:!t||!o||!c,children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),`Start Calibration`]})}),u&&(0,V.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,V.jsx)(`div`,{className:`text-sm font-medium text-slate-300`,children:`Robot calibration`}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.leader_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.leader_config?`text-slate-200`:`text-slate-400`,children:`Leader (Teleoperator)`})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[u.follower_config?(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`}):(0,V.jsx)(Ia,{className:`w-4 h-4 text-slate-500`}),(0,V.jsx)(`span`,{className:u.follower_config?`text-slate-200`:`text-slate-400`,children:`Follower (Robot)`})]})]})]})]}),(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(Sa,{className:`w-5 h-5 text-teal-400`}),`Status`]})}),(0,V.jsxs)(Tv,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between p-3 bg-slate-900/50 rounded-md`,children:[(0,V.jsx)(`span`,{className:`text-slate-300`,children:`Status:`}),(0,V.jsxs)(iM,{className:`${ee.color} text-white rounded-md`,children:[ee.icon,(0,V.jsx)(`span`,{className:`ml-2`,children:ee.text})]})]}),w.status===`recording`&&w.recorded_ranges&&(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(Sa,{className:`w-4 h-4 text-purple-400`}),(0,V.jsx)(`span`,{className:`text-sm font-medium text-slate-300`,children:`Live Position Data`})]}),(0,V.jsx)(`div`,{className:`bg-slate-800 rounded-lg p-4 border border-slate-700`,children:(0,V.jsx)(`div`,{className:`space-y-3`,children:Object.entries(w.recorded_ranges).map(([e,t])=>{let n=t.max-t.min,r=t.current-t.min,i=n>0?r/n*100:50,a=vM(w.device_type,e,n);return(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold text-sm`,children:e}),a&&(0,V.jsx)(Ma,{className:`w-4 h-4 text-green-400`,"aria-label":`Range complete`})]}),(0,V.jsx)(`span`,{className:`text-slate-300 text-xs font-mono`,children:t.current})]}),(0,V.jsxs)(`div`,{className:`relative`,children:[(0,V.jsx)(`div`,{className:`w-full bg-slate-700 rounded-full h-3`,children:(0,V.jsx)(`div`,{className:`bg-slate-600 h-3 rounded-full relative`,style:{width:`100%`},children:(0,V.jsx)(`div`,{className:`absolute top-0 w-1 h-3 rounded-full transition-all duration-100 ${a?`bg-green-400`:`bg-yellow-400`}`,style:{left:`${Math.max(0,Math.min(100,i))}%`,transform:`translateX(-50%)`}})})}),(0,V.jsxs)(`div`,{className:`flex justify-between text-xs text-slate-400 mt-1`,children:[(0,V.jsx)(`span`,{children:t.min}),(0,V.jsx)(`span`,{children:t.max})]})]})]},e)})})})]}),w.status===`connecting`&&(0,V.jsxs)(ug,{className:`bg-yellow-900/50 border-yellow-700 text-yellow-200`,children:[(0,V.jsx)(ja,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Connecting to the device. Please ensure it's connected.`})]}),w.status===`recording`&&(()=>{let e=w.recorded_ranges??{},t=Object.entries(e),n=t.length>0&&t.every(([e,t])=>vM(w.device_type,e,t.max-t.min));return(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`div`,{className:`flex justify-center`,children:(0,V.jsxs)(G,{onClick:M,disabled:!w.calibration_active,className:`px-8 py-3 rounded-full transition-colors ${n?`bg-green-600 hover:bg-green-700`:`bg-orange-500 hover:bg-orange-600`}`,children:[n?(0,V.jsx)(Ma,{className:`w-4 h-4 mr-2`}):(0,V.jsx)(ja,{className:`w-4 h-4 mr-2`}),`Save Calibration`]})}),(0,V.jsxs)(ug,{className:`bg-purple-900/50 border-purple-700 text-purple-200`,children:[(0,V.jsx)(Sa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:`Important:`}),` Move EACH joint through its full range. A check appears next to each joint once its range is wide enough.`]})]})]})})(),w.status===`completed`&&(0,V.jsxs)(ug,{className:`bg-green-900/50 border-green-700 text-green-200`,children:[(0,V.jsx)(Ma,{className:`h-4 w-4`}),(0,V.jsx)(fg,{children:`Calibration completed successfully!`})]}),w.status===`error`&&w.error&&(w.error.startsWith(yM)?(0,V.jsxs)(ug,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`div`,{className:`font-semibold text-base mb-1`,children:`Motor discontinuity detected`}),(0,V.jsx)(`div`,{children:`Make sure to start the calibration with the robot in a middle position — all joints in the middle of their ranges. See the calibration demo below for the correct starting pose.`})]})]}):(0,V.jsxs)(ug,{className:`bg-red-900/50 border-red-700 text-red-200`,children:[(0,V.jsx)(Fa,{className:`h-4 w-4`}),(0,V.jsxs)(fg,{children:[(0,V.jsx)(`strong`,{children:`Error:`}),` `,w.error]})]})),(0,V.jsxs)(`div`,{ref:a,className:`bg-slate-900/50 p-4 rounded-lg border border-slate-700`,children:[(0,V.jsx)(`h4`,{className:`font-semibold mb-3 text-slate-200`,children:`Calibration Demo:`}),(0,V.jsx)(`div`,{className:`relative rounded-lg overflow-hidden bg-slate-800`,children:(0,V.jsxs)(`video`,{className:`w-full h-auto rounded-md`,controls:!0,preload:`auto`,muted:!0,children:[(0,V.jsx)(`source`,{src:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,type:`video/mp4`}),(0,V.jsxs)(`p`,{className:`text-slate-400 text-sm text-center py-4`,children:[`Your browser does not support the video tag.`,(0,V.jsx)(`br`,{}),(0,V.jsx)(`a`,{href:`https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/lerobot/calibrate_so101_2.mp4`,className:`text-blue-400 hover:text-blue-300 underline`,target:`_blank`,rel:`noopener noreferrer`,children:`Click here to view the calibration video`})]})]})})]})]})]})]}),t&&(0,V.jsxs)(Sv,{className:`bg-slate-800/60 border-slate-700 backdrop-blur-sm mt-6`,children:[(0,V.jsxs)(Cv,{className:`flex-row items-center justify-between space-y-0`,children:[(0,V.jsxs)(wv,{className:`flex items-center gap-2 text-slate-200`,children:[(0,V.jsx)(to,{className:`w-5 h-5 text-blue-400`}),`Attached cameras`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(q,{htmlFor:`cameras-toggle`,className:`text-sm text-slate-400 cursor-pointer`,children:m?`On`:`Off`}),(0,V.jsx)($j,{id:`cameras-toggle`,checked:m,onCheckedChange:h,className:`data-[state=checked]:bg-green-500`,"aria-label":`Turn cameras on or off`})]})]}),(0,V.jsx)(Tv,{children:m?(0,V.jsx)(pv,{cameras:f,onCamerasChange:y}):(0,V.jsxs)(`div`,{className:`rounded-lg border border-slate-700 bg-slate-900/40 p-6 text-center space-y-3`,children:[(0,V.jsx)(Ta,{className:`w-10 h-10 mx-auto text-slate-500`}),(0,V.jsxs)(`div`,{className:`space-y-1`,children:[(0,V.jsx)(`p`,{className:`text-slate-200 font-medium`,children:`Cameras are off`}),(0,V.jsx)(`p`,{className:`text-sm text-slate-400 max-w-md mx-auto`,children:`Turn cameras on to scan for connected devices and preview them. The browser may briefly open a camera to read device labels, and configured cameras stay active while previews are visible; your browser will ask for camera permission. Nothing is recorded.`}),f.length>0&&(0,V.jsxs)(`p`,{className:`text-xs text-slate-500 pt-1`,children:[f.length,` camera`,f.length===1?``:`s`,` saved to this robot.`]})]}),(0,V.jsxs)(`p`,{className:`flex items-center justify-center gap-1.5 text-xs text-slate-500`,children:[(0,V.jsx)(no,{className:`w-3.5 h-3.5`}),`You'll be asked to grant camera access.`]})]})})]})]}),(0,V.jsx)(hM,{open:b,onOpenChange:x,robotType:S,onPortDetected:I})]})},xM=`rovingFocusGroup.onEntryFocus`,SM={bubbles:!1,cancelable:!0},CM=`RovingFocusGroup`,[wM,TM,EM]=Ar(CM),[DM,OM]=Sr(CM,[EM]),[kM,AM]=DM(CM),jM=_.forwardRef((e,t)=>(0,V.jsx)(wM.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(wM.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(MM,{...e,ref:t})})}));jM.displayName=CM;var MM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=_.useRef(null),p=br(t,f),m=hg(a),[h,g]=ui({prop:o,defaultProp:s??null,onChange:c,caller:CM}),[v,y]=_.useState(!1),b=Rr(l),x=TM(n),S=_.useRef(!1),[C,w]=_.useState(0);return _.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(xM,b),()=>e.removeEventListener(xM,b)},[b]),(0,V.jsx)(kM,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:_.useCallback(e=>g(e),[g]),onItemShiftTab:_.useCallback(()=>y(!0),[]),onFocusableItemAdd:_.useCallback(()=>w(e=>e+1),[]),onFocusableItemRemove:_.useCallback(()=>w(e=>e-1),[]),children:(0,V.jsx)(U.div,{tabIndex:v||C===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:H(e.onMouseDown,()=>{S.current=!0}),onFocus:H(e.onFocus,e=>{let t=!S.current;if(e.target===e.currentTarget&&t&&!v){let t=new CustomEvent(xM,SM);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=x().filter(e=>e.focusable);RM([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}S.current=!1}),onBlur:H(e.onBlur,()=>y(!1))})})}),NM=`RovingFocusGroupItem`,PM=_.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=Ws(),l=a||c,u=AM(NM,n),d=u.currentTabStopId===l,f=TM(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return _.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(wM.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(U.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:H(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:H(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:H(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=LM(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?zM(n,r+1):n.slice(r+1)}setTimeout(()=>RM(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});PM.displayName=NM;var FM={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function IM(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function LM(e,t,n){let r=IM(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return FM[r]}function RM(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function zM(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var BM=jM,VM=PM;function HM(e){let t=UM(e),n=_.forwardRef((e,n)=>{let{children:r,...i}=e,a=_.Children.toArray(r),o=a.find(GM);if(o){let e=o.props.children,r=a.map(t=>t===o?_.Children.count(e)>1?_.Children.only(null):_.isValidElement(e)?e.props.children:null:t);return(0,V.jsx)(t,{...i,ref:n,children:_.isValidElement(e)?_.cloneElement(e,void 0,r):null})}return(0,V.jsx)(t,{...i,ref:n,children:r})});return n.displayName=`${e}.Slot`,n}function UM(e){let t=_.forwardRef((e,t)=>{let{children:n,...r}=e;if(_.isValidElement(n)){let e=qM(n),i=KM(r,n.props);return n.type!==_.Fragment&&(i.ref=t?yr(t,e):e),_.cloneElement(n,i)}return _.Children.count(n)>1?_.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var WM=Symbol(`radix.slottable`);function GM(e){return _.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===WM}function KM(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function qM(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var JM=[`Enter`,` `],YM=[`ArrowDown`,`PageUp`,`Home`],XM=[`ArrowUp`,`PageDown`,`End`],ZM=[...YM,...XM],QM={ltr:[...JM,`ArrowRight`],rtl:[...JM,`ArrowLeft`]},$M={ltr:[`ArrowLeft`],rtl:[`ArrowRight`]},eN=`Menu`,[tN,nN,rN]=Ar(eN),[iN,aN]=Sr(eN,[rN,Gf,OM]),oN=Gf(),sN=OM(),[cN,lN]=iN(eN),[uN,dN]=iN(eN),fN=e=>{let{__scopeMenu:t,open:n=!1,children:r,dir:i,onOpenChange:a,modal:o=!0}=e,s=oN(t),[c,l]=_.useState(null),u=_.useRef(!1),d=Rr(a),f=hg(i);return _.useEffect(()=>{let e=()=>{u.current=!0,document.addEventListener(`pointerdown`,t,{capture:!0,once:!0}),document.addEventListener(`pointermove`,t,{capture:!0,once:!0})},t=()=>u.current=!1;return document.addEventListener(`keydown`,e,{capture:!0}),()=>{document.removeEventListener(`keydown`,e,{capture:!0}),document.removeEventListener(`pointerdown`,t,{capture:!0}),document.removeEventListener(`pointermove`,t,{capture:!0})}},[]),(0,V.jsx)(np,{...s,children:(0,V.jsx)(cN,{scope:t,open:n,onOpenChange:d,content:c,onContentChange:l,children:(0,V.jsx)(uN,{scope:t,onClose:_.useCallback(()=>d(!1),[d]),isUsingKeyboardRef:u,dir:f,modal:o,children:r})})})};fN.displayName=eN;var pN=`MenuAnchor`,mN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=oN(n);return(0,V.jsx)(rp,{...i,...r,ref:t})});mN.displayName=pN;var hN=`MenuPortal`,[gN,_N]=iN(hN,{forceMount:void 0}),vN=e=>{let{__scopeMenu:t,forceMount:n,children:r,container:i}=e,a=lN(hN,t);return(0,V.jsx)(gN,{scope:t,forceMount:n,children:(0,V.jsx)(ai,{present:n||a.open,children:(0,V.jsx)(ri,{asChild:!0,container:i,children:r})})})};vN.displayName=hN;var yN=`MenuContent`,[bN,xN]=iN(yN),SN=_.forwardRef((e,t)=>{let n=_N(yN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=lN(yN,e.__scopeMenu),o=dN(yN,e.__scopeMenu);return(0,V.jsx)(tN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(tN.Slot,{scope:e.__scopeMenu,children:o.modal?(0,V.jsx)(CN,{...i,ref:t}):(0,V.jsx)(wN,{...i,ref:t})})})})}),CN=_.forwardRef((e,t)=>{let n=lN(yN,e.__scopeMenu),r=_.useRef(null),i=br(t,r);return _.useEffect(()=>{let e=r.current;if(e)return El(e)},[]),(0,V.jsx)(EN,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:H(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),wN=_.forwardRef((e,t)=>{let n=lN(yN,e.__scopeMenu);return(0,V.jsx)(EN,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),TN=HM(`MenuContent.ScrollLock`),EN=_.forwardRef((e,t)=>{let{__scopeMenu:n,loop:r=!1,trapFocus:i,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:s,onEntryFocus:c,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,disableOutsideScroll:m,...h}=e,g=lN(yN,n),v=dN(yN,n),y=oN(n),b=sN(n),x=nN(n),[S,C]=_.useState(null),w=_.useRef(null),T=br(t,w,g.onContentChange),E=_.useRef(0),D=_.useRef(``),O=_.useRef(0),k=_.useRef(null),A=_.useRef(`right`),j=_.useRef(0),M=m?_l:_.Fragment,N=m?{as:TN,allowPinchZoom:!0}:void 0,P=e=>{let t=D.current+e,n=x().filter(e=>!e.disabled),r=document.activeElement,i=n.find(e=>e.ref.current===r)?.textValue,a=uP(n.map(e=>e.textValue),t,i),o=n.find(e=>e.textValue===a)?.ref.current;(function e(t){D.current=t,window.clearTimeout(E.current),t!==``&&(E.current=window.setTimeout(()=>e(``),1e3))})(t),o&&setTimeout(()=>o.focus())};_.useEffect(()=>()=>window.clearTimeout(E.current),[]),cc();let F=_.useCallback(e=>A.current===k.current?.side&&fP(e,k.current?.area),[]);return(0,V.jsx)(bN,{scope:n,searchRef:D,onItemEnter:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),onItemLeave:_.useCallback(e=>{F(e)||(w.current?.focus(),C(null))},[F]),onTriggerLeave:_.useCallback(e=>{F(e)&&e.preventDefault()},[F]),pointerGraceTimerRef:O,onPointerGraceIntentChange:_.useCallback(e=>{k.current=e},[]),children:(0,V.jsx)(M,{...N,children:(0,V.jsx)(Ys,{asChild:!0,trapped:i,onMountAutoFocus:H(a,e=>{e.preventDefault(),w.current?.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:(0,V.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:s,onEscapeKeyDown:l,onPointerDownOutside:u,onFocusOutside:d,onInteractOutside:f,onDismiss:p,children:(0,V.jsx)(BM,{asChild:!0,...b,dir:v.dir,orientation:`vertical`,loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:H(c,e=>{v.isUsingKeyboardRef.current||e.preventDefault()}),preventScrollOnEntryFocus:!0,children:(0,V.jsx)(ip,{role:`menu`,"aria-orientation":`vertical`,"data-state":aP(g.open),"data-radix-menu-content":``,dir:v.dir,...y,...h,ref:T,style:{outline:`none`,...h.style},onKeyDown:H(h.onKeyDown,e=>{let t=e.target.closest(`[data-radix-menu-content]`)===e.currentTarget,n=e.ctrlKey||e.altKey||e.metaKey,r=e.key.length===1;t&&(e.key===`Tab`&&e.preventDefault(),!n&&r&&P(e.key));let i=w.current;if(e.target!==i||!ZM.includes(e.key))return;e.preventDefault();let a=x().filter(e=>!e.disabled).map(e=>e.ref.current);XM.includes(e.key)&&a.reverse(),cP(a)}),onBlur:H(e.onBlur,e=>{e.currentTarget.contains(e.target)||(window.clearTimeout(E.current),D.current=``)}),onPointerMove:H(e.onPointerMove,pP(e=>{let t=e.target,n=j.current!==e.clientX;e.currentTarget.contains(t)&&n&&(A.current=e.clientX>j.current?`right`:`left`,j.current=e.clientX)}))})})})})})})});SN.displayName=yN;var DN=`MenuGroup`,ON=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`group`,...r,ref:t})});ON.displayName=DN;var kN=`MenuLabel`,AN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{...r,ref:t})});AN.displayName=kN;var jN=`MenuItem`,MN=`menu.itemSelect`,NN=_.forwardRef((e,t)=>{let{disabled:n=!1,onSelect:r,...i}=e,a=_.useRef(null),o=dN(jN,e.__scopeMenu),s=xN(jN,e.__scopeMenu),c=br(t,a),l=_.useRef(!1),u=()=>{let e=a.current;if(!n&&e){let t=new CustomEvent(MN,{bubbles:!0,cancelable:!0});e.addEventListener(MN,e=>r?.(e),{once:!0}),Lr(e,t),t.defaultPrevented?l.current=!1:o.onClose()}};return(0,V.jsx)(PN,{...i,ref:c,disabled:n,onClick:H(e.onClick,u),onPointerDown:t=>{e.onPointerDown?.(t),l.current=!0},onPointerUp:H(e.onPointerUp,e=>{l.current||e.currentTarget?.click()}),onKeyDown:H(e.onKeyDown,e=>{let t=s.searchRef.current!==``;n||t&&e.key===` `||JM.includes(e.key)&&(e.currentTarget.click(),e.preventDefault())})})});NN.displayName=jN;var PN=_.forwardRef((e,t)=>{let{__scopeMenu:n,disabled:r=!1,textValue:i,...a}=e,o=xN(jN,n),s=sN(n),c=_.useRef(null),l=br(t,c),[u,d]=_.useState(!1),[f,p]=_.useState(``);return _.useEffect(()=>{let e=c.current;e&&p((e.textContent??``).trim())},[a.children]),(0,V.jsx)(tN.ItemSlot,{scope:n,disabled:r,textValue:i??f,children:(0,V.jsx)(VM,{asChild:!0,...s,focusable:!r,children:(0,V.jsx)(U.div,{role:`menuitem`,"data-highlighted":u?``:void 0,"aria-disabled":r||void 0,"data-disabled":r?``:void 0,...a,ref:l,onPointerMove:H(e.onPointerMove,pP(e=>{r?o.onItemLeave(e):(o.onItemEnter(e),e.defaultPrevented||e.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:H(e.onPointerLeave,pP(e=>o.onItemLeave(e))),onFocus:H(e.onFocus,()=>d(!0)),onBlur:H(e.onBlur,()=>d(!1))})})})}),FN=`MenuCheckboxItem`,IN=_.forwardRef((e,t)=>{let{checked:n=!1,onCheckedChange:r,...i}=e;return(0,V.jsx)(WN,{scope:e.__scopeMenu,checked:n,children:(0,V.jsx)(NN,{role:`menuitemcheckbox`,"aria-checked":oP(n)?`mixed`:n,...i,ref:t,"data-state":sP(n),onSelect:H(i.onSelect,()=>r?.(oP(n)?!0:!n),{checkForDefaultPrevented:!1})})})});IN.displayName=FN;var LN=`MenuRadioGroup`,[RN,zN]=iN(LN,{value:void 0,onValueChange:()=>{}}),BN=_.forwardRef((e,t)=>{let{value:n,onValueChange:r,...i}=e,a=Rr(r);return(0,V.jsx)(RN,{scope:e.__scopeMenu,value:n,onValueChange:a,children:(0,V.jsx)(ON,{...i,ref:t})})});BN.displayName=LN;var VN=`MenuRadioItem`,HN=_.forwardRef((e,t)=>{let{value:n,...r}=e,i=zN(VN,e.__scopeMenu),a=n===i.value;return(0,V.jsx)(WN,{scope:e.__scopeMenu,checked:a,children:(0,V.jsx)(NN,{role:`menuitemradio`,"aria-checked":a,...r,ref:t,"data-state":sP(a),onSelect:H(r.onSelect,()=>i.onValueChange?.(n),{checkForDefaultPrevented:!1})})})});HN.displayName=VN;var UN=`MenuItemIndicator`,[WN,GN]=iN(UN,{checked:!1}),KN=_.forwardRef((e,t)=>{let{__scopeMenu:n,forceMount:r,...i}=e,a=GN(UN,n);return(0,V.jsx)(ai,{present:r||oP(a.checked)||a.checked===!0,children:(0,V.jsx)(U.span,{...i,ref:t,"data-state":sP(a.checked)})})});KN.displayName=UN;var qN=`MenuSeparator`,JN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e;return(0,V.jsx)(U.div,{role:`separator`,"aria-orientation":`horizontal`,...r,ref:t})});JN.displayName=qN;var YN=`MenuArrow`,XN=_.forwardRef((e,t)=>{let{__scopeMenu:n,...r}=e,i=oN(n);return(0,V.jsx)(ap,{...i,...r,ref:t})});XN.displayName=YN;var ZN=`MenuSub`,[QN,$N]=iN(ZN),eP=e=>{let{__scopeMenu:t,children:n,open:r=!1,onOpenChange:i}=e,a=lN(ZN,t),o=oN(t),[s,c]=_.useState(null),[l,u]=_.useState(null),d=Rr(i);return _.useEffect(()=>(a.open===!1&&d(!1),()=>d(!1)),[a.open,d]),(0,V.jsx)(np,{...o,children:(0,V.jsx)(cN,{scope:t,open:r,onOpenChange:d,content:l,onContentChange:u,children:(0,V.jsx)(QN,{scope:t,contentId:Ws(),triggerId:Ws(),trigger:s,onTriggerChange:c,children:n})})})};eP.displayName=ZN;var tP=`MenuSubTrigger`,nP=_.forwardRef((e,t)=>{let n=lN(tP,e.__scopeMenu),r=dN(tP,e.__scopeMenu),i=$N(tP,e.__scopeMenu),a=xN(tP,e.__scopeMenu),o=_.useRef(null),{pointerGraceTimerRef:s,onPointerGraceIntentChange:c}=a,l={__scopeMenu:e.__scopeMenu},u=_.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return _.useEffect(()=>u,[u]),_.useEffect(()=>{let e=s.current;return()=>{window.clearTimeout(e),c(null)}},[s,c]),(0,V.jsx)(mN,{asChild:!0,...l,children:(0,V.jsx)(PN,{id:i.triggerId,"aria-haspopup":`menu`,"aria-expanded":n.open,"aria-controls":i.contentId,"data-state":aP(n.open),...e,ref:yr(t,i.onTriggerChange),onClick:t=>{e.onClick?.(t),!(e.disabled||t.defaultPrevented)&&(t.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:H(e.onPointerMove,pP(t=>{a.onItemEnter(t),!t.defaultPrevented&&!e.disabled&&!n.open&&!o.current&&(a.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:H(e.onPointerLeave,pP(e=>{u();let t=n.content?.getBoundingClientRect();if(t){let r=n.content?.dataset.side,i=r===`right`,o=i?-5:5,c=t[i?`left`:`right`],l=t[i?`right`:`left`];a.onPointerGraceIntentChange({area:[{x:e.clientX+o,y:e.clientY},{x:c,y:t.top},{x:l,y:t.top},{x:l,y:t.bottom},{x:c,y:t.bottom}],side:r}),window.clearTimeout(s.current),s.current=window.setTimeout(()=>a.onPointerGraceIntentChange(null),300)}else{if(a.onTriggerLeave(e),e.defaultPrevented)return;a.onPointerGraceIntentChange(null)}})),onKeyDown:H(e.onKeyDown,t=>{let i=a.searchRef.current!==``;e.disabled||i&&t.key===` `||QM[r.dir].includes(t.key)&&(n.onOpenChange(!0),n.content?.focus(),t.preventDefault())})})})});nP.displayName=tP;var rP=`MenuSubContent`,iP=_.forwardRef((e,t)=>{let n=_N(yN,e.__scopeMenu),{forceMount:r=n.forceMount,...i}=e,a=lN(yN,e.__scopeMenu),o=dN(yN,e.__scopeMenu),s=$N(rP,e.__scopeMenu),c=_.useRef(null),l=br(t,c);return(0,V.jsx)(tN.Provider,{scope:e.__scopeMenu,children:(0,V.jsx)(ai,{present:r||a.open,children:(0,V.jsx)(tN.Slot,{scope:e.__scopeMenu,children:(0,V.jsx)(EN,{id:s.contentId,"aria-labelledby":s.triggerId,...i,ref:l,align:`start`,side:o.dir===`rtl`?`left`:`right`,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:e=>{o.isUsingKeyboardRef.current&&c.current?.focus(),e.preventDefault()},onCloseAutoFocus:e=>e.preventDefault(),onFocusOutside:H(e.onFocusOutside,e=>{e.target!==s.trigger&&a.onOpenChange(!1)}),onEscapeKeyDown:H(e.onEscapeKeyDown,e=>{o.onClose(),e.preventDefault()}),onKeyDown:H(e.onKeyDown,e=>{let t=e.currentTarget.contains(e.target),n=$M[o.dir].includes(e.key);t&&n&&(a.onOpenChange(!1),s.trigger?.focus(),e.preventDefault())})})})})})});iP.displayName=rP;function aP(e){return e?`open`:`closed`}function oP(e){return e===`indeterminate`}function sP(e){return oP(e)?`indeterminate`:e?`checked`:`unchecked`}function cP(e){let t=document.activeElement;for(let n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function lP(e,t){return e.map((n,r)=>e[(t+r)%e.length])}function uP(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=lP(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function dP(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;er!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function fP(e,t){return t?dP({x:e.clientX,y:e.clientY},t):!1}function pP(e){return t=>t.pointerType===`mouse`?e(t):void 0}var mP=fN,hP=mN,gP=vN,_P=SN,vP=ON,yP=AN,bP=NN,xP=IN,SP=BN,CP=HN,wP=KN,TP=JN,EP=XN,DP=nP,OP=iP,kP=`DropdownMenu`,[AP,Tte]=Sr(kP,[aN]),jP=aN(),[MP,NP]=AP(kP),PP=e=>{let{__scopeDropdownMenu:t,children:n,dir:r,open:i,defaultOpen:a,onOpenChange:o,modal:s=!0}=e,c=jP(t),l=_.useRef(null),[u,d]=ui({prop:i,defaultProp:a??!1,onChange:o,caller:kP});return(0,V.jsx)(MP,{scope:t,triggerId:Ws(),triggerRef:l,contentId:Ws(),open:u,onOpenChange:d,onOpenToggle:_.useCallback(()=>d(e=>!e),[d]),modal:s,children:(0,V.jsx)(mP,{...c,open:u,onOpenChange:d,dir:r,modal:s,children:n})})};PP.displayName=kP;var FP=`DropdownMenuTrigger`,IP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,disabled:r=!1,...i}=e,a=NP(FP,n),o=jP(n);return(0,V.jsx)(hP,{asChild:!0,...o,children:(0,V.jsx)(U.button,{type:`button`,id:a.triggerId,"aria-haspopup":`menu`,"aria-expanded":a.open,"aria-controls":a.open?a.contentId:void 0,"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,disabled:r,...i,ref:yr(t,a.triggerRef),onPointerDown:H(e.onPointerDown,e=>{!r&&e.button===0&&e.ctrlKey===!1&&(a.onOpenToggle(),a.open||e.preventDefault())}),onKeyDown:H(e.onKeyDown,e=>{r||([`Enter`,` `].includes(e.key)&&a.onOpenToggle(),e.key===`ArrowDown`&&a.onOpenChange(!0),[`Enter`,` `,`ArrowDown`].includes(e.key)&&e.preventDefault())})})})});IP.displayName=FP;var LP=`DropdownMenuPortal`,RP=e=>{let{__scopeDropdownMenu:t,...n}=e,r=jP(t);return(0,V.jsx)(gP,{...r,...n})};RP.displayName=LP;var zP=`DropdownMenuContent`,BP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=NP(zP,n),a=jP(n),o=_.useRef(!1);return(0,V.jsx)(_P,{id:i.contentId,"aria-labelledby":i.triggerId,...a,...r,ref:t,onCloseAutoFocus:H(e.onCloseAutoFocus,e=>{o.current||i.triggerRef.current?.focus(),o.current=!1,e.preventDefault()}),onInteractOutside:H(e.onInteractOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;(!i.modal||r)&&(o.current=!0)}),style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});BP.displayName=zP;var VP=`DropdownMenuGroup`,HP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(vP,{...i,...r,ref:t})});HP.displayName=VP;var UP=`DropdownMenuLabel`,WP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(yP,{...i,...r,ref:t})});WP.displayName=UP;var GP=`DropdownMenuItem`,KP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(bP,{...i,...r,ref:t})});KP.displayName=GP;var qP=`DropdownMenuCheckboxItem`,JP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(xP,{...i,...r,ref:t})});JP.displayName=qP;var YP=`DropdownMenuRadioGroup`,XP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(SP,{...i,...r,ref:t})});XP.displayName=YP;var ZP=`DropdownMenuRadioItem`,QP=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(CP,{...i,...r,ref:t})});QP.displayName=ZP;var $P=`DropdownMenuItemIndicator`,eF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(wP,{...i,...r,ref:t})});eF.displayName=$P;var tF=`DropdownMenuSeparator`,nF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(TP,{...i,...r,ref:t})});nF.displayName=tF;var rF=`DropdownMenuArrow`,iF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(EP,{...i,...r,ref:t})});iF.displayName=rF;var aF=`DropdownMenuSubTrigger`,oF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(DP,{...i,...r,ref:t})});oF.displayName=aF;var sF=`DropdownMenuSubContent`,cF=_.forwardRef((e,t)=>{let{__scopeDropdownMenu:n,...r}=e,i=jP(n);return(0,V.jsx)(OP,{...i,...r,ref:t,style:{...e.style,"--radix-dropdown-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-dropdown-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-dropdown-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-dropdown-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-dropdown-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});cF.displayName=sF;var lF=PP,uF=IP,dF=RP,fF=BP,pF=WP,mF=KP,hF=JP,gF=QP,_F=eF,vF=nF,yF=oF,bF=cF,xF=lF,SF=uF,CF=_.forwardRef(({className:e,inset:t,children:n,...r},i)=>(0,V.jsxs)(yF,{ref:i,className:W(`flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-accent data-[state=open]:bg-accent`,t&&`pl-8`,e),...r,children:[n,(0,V.jsx)(Oa,{className:`ml-auto h-4 w-4`})]}));CF.displayName=yF.displayName;var wF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(bF,{ref:n,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...t}));wF.displayName=bF.displayName;var TF=_.forwardRef(({className:e,sideOffset:t=4,...n},r)=>(0,V.jsx)(dF,{children:(0,V.jsx)(fF,{ref:r,sideOffset:t,className:W(`z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,e),...n})}));TF.displayName=fF.displayName;var EF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(mF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,t&&`pl-8`,e),...n}));EF.displayName=mF.displayName;var DF=_.forwardRef(({className:e,children:t,checked:n,...r},i)=>(0,V.jsxs)(hF,{ref:i,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),checked:n,...r,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(_F,{children:(0,V.jsx)(Ea,{className:`h-4 w-4`})})}),t]}));DF.displayName=hF.displayName;var OF=_.forwardRef(({className:e,children:t,...n},r)=>(0,V.jsxs)(gF,{ref:r,className:W(`relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,V.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,V.jsx)(_F,{children:(0,V.jsx)(Ia,{className:`h-2 w-2 fill-current`})})}),t]}));OF.displayName=gF.displayName;var kF=_.forwardRef(({className:e,inset:t,...n},r)=>(0,V.jsx)(pF,{ref:r,className:W(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));kF.displayName=pF.displayName;var AF=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vF,{ref:n,className:W(`-mx-1 my-1 h-px bg-muted`,e),...t}));AF.displayName=vF.displayName;var jF=({className:e,...t})=>(0,V.jsx)(`span`,{className:W(`ml-auto text-xs tracking-widest opacity-60`,e),...t});jF.displayName=`DropdownMenuShortcut`;var MF=`lelab.recording.muted`,NF=null,PF=()=>(NF||=new AudioContext,NF),FF=()=>localStorage.getItem(MF)===`1`,IF=e=>{localStorage.setItem(MF,e?`1`:`0`)},LF=(e,t,n=0)=>{if(FF())return;let r=PF(),i=r.createOscillator(),a=r.createGain();i.frequency.value=e,i.type=`sine`,a.gain.value=0,i.connect(a),a.connect(r.destination);let o=r.currentTime+n/1e3,s=o+t/1e3;a.gain.setValueAtTime(0,o),a.gain.linearRampToValueAtTime(.2,o+.01),a.gain.setValueAtTime(.2,s-.02),a.gain.linearRampToValueAtTime(0,s),i.start(o),i.stop(s)},RF=()=>{LF(660,80,0),LF(880,80,90)},zF=()=>{LF(660,80,0),LF(440,80,90)},BF=()=>{LF(880,70,0),LF(880,70,1e3),LF(880,70,2e3)},VF=Symbol(`radix.slottable`);function HF(e){let t=({children:e})=>(0,V.jsx)(V.Fragment,{children:e});return t.displayName=`${e}.Slottable`,t.__radixId=VF,t}var UF=`AlertDialog`,[WF,Ete]=Sr(UF,[Fl]),GF=Fl(),KF=e=>{let{__scopeAlertDialog:t,...n}=e,r=GF(t);return(0,V.jsx)(pu,{...r,...n,modal:!0})};KF.displayName=UF;var qF=`AlertDialogTrigger`,JF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(mu,{...i,...r,ref:t})});JF.displayName=qF;var YF=`AlertDialogPortal`,XF=e=>{let{__scopeAlertDialog:t,...n}=e,r=GF(t);return(0,V.jsx)(hu,{...r,...n})};XF.displayName=YF;var ZF=`AlertDialogOverlay`,QF=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(gu,{...i,...r,ref:t})});QF.displayName=ZF;var $F=`AlertDialogContent`,[eI,tI]=WF($F),nI=HF(`AlertDialogContent`),rI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,children:r,...i}=e,a=GF(n),o=_.useRef(null),s=br(t,o),c=_.useRef(null);return(0,V.jsx)(cu,{contentName:$F,titleName:iI,docsSlug:`alert-dialog`,children:(0,V.jsx)(eI,{scope:n,cancelRef:c,children:(0,V.jsxs)(_u,{role:`alertdialog`,...a,...i,ref:s,onOpenAutoFocus:H(i.onOpenAutoFocus,e=>{e.preventDefault(),c.current?.focus({preventScroll:!0})}),onPointerDownOutside:e=>e.preventDefault(),onInteractOutside:e=>e.preventDefault(),children:[(0,V.jsx)(nI,{children:r}),(0,V.jsx)(fI,{contentRef:o})]})})})});rI.displayName=$F;var iI=`AlertDialogTitle`,aI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(vu,{...i,...r,ref:t})});aI.displayName=iI;var oI=`AlertDialogDescription`,sI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(yu,{...i,...r,ref:t})});sI.displayName=oI;var cI=`AlertDialogAction`,lI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,i=GF(n);return(0,V.jsx)(bu,{...i,...r,ref:t})});lI.displayName=cI;var uI=`AlertDialogCancel`,dI=_.forwardRef((e,t)=>{let{__scopeAlertDialog:n,...r}=e,{cancelRef:i}=tI(uI,n),a=GF(n),o=br(t,i);return(0,V.jsx)(bu,{...a,...r,ref:o})});dI.displayName=uI;var fI=({contentRef:e})=>{let t=`\`${$F}\` requires a description for the component to be accessible for screen reader users. - -You can add a description to the \`${$F}\` by passing a \`${oI}\` component as a child, which also benefits sighted users by adding visible context to the dialog. - -Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${$F}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component. - -For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return _.useEffect(()=>{document.getElementById(e.current?.getAttribute(`aria-describedby`))||console.warn(t)},[t,e]),null},pI=KF,mI=XF,hI=QF,gI=rI,_I=lI,vI=dI,yI=aI,bI=sI,xI=pI,SI=mI,CI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(hI,{className:W(`fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0`,e),...t,ref:n}));CI.displayName=hI.displayName;var wI=_.forwardRef(({className:e,...t},n)=>(0,V.jsxs)(SI,{children:[(0,V.jsx)(CI,{}),(0,V.jsx)(gI,{ref:n,className:W(`fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg`,e),...t})]}));wI.displayName=gI.displayName;var TI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col space-y-2 text-center sm:text-left`,e),...t});TI.displayName=`AlertDialogHeader`;var EI=({className:e,...t})=>(0,V.jsx)(`div`,{className:W(`flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2`,e),...t});EI.displayName=`AlertDialogFooter`;var DI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(yI,{ref:n,className:W(`text-lg font-semibold`,e),...t}));DI.displayName=yI.displayName;var OI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(bI,{ref:n,className:W(`text-sm text-muted-foreground`,e),...t}));OI.displayName=bI.displayName;var kI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(_I,{ref:n,className:W(js(),e),...t}));kI.displayName=_I.displayName;var AI=_.forwardRef(({className:e,...t},n)=>(0,V.jsx)(vI,{ref:n,className:W(js({variant:`outline`}),`mt-2 sm:mt-0`,e),...t}));AI.displayName=vI.displayName;var Dte=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,wsBaseUrl:i,fetchWithHeaders:a}=Rs(),o=e.state?.recordingConfig,[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(()=>FF()),v=(0,_.useRef)(null),[y,b]=(0,_.useState)(0),x=(0,_.useRef)({phase:null,episode:null,tick:0}),S=(0,_.useRef)(!1),C=(0,_.useCallback)(()=>{g(e=>{let t=!e;return IF(t),t})},[]);(0,_.useEffect)(()=>{o||(n({title:`No Configuration`,description:`Please start recording from the main page.`,variant:`destructive`}),t(`/`))},[o,t,n]),(0,_.useEffect)(()=>{o&&!S.current&&(S.current=!0,D())},[o]);let w=(0,_.useRef)(d);w.current=d;let T=(0,_.useRef)(y);T.current=y,(0,_.useEffect)(()=>{if(!l)return;let e=async()=>{try{let e=await a(`${r}/recording-status`);if(!e.ok)return;let n=await e.json();c(n);let i=w.current;i&&n.current_phase===i&&f(null);let s=n.current_phase,l=v.current;l!==s&&(s===`recording`&&l!==null?RF():s===`resetting`&&zF(),v.current=s,x.current={phase:null,episode:null,tick:0});let u=n.phase_elapsed_seconds||0,d=n.phase_time_limit_s||0,p=d>3&&u>=d-3,m=n.current_episode??null,h=T.current,g=x.current;p&&i===null&&(g.phase!==s||g.episode!==m||g.tick!==h)&&(BF(),x.current={phase:s,episode:m,tick:h}),!n.recording_active&&n.session_ended&&t(`/upload`,{state:{datasetInfo:{dataset_repo_id:n.dataset_repo_id||o.dataset_repo_id,single_task:o.single_task,num_episodes:o.num_episodes,saved_episodes:n.saved_episodes||0,session_elapsed_seconds:n.session_elapsed_seconds||0}}})}catch(e){console.error(`Error polling recording status:`,e)}};e();let n=setInterval(e,1e3);return()=>clearInterval(n)},[l,o,t,r,a]);let E=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},D=async()=>{try{let e=await a(`${r}/start-recording`,{method:`POST`,body:JSON.stringify(o)}),i=await e.json();e.ok?(u(!0),n({title:`Recording Started`,description:`Started recording ${o.num_episodes} episodes`})):(n({title:`Error Starting Recording`,description:i.message||`Failed to start recording session.`,variant:`destructive`}),t(`/`))}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`}),t(`/`)}},O=(0,_.useCallback)(async()=>{if(!s?.available_controls.exit_early||d!==null)return;let e=s.current_phase,t=e===`recording`?`resetting`:e===`resetting`?`recording`:null;if(t){f(t);try{let e=await a(`${r}/recording-exit-early`,{method:`POST`});if(!e.ok){let t=await e.json();f(null),n({title:`Error`,description:t.message,variant:`destructive`})}}catch{f(null),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}}},[s,d,r,a,n]),k=(0,_.useCallback)(async()=>{if(s?.available_controls.rerecord_episode)try{let e=await a(`${r}/recording-rerecord-episode`,{method:`POST`}),t=await e.json();e.ok?(b(e=>e+1),n({title:`Re-recording Episode`,description:`Episode ${s.current_episode} will be re-recorded.`})):n({title:`Error`,description:t.message,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}},[s,r,a,n]),A=(0,_.useCallback)(async()=>{if(s?.available_controls.stop_recording)try{await a(`${r}/stop-recording`,{method:`POST`}),n({title:`Stopping recording`,description:`Finalizing dataset…`})}catch{n({title:`Error`,description:`Failed to stop recording.`,variant:`destructive`})}},[s,r,a,n]),j=(0,_.useCallback)(()=>{s?.available_controls.stop_recording&&m(!0)},[s]),M=(0,_.useCallback)(async()=>{m(!1),await A()},[A]),N=(0,_.useRef)({handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p});(0,_.useEffect)(()=>{N.current={handleExitEarly:O,handleRerecordEpisode:k,requestStopRecording:j,showStopConfirm:p}});let P=l&&s!==null;if((0,_.useEffect)(()=>{if(!P)return;let e=e=>{let t=e.target;if(!(t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.isContentEditable))){if(e.key===` `||e.code===`Space`||e.key===`ArrowRight`)e.preventDefault(),N.current.handleExitEarly();else if(e.key===`ArrowLeft`)e.preventDefault(),N.current.handleRerecordEpisode();else if(e.key===`Escape`){if(N.current.showStopConfirm)return;N.current.requestStopRecording()}}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[P]),!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`text-lg`,children:`No recording configuration found.`}),(0,V.jsx)(G,{onClick:()=>t(`/`),className:`mt-4`,children:`Return to Home`})]})});if(!s)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-red-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Connecting to recording session...`})]})});let F=s.current_phase,I=d??F,ee=s.current_episode??1,te=s.total_episodes??o.num_episodes,ne=d?0:s.phase_elapsed_seconds||0,re=I===`recording`?o.episode_time_s:I===`resetting`?o.reset_time_s:s.phase_time_limit_s||0,ie=s.session_elapsed_seconds||0,ae=()=>I===`recording`?`RECORDING EPISODE ${ee}`:I===`resetting`?`RESET — GET READY`:I===`preparing`?`PREPARING SESSION`:`SESSION COMPLETE`,oe=I===`recording`?{dot:`bg-red-500`,pill:`bg-red-500/15 text-red-300`,timer:`text-green-400`,bar:`bg-green-500`,button:`bg-green-500 hover:bg-green-600`}:I===`resetting`?{dot:`bg-orange-500`,pill:`bg-orange-500/15 text-orange-300`,timer:`text-orange-400`,bar:`bg-orange-500`,button:`bg-orange-500 hover:bg-orange-600`}:{dot:`bg-gray-500`,pill:`bg-gray-500/15 text-gray-300`,timer:`text-gray-400`,bar:`bg-gray-500`,button:`bg-gray-500`},se=I===`recording`?`End Episode`:I===`resetting`?`Start Next Episode`:`Advance`,ce=I===`recording`?ro:Xa;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-2xl mx-auto`,children:[(0,V.jsx)(`div`,{className:`mb-8`,children:(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]})}),(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8`,children:[(0,V.jsxs)(`div`,{className:`flex justify-end items-center gap-4 mb-6 text-sm text-gray-400`,children:[(0,V.jsxs)(`span`,{"aria-label":`Episode ${ee} of ${te}`,children:[`Episode `,(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:ee}),` / `,te]}),(0,V.jsx)(`span`,{className:`font-mono`,"aria-label":`Total session time ${E(ie)}`,children:E(ie)}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:C,"aria-label":h?`Unmute`:`Mute`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,children:h?(0,V.jsx)(po,{className:`w-5 h-5`}):(0,V.jsx)(fo,{className:`w-5 h-5`})}),(0,V.jsxs)(xF,{children:[(0,V.jsx)(SF,{asChild:!0,children:(0,V.jsx)(G,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-gray-400 hover:text-white hover:bg-gray-800`,"aria-label":`More actions`,children:(0,V.jsx)(Va,{className:`w-5 h-5`})})}),(0,V.jsxs)(TF,{align:`end`,onCloseAutoFocus:e=>e.preventDefault(),className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(EF,{onClick:k,disabled:!s.available_controls.rerecord_episode,className:`focus:bg-gray-800 focus:text-white`,children:[(0,V.jsx)($a,{className:`w-4 h-4 mr-2`}),`Re-record episode`]}),(0,V.jsxs)(EF,{onClick:j,disabled:!s.available_controls.stop_recording,className:`text-red-400 focus:bg-gray-800 focus:text-red-300`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),`Stop recording`]})]})]})]}),(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${oe.pill}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${oe.dot} ${I===`completed`?``:`animate-pulse`}`}),ae()]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${oe.timer}`,children:E(ne)}),(0,V.jsxs)(`div`,{className:`text-sm text-gray-500 mt-2`,children:[`/ `,E(re)]})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${oe.bar}`,style:{width:`${Math.min(ne/re*100,100)}%`}})}),(0,V.jsxs)(G,{onClick:O,disabled:!s.available_controls.exit_early||d!==null||I===`completed`,className:`w-full text-white font-semibold py-6 text-lg disabled:opacity-50 ${oe.button}`,children:[(0,V.jsx)(ce,{className:`w-5 h-5 mr-2`}),se,I!==`completed`&&(0,V.jsx)(`span`,{className:`ml-3 px-2 py-0.5 rounded text-xs font-mono bg-black/30 text-white/70`,children:`SPACE / →`})]}),I===`completed`&&(0,V.jsx)(`p`,{className:`text-center text-sm text-gray-400 mt-6`,children:`Recording complete — redirecting to upload…`})]})]}),(0,V.jsx)(xI,{open:p,onOpenChange:m,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Stop recording?`}),(0,V.jsx)(OI,{className:`text-gray-400`,children:`Saved episodes are kept. The session will end and you'll be taken to the upload page.`})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep recording`}),(0,V.jsx)(kI,{onClick:M,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},jI=()=>{let e=Re();return(0,V.jsx)(`div`,{className:`flex items-center justify-between mb-8`,children:(0,V.jsxs)(`div`,{className:`flex items-center gap-4 text-3xl`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(zj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Training`})]})})},MI=/^[\w.\-]+\/[\w.\-]+$/,Ote=({datasets:e,loading:t,value:n,onChange:r})=>{let[i,a]=_.useState(!1),[o,s]=_.useState(!1),[c,l]=_.useState(``),u=()=>{let e=c.trim();MI.test(e)&&(r(e),s(!1))},d=e.filter(e=>e.source===`local`||e.source===`both`),f=e.filter(e=>e.source===`hub`),p=e=>(0,V.jsxs)(bh,{value:e.repo_id,onSelect:()=>{r(e.repo_id),a(!1)},className:`text-white aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ea,{className:W(`mr-2 h-4 w-4`,n===e.repo_id?`opacity-100`:`opacity-0`)}),(0,V.jsx)(`span`,{className:`flex-1 truncate`,children:e.repo_id}),e.source===`both`&&(0,V.jsx)(`span`,{className:`text-xs text-gray-400 mr-2`,children:`on Hub`}),e.private&&(0,V.jsx)(`span`,{className:`text-xs text-amber-400`,children:`private`})]},e.repo_id);return o?(0,V.jsxs)(`div`,{className:`flex gap-2`,children:[(0,V.jsx)(Th,{autoFocus:!0,value:c,onChange:e=>l(e.target.value),onKeyDown:e=>{e.key===`Enter`&&u()},placeholder:`org/dataset-name`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(G,{onClick:u,disabled:!MI.test(c.trim()),children:`Use`}),(0,V.jsx)(G,{variant:`ghost`,onClick:()=>s(!1),children:`Cancel`})]}):(0,V.jsxs)(gm,{open:i,onOpenChange:a,children:[(0,V.jsx)(_m,{asChild:!0,children:(0,V.jsxs)(G,{variant:`outline`,role:`combobox`,"aria-expanded":i,className:`w-full justify-between bg-gray-800 border-gray-600 text-white hover:bg-gray-700`,children:[n??(t?`Loading datasets…`:`Select a dataset…`),(0,V.jsx)(Aa,{className:`ml-2 h-4 w-4 shrink-0 opacity-50`})]})}),(0,V.jsx)(vm,{className:`w-[--radix-popover-trigger-width] p-0 bg-gray-800 border-gray-700`,align:`start`,children:(0,V.jsxs)(mh,{className:`bg-gray-800 text-white`,children:[(0,V.jsx)(hh,{placeholder:`Search datasets…`,className:`text-white`}),(0,V.jsxs)(gh,{children:[(0,V.jsx)(_h,{children:t?`Loading…`:`No datasets.`}),d.length>0&&(0,V.jsx)(vh,{heading:`Local`,children:d.map(p)}),f.length>0&&(0,V.jsx)(vh,{heading:`Hugging Face`,children:f.map(p)}),(0,V.jsx)(vh,{children:(0,V.jsxs)(bh,{onSelect:()=>{s(!0),a(!1)},className:`text-purple-300 aria-selected:bg-gray-700`,children:[(0,V.jsx)(Ya,{className:`mr-2 h-4 w-4`}),`Use custom repo ID…`]})})]})]})})]})},kte=1500;function NI(e,t=!0){let{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(`idle`),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)([]),u=(0,_.useRef)(null);return(0,_.useEffect)(()=>{if(!t)return;let i=!1;return r(`${n}/${e}/install-status`).then(e=>e.json()).then(e=>{i||(a(e.state),s(e.error),e.logs.length>0&&l(e.logs))}).catch(()=>{}),()=>{i=!0}},[t,n,r,e]),(0,_.useEffect)(()=>{if(i!==`installing`)return;let t=setInterval(async()=>{try{let t=await r(`${n}/${e}/install-status`);if(!t.ok)return;let i=await t.json();i.logs&&i.logs.length>0&&l(e=>[...e,...i.logs]),i.state!==`installing`&&(a(i.state),s(i.error))}catch{}},kte);return()=>clearInterval(t)},[i,n,r,e]),(0,_.useEffect)(()=>{u.current&&(u.current.scrollTop=u.current.scrollHeight)},[c]),{state:i,error:o,logs:c,logBoxRef:u,handleInstall:(0,_.useCallback)(async()=>{a(`installing`),s(null),l([]);try{let t=await r(`${n}/${e}/install`,{method:`POST`}),i=await t.json();if(!i.started&&t.ok)return;t.ok||(a(`error`),s(i.message||`Install request failed (${t.status})`))}catch(e){a(`error`),s(`Install request failed: ${e instanceof Error?e.message:String(e)}`)}},[n,r,e]),handleRetry:(0,_.useCallback)(()=>{a(`idle`),s(null),l([])},[])}}function PI(e,t){switch(e){case`done`:return`Install Complete`;case`error`:return`Install Failed`;case`installing`:return`Installing…`;default:return t}}function FI({state:e}){return e===`done`?(0,V.jsx)(Na,{className:`w-6 h-6 text-green-400`}):e===`error`?(0,V.jsx)(Fa,{className:`w-6 h-6 text-red-400`}):e===`installing`?(0,V.jsx)(qa,{className:`w-6 h-6 text-sky-400 animate-spin`}):(0,V.jsx)(co,{className:`w-6 h-6 text-amber-400`})}var II=({state:e,error:t,logs:n,logBoxRef:r,onInstall:i,onRetry:a,installHint:o,packageName:s,idleDescription:c,doneDescription:l})=>{let{toast:u}=_r();return(0,V.jsxs)(V.Fragment,{children:[e===`idle`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-slate-300`,children:c}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 bg-slate-900 border border-slate-700 rounded-lg px-3 py-2 text-sm text-slate-200 font-mono`,children:o}),(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:async()=>{try{await navigator.clipboard.writeText(o),u({title:`Copied`,description:o})}catch{u({title:`Copy failed`,description:`Select the command and copy manually.`,variant:`destructive`})}},className:`text-slate-400 hover:text-white`,"aria-label":`Copy install command`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]}),(0,V.jsx)(G,{onClick:i,className:`bg-green-500 hover:bg-green-600 text-white font-semibold`,children:`Install Now`})]}),e===`installing`&&(0,V.jsxs)(`p`,{className:`text-slate-300`,children:[`Installing`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:s}),`. This usually takes about 10 seconds.`]}),e===`done`&&(0,V.jsx)(`div`,{className:`space-y-3 text-slate-300`,children:l}),e===`error`&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`p`,{className:`text-red-300`,children:t||`Install failed.`}),(0,V.jsx)(G,{onClick:a,className:`bg-slate-700 hover:bg-slate-600 text-white`,children:`Try again`})]}),e===`error`&&n.length>0&&(0,V.jsx)(`div`,{ref:r,className:`bg-slate-900 rounded-lg p-3 h-48 overflow-y-auto font-mono text-xs border border-slate-700 text-slate-300 whitespace-pre-wrap break-words`,children:n.map((e,t)=>(0,V.jsx)(`div`,{children:e.message},t))})]})},LI=({purpose:e})=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{children:[`Install complete. Restart`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`to enable `,e,`:`]}),(0,V.jsxs)(`ol`,{className:`list-decimal list-inside space-y-2 pl-1`,children:[(0,V.jsxs)(`li`,{children:[`Press`,` `,(0,V.jsx)(`kbd`,{className:`px-1.5 py-0.5 rounded bg-slate-900 border border-slate-600 text-xs font-mono text-slate-200`,children:`Ctrl+C`}),` `,`in the terminal running`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),`.`]}),(0,V.jsxs)(`li`,{children:[`Run`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`lelab`}),` `,`again.`]})]})]}),Ate=({open:e,onOpenChange:t,installHint:n})=>{let r=NI(`system/wandb-extra`,e);return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:r.state}),PI(r.state,`Weights & Biases Not Installed`)]}),(0,V.jsx)(Ou,{className:`sr-only`,children:`Install the wandb package to enable W&B logging.`})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(II,{state:r.state,error:r.error,logs:r.logs,logBoxRef:r.logBoxRef,onInstall:r.handleInstall,onRetry:r.handleRetry,installHint:n,packageName:`wandb`,idleTitle:`Weights & Biases Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Enabling W&B logging requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`wandb`}),` `,`package, which isn't installed in this environment. Install it to log this run to W&B.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`W&B logging`})})})]})})},jte=({config:e,updateConfig:t,datasets:n,datasetsLoading:r})=>{let{baseUrl:i,fetchWithHeaders:a}=Rs(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(`pip install wandb`);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`Run Configuration`})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{className:`text-slate-300`,children:`Dataset Repository ID *`}),(0,V.jsx)(`div`,{className:`mt-1`,children:(0,V.jsx)(Ote,{datasets:n,loading:r,value:e.dataset_repo_id||null,onChange:e=>{e&&t(`dataset_repo_id`,e)}})}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace Hub dataset repository ID`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_type`,className:`text-slate-300`,children:`Policy`}),(0,V.jsxs)(J_,{value:e.policy_type,onValueChange:e=>t(`policy_type`,e),children:[(0,V.jsx)(X_,{id:`policy_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`act`,children:`ACT (Action Chunking Transformer)`}),(0,V.jsx)(tv,{value:`diffusion`,children:`Diffusion Policy`}),(0,V.jsx)(tv,{value:`pi0`,children:`PI0`}),(0,V.jsx)(tv,{value:`smolvla`,children:`SmolVLA`}),(0,V.jsx)(tv,{value:`groot`,children:`GR00T N1.7`}),(0,V.jsx)(tv,{value:`tdmpc`,children:`TD-MPC`}),(0,V.jsx)(tv,{value:`vqbet`,children:`VQ-BeT`}),(0,V.jsx)(tv,{value:`pi0_fast`,children:`PI0 Fast`}),(0,V.jsx)(tv,{value:`sac`,children:`SAC`}),(0,V.jsx)(tv,{value:`reward_classifier`,children:`Reward Classifier`})]})]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`steps`,className:`text-slate-300`,children:`Training Steps`}),(0,V.jsx)(Eh,{id:`steps`,value:e.steps,onChange:e=>{e!==void 0&&t(`steps`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`batch_size`,className:`text-slate-300`,children:`Batch Size`}),(0,V.jsx)(Eh,{id:`batch_size`,value:e.batch_size,onChange:e=>{e!==void 0&&t(`batch_size`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)($j,{id:`wandb_enable`,checked:e.wandb_enable,onCheckedChange:async e=>{if(!e){t(`wandb_enable`,!1);return}try{let e=await(await a(`${i}/system/wandb-extra`)).json();e.available?t(`wandb_enable`,!0):(l(e.install_hint),s(!0))}catch{t(`wandb_enable`,!0)}},className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`wandb_enable`,className:`text-slate-300`,children:`Enable Weights & Biases`})]})]}),(0,V.jsx)(Ate,{open:o,onOpenChange:s,installHint:c}),e.wandb_enable&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_project`,className:`text-slate-300`,children:`W&B Project Name`}),(0,V.jsx)(Th,{id:`wandb_project`,value:e.wandb_project||``,onChange:e=>t(`wandb_project`,e.target.value||void 0),placeholder:`my-robotics-project`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]})},RI={policy_base_model_path:`nvidia/GR00T-N1.7-3B`,policy_embodiment_tag:`new_embodiment`,policy_chunk_size:16,policy_n_action_steps:16,policy_use_relative_actions:!0,policy_relative_exclude_joints:[`gripper`],policy_use_bf16:!0,dataset_image_transforms_enable:!0},Mte=({config:e,updateConfig:t})=>{let n=e.policy_type===`groot`;if((0,_.useEffect)(()=>{n&&Object.keys(RI).forEach(n=>{e[n]===void 0&&t(n,RI[n])})},[n]),!n)return null;let r=(e.policy_relative_exclude_joints??[]).join(`, `);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`GR00T N1.7`})}),(0,V.jsxs)(Tv,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_base_model_path`,className:`text-slate-300`,children:`Base Model Path`}),(0,V.jsx)(Th,{id:`policy_base_model_path`,value:e.policy_base_model_path??``,onChange:e=>t(`policy_base_model_path`,e.target.value||void 0),placeholder:`nvidia/GR00T-N1.7-3B`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`HuggingFace repo of the pretrained GR00T backbone to fine-tune.`})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_embodiment_tag`,className:`text-slate-300`,children:`Embodiment Tag`}),(0,V.jsx)(Th,{id:`policy_embodiment_tag`,value:e.policy_embodiment_tag??``,onChange:e=>t(`policy_embodiment_tag`,e.target.value||void 0),placeholder:`new_embodiment`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_relative_exclude_joints`,className:`text-slate-300`,children:`Relative Exclude Joints`}),(0,V.jsx)(Th,{id:`policy_relative_exclude_joints`,value:r,onChange:e=>t(`policy_relative_exclude_joints`,e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)),placeholder:`gripper`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Comma-separated joints kept absolute when relative actions are on.`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_chunk_size`,className:`text-slate-300`,children:`Chunk Size`}),(0,V.jsx)(Eh,{id:`policy_chunk_size`,value:e.policy_chunk_size,onChange:e=>t(`policy_chunk_size`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_n_action_steps`,className:`text-slate-300`,children:`Action Steps`}),(0,V.jsx)(Eh,{id:`policy_n_action_steps`,value:e.policy_n_action_steps,onChange:e=>t(`policy_n_action_steps`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`policy_use_relative_actions`,checked:e.policy_use_relative_actions??!1,onCheckedChange:e=>t(`policy_use_relative_actions`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`policy_use_relative_actions`,className:`text-slate-300`,children:`Use Relative Actions`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`policy_use_bf16`,checked:e.policy_use_bf16??!1,onCheckedChange:e=>t(`policy_use_bf16`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`policy_use_bf16`,className:`text-slate-300`,children:`Use bfloat16`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`dataset_image_transforms_enable`,checked:e.dataset_image_transforms_enable??!1,onCheckedChange:e=>t(`dataset_image_transforms_enable`,e),className:`data-[state=checked]:bg-green-500`}),(0,V.jsx)(q,{htmlFor:`dataset_image_transforms_enable`,className:`text-slate-300`,children:`Enable Image Augmentations`})]})]})]})]})},zI=({children:e})=>(0,V.jsx)(`h4`,{className:`text-xs font-semibold text-slate-400 uppercase tracking-wider`,children:e}),Nte=({config:e,updateConfig:t})=>{let[n,r]=(0,_.useState)(!1);return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsxs)(Cv,{role:`button`,tabIndex:0,"aria-expanded":n,onClick:()=>r(e=>!e),onKeyDown:e=>{(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),r(e=>!e))},className:`cursor-pointer select-none flex flex-row items-center justify-between`,children:[(0,V.jsx)(`span`,{className:`text-white font-semibold`,children:`Advanced`}),(0,V.jsxs)(`span`,{className:`flex items-center gap-1 text-slate-400 text-sm`,children:[n?(0,V.jsx)(Da,{className:`w-4 h-4`}):(0,V.jsx)(Oa,{className:`w-4 h-4`}),n?`Hide`:`Show`]})]}),n&&(0,V.jsxs)(Tv,{className:`space-y-8`,children:[(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Policy`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`policy_device`,className:`text-slate-300`,children:`Device`}),(0,V.jsxs)(J_,{value:e.policy_device||`cuda`,onValueChange:e=>t(`policy_device`,e),children:[(0,V.jsx)(X_,{id:`policy_device`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`cuda`,children:`CUDA (GPU)`}),(0,V.jsx)(tv,{value:`cpu`,children:`CPU`}),(0,V.jsx)(tv,{value:`mps`,children:`MPS (Apple Silicon)`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3 pt-6`,children:[(0,V.jsx)($j,{id:`policy_use_amp`,checked:e.policy_use_amp,onCheckedChange:e=>t(`policy_use_amp`,e)}),(0,V.jsx)(q,{htmlFor:`policy_use_amp`,className:`text-slate-300`,children:`Use Automatic Mixed Precision`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Training`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`seed`,className:`text-slate-300`,children:`Random Seed`}),(0,V.jsx)(Eh,{id:`seed`,value:e.seed,onChange:e=>t(`seed`,e),className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`num_workers`,className:`text-slate-300`,children:`Number of Workers`}),(0,V.jsx)(Eh,{id:`num_workers`,value:e.num_workers,onChange:e=>{e!==void 0&&t(`num_workers`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Optimizer`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_type`,className:`text-slate-300`,children:`Optimizer`}),(0,V.jsxs)(J_,{value:e.optimizer_type||`adam`,onValueChange:e=>t(`optimizer_type`,e),children:[(0,V.jsx)(X_,{id:`optimizer_type`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`adam`,children:`Adam`}),(0,V.jsx)(tv,{value:`adamw`,children:`AdamW`}),(0,V.jsx)(tv,{value:`sgd`,children:`SGD`}),(0,V.jsx)(tv,{value:`multi_adam`,children:`Multi Adam`})]})]})]}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-3 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_lr`,className:`text-slate-300`,children:`Learning Rate`}),(0,V.jsx)(Eh,{id:`optimizer_lr`,integer:!1,step:`0.0001`,value:e.optimizer_lr,onChange:e=>t(`optimizer_lr`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_weight_decay`,className:`text-slate-300`,children:`Weight Decay`}),(0,V.jsx)(Eh,{id:`optimizer_weight_decay`,integer:!1,step:`0.0001`,value:e.optimizer_weight_decay,onChange:e=>t(`optimizer_weight_decay`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`optimizer_grad_clip_norm`,className:`text-slate-300`,children:`Gradient Clipping`}),(0,V.jsx)(Eh,{id:`optimizer_grad_clip_norm`,integer:!1,step:`0.0001`,value:e.optimizer_grad_clip_norm,onChange:e=>t(`optimizer_grad_clip_norm`,e),placeholder:`Use policy default`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]})]}),(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Logging & Checkpointing`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-4`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`log_freq`,className:`text-slate-300`,children:`Log Frequency`}),(0,V.jsx)(Eh,{id:`log_freq`,value:e.log_freq,onChange:e=>{e!==void 0&&t(`log_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`save_freq`,className:`text-slate-300`,children:`Save Frequency`}),(0,V.jsx)(Eh,{id:`save_freq`,value:e.save_freq,onChange:e=>{e!==void 0&&t(`save_freq`,e)},className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`save_checkpoint`,checked:e.save_checkpoint,onCheckedChange:e=>t(`save_checkpoint`,e)}),(0,V.jsx)(q,{htmlFor:`save_checkpoint`,className:`text-slate-300`,children:`Save Checkpoints`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`resume`,checked:e.resume,onCheckedChange:e=>t(`resume`,e)}),(0,V.jsx)(q,{htmlFor:`resume`,className:`text-slate-300`,children:`Resume from Checkpoint`})]})]}),e.wandb_enable&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Weights & Biases`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_entity`,className:`text-slate-300`,children:`W&B Entity (optional)`}),(0,V.jsx)(Th,{id:`wandb_entity`,value:e.wandb_entity||``,onChange:e=>t(`wandb_entity`,e.target.value||void 0),placeholder:`your-username`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_notes`,className:`text-slate-300`,children:`W&B Notes (optional)`}),(0,V.jsx)(Th,{id:`wandb_notes`,value:e.wandb_notes||``,onChange:e=>t(`wandb_notes`,e.target.value||void 0),placeholder:`Training run notes...`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`wandb_mode`,className:`text-slate-300`,children:`W&B Mode`}),(0,V.jsxs)(J_,{value:e.wandb_mode||`online`,onValueChange:e=>t(`wandb_mode`,e),children:[(0,V.jsx)(X_,{id:`wandb_mode`,className:`bg-slate-900 border-slate-600 text-white rounded-lg`,children:(0,V.jsx)(Y_,{})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`online`,children:`Online`}),(0,V.jsx)(tv,{value:`offline`,children:`Offline`}),(0,V.jsx)(tv,{value:`disabled`,children:`Disabled`})]})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`wandb_disable_artifact`,checked:e.wandb_disable_artifact,onCheckedChange:e=>t(`wandb_disable_artifact`,e)}),(0,V.jsx)(q,{htmlFor:`wandb_disable_artifact`,className:`text-slate-300`,children:`Disable Artifacts`})]})]})]}),!e.wandb_enable&&(0,V.jsx)(fM,{className:`bg-slate-700`}),(0,V.jsxs)(`section`,{className:`space-y-4`,children:[(0,V.jsx)(zI,{children:`Misc`}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)($j,{id:`use_policy_training_preset`,checked:e.use_policy_training_preset,onCheckedChange:e=>t(`use_policy_training_preset`,e)}),(0,V.jsx)(q,{htmlFor:`use_policy_training_preset`,className:`text-slate-300`,children:`Use Policy Training Preset`})]})]})]})]})},Pte=(e,t)=>`$${(t===`minute`?e*60:e).toFixed(2)}/hr`,Fte=e=>{let t=e.accelerator?e.accelerator:e.cpu;return`${e.pretty_name} · ${t} · ${Pte(e.unit_cost_usd,e.unit_label)}`},Ite=({config:e,updateConfig:t,authenticated:n,flavors:r,loading:i})=>{let a=e.target,o=a.runner===`local`?`local`:`hf:${a.flavor??``}`;return(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsx)(wv,{className:`text-white`,children:`Compute target`})}),(0,V.jsx)(Tv,{className:`space-y-3`,children:(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{className:`text-slate-300`,children:`Run training on`}),(0,V.jsxs)(J_,{value:o,onValueChange:e=>{e===`local`?t(`target`,{runner:`local`}):e.startsWith(`hf:`)&&t(`target`,{runner:`hf_cloud`,flavor:e.slice(3)})},children:[(0,V.jsx)(X_,{className:`bg-slate-900 border-slate-600 text-white rounded-lg mt-1`,children:(0,V.jsx)(Y_,{placeholder:i?`Loading…`:`Select target`})}),(0,V.jsxs)($_,{className:`bg-slate-800 border-slate-600 text-white`,children:[(0,V.jsx)(tv,{value:`local`,children:`Local — your machine (free)`}),r.map(e=>(0,V.jsxs)(tv,{value:`hf:${e.name}`,disabled:!n,children:[Fte(e),!n&&(0,V.jsx)(`span`,{className:`text-amber-300 ml-2 text-xs`,children:`log in to HF`})]},e.name))]})]}),(0,V.jsx)(`p`,{className:`text-xs text-slate-500 mt-1`,children:`Cost shown is per running hour. Final policy uploads to your HF account when training completes.`})]})})]})},Lte=({config:e,updateConfig:t,datasets:n,datasetsLoading:r,authenticated:i,flavors:a,hardwareLoading:o})=>(0,V.jsxs)(`div`,{className:`max-w-3xl mx-auto space-y-6`,children:[(0,V.jsx)(Ite,{config:e,updateConfig:t,authenticated:i,flavors:a,loading:o}),(0,V.jsx)(jte,{config:e,updateConfig:t,datasets:n,datasetsLoading:r}),(0,V.jsx)(Mte,{config:e,updateConfig:t}),(0,V.jsx)(Nte,{config:e,updateConfig:t})]}),BI=o(((e,t)=>{t.exports=Array.isArray})),VI=o(((e,t)=>{t.exports=typeof global==`object`&&global&&global.Object===Object&&global})),HI=o(((e,t)=>{var n=VI(),r=typeof self==`object`&&self&&self.Object===Object&&self;t.exports=n||r||Function(`return this`)()})),UI=o(((e,t)=>{t.exports=HI().Symbol})),Rte=o(((e,t)=>{var n=UI(),r=Object.prototype,i=r.hasOwnProperty,a=r.toString,o=n?n.toStringTag:void 0;function s(e){var t=i.call(e,o),n=e[o];try{e[o]=void 0;var r=!0}catch{}var s=a.call(e);return r&&(t?e[o]=n:delete e[o]),s}t.exports=s})),zte=o(((e,t)=>{var n=Object.prototype.toString;function r(e){return n.call(e)}t.exports=r})),WI=o(((e,t)=>{var n=UI(),r=Rte(),i=zte(),a=`[object Null]`,o=`[object Undefined]`,s=n?n.toStringTag:void 0;function c(e){return e==null?e===void 0?o:a:s&&s in Object(e)?r(e):i(e)}t.exports=c})),GI=o(((e,t)=>{function n(e){return typeof e==`object`&&!!e}t.exports=n})),KI=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Symbol]`;function a(e){return typeof e==`symbol`||r(e)&&n(e)==i}t.exports=a})),qI=o(((e,t)=>{var n=BI(),r=KI(),i=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,a=/^\w*$/;function o(e,t){if(n(e))return!1;var o=typeof e;return o==`number`||o==`symbol`||o==`boolean`||e==null||r(e)?!0:a.test(e)||!i.test(e)||t!=null&&e in Object(t)}t.exports=o})),JI=o(((e,t)=>{function n(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=n})),YI=o(((e,t)=>{var n=WI(),r=JI(),i=`[object AsyncFunction]`,a=`[object Function]`,o=`[object GeneratorFunction]`,s=`[object Proxy]`;function c(e){if(!r(e))return!1;var t=n(e);return t==a||t==o||t==i||t==s}t.exports=c})),Bte=o(((e,t)=>{t.exports=HI()[`__core-js_shared__`]})),Vte=o(((e,t)=>{var n=Bte(),r=function(){var e=/[^.]+$/.exec(n&&n.keys&&n.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function i(e){return!!r&&r in e}t.exports=i})),XI=o(((e,t)=>{var n=Function.prototype.toString;function r(e){if(e!=null){try{return n.call(e)}catch{}try{return e+``}catch{}}return``}t.exports=r})),Hte=o(((e,t)=>{var n=YI(),r=Vte(),i=JI(),a=XI(),o=/[\\^$.*+?()[\]{}|]/g,s=/^\[object .+?Constructor\]$/,c=Function.prototype,l=Object.prototype,u=c.toString,d=l.hasOwnProperty,f=RegExp(`^`+u.call(d).replace(o,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function p(e){return!i(e)||r(e)?!1:(n(e)?f:s).test(a(e))}t.exports=p})),Ute=o(((e,t)=>{function n(e,t){return e?.[t]}t.exports=n})),ZI=o(((e,t)=>{var n=Hte(),r=Ute();function i(e,t){var i=r(e,t);return n(i)?i:void 0}t.exports=i})),QI=o(((e,t)=>{t.exports=ZI()(Object,`create`)})),Wte=o(((e,t)=>{var n=QI();function r(){this.__data__=n?n(null):{},this.size=0}t.exports=r})),Gte=o(((e,t)=>{function n(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}t.exports=n})),Kte=o(((e,t)=>{var n=QI(),r=`__lodash_hash_undefined__`,i=Object.prototype.hasOwnProperty;function a(e){var t=this.__data__;if(n){var a=t[e];return a===r?void 0:a}return i.call(t,e)?t[e]:void 0}t.exports=a})),qte=o(((e,t)=>{var n=QI(),r=Object.prototype.hasOwnProperty;function i(e){var t=this.__data__;return n?t[e]!==void 0:r.call(t,e)}t.exports=i})),Jte=o(((e,t)=>{var n=QI(),r=`__lodash_hash_undefined__`;function i(e,t){var i=this.__data__;return this.size+=+!this.has(e),i[e]=n&&t===void 0?r:t,this}t.exports=i})),Yte=o(((e,t)=>{var n=Wte(),r=Gte(),i=Kte(),a=qte(),o=Jte();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{function n(){this.__data__=[],this.size=0}t.exports=n})),$I=o(((e,t)=>{function n(e,t){return e===t||e!==e&&t!==t}t.exports=n})),eL=o(((e,t)=>{var n=$I();function r(e,t){for(var r=e.length;r--;)if(n(e[r][0],t))return r;return-1}t.exports=r})),Zte=o(((e,t)=>{var n=eL(),r=Array.prototype.splice;function i(e){var t=this.__data__,i=n(t,e);return i<0?!1:(i==t.length-1?t.pop():r.call(t,i,1),--this.size,!0)}t.exports=i})),Qte=o(((e,t)=>{var n=eL();function r(e){var t=this.__data__,r=n(t,e);return r<0?void 0:t[r][1]}t.exports=r})),$te=o(((e,t)=>{var n=eL();function r(e){return n(this.__data__,e)>-1}t.exports=r})),ene=o(((e,t)=>{var n=eL();function r(e,t){var r=this.__data__,i=n(r,e);return i<0?(++this.size,r.push([e,t])):r[i][1]=t,this}t.exports=r})),tL=o(((e,t)=>{var n=Xte(),r=Zte(),i=Qte(),a=$te(),o=ene();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{t.exports=ZI()(HI(),`Map`)})),tne=o(((e,t)=>{var n=Yte(),r=tL(),i=nL();function a(){this.size=0,this.__data__={hash:new n,map:new(i||r),string:new n}}t.exports=a})),nne=o(((e,t)=>{function n(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}t.exports=n})),rL=o(((e,t)=>{var n=nne();function r(e,t){var r=e.__data__;return n(t)?r[typeof t==`string`?`string`:`hash`]:r.map}t.exports=r})),rne=o(((e,t)=>{var n=rL();function r(e){var t=n(this,e).delete(e);return this.size-=+!!t,t}t.exports=r})),ine=o(((e,t)=>{var n=rL();function r(e){return n(this,e).get(e)}t.exports=r})),ane=o(((e,t)=>{var n=rL();function r(e){return n(this,e).has(e)}t.exports=r})),one=o(((e,t)=>{var n=rL();function r(e,t){var r=n(this,e),i=r.size;return r.set(e,t),this.size+=r.size==i?0:1,this}t.exports=r})),iL=o(((e,t)=>{var n=tne(),r=rne(),i=ine(),a=ane(),o=one();function s(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t{var n=iL(),r=`Expected a function`;function i(e,t){if(typeof e!=`function`||t!=null&&typeof t!=`function`)throw TypeError(r);var a=function(){var n=arguments,r=t?t.apply(this,n):n[0],i=a.cache;if(i.has(r))return i.get(r);var o=e.apply(this,n);return a.cache=i.set(r,o)||i,o};return a.cache=new(i.Cache||n),a}i.Cache=n,t.exports=i})),sne=o(((e,t)=>{var n=aL(),r=500;function i(e){var t=n(e,function(e){return i.size===r&&i.clear(),e}),i=t.cache;return t}t.exports=i})),cne=o(((e,t)=>{var n=sne(),r=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,i=/\\(\\)?/g;t.exports=n(function(e){var t=[];return e.charCodeAt(0)===46&&t.push(``),e.replace(r,function(e,n,r,a){t.push(r?a.replace(i,`$1`):n||e)}),t})})),oL=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=Array(r);++n{var n=UI(),r=oL(),i=BI(),a=KI(),o=1/0,s=n?n.prototype:void 0,c=s?s.toString:void 0;function l(e){if(typeof e==`string`)return e;if(i(e))return r(e,l)+``;if(a(e))return c?c.call(e):``;var t=e+``;return t==`0`&&1/e==-o?`-0`:t}t.exports=l})),sL=o(((e,t)=>{var n=lne();function r(e){return e==null?``:n(e)}t.exports=r})),cL=o(((e,t)=>{var n=BI(),r=qI(),i=cne(),a=sL();function o(e,t){return n(e)?e:r(e,t)?[e]:i(a(e))}t.exports=o})),lL=o(((e,t)=>{var n=KI(),r=1/0;function i(e){if(typeof e==`string`||n(e))return e;var t=e+``;return t==`0`&&1/e==-r?`-0`:t}t.exports=i})),uL=o(((e,t)=>{var n=cL(),r=lL();function i(e,t){t=n(t,e);for(var i=0,a=t.length;e!=null&&i{var n=uL();function r(e,t,r){var i=e==null?void 0:n(e,t);return i===void 0?r:i}t.exports=r})),une=o(((e,t)=>{function n(e){return e==null}t.exports=n})),dne=o(((e,t)=>{var n=WI(),r=BI(),i=GI(),a=`[object String]`;function o(e){return typeof e==`string`||!r(e)&&i(e)&&n(e)==a}t.exports=o})),fne=o((e=>{var t=Symbol.for(`react.element`),n=Symbol.for(`react.portal`),r=Symbol.for(`react.fragment`),i=Symbol.for(`react.strict_mode`),a=Symbol.for(`react.profiler`),o=Symbol.for(`react.provider`),s=Symbol.for(`react.context`),c=Symbol.for(`react.server_context`),l=Symbol.for(`react.forward_ref`),u=Symbol.for(`react.suspense`),d=Symbol.for(`react.suspense_list`),f=Symbol.for(`react.memo`),p=Symbol.for(`react.lazy`);function m(e){if(typeof e==`object`&&e){var m=e.$$typeof;switch(m){case t:switch(e=e.type,e){case r:case a:case i:case u:case d:return e;default:switch(e&&=e.$$typeof,e){case c:case s:case l:case p:case f:case o:return e;default:return m}}case n:return m}}}e.isFragment=function(e){return m(e)===r}})),pne=o(((e,t)=>{t.exports=fne()})),fL=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Number]`;function a(e){return typeof e==`number`||r(e)&&n(e)==i}t.exports=a})),mne=o(((e,t)=>{var n=fL();function r(e){return n(e)&&e!=+e}t.exports=r})),pL=l(dne()),mL=l(mne()),hL=l(dL()),hne=l(fL()),gL=l(une()),_L=function(e){return e===0?0:e>0?1:-1},vL=function(e){return(0,pL.default)(e)&&e.indexOf(`%`)===e.length-1},Q=function(e){return(0,hne.default)(e)&&!(0,mL.default)(e)},yL=function(e){return(0,gL.default)(e)},bL=function(e){return Q(e)||(0,pL.default)(e)},xL=0,SL=function(e){var t=++xL;return`${e||``}${t}`},CL=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!Q(e)&&!(0,pL.default)(e))return n;var i;if(vL(e)){var a=e.indexOf(`%`);i=t*parseFloat(e.slice(0,a))/100}else i=+e;return(0,mL.default)(i)&&(i=n),r&&i>t&&(i=t),i},wL=function(e){if(!e)return null;var t=Object.keys(e);return t&&t.length?e[t[0]]:null},TL=function(e){if(!Array.isArray(e))return!1;for(var t=e.length,n={},r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function GL(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function KL(e){"@babel/helpers - typeof";return KL=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},KL(e)}var qL={click:`onClick`,mousedown:`onMouseDown`,mouseup:`onMouseUp`,mouseover:`onMouseOver`,mousemove:`onMouseMove`,mouseout:`onMouseOut`,mouseenter:`onMouseEnter`,mouseleave:`onMouseLeave`,touchcancel:`onTouchCancel`,touchend:`onTouchEnd`,touchmove:`onTouchMove`,touchstart:`onTouchStart`,contextmenu:`onContextMenu`,dblclick:`onDoubleClick`},JL=function(e){return typeof e==`string`?e:e?e.displayName||e.name||`Component`:``},YL=null,XL=null,ZL=function e(t){if(t===YL&&Array.isArray(XL))return XL;var n=[];return _.Children.forEach(t,function(t){(0,gL.default)(t)||((0,VL.isFragment)(t)?n=n.concat(e(t.props.children)):n.push(t))}),XL=n,YL=t,n};function QL(e,t){var n=[],r=[];return r=Array.isArray(t)?t.map(function(e){return JL(e)}):[JL(t)],ZL(e).forEach(function(e){var t=(0,hL.default)(e,`type.displayName`)||(0,hL.default)(e,`type.name`);r.indexOf(t)!==-1&&n.push(e)}),n}function $L(e,t){var n=QL(e,t);return n&&n[0]}var eR=function(e){if(!e||!e.props)return!1;var t=e.props,n=t.width,r=t.height;return!(!Q(n)||n<=0||!Q(r)||r<=0)},tR=`a.altGlyph.altGlyphDef.altGlyphItem.animate.animateColor.animateMotion.animateTransform.circle.clipPath.color-profile.cursor.defs.desc.ellipse.feBlend.feColormatrix.feComponentTransfer.feComposite.feConvolveMatrix.feDiffuseLighting.feDisplacementMap.feDistantLight.feFlood.feFuncA.feFuncB.feFuncG.feFuncR.feGaussianBlur.feImage.feMerge.feMergeNode.feMorphology.feOffset.fePointLight.feSpecularLighting.feSpotLight.feTile.feTurbulence.filter.font.font-face.font-face-format.font-face-name.font-face-url.foreignObject.g.glyph.glyphRef.hkern.image.line.lineGradient.marker.mask.metadata.missing-glyph.mpath.path.pattern.polygon.polyline.radialGradient.rect.script.set.stop.style.svg.switch.symbol.text.textPath.title.tref.tspan.use.view.vkern`.split(`.`),nR=function(e){return e&&e.type&&(0,pL.default)(e.type)&&tR.indexOf(e.type)>=0},rR=function(e){return e&&KL(e)===`object`&&`clipDot`in e},iR=function(e,t,n,r){var i=FL?.[r]??[];return t.startsWith(`data-`)||!(0,BL.default)(e)&&(r&&i.includes(t)||NL.includes(t))||n&&IL.includes(t)},aR=function(e,t,n){if(!e||typeof e==`function`||typeof e==`boolean`)return null;var r=e;if((0,_.isValidElement)(e)&&(r=e.props),!(0,AL.default)(r))return null;var i={};return Object.keys(r).forEach(function(e){iR(r?.[e],e,t,n)&&(i[e]=r[e])}),i},oR=function e(t,n){if(t===n)return!0;var r=_.Children.count(t);if(r!==_.Children.count(n))return!1;if(r===0)return!0;if(r===1)return sR(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function mR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function hR(e){var t=e.children,n=e.width,r=e.height,i=e.viewBox,a=e.className,o=e.style,s=e.title,c=e.desc,l=pR(e,dR),u=i||{width:n,height:r,x:0,y:0},d=pa(`recharts-surface`,a);return _.createElement(`svg`,fR({},aR(l,!0,`svg`),{className:d,width:n,height:r,style:o,viewBox:`${u.x} ${u.y} ${u.width} ${u.height}`}),_.createElement(`title`,null,s),_.createElement(`desc`,null,c),t)}var gR=[`children`,`className`];function _R(){return _R=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function yR(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var bR=_.forwardRef(function(e,t){var n=e.children,r=e.className,i=vR(e,gR),a=pa(`recharts-layer`,r);return _.createElement(`g`,_R({className:a},aR(i,!0),{ref:t}),n)}),xR=!1,SR=function(e,t){var n=[...arguments].slice(2);if(xR&&typeof console<`u`&&console.warn&&(t===void 0&&console.warn(`LogUtils requires an error message argument`),!e))if(t===void 0)console.warn(`Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.`);else{var r=0;console.warn(t.replace(/%s/g,function(){return n[r++]}))}},CR=o(((e,t)=>{function n(e,t,n){var r=-1,i=e.length;t<0&&(t=-t>i?0:i+t),n=n>i?i:n,n<0&&(n+=i),i=t>n?0:n-t>>>0,t>>>=0;for(var a=Array(i);++r{var n=CR();function r(e,t,r){var i=e.length;return r=r===void 0?i:r,!t&&r>=i?e:n(e,t,r)}t.exports=r})),TR=o(((e,t)=>{var n=RegExp(`[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]`);function r(e){return n.test(e)}t.exports=r})),ER=o(((e,t)=>{function n(e){return e.split(``)}t.exports=n})),DR=o(((e,t)=>{var n=`\\ud800-\\udfff`,r=`\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff`,i=`\\ufe0e\\ufe0f`,a=`[`+n+`]`,o=`[`+r+`]`,s=`\\ud83c[\\udffb-\\udfff]`,c=`(?:`+o+`|`+s+`)`,l=`[^`+n+`]`,u=`(?:\\ud83c[\\udde6-\\uddff]){2}`,d=`[\\ud800-\\udbff][\\udc00-\\udfff]`,f=`\\u200d`,p=c+`?`,m=`[`+i+`]?`,h=`(?:`+f+`(?:`+[l,u,d].join(`|`)+`)`+m+p+`)*`,g=m+p+h,_=`(?:`+[l+o+`?`,o,u,d,a].join(`|`)+`)`,v=RegExp(s+`(?=`+s+`)|`+_+g,`g`);function y(e){return e.match(v)||[]}t.exports=y})),OR=o(((e,t)=>{var n=ER(),r=TR(),i=DR();function a(e){return r(e)?i(e):n(e)}t.exports=a})),kR=o(((e,t)=>{var n=wR(),r=TR(),i=OR(),a=sL();function o(e){return function(t){t=a(t);var o=r(t)?i(t):void 0,s=o?o[0]:t.charAt(0),c=o?n(o,1).join(``):t.slice(1);return s[e]()+c}}t.exports=o})),AR=o(((e,t)=>{t.exports=kR()(`toUpperCase`)}));function jR(e){return function(){return e}}var MR=Math.cos,NR=Math.sin,PR=Math.sqrt,FR=Math.PI;FR/2;var IR=2*FR,LR=Math.PI,RR=2*LR,zR=1e-6,BR=RR-zR;function VR(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw Error(`invalid digits: ${e}`);if(t>15)return VR;let n=10**t;return function(e){this._+=e[0];for(let t=1,r=e.length;tzR)if(!(Math.abs(u*s-c*l)>zR)||!i)this._append`L${this._x1=e},${this._y1=t}`;else{let f=n-a,p=r-o,m=s*s+c*c,h=f*f+p*p,g=Math.sqrt(m),_=Math.sqrt(d),v=i*Math.tan((LR-Math.acos((m+d-h)/(2*g*_)))/2),y=v/_,b=v/g;Math.abs(y-1)>zR&&this._append`L${e+y*l},${t+y*u}`,this._append`A${i},${i},0,0,${+(u*f>l*p)},${this._x1=e+b*s},${this._y1=t+b*c}`}}arc(e,t,n,r,i,a){if(e=+e,t=+t,n=+n,a=!!a,n<0)throw Error(`negative radius: ${n}`);let o=n*Math.cos(r),s=n*Math.sin(r),c=e+o,l=t+s,u=1^a,d=a?r-i:i-r;this._x1===null?this._append`M${c},${l}`:(Math.abs(this._x1-c)>zR||Math.abs(this._y1-l)>zR)&&this._append`L${c},${l}`,n&&(d<0&&(d=d%RR+RR),d>BR?this._append`A${n},${n},0,1,${u},${e-o},${t-s}A${n},${n},0,1,${u},${this._x1=c},${this._y1=l}`:d>zR&&this._append`A${n},${n},0,${+(d>=LR)},${u},${this._x1=e+n*Math.cos(i)},${this._y1=t+n*Math.sin(i)}`)}rect(e,t,n,r){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+t}h${n=+n}v${+r}h${-n}Z`}toString(){return this._}};function WR(){return new UR}WR.prototype=UR.prototype;function GR(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{let e=Math.floor(n);if(!(e>=0))throw RangeError(`invalid digits: ${n}`);t=e}return e},()=>new UR(t)}Array.prototype.slice;function KR(e){return typeof e==`object`&&`length`in e?e:Array.from(e)}function qR(e){this._context=e}qR.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function JR(e){return new qR(e)}function YR(e){return e[0]}function XR(e){return e[1]}function ZR(e,t){var n=jR(!0),r=null,i=JR,a=null,o=GR(s);e=typeof e==`function`?e:e===void 0?YR:jR(e),t=typeof t==`function`?t:t===void 0?XR:jR(t);function s(s){var c,l=(s=KR(s)).length,u,d=!1,f;for(r??(a=i(f=o())),c=0;c<=l;++c)!(c=d;--f)s.point(_[f],v[f]);s.lineEnd(),s.areaEnd()}h&&(_[u]=+e(m,u,l),v[u]=+t(m,u,l),s.point(r?+r(m,u,l):_[u],n?+n(m,u,l):v[u]))}if(g)return s=null,g+``||null}function u(){return ZR().defined(i).curve(o).context(a)}return l.x=function(t){return arguments.length?(e=typeof t==`function`?t:jR(+t),r=null,l):e},l.x0=function(t){return arguments.length?(e=typeof t==`function`?t:jR(+t),l):e},l.x1=function(e){return arguments.length?(r=e==null?null:typeof e==`function`?e:jR(+e),l):r},l.y=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),n=null,l):t},l.y0=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),l):t},l.y1=function(e){return arguments.length?(n=e==null?null:typeof e==`function`?e:jR(+e),l):n},l.lineX0=l.lineY0=function(){return u().x(e).y(t)},l.lineY1=function(){return u().x(e).y(n)},l.lineX1=function(){return u().x(r).y(t)},l.defined=function(e){return arguments.length?(i=typeof e==`function`?e:jR(!!e),l):i},l.curve=function(e){return arguments.length?(o=e,a!=null&&(s=o(a)),l):o},l.context=function(e){return arguments.length?(e==null?a=s=null:s=o(a=e),l):a},l}var $R=class{constructor(e,t){this._context=e,this._x=t}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,t,e,t):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+t)/2,e,this._y0,e,t);break}this._x0=e,this._y0=t}};function ez(e){return new $R(e,!0)}function tz(e){return new $R(e,!1)}var nz={draw(e,t){let n=PR(t/FR);e.moveTo(n,0),e.arc(0,0,n,0,IR)}},rz={draw(e,t){let n=PR(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},iz=PR(1/3),az=iz*2,oz={draw(e,t){let n=PR(t/az),r=n*iz;e.moveTo(0,-n),e.lineTo(r,0),e.lineTo(0,n),e.lineTo(-r,0),e.closePath()}},sz={draw(e,t){let n=PR(t),r=-n/2;e.rect(r,r,n,n)}},cz=.8908130915292852,lz=NR(FR/10)/NR(7*FR/10),uz=NR(IR/10)*lz,dz=-MR(IR/10)*lz,fz={draw(e,t){let n=PR(t*cz),r=uz*n,i=dz*n;e.moveTo(0,-n),e.lineTo(r,i);for(let t=1;t<5;++t){let a=IR*t/5,o=MR(a),s=NR(a);e.lineTo(s*n,-o*n),e.lineTo(o*r-s*i,s*r+o*i)}e.closePath()}},pz=PR(3),mz={draw(e,t){let n=-PR(t/(pz*3));e.moveTo(0,n*2),e.lineTo(-pz*n,-n),e.lineTo(pz*n,-n),e.closePath()}},hz=-.5,gz=PR(3)/2,_z=1/PR(12),vz=(_z/2+1)*3,yz={draw(e,t){let n=PR(t/vz),r=n/2,i=n*_z,a=r,o=n*_z+n,s=-a,c=o;e.moveTo(r,i),e.lineTo(a,o),e.lineTo(s,c),e.lineTo(hz*r-gz*i,gz*r+hz*i),e.lineTo(hz*a-gz*o,gz*a+hz*o),e.lineTo(hz*s-gz*c,gz*s+hz*c),e.lineTo(hz*r+gz*i,hz*i-gz*r),e.lineTo(hz*a+gz*o,hz*o-gz*a),e.lineTo(hz*s+gz*c,hz*c-gz*s),e.closePath()}};function bz(e,t){let n=null,r=GR(i);e=typeof e==`function`?e:jR(e||nz),t=typeof t==`function`?t:jR(t===void 0?64:+t);function i(){let i;if(n||=i=r(),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),i)return n=null,i+``||null}return i.type=function(t){return arguments.length?(e=typeof t==`function`?t:jR(t),i):e},i.size=function(e){return arguments.length?(t=typeof e==`function`?e:jR(+e),i):t},i.context=function(e){return arguments.length?(n=e??null,i):n},i}function xz(){}function Sz(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function Cz(e){this._context=e}Cz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:Sz(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function wz(e){return new Cz(e)}function Tz(e){this._context=e}Tz.prototype={areaStart:xz,areaEnd:xz,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:this._context.moveTo(this._x2,this._y2),this._context.closePath();break;case 2:this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break;case 3:this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Ez(e){return new Tz(e)}function Dz(e){this._context=e}Dz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+e)/6,r=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:Sz(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function Oz(e){return new Dz(e)}function kz(e){this._context=e}kz.prototype={areaStart:xz,areaEnd:xz,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function Az(e){return new kz(e)}function jz(e){return e<0?-1:1}function Mz(e,t,n){var r=e._x1-e._x0,i=t-e._x1,a=(e._y1-e._y0)/(r||i<0&&-0),o=(n-e._y1)/(i||r<0&&-0),s=(a*i+o*r)/(r+i);return(jz(a)+jz(o))*Math.min(Math.abs(a),Math.abs(o),.5*Math.abs(s))||0}function Nz(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Pz(e,t,n){var r=e._x0,i=e._y0,a=e._x1,o=e._y1,s=(a-r)/3;e._context.bezierCurveTo(r+s,i+s*t,a-s,o-s*n,a,o)}function Fz(e){this._context=e}Fz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Pz(this,this._t0,Nz(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Pz(this,Nz(this,n=Mz(this,e,t)),n);break;default:Pz(this,this._t0,n=Mz(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function Iz(e){this._context=new Lz(e)}(Iz.prototype=Object.create(Fz.prototype)).point=function(e,t){Fz.prototype.point.call(this,t,e)};function Lz(e){this._context=e}Lz.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,r,i,a){this._context.bezierCurveTo(t,e,r,n,a,i)}};function Rz(e){return new Fz(e)}function zz(e){return new Iz(e)}function Bz(e){this._context=e}Bz.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var r=Vz(e),i=Vz(t),a=0,o=1;o=0;--t)i[t]=(o[t]-i[t+1])/a[t];for(a[n-1]=(e[n]+i[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}this._x=e,this._y=t}};function Wz(e){return new Uz(e,.5)}function Gz(e){return new Uz(e,0)}function Kz(e){return new Uz(e,1)}function qz(e,t){if((o=e.length)>1)for(var n=1,r,i,a=e[t[0]],o,s=a.length;n=0;)n[t]=t;return n}function Yz(e,t){return e[t]}function Xz(e){let t=[];return t.key=e,t}function Zz(){var e=jR([]),t=Jz,n=qz,r=Yz;function i(i){var a=Array.from(e.apply(this,arguments),Xz),o,s=a.length,c=-1,l;for(let e of i)for(o=0,++c;o0){for(var n,r,i=0,a=e[0].length,o;i0){for(var n=0,r=e[t[0]],i,a=r.length;n0)||!((a=(i=e[t[0]]).length)>0))){for(var n=0,r=1,i,a,o;r=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function dB(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var fB={symbolCircle:nz,symbolCross:rz,symbolDiamond:oz,symbolSquare:sz,symbolStar:fz,symbolTriangle:mz,symbolWye:yz},pB=Math.PI/180,mB=function(e){return fB[`symbol${(0,tB.default)(e)}`]||nz},hB=function(e,t,n){if(t===`area`)return e;switch(n){case`cross`:return 5*e*e/9;case`diamond`:return .5*e*e/Math.sqrt(3);case`square`:return e*e;case`star`:var r=18*pB;return 1.25*e*e*(Math.tan(r)-Math.tan(r*2)*Math.tan(r)**2);case`triangle`:return Math.sqrt(3)*e*e/4;case`wye`:return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},gB=function(e,t){fB[`symbol${(0,tB.default)(e)}`]=t},_B=function(e){var t=e.type,n=t===void 0?`circle`:t,r=e.size,i=r===void 0?64:r,a=e.sizeType,o=a===void 0?`area`:a,s=oB(oB({},uB(e,rB)),{},{type:n,size:i,sizeType:o}),c=function(){var e=mB(n);return bz().type(e).size(hB(i,o,n))()},l=s.className,u=s.cx,d=s.cy,f=aR(s,!0);return u===+u&&d===+d&&i===+i?_.createElement(`path`,iB({},f,{className:pa(`recharts-symbols`,l),transform:`translate(${u}, ${d})`,d:c()})):null};_B.registerSymbol=gB;function vB(e){"@babel/helpers - typeof";return vB=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vB(e)}function yB(){return yB=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var f=t.inactive?o:t.color;return _.createElement(`li`,yB({className:u,style:c,key:`legend-item-${n}`},zL(e.props,t,n)),_.createElement(hR,{width:r,height:r,viewBox:s,style:l},e.renderIcon(t)),_.createElement(`span`,{className:`recharts-legend-item-text`,style:{color:f}},i?i(d,t,n):d))})}},{key:`render`,value:function(){var e=this.props,t=e.payload,n=e.layout,r=e.align;if(!t||!t.length)return null;var i={padding:0,margin:0,textAlign:n===`horizontal`?r:`left`};return _.createElement(`ul`,{className:`recharts-default-legend`,style:i},this.renderItems())}}])}(_.PureComponent);MB(IB,`displayName`,`Legend`),MB(IB,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`middle`,inactiveColor:`#ccc`});var LB=o(((e,t)=>{var n=tL();function r(){this.__data__=new n,this.size=0}t.exports=r})),RB=o(((e,t)=>{function n(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}t.exports=n})),zB=o(((e,t)=>{function n(e){return this.__data__.get(e)}t.exports=n})),BB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),VB=o(((e,t)=>{var n=tL(),r=nL(),i=iL(),a=200;function o(e,t){var o=this.__data__;if(o instanceof n){var s=o.__data__;if(!r||s.length{var n=tL(),r=LB(),i=RB(),a=zB(),o=BB(),s=VB();function c(e){var t=this.__data__=new n(e);this.size=t.size}c.prototype.clear=r,c.prototype.delete=i,c.prototype.get=a,c.prototype.has=o,c.prototype.set=s,t.exports=c})),UB=o(((e,t)=>{var n=`__lodash_hash_undefined__`;function r(e){return this.__data__.set(e,n),this}t.exports=r})),WB=o(((e,t)=>{function n(e){return this.__data__.has(e)}t.exports=n})),GB=o(((e,t)=>{var n=iL(),r=UB(),i=WB();function a(e){var t=-1,r=e==null?0:e.length;for(this.__data__=new n;++t{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{function n(e,t){return e.has(t)}t.exports=n})),JB=o(((e,t)=>{var n=GB(),r=KB(),i=qB(),a=1,o=2;function s(e,t,s,c,l,u){var d=s&a,f=e.length,p=t.length;if(f!=p&&!(d&&p>f))return!1;var m=u.get(e),h=u.get(t);if(m&&h)return m==t&&h==e;var g=-1,_=!0,v=s&o?new n:void 0;for(u.set(e,t),u.set(t,e);++g{t.exports=HI().Uint8Array})),XB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}t.exports=n})),ZB=o(((e,t)=>{function n(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}t.exports=n})),QB=o(((e,t)=>{var n=UI(),r=YB(),i=$I(),a=JB(),o=XB(),s=ZB(),c=1,l=2,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Map]`,m=`[object Number]`,h=`[object RegExp]`,g=`[object Set]`,_=`[object String]`,v=`[object Symbol]`,y=`[object ArrayBuffer]`,b=`[object DataView]`,x=n?n.prototype:void 0,S=x?x.valueOf:void 0;function C(e,t,n,x,C,w,T){switch(n){case b:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case y:return!(e.byteLength!=t.byteLength||!w(new r(e),new r(t)));case u:case d:case m:return i(+e,+t);case f:return e.name==t.name&&e.message==t.message;case h:case _:return e==t+``;case p:var E=o;case g:var D=x&c;if(E||=s,e.size!=t.size&&!D)return!1;var O=T.get(e);if(O)return O==t;x|=l,T.set(e,t);var k=a(E(e),E(t),x,C,w,T);return T.delete(e),k;case v:if(S)return S.call(e)==S.call(t)}return!1}t.exports=C})),$B=o(((e,t)=>{function n(e,t){for(var n=-1,r=t.length,i=e.length;++n{var n=$B(),r=BI();function i(e,t,i){var a=t(e);return r(e)?a:n(a,i(e))}t.exports=i})),tV=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n{function n(){return[]}t.exports=n})),rV=o(((e,t)=>{var n=tV(),r=nV(),i=Object.prototype.propertyIsEnumerable,a=Object.getOwnPropertySymbols;t.exports=a?function(e){return e==null?[]:(e=Object(e),n(a(e),function(t){return i.call(e,t)}))}:r})),iV=o(((e,t)=>{function n(e,t){for(var n=-1,r=Array(e);++n{var n=WI(),r=GI(),i=`[object Arguments]`;function a(e){return r(e)&&n(e)==i}t.exports=a})),oV=o(((e,t)=>{var n=aV(),r=GI(),i=Object.prototype,a=i.hasOwnProperty,o=i.propertyIsEnumerable;t.exports=n(function(){return arguments}())?n:function(e){return r(e)&&a.call(e,`callee`)&&!o.call(e,`callee`)}})),sV=o(((e,t)=>{function n(){return!1}t.exports=n})),cV=o(((e,t)=>{var n=HI(),r=sV(),i=typeof e==`object`&&e&&!e.nodeType&&e,a=i&&typeof t==`object`&&t&&!t.nodeType&&t,o=a&&a.exports===i?n.Buffer:void 0;t.exports=(o?o.isBuffer:void 0)||r})),lV=o(((e,t)=>{var n=9007199254740991,r=/^(?:0|[1-9]\d*)$/;function i(e,t){var i=typeof e;return t??=n,!!t&&(i==`number`||i!=`symbol`&&r.test(e))&&e>-1&&e%1==0&&e{var n=9007199254740991;function r(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=n}t.exports=r})),dV=o(((e,t)=>{var n=WI(),r=uV(),i=GI(),a=`[object Arguments]`,o=`[object Array]`,s=`[object Boolean]`,c=`[object Date]`,l=`[object Error]`,u=`[object Function]`,d=`[object Map]`,f=`[object Number]`,p=`[object Object]`,m=`[object RegExp]`,h=`[object Set]`,g=`[object String]`,_=`[object WeakMap]`,v=`[object ArrayBuffer]`,y=`[object DataView]`,b=`[object Float32Array]`,x=`[object Float64Array]`,S=`[object Int8Array]`,C=`[object Int16Array]`,w=`[object Int32Array]`,T=`[object Uint8Array]`,E=`[object Uint8ClampedArray]`,D=`[object Uint16Array]`,O=`[object Uint32Array]`,k={};k[b]=k[x]=k[S]=k[C]=k[w]=k[T]=k[E]=k[D]=k[O]=!0,k[a]=k[o]=k[v]=k[s]=k[y]=k[c]=k[l]=k[u]=k[d]=k[f]=k[p]=k[m]=k[h]=k[g]=k[_]=!1;function A(e){return i(e)&&r(e.length)&&!!k[n(e)]}t.exports=A})),fV=o(((e,t)=>{function n(e){return function(t){return e(t)}}t.exports=n})),pV=o(((e,t)=>{var n=VI(),r=typeof e==`object`&&e&&!e.nodeType&&e,i=r&&typeof t==`object`&&t&&!t.nodeType&&t,a=i&&i.exports===r&&n.process;t.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})),mV=o(((e,t)=>{var n=dV(),r=fV(),i=pV(),a=i&&i.isTypedArray;t.exports=a?r(a):n})),hV=o(((e,t)=>{var n=iV(),r=oV(),i=BI(),a=cV(),o=lV(),s=mV(),c=Object.prototype.hasOwnProperty;function l(e,t){var l=i(e),u=!l&&r(e),d=!l&&!u&&a(e),f=!l&&!u&&!d&&s(e),p=l||u||d||f,m=p?n(e.length,String):[],h=m.length;for(var g in e)(t||c.call(e,g))&&!(p&&(g==`length`||d&&(g==`offset`||g==`parent`)||f&&(g==`buffer`||g==`byteLength`||g==`byteOffset`)||o(g,h)))&&m.push(g);return m}t.exports=l})),gV=o(((e,t)=>{var n=Object.prototype;function r(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||n)}t.exports=r})),_V=o(((e,t)=>{function n(e,t){return function(n){return e(t(n))}}t.exports=n})),vV=o(((e,t)=>{t.exports=_V()(Object.keys,Object)})),yV=o(((e,t)=>{var n=gV(),r=vV(),i=Object.prototype.hasOwnProperty;function a(e){if(!n(e))return r(e);var t=[];for(var a in Object(e))i.call(e,a)&&a!=`constructor`&&t.push(a);return t}t.exports=a})),bV=o(((e,t)=>{var n=YI(),r=uV();function i(e){return e!=null&&r(e.length)&&!n(e)}t.exports=i})),xV=o(((e,t)=>{var n=hV(),r=yV(),i=bV();function a(e){return i(e)?n(e):r(e)}t.exports=a})),SV=o(((e,t)=>{var n=eV(),r=rV(),i=xV();function a(e){return n(e,i,r)}t.exports=a})),CV=o(((e,t)=>{var n=SV(),r=1,i=Object.prototype.hasOwnProperty;function a(e,t,a,o,s,c){var l=a&r,u=n(e),d=u.length;if(d!=n(t).length&&!l)return!1;for(var f=d;f--;){var p=u[f];if(!(l?p in t:i.call(t,p)))return!1}var m=c.get(e),h=c.get(t);if(m&&h)return m==t&&h==e;var g=!0;c.set(e,t),c.set(t,e);for(var _=l;++f{t.exports=ZI()(HI(),`DataView`)})),TV=o(((e,t)=>{t.exports=ZI()(HI(),`Promise`)})),EV=o(((e,t)=>{t.exports=ZI()(HI(),`Set`)})),DV=o(((e,t)=>{t.exports=ZI()(HI(),`WeakMap`)})),OV=o(((e,t)=>{var n=wV(),r=nL(),i=TV(),a=EV(),o=DV(),s=WI(),c=XI(),l=`[object Map]`,u=`[object Object]`,d=`[object Promise]`,f=`[object Set]`,p=`[object WeakMap]`,m=`[object DataView]`,h=c(n),g=c(r),_=c(i),v=c(a),y=c(o),b=s;(n&&b(new n(new ArrayBuffer(1)))!=m||r&&b(new r)!=l||i&&b(i.resolve())!=d||a&&b(new a)!=f||o&&b(new o)!=p)&&(b=function(e){var t=s(e),n=t==u?e.constructor:void 0,r=n?c(n):``;if(r)switch(r){case h:return m;case g:return l;case _:return d;case v:return f;case y:return p}return t}),t.exports=b})),kV=o(((e,t)=>{var n=HB(),r=JB(),i=QB(),a=CV(),o=OV(),s=BI(),c=cV(),l=mV(),u=1,d=`[object Arguments]`,f=`[object Array]`,p=`[object Object]`,m=Object.prototype.hasOwnProperty;function h(e,t,h,g,_,v){var y=s(e),b=s(t),x=y?f:o(e),S=b?f:o(t);x=x==d?p:x,S=S==d?p:S;var C=x==p,w=S==p,T=x==S;if(T&&c(e)){if(!c(t))return!1;y=!0,C=!1}if(T&&!C)return v||=new n,y||l(e)?r(e,t,h,g,_,v):i(e,t,x,h,g,_,v);if(!(h&u)){var E=C&&m.call(e,`__wrapped__`),D=w&&m.call(t,`__wrapped__`);if(E||D){var O=E?e.value():e,k=D?t.value():t;return v||=new n,_(O,k,h,g,v)}}return T?(v||=new n,a(e,t,h,g,_,v)):!1}t.exports=h})),AV=o(((e,t)=>{var n=kV(),r=GI();function i(e,t,a,o,s){return e===t?!0:e==null||t==null||!r(e)&&!r(t)?e!==e&&t!==t:n(e,t,a,o,i,s)}t.exports=i})),jV=o(((e,t)=>{var n=HB(),r=AV(),i=1,a=2;function o(e,t,o,s){var c=o.length,l=c,u=!s;if(e==null)return!l;for(e=Object(e);c--;){var d=o[c];if(u&&d[2]?d[1]!==e[d[0]]:!(d[0]in e))return!1}for(;++c{var n=JI();function r(e){return e===e&&!n(e)}t.exports=r})),NV=o(((e,t)=>{var n=MV(),r=xV();function i(e){for(var t=r(e),i=t.length;i--;){var a=t[i],o=e[a];t[i]=[a,o,n(o)]}return t}t.exports=i})),PV=o(((e,t)=>{function n(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}t.exports=n})),FV=o(((e,t)=>{var n=jV(),r=NV(),i=PV();function a(e){var t=r(e);return t.length==1&&t[0][2]?i(t[0][0],t[0][1]):function(r){return r===e||n(r,e,t)}}t.exports=a})),IV=o(((e,t)=>{function n(e,t){return e!=null&&t in Object(e)}t.exports=n})),LV=o(((e,t)=>{var n=cL(),r=oV(),i=BI(),a=lV(),o=uV(),s=lL();function c(e,t,c){t=n(t,e);for(var l=-1,u=t.length,d=!1;++l{var n=IV(),r=LV();function i(e,t){return e!=null&&r(e,t,n)}t.exports=i})),zV=o(((e,t)=>{var n=AV(),r=dL(),i=RV(),a=qI(),o=MV(),s=PV(),c=lL(),l=1,u=2;function d(e,t){return a(e)&&o(t)?s(c(e),t):function(a){var o=r(a,e);return o===void 0&&o===t?i(a,e):n(t,o,l|u)}}t.exports=d})),BV=o(((e,t)=>{function n(e){return e}t.exports=n})),VV=o(((e,t)=>{function n(e){return function(t){return t?.[e]}}t.exports=n})),HV=o(((e,t)=>{var n=uL();function r(e){return function(t){return n(t,e)}}t.exports=r})),UV=o(((e,t)=>{var n=VV(),r=HV(),i=qI(),a=lL();function o(e){return i(e)?n(a(e)):r(e)}t.exports=o})),WV=o(((e,t)=>{var n=FV(),r=zV(),i=BV(),a=BI(),o=UV();function s(e){return typeof e==`function`?e:e==null?i:typeof e==`object`?a(e)?r(e[0],e[1]):n(e):o(e)}t.exports=s})),GV=o(((e,t)=>{function n(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a{function n(e){return e!==e}t.exports=n})),qV=o(((e,t)=>{function n(e,t,n){for(var r=n-1,i=e.length;++r{var n=GV(),r=KV(),i=qV();function a(e,t,a){return t===t?i(e,t,a):n(e,r,a)}t.exports=a})),YV=o(((e,t)=>{var n=JV();function r(e,t){return!!(e!=null&&e.length)&&n(e,t,0)>-1}t.exports=r})),XV=o(((e,t)=>{function n(e,t,n){for(var r=-1,i=e==null?0:e.length;++r{function n(){}t.exports=n})),QV=o(((e,t)=>{var n=EV(),r=ZV(),i=ZB();t.exports=n&&1/i(new n([,-0]))[1]==1/0?function(e){return new n(e)}:r})),$V=o(((e,t)=>{var n=GB(),r=YV(),i=XV(),a=qB(),o=QV(),s=ZB(),c=200;function l(e,t,l){var u=-1,d=r,f=e.length,p=!0,m=[],h=m;if(l)p=!1,d=i;else if(f>=c){var g=t?null:o(e);if(g)return s(g);p=!1,d=a,h=new n}else h=t?[]:m;outer:for(;++u{var n=WV(),r=$V();function i(e,t){return e&&e.length?r(e,n(t,2)):[]}t.exports=i}))());function tH(e,t,n){return t===!0?(0,eH.default)(e,n):(0,BL.default)(t)?(0,eH.default)(e,t):e}function nH(e){"@babel/helpers - typeof";return nH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},nH(e)}var rH=[`ref`];function iH(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function aH(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function bH(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function xH(e){return e.value}function SH(e,t){if(_.isValidElement(e))return _.cloneElement(e,t);if(typeof e==`function`)return _.createElement(e,t);t.ref;var n=yH(t,rH);return _.createElement(IB,n)}var CH=1,wH=function(e){function t(){var e;oH(this,t);var n=[...arguments];return e=lH(this,t,[].concat(n)),gH(e,`lastBoundingBox`,{width:-1,height:-1}),e}return mH(t,e),cH(t,[{key:`componentDidMount`,value:function(){this.updateBBox()}},{key:`componentDidUpdate`,value:function(){this.updateBBox()}},{key:`getBBox`,value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var e=this.wrapperNode.getBoundingClientRect();return e.height=this.wrapperNode.offsetHeight,e.width=this.wrapperNode.offsetWidth,e}return null}},{key:`updateBBox`,value:function(){var e=this.props.onBBoxUpdate,t=this.getBBox();t?(Math.abs(t.width-this.lastBoundingBox.width)>CH||Math.abs(t.height-this.lastBoundingBox.height)>CH)&&(this.lastBoundingBox.width=t.width,this.lastBoundingBox.height=t.height,e&&e(t)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,e&&e(null))}},{key:`getBBoxSnapshot`,value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?aH({},this.lastBoundingBox):{width:0,height:0}}},{key:`getDefaultPosition`,value:function(e){var t=this.props,n=t.layout,r=t.align,i=t.verticalAlign,a=t.margin,o=t.chartWidth,s=t.chartHeight,c,l;if(!e||(e.left===void 0||e.left===null)&&(e.right===void 0||e.right===null))if(r===`center`&&n===`vertical`){var u=this.getBBoxSnapshot();c={left:((o||0)-u.width)/2}}else c=r===`right`?{right:a&&a.right||0}:{left:a&&a.left||0};if(!e||(e.top===void 0||e.top===null)&&(e.bottom===void 0||e.bottom===null))if(i===`middle`){var d=this.getBBoxSnapshot();l={top:((s||0)-d.height)/2}}else l=i===`bottom`?{bottom:a&&a.bottom||0}:{top:a&&a.top||0};return aH(aH({},c),l)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.content,r=t.width,i=t.height,a=t.wrapperStyle,o=t.payloadUniqBy,s=t.payload,c=aH(aH({position:`absolute`,width:r||`auto`,height:i||`auto`},this.getDefaultPosition(a)),a);return _.createElement(`div`,{className:`recharts-legend-wrapper`,style:c,ref:function(t){e.wrapperNode=t}},SH(n,aH(aH({},this.props),{},{payload:tH(s,o,xH)})))}}],[{key:`getWithHeight`,value:function(e,t){var n=aH(aH({},this.defaultProps),e.props).layout;return n===`vertical`&&Q(e.props.height)?{height:e.props.height}:n===`horizontal`?{width:e.props.width||t}:null}}])}(_.PureComponent);gH(wH,`displayName`,`Legend`),gH(wH,`defaultProps`,{iconSize:14,layout:`horizontal`,align:`center`,verticalAlign:`bottom`});var TH=o(((e,t)=>{var n=UI(),r=oV(),i=BI(),a=n?n.isConcatSpreadable:void 0;function o(e){return i(e)||r(e)||!!(a&&e&&e[a])}t.exports=o})),EH=o(((e,t)=>{var n=$B(),r=TH();function i(e,t,a,o,s){var c=-1,l=e.length;for(a||=r,s||=[];++c0&&a(u)?t>1?i(u,t-1,a,o,s):n(s,u):o||(s[s.length]=u)}return s}t.exports=i})),DH=o(((e,t)=>{function n(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}t.exports=n})),OH=o(((e,t)=>{t.exports=DH()()})),kH=o(((e,t)=>{var n=OH(),r=xV();function i(e,t){return e&&n(e,t,r)}t.exports=i})),AH=o(((e,t)=>{var n=bV();function r(e,t){return function(r,i){if(r==null)return r;if(!n(r))return e(r,i);for(var a=r.length,o=t?a:-1,s=Object(r);(t?o--:++o{var n=kH();t.exports=AH()(n)})),MH=o(((e,t)=>{var n=jH(),r=bV();function i(e,t){var i=-1,a=r(e)?Array(e.length):[];return n(e,function(e,n,r){a[++i]=t(e,n,r)}),a}t.exports=i})),NH=o(((e,t)=>{function n(e,t){var n=e.length;for(e.sort(t);n--;)e[n]=e[n].value;return e}t.exports=n})),PH=o(((e,t)=>{var n=KI();function r(e,t){if(e!==t){var r=e!==void 0,i=e===null,a=e===e,o=n(e),s=t!==void 0,c=t===null,l=t===t,u=n(t);if(!c&&!u&&!o&&e>t||o&&s&&l&&!c&&!u||i&&s&&l||!r&&l||!a)return 1;if(!i&&!o&&!u&&e{var n=PH();function r(e,t,r){for(var i=-1,a=e.criteria,o=t.criteria,s=a.length,c=r.length;++i=c?l:l*(r[i]==`desc`?-1:1)}return e.index-t.index}t.exports=r})),IH=o(((e,t)=>{var n=oL(),r=uL(),i=WV(),a=MH(),o=NH(),s=fV(),c=FH(),l=BV(),u=BI();function d(e,t,d){t=t.length?n(t,function(e){return u(e)?function(t){return r(t,e.length===1?e[0]:e)}:e}):[l];var f=-1;return t=n(t,s(i)),o(a(e,function(e,r,i){return{criteria:n(t,function(t){return t(e)}),index:++f,value:e}}),function(e,t){return c(e,t,d)})}t.exports=d})),LH=o(((e,t)=>{function n(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}t.exports=n})),RH=o(((e,t)=>{var n=LH(),r=Math.max;function i(e,t,i){return t=r(t===void 0?e.length-1:t,0),function(){for(var a=arguments,o=-1,s=r(a.length-t,0),c=Array(s);++o{function n(e){return function(){return e}}t.exports=n})),BH=o(((e,t)=>{var n=ZI();t.exports=function(){try{var e=n(Object,`defineProperty`);return e({},``,{}),e}catch{}}()})),VH=o(((e,t)=>{var n=zH(),r=BH(),i=BV();t.exports=r?function(e,t){return r(e,`toString`,{configurable:!0,enumerable:!1,value:n(t),writable:!0})}:i})),HH=o(((e,t)=>{var n=800,r=16,i=Date.now;function a(e){var t=0,a=0;return function(){var o=i(),s=r-(o-a);if(a=o,s>0){if(++t>=n)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}t.exports=a})),UH=o(((e,t)=>{var n=VH();t.exports=HH()(n)})),WH=o(((e,t)=>{var n=BV(),r=RH(),i=UH();function a(e,t){return i(r(e,t,n),e+``)}t.exports=a})),GH=o(((e,t)=>{var n=$I(),r=bV(),i=lV(),a=JI();function o(e,t,o){if(!a(o))return!1;var s=typeof t;return(s==`number`?r(o)&&i(t,o.length):s==`string`&&t in o)?n(o[t],e):!1}t.exports=o})),KH=l(o(((e,t)=>{var n=EH(),r=IH(),i=WH(),a=GH();t.exports=i(function(e,t){if(e==null)return[];var i=t.length;return i>1&&a(e,t[0],t[1])?t=[]:i>2&&a(t[0],t[1],t[2])&&(t=[t[0]]),r(e,n(t,1),[])})}))());function qH(e){"@babel/helpers - typeof";return qH=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},qH(e)}function JH(){return JH=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=t.x),`${fU}-left`,Q(n)&&t&&Q(t.x)&&n=t.y),`${fU}-top`,Q(r)&&t&&Q(t.y)&&rc[r]+l?Math.max(u,c[r]):Math.max(d,c[r])}function gU(e){var t=e.translateX,n=e.translateY;return{transform:e.useTranslate3d?`translate3d(${t}px, ${n}px, 0)`:`translate(${t}px, ${n}px)`}}function _U(e){var t=e.allowEscapeViewBox,n=e.coordinate,r=e.offsetTopLeft,i=e.position,a=e.reverseDirection,o=e.tooltipBox,s=e.useTranslate3d,c=e.viewBox,l,u,d;return o.height>0&&o.width>0&&n?(u=hU({allowEscapeViewBox:t,coordinate:n,key:`x`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),d=hU({allowEscapeViewBox:t,coordinate:n,key:`y`,offsetTopLeft:r,position:i,reverseDirection:a,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),l=gU({translateX:u,translateY:d,useTranslate3d:s})):l=pU,{cssProperties:l,cssClasses:mU({translateX:u,translateY:d,coordinate:n})}}function vU(e){"@babel/helpers - typeof";return vU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},vU(e)}function yU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function bU(e){for(var t=1;tPU||Math.abs(e.height-this.state.lastBoundingBox.height)>PU)&&this.setState({lastBoundingBox:{width:e.width,height:e.height}})}else (this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:`componentDidMount`,value:function(){document.addEventListener(`keydown`,this.handleKeyDown),this.updateBBox()}},{key:`componentWillUnmount`,value:function(){document.removeEventListener(`keydown`,this.handleKeyDown)}},{key:`componentDidUpdate`,value:function(){this.props.active&&this.updateBBox(),this.state.dismissed&&(this.props.coordinate?.x!==this.state.dismissedAtCoordinate.x||this.props.coordinate?.y!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:`render`,value:function(){var e=this,t=this.props,n=t.active,r=t.allowEscapeViewBox,i=t.animationDuration,a=t.animationEasing,o=t.children,s=t.coordinate,c=t.hasPayload,l=t.isAnimationActive,u=t.offset,d=t.position,f=t.reverseDirection,p=t.useTranslate3d,m=t.viewBox,h=t.wrapperStyle,g=_U({allowEscapeViewBox:r,coordinate:s,offsetTopLeft:u,position:d,reverseDirection:f,tooltipBox:this.state.lastBoundingBox,useTranslate3d:p,viewBox:m}),v=g.cssClasses,y=g.cssProperties,b=bU(bU({transition:l&&n?`transform ${i}ms ${a}`:void 0},y),{},{pointerEvents:`none`,visibility:!this.state.dismissed&&n&&c?`visible`:`hidden`,position:`absolute`,top:0,left:0},h);return _.createElement(`div`,{tabIndex:-1,className:v,style:b,ref:function(t){e.wrapperNode=t}},o)}}])}(_.PureComponent),IU={isSsr:function(){return!(typeof window<`u`&&window.document&&window.document.createElement&&window.setTimeout)}(),get:function(e){return IU[e]},set:function(e,t){if(typeof e==`string`)IU[e]=t;else{var n=Object.keys(e);n&&n.length&&n.forEach(function(t){IU[t]=e[t]})}}};function LU(e){"@babel/helpers - typeof";return LU=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},LU(e)}function RU(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function zU(e){for(var t=1;t0;return _.createElement(FU,{allowEscapeViewBox:r,animationDuration:i,animationEasing:a,isAnimationActive:l,active:n,coordinate:s,hasPayload:b,offset:u,position:p,reverseDirection:m,useTranslate3d:h,viewBox:g,wrapperStyle:v},eW(o,zU(zU({},this.props),{},{payload:y})))}}])}(_.PureComponent);XU(tW,`displayName`,`Tooltip`),XU(tW,`defaultProps`,{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:`ease`,contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!IU.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:` : `,trigger:`hover`,useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var nW=o(((e,t)=>{var n=HI();t.exports=function(){return n.Date.now()}})),rW=o(((e,t)=>{var n=/\s/;function r(e){for(var t=e.length;t--&&n.test(e.charAt(t)););return t}t.exports=r})),iW=o(((e,t)=>{var n=rW(),r=/^\s+/;function i(e){return e&&e.slice(0,n(e)+1).replace(r,``)}t.exports=i})),aW=o(((e,t)=>{var n=iW(),r=JI(),i=KI(),a=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,c=/^0o[0-7]+$/i,l=parseInt;function u(e){if(typeof e==`number`)return e;if(i(e))return a;if(r(e)){var t=typeof e.valueOf==`function`?e.valueOf():e;e=r(t)?t+``:t}if(typeof e!=`string`)return e===0?e:+e;e=n(e);var u=s.test(e);return u||c.test(e)?l(e.slice(2),u?2:8):o.test(e)?a:+e}t.exports=u})),oW=o(((e,t)=>{var n=JI(),r=nW(),i=aW(),a=`Expected a function`,o=Math.max,s=Math.min;function c(e,t,c){var l,u,d,f,p,m,h=0,g=!1,_=!1,v=!0;if(typeof e!=`function`)throw TypeError(a);t=i(t)||0,n(c)&&(g=!!c.leading,_=`maxWait`in c,d=_?o(i(c.maxWait)||0,t):d,v=`trailing`in c?!!c.trailing:v);function y(t){var n=l,r=u;return l=u=void 0,h=t,f=e.apply(r,n),f}function b(e){return h=e,p=setTimeout(C,t),g?y(e):f}function x(e){var n=e-m,r=e-h,i=t-n;return _?s(i,d-r):i}function S(e){var n=e-m,r=e-h;return m===void 0||n>=t||n<0||_&&r>=d}function C(){var e=r();if(S(e))return w(e);p=setTimeout(C,x(e))}function w(e){return p=void 0,v&&l?y(e):(l=u=void 0,f)}function T(){p!==void 0&&clearTimeout(p),h=0,l=m=u=p=void 0}function E(){return p===void 0?f:w(r())}function D(){var e=r(),n=S(e);if(l=arguments,u=this,m=e,n){if(p===void 0)return b(m);if(_)return clearTimeout(p),p=setTimeout(C,t),y(m)}return p===void 0&&(p=setTimeout(C,t)),f}return D.cancel=T,D.flush=E,D}t.exports=c})),sW=l(o(((e,t)=>{var n=oW(),r=JI(),i=`Expected a function`;function a(e,t,a){var o=!0,s=!0;if(typeof e!=`function`)throw TypeError(i);return r(a)&&(o=`leading`in a?!!a.leading:o,s=`trailing`in a?!!a.trailing:s),n(e,t,{leading:o,maxWait:t,trailing:s})}t.exports=a}))());function cW(e){"@babel/helpers - typeof";return cW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},cW(e)}function lW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function uW(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&(e=(0,sW.default)(e,h,{trailing:!0,leading:!1}));var t=new ResizeObserver(e),n=S.current.getBoundingClientRect(),r=n.width,i=n.height;return D(r,i),t.observe(S.current),function(){t.disconnect()}},[D,h]);var O=(0,_.useMemo)(function(){var e=T.containerWidth,t=T.containerHeight;if(e<0||t<0)return null;SR(vL(o)||vL(c),`The width(%s) and height(%s) are both fixed numbers, - maybe you don't need to use a ResponsiveContainer.`,o,c),SR(!n||n>0,`The aspect(%s) must be greater than zero.`,n);var r=vL(o)?e:o,i=vL(c)?t:c;n&&n>0&&(r?i=r/n:i&&(r=i*n),f&&i>f&&(i=f)),SR(r>0||i>0,`The width(%s) and height(%s) of chart should be greater than 0, - please check the style of container, or the props width(%s) and height(%s), - or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the - height and width.`,r,i,o,c,u,d,n);var a=!Array.isArray(p)&&JL(p.type).endsWith(`Chart`);return _.Children.map(p,function(e){return _.isValidElement(e)?(0,_.cloneElement)(e,uW({width:r,height:i},a?{style:uW({height:`100%`,width:`100%`,maxHeight:i,maxWidth:r},e.props.style)}:{})):e})},[n,p,c,f,d,u,T,o]);return _.createElement(`div`,{id:g?`${g}`:void 0,className:pa(`recharts-responsive-container`,v),style:uW(uW({},x),{},{width:o,height:c,minWidth:u,minHeight:d,maxHeight:f}),ref:S},O)}),xW=function(e){return null};xW.displayName=`Cell`;function SW(e){"@babel/helpers - typeof";return SW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},SW(e)}function CW(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function wW(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||IU.isSsr)return{width:0,height:0};var n=MW(t),r=JSON.stringify({text:e,copyStyle:n});if(OW.widthCache[r])return OW.widthCache[r];try{var i=document.getElementById(jW);i||(i=document.createElement(`span`),i.setAttribute(`id`,jW),i.setAttribute(`aria-hidden`,`true`),document.body.appendChild(i));var a=wW(wW({},AW),n);Object.assign(i.style,a),i.textContent=`${e}`;var o=i.getBoundingClientRect(),s={width:o.width,height:o.height};return OW.widthCache[r]=s,++OW.cacheCount>kW&&(OW.cacheCount=0,OW.widthCache={}),s}catch{return{width:0,height:0}}},PW=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function FW(e){"@babel/helpers - typeof";return FW=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},FW(e)}function IW(e,t){return VW(e)||BW(e,t)||RW(e,t)||LW()}function LW(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function RW(e,t){if(e){if(typeof e==`string`)return zW(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zW(e,t)}}function zW(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function fG(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function pG(e,t){return vG(e)||_G(e,t)||hG(e,t)||mG()}function mG(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hG(e,t){if(e){if(typeof e==`string`)return gG(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gG(e,t)}}function gG(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n0&&arguments[0]!==void 0?arguments[0]:[]).reduce(function(e,t){var a=t.word,o=t.width,s=e[e.length-1];if(s&&(r==null||i||s.width+o+nt.width?e:t})};if(!l)return f;for(var m=`…`,h=function(e){var t=bG({breakAll:c,style:s,children:u.slice(0,e)+m}).wordsWithComputedWidth,n=d(t);return[n.length>a||p(n).width>Number(r),n]},g=0,_=u.length-1,v=0,y;g<=_&&v<=u.length-1;){var b=Math.floor((g+_)/2),x=pG(h(b-1),2),S=x[0],C=x[1],w=pG(h(b),1)[0];if(!S&&!w&&(g=b+1),S&&w&&(_=b-1),!S&&w){y=C;break}v++}return y||f},SG=function(e){return[{words:(0,gL.default)(e)?[]:e.toString().split(yG)}]},CG=function(e){var t=e.width,n=e.scaleToFit,r=e.children,i=e.style,a=e.breakAll,o=e.maxLines;if((t||n)&&!IU.isSsr){var s,c,l=bG({breakAll:a,children:r,style:i});if(l){var u=l.wordsWithComputedWidth,d=l.spaceWidth;s=u,c=d}else return SG(r);return xG({breakAll:a,children:r,maxLines:o,style:i},s,c,t,n)}return SG(r)},wG=`#808080`,TG=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.lineHeight,o=a===void 0?`1em`:a,s=e.capHeight,c=s===void 0?`0.71em`:s,l=e.scaleToFit,u=l===void 0?!1:l,d=e.textAnchor,f=d===void 0?`start`:d,p=e.verticalAnchor,m=p===void 0?`end`:p,h=e.fill,g=h===void 0?wG:h,v=dG(e,cG),y=(0,_.useMemo)(function(){return CG({breakAll:v.breakAll,children:v.children,maxLines:v.maxLines,scaleToFit:u,style:v.style,width:v.width})},[v.breakAll,v.children,v.maxLines,u,v.style,v.width]),b=v.dx,x=v.dy,S=v.angle,C=v.className,w=v.breakAll,T=dG(v,lG);if(!bL(n)||!bL(i))return null;var E=n+(Q(b)?b:0),D=i+(Q(x)?x:0),O;switch(m){case`start`:O=sG(`calc(${c})`);break;case`middle`:O=sG(`calc(${(y.length-1)/2} * -${o} + (${c} / 2))`);break;default:O=sG(`calc(${y.length-1} * -${o})`);break}var k=[];if(u){var A=y[0].width,j=v.width;k.push(`scale(${(Q(j)?j/A:1)/A})`)}return S&&k.push(`rotate(${S}, ${E}, ${D})`),k.length&&(T.transform=k.join(` `)),_.createElement(`text`,uG({},aR(T,!0),{x:E,y:D,className:pa(`recharts-text`,C),textAnchor:f,fill:g.includes(`url`)?wG:g}),y.map(function(e,t){var n=e.words.join(w?``:` `);return _.createElement(`tspan`,{x:E,dy:t===0?O:o,key:`${n}-${t}`},n)}))};function EG(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function DG(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function OG(e){let t,n,r;e.length===2?(t=e===EG||e===DG?e:kG,n=e,r=e):(t=EG,n=(t,n)=>EG(e(t),n),r=(t,n)=>e(t)-n);function i(e,r,i=0,a=e.length){if(i>>1;n(e[t],r)<0?i=t+1:a=t}while(i>>1;n(e[t],r)<=0?i=t+1:a=t}while(in&&r(e[o-1],t)>-r(e[o],t)?o-1:o}return{left:i,center:o,right:a}}function kG(){return 0}function AG(e){return e===null?NaN:+e}function*jG(e,t){if(t===void 0)for(let t of e)t!=null&&(t=+t)>=t&&(yield t);else{let n=-1;for(let r of e)(r=t(r,++n,e))!=null&&(r=+r)>=r&&(yield r)}}var MG=OG(EG),NG=MG.right;MG.left,OG(AG).center;var PG=class extends Map{constructor(e,t=RG){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),e!=null)for(let[t,n]of e)this.set(t,n)}get(e){return super.get(FG(this,e))}has(e){return super.has(FG(this,e))}set(e,t){return super.set(IG(this,e),t)}delete(e){return super.delete(LG(this,e))}};function FG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):n}function IG({_intern:e,_key:t},n){let r=t(n);return e.has(r)?e.get(r):(e.set(r,n),n)}function LG({_intern:e,_key:t},n){let r=t(n);return e.has(r)&&(n=e.get(r),e.delete(r)),n}function RG(e){return typeof e==`object`&&e?e.valueOf():e}function zG(e=EG){if(e===EG)return BG;if(typeof e!=`function`)throw TypeError(`compare is not a function`);return(t,n)=>{let r=e(t,n);return r||r===0?r:(e(n,n)===0)-(e(t,t)===0)}}function BG(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et))}var VG=Math.sqrt(50),HG=Math.sqrt(10),UG=Math.sqrt(2);function WG(e,t,n){let r=(t-e)/Math.max(0,n),i=Math.floor(Math.log10(r)),a=r/10**i,o=a>=VG?10:a>=HG?5:a>=UG?2:1,s,c,l;return i<0?(l=10**-i/o,s=Math.round(e*l),c=Math.round(t*l),s/lt&&--c,l=-l):(l=10**i*o,s=Math.round(e/l),c=Math.round(t/l),s*lt&&--c),c0))return[];if(e===t)return[e];let r=t=i))return[];let s=a-i+1,c=Array(s);if(r)if(o<0)for(let e=0;e=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n=i)&&(n=i)}return n}function YG(e,t){let n;if(t===void 0)for(let t of e)t!=null&&(n>t||n===void 0&&t>=t)&&(n=t);else{let r=-1;for(let i of e)(i=t(i,++r,e))!=null&&(n>i||n===void 0&&i>=i)&&(n=i)}return n}function XG(e,t,n=0,r=1/0,i){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(e.length-1,r)),!(n<=t&&t<=r))return e;for(i=i===void 0?BG:zG(i);r>n;){if(r-n>600){let a=r-n+1,o=t-n+1,s=Math.log(a),c=.5*Math.exp(2*s/3),l=.5*Math.sqrt(s*c*(a-c)/a)*(o-a/2<0?-1:1),u=Math.max(n,Math.floor(t-o*c/a+l)),d=Math.min(r,Math.floor(t+(a-o)*c/a+l));XG(e,t,u,d,i)}let a=e[t],o=n,s=r;for(ZG(e,n,t),i(e[r],a)>0&&ZG(e,n,r);o0;)--s}i(e[n],a)===0?ZG(e,n,s):(++s,ZG(e,s,r)),s<=t&&(n=s+1),t<=s&&(r=s-1)}return e}function ZG(e,t,n){let r=e[t];e[t]=e[n],e[n]=r}function QG(e,t,n){if(e=Float64Array.from(jG(e,n)),!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return YG(e);if(t>=1)return JG(e);var r,i=(r-1)*t,a=Math.floor(i),o=JG(XG(e,a).subarray(0,a+1));return o+(YG(e.subarray(a+1))-o)*(i-a)}}function $G(e,t,n=AG){if(!(!(r=e.length)||isNaN(t=+t))){if(t<=0||r<2)return+n(e[0],0,e);if(t>=1)return+n(e[r-1],r-1,e);var r,i=(r-1)*t,a=Math.floor(i),o=+n(e[a],a,e);return o+(+n(e[a+1],a+1,e)-o)*(i-a)}}function eK(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?AK(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?AK(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=_K.exec(e))?new NK(t[1],t[2],t[3],1):(t=vK.exec(e))?new NK(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=yK.exec(e))?AK(t[1],t[2],t[3],t[4]):(t=bK.exec(e))?AK(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=xK.exec(e))?BK(t[1],t[2]/100,t[3]/100,1):(t=SK.exec(e))?BK(t[1],t[2]/100,t[3]/100,t[4]):CK.hasOwnProperty(e)?kK(CK[e]):e===`transparent`?new NK(NaN,NaN,NaN,0):null}function kK(e){return new NK(e>>16&255,e>>8&255,e&255,1)}function AK(e,t,n,r){return r<=0&&(e=t=n=NaN),new NK(e,t,n,r)}function jK(e){return e instanceof uK||(e=OK(e)),e?(e=e.rgb(),new NK(e.r,e.g,e.b,e.opacity)):new NK}function MK(e,t,n,r){return arguments.length===1?jK(e):new NK(e,t,n,r??1)}function NK(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}cK(NK,MK,lK(uK,{brighter(e){return e=e==null?fK:fK**+e,new NK(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?dK:dK**+e,new NK(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new NK(RK(this.r),RK(this.g),RK(this.b),LK(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:PK,formatHex:PK,formatHex8:FK,formatRgb:IK,toString:IK}));function PK(){return`#${zK(this.r)}${zK(this.g)}${zK(this.b)}`}function FK(){return`#${zK(this.r)}${zK(this.g)}${zK(this.b)}${zK((isNaN(this.opacity)?1:this.opacity)*255)}`}function IK(){let e=LK(this.opacity);return`${e===1?`rgb(`:`rgba(`}${RK(this.r)}, ${RK(this.g)}, ${RK(this.b)}${e===1?`)`:`, ${e})`}`}function LK(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function RK(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function zK(e){return e=RK(e),(e<16?`0`:``)+e.toString(16)}function BK(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new UK(e,t,n,r)}function VK(e){if(e instanceof UK)return new UK(e.h,e.s,e.l,e.opacity);if(e instanceof uK||(e=OK(e)),!e)return new UK;if(e instanceof UK)return e;e=e.rgb();var t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(t,n,r),a=Math.max(t,n,r),o=NaN,s=a-i,c=(a+i)/2;return s?(o=t===a?(n-r)/s+(n0&&c<1?0:o,new UK(o,s,c,e.opacity)}function HK(e,t,n,r){return arguments.length===1?VK(e):new UK(e,t,n,r??1)}function UK(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}cK(UK,HK,lK(uK,{brighter(e){return e=e==null?fK:fK**+e,new UK(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?dK:dK**+e,new UK(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,i=2*n-r;return new NK(KK(e>=240?e-240:e+120,i,r),KK(e,i,r),KK(e<120?e+240:e-120,i,r),this.opacity)},clamp(){return new UK(WK(this.h),GK(this.s),GK(this.l),LK(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=LK(this.opacity);return`${e===1?`hsl(`:`hsla(`}${WK(this.h)}, ${GK(this.s)*100}%, ${GK(this.l)*100}%${e===1?`)`:`, ${e})`}`}}));function WK(e){return e=(e||0)%360,e<0?e+360:e}function GK(e){return Math.max(0,Math.min(1,e||0))}function KK(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}var qK=e=>()=>e;function JK(e,t){return function(n){return e+n*t}}function YK(e,t,n){return e**=+n,t=t**+n-e,n=1/n,function(r){return(e+r*t)**+n}}function XK(e){return(e=+e)==1?ZK:function(t,n){return n-t?YK(t,n,e):qK(isNaN(t)?n:t)}}function ZK(e,t){var n=t-e;return n?JK(e,n):qK(isNaN(e)?t:e)}var QK=(function e(t){var n=XK(t);function r(e,t){var r=n((e=MK(e)).r,(t=MK(t)).r),i=n(e.g,t.g),a=n(e.b,t.b),o=ZK(e.opacity,t.opacity);return function(t){return e.r=r(t),e.g=i(t),e.b=a(t),e.opacity=o(t),e+``}}return r.gamma=e,r})(1);function $K(e,t){t||=[];var n=e?Math.min(t.length,e.length):0,r=t.slice(),i;return function(a){for(i=0;in&&(a=t.slice(n,a),s[o]?s[o]+=a:s[++o]=a),(r=r[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,c.push({i:o,x:rq(r,i)})),n=oq.lastIndex;return nt&&(n=e,e=t,t=n),function(n){return Math.max(e,Math.min(t,n))}}function yq(e,t,n){var r=e[0],i=e[1],a=t[0],o=t[1];return i2?bq:yq,c=l=null,d}function d(i){return i==null||isNaN(i=+i)?a:(c||=s(e.map(r),t,n))(r(o(i)))}return d.invert=function(n){return o(i((l||=s(t,e.map(r),rq))(n)))},d.domain=function(t){return arguments.length?(e=Array.from(t,mq),u()):e.slice()},d.range=function(e){return arguments.length?(t=Array.from(e),u()):t.slice()},d.rangeRound=function(e){return t=Array.from(e),n=dq,u()},d.clamp=function(e){return arguments.length?(o=e?!0:gq,u()):o!==gq},d.interpolate=function(e){return arguments.length?(n=e,u()):n},d.unknown=function(e){return arguments.length?(a=e,d):a},function(e,t){return r=e,i=t,u()}}function Cq(){return Sq()(gq,gq)}function wq(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString(`en`).replace(/,/g,``):e.toString(10)}function Tq(e,t){if(!isFinite(e)||e===0)return null;var n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf(`e`),r=e.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+e.slice(n+1)]}function Eq(e){return e=Tq(Math.abs(e)),e?e[1]:NaN}function Dq(e,t){return function(n,r){for(var i=n.length,a=[],o=0,s=e[0],c=0;i>0&&s>0&&(c+s+1>r&&(s=Math.max(1,r-c)),a.push(n.substring(i-=s,i+s)),!((c+=s+1)>r));)s=e[o=(o+1)%e.length];return a.reverse().join(t)}}function Oq(e){return function(t){return t.replace(/[0-9]/g,function(t){return e[+t]})}}var kq=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Aq(e){if(!(t=kq.exec(e)))throw Error(`invalid format: `+e);var t;return new jq({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}Aq.prototype=jq.prototype;function jq(e){this.fill=e.fill===void 0?` `:e.fill+``,this.align=e.align===void 0?`>`:e.align+``,this.sign=e.sign===void 0?`-`:e.sign+``,this.symbol=e.symbol===void 0?``:e.symbol+``,this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?``:e.type+``}jq.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?`0`:``)+(this.width===void 0?``:Math.max(1,this.width|0))+(this.comma?`,`:``)+(this.precision===void 0?``:`.`+Math.max(0,this.precision|0))+(this.trim?`~`:``)+this.type};function Mq(e){out:for(var t=e.length,n=1,r=-1,i;n0&&(r=0);break}return r>0?e.slice(0,r)+e.slice(i+1):e}var Nq;function Pq(e,t){var n=Tq(e,t);if(!n)return Nq=void 0,e.toPrecision(t);var r=n[0],i=n[1],a=i-(Nq=Math.max(-8,Math.min(8,Math.floor(i/3)))*3)+1,o=r.length;return a===o?r:a>o?r+Array(a-o+1).join(`0`):a>0?r.slice(0,a)+`.`+r.slice(a):`0.`+Array(1-a).join(`0`)+Tq(e,Math.max(0,t+a-1))[0]}function Fq(e,t){var n=Tq(e,t);if(!n)return e+``;var r=n[0],i=n[1];return i<0?`0.`+Array(-i).join(`0`)+r:r.length>i+1?r.slice(0,i+1)+`.`+r.slice(i+1):r+Array(i-r.length+2).join(`0`)}var Iq={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+``,d:wq,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>Fq(e*100,t),r:Fq,s:Pq,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function Lq(e){return e}var Rq=Array.prototype.map,zq=[`y`,`z`,`a`,`f`,`p`,`n`,`µ`,`m`,``,`k`,`M`,`G`,`T`,`P`,`E`,`Z`,`Y`];function Bq(e){var t=e.grouping===void 0||e.thousands===void 0?Lq:Dq(Rq.call(e.grouping,Number),e.thousands+``),n=e.currency===void 0?``:e.currency[0]+``,r=e.currency===void 0?``:e.currency[1]+``,i=e.decimal===void 0?`.`:e.decimal+``,a=e.numerals===void 0?Lq:Oq(Rq.call(e.numerals,String)),o=e.percent===void 0?`%`:e.percent+``,s=e.minus===void 0?`−`:e.minus+``,c=e.nan===void 0?`NaN`:e.nan+``;function l(e,l){e=Aq(e);var u=e.fill,d=e.align,f=e.sign,p=e.symbol,m=e.zero,h=e.width,g=e.comma,_=e.precision,v=e.trim,y=e.type;y===`n`?(g=!0,y=`g`):Iq[y]||(_===void 0&&(_=12),v=!0,y=`g`),(m||u===`0`&&d===`=`)&&(m=!0,u=`0`,d=`=`);var b=(l&&l.prefix!==void 0?l.prefix:``)+(p===`$`?n:p===`#`&&/[boxX]/.test(y)?`0`+y.toLowerCase():``),x=(p===`$`?r:/[%p]/.test(y)?o:``)+(l&&l.suffix!==void 0?l.suffix:``),S=Iq[y],C=/[defgprs%]/.test(y);_=_===void 0?6:/[gprs]/.test(y)?Math.max(1,Math.min(21,_)):Math.max(0,Math.min(20,_));function w(e){var n=b,r=x,o,l,p;if(y===`c`)r=S(e)+r,e=``;else{e=+e;var w=e<0||1/e<0;if(e=isNaN(e)?c:S(Math.abs(e),_),v&&(e=Mq(e)),w&&+e==0&&f!==`+`&&(w=!1),n=(w?f===`(`?f:s:f===`-`||f===`(`?``:f)+n,r=(y===`s`&&!isNaN(e)&&Nq!==void 0?zq[8+Nq/3]:``)+r+(w&&f===`(`?`)`:``),C){for(o=-1,l=e.length;++op||p>57){r=(p===46?i+e.slice(o+1):e.slice(o))+r,e=e.slice(0,o);break}}}g&&!m&&(e=t(e,1/0));var T=n.length+e.length+r.length,E=T>1)+n+e+r+E.slice(T);break;default:e=E+n+e+r;break}return a(e)}return w.toString=function(){return e+``},w}function u(e,t){var n=Math.max(-8,Math.min(8,Math.floor(Eq(t)/3)))*3,r=10**-n,i=l((e=Aq(e),e.type=`f`,e),{suffix:zq[8+n/3]});return function(e){return i(r*e)}}return{format:l,formatPrefix:u}}var Vq,Hq,Uq;Wq({thousands:`,`,grouping:[3],currency:[`$`,``]});function Wq(e){return Vq=Bq(e),Hq=Vq.format,Uq=Vq.formatPrefix,Vq}function Gq(e){return Math.max(0,-Eq(Math.abs(e)))}function Kq(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(Eq(t)/3)))*3-Eq(Math.abs(e)))}function qq(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,Eq(t)-Eq(e))+1}function Jq(e,t,n,r){var i=qG(e,t,n),a;switch(r=Aq(r??`,f`),r.type){case`s`:var o=Math.max(Math.abs(e),Math.abs(t));return r.precision==null&&!isNaN(a=Kq(i,o))&&(r.precision=a),Uq(r,o);case``:case`e`:case`g`:case`p`:case`r`:r.precision==null&&!isNaN(a=qq(i,Math.max(Math.abs(e),Math.abs(t))))&&(r.precision=a-(r.type===`e`));break;case`f`:case`%`:r.precision==null&&!isNaN(a=Gq(i))&&(r.precision=a-(r.type===`%`)*2);break}return Hq(r)}function Yq(e){var t=e.domain;return e.ticks=function(e){var n=t();return GG(n[0],n[n.length-1],e??10)},e.tickFormat=function(e,n){var r=t();return Jq(r[0],r[r.length-1],e??10,n)},e.nice=function(n){n??=10;var r=t(),i=0,a=r.length-1,o=r[i],s=r[a],c,l,u=10;for(s0;){if(l=KG(o,s,n),l===c)return r[i]=o,r[a]=s,t(r);if(l>0)o=Math.floor(o/l)*l,s=Math.ceil(s/l)*l;else if(l<0)o=Math.ceil(o*l)/l,s=Math.floor(s*l)/l;else break;c=l}return e},e}function Xq(){var e=Cq();return e.copy=function(){return xq(e,Xq())},tK.apply(e,arguments),Yq(e)}function Zq(e){var t;function n(e){return e==null||isNaN(e=+e)?t:e}return n.invert=n,n.domain=n.range=function(t){return arguments.length?(e=Array.from(t,mq),n):e.slice()},n.unknown=function(e){return arguments.length?(t=e,n):t},n.copy=function(){return Zq(e).unknown(t)},e=arguments.length?Array.from(e,mq):[0,1],Yq(n)}function Qq(e,t){e=e.slice();var n=0,r=e.length-1,i=e[n],a=e[r],o;return ae**+t}function aJ(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function oJ(e){return(t,n)=>-e(-t,n)}function sJ(e){let t=e($q,eJ),n=t.domain,r=10,i,a;function o(){return i=aJ(r),a=iJ(r),n()[0]<0?(i=oJ(i),a=oJ(a),e(tJ,nJ)):e($q,eJ),t}return t.base=function(e){return arguments.length?(r=+e,o()):r},t.domain=function(e){return arguments.length?(n(e),o()):n()},t.ticks=e=>{let t=n(),o=t[0],s=t[t.length-1],c=s0){for(;l<=u;++l)for(d=1;ds)break;m.push(f)}}else for(;l<=u;++l)for(d=r-1;d>=1;--d)if(f=l>0?d/a(-l):d*a(l),!(fs)break;m.push(f)}m.length*2{if(e??=10,n??=r===10?`s`:`,`,typeof n!=`function`&&(!(r%1)&&(n=Aq(n)).precision==null&&(n.trim=!0),n=Hq(n)),e===1/0)return n;let o=Math.max(1,r*e/t.ticks().length);return e=>{let t=e/a(Math.round(i(e)));return t*rn(Qq(n(),{floor:e=>a(Math.floor(i(e))),ceil:e=>a(Math.ceil(i(e)))})),t}function cJ(){let e=sJ(Sq()).domain([1,10]);return e.copy=()=>xq(e,cJ()).base(e.base()),tK.apply(e,arguments),e}function lJ(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function uJ(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function dJ(e){var t=1,n=e(lJ(t),uJ(t));return n.constant=function(n){return arguments.length?e(lJ(t=+n),uJ(t)):t},Yq(n)}function fJ(){var e=dJ(Sq());return e.copy=function(){return xq(e,fJ()).constant(e.constant())},tK.apply(e,arguments)}function pJ(e){return function(t){return t<0?-((-t)**+e):t**+e}}function mJ(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function hJ(e){return e<0?-e*e:e*e}function gJ(e){var t=e(gq,gq),n=1;function r(){return n===1?e(gq,gq):n===.5?e(mJ,hJ):e(pJ(n),pJ(1/n))}return t.exponent=function(e){return arguments.length?(n=+e,r()):n},Yq(t)}function _J(){var e=gJ(Sq());return e.copy=function(){return xq(e,_J()).exponent(e.exponent())},tK.apply(e,arguments),e}function vJ(){return _J.apply(null,arguments).exponent(.5)}function yJ(e){return Math.sign(e)*e*e}function bJ(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function xJ(){var e=Cq(),t=[0,1],n=!1,r;function i(t){var i=bJ(e(t));return isNaN(i)?r:n?Math.round(i):i}return i.invert=function(t){return e.invert(yJ(t))},i.domain=function(t){return arguments.length?(e.domain(t),i):e.domain()},i.range=function(n){return arguments.length?(e.range((t=Array.from(n,mq)).map(yJ)),i):t.slice()},i.rangeRound=function(e){return i.range(e).round(!0)},i.round=function(e){return arguments.length?(n=!!e,i):n},i.clamp=function(t){return arguments.length?(e.clamp(t),i):e.clamp()},i.unknown=function(e){return arguments.length?(r=e,i):r},i.copy=function(){return xJ(e.domain(),t).round(n).clamp(e.clamp()).unknown(r)},tK.apply(i,arguments),Yq(i)}function SJ(){var e=[],t=[],n=[],r;function i(){var r=0,i=Math.max(1,t.length);for(n=Array(i-1);++r0?n[i-1]:e[0],i=n?[r[n-1],t]:[r[o-1],r[o]]},o.unknown=function(e){return arguments.length&&(a=e),o},o.thresholds=function(){return r.slice()},o.copy=function(){return CJ().domain([e,t]).range(i).unknown(a)},tK.apply(Yq(o),arguments)}function wJ(){var e=[.5],t=[0,1],n,r=1;function i(i){return i!=null&&i<=i?t[NG(e,i,0,r)]:n}return i.domain=function(n){return arguments.length?(e=Array.from(n),r=Math.min(e.length,t.length-1),i):e.slice()},i.range=function(n){return arguments.length?(t=Array.from(n),r=Math.min(e.length,t.length-1),i):t.slice()},i.invertExtent=function(n){var r=t.indexOf(n);return[e[r-1],e[r]]},i.unknown=function(e){return arguments.length?(n=e,i):n},i.copy=function(){return wJ().domain(e).range(t).unknown(n)},tK.apply(i,arguments)}var TJ=new Date,EJ=new Date;function DJ(e,t,n,r){function i(t){return e(t=arguments.length===0?new Date:new Date(+t)),t}return i.floor=t=>(e(t=new Date(+t)),t),i.ceil=n=>(e(n=new Date(n-1)),t(n,1),e(n),n),i.round=e=>{let t=i(e),n=i.ceil(e);return e-t(t(e=new Date(+e),n==null?1:Math.floor(n)),e),i.range=(n,r,a)=>{let o=[];if(n=i.ceil(n),a=a==null?1:Math.floor(a),!(n0))return o;let s;do o.push(s=new Date(+n)),t(n,a),e(n);while(sDJ(t=>{if(t>=t)for(;e(t),!n(t);)t.setTime(t-1)},(e,r)=>{if(e>=e)if(r<0)for(;++r<=0;)for(;t(e,-1),!n(e););else for(;--r>=0;)for(;t(e,1),!n(e););}),n&&(i.count=(t,r)=>(TJ.setTime(+t),EJ.setTime(+r),e(TJ),e(EJ),Math.floor(n(TJ,EJ))),i.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?i.filter(r?t=>r(t)%e===0:t=>i.count(0,t)%e===0):i)),i}var OJ=DJ(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);OJ.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?DJ(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):OJ),OJ.range;var kJ=1e3,AJ=kJ*60,jJ=AJ*60,MJ=jJ*24,NJ=MJ*7,PJ=MJ*30,FJ=MJ*365,IJ=DJ(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*kJ)},(e,t)=>(t-e)/kJ,e=>e.getUTCSeconds());IJ.range;var LJ=DJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*kJ)},(e,t)=>{e.setTime(+e+t*AJ)},(e,t)=>(t-e)/AJ,e=>e.getMinutes());LJ.range;var RJ=DJ(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*AJ)},(e,t)=>(t-e)/AJ,e=>e.getUTCMinutes());RJ.range;var zJ=DJ(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*kJ-e.getMinutes()*AJ)},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getHours());zJ.range;var BJ=DJ(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*jJ)},(e,t)=>(t-e)/jJ,e=>e.getUTCHours());BJ.range;var VJ=DJ(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*AJ)/MJ,e=>e.getDate()-1);VJ.range;var HJ=DJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/MJ,e=>e.getUTCDate()-1);HJ.range;var UJ=DJ(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/MJ,e=>Math.floor(e/MJ));UJ.range;function WJ(e){return DJ(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(e,t)=>{e.setDate(e.getDate()+t*7)},(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*AJ)/NJ)}var GJ=WJ(0),KJ=WJ(1),qJ=WJ(2),JJ=WJ(3),YJ=WJ(4),XJ=WJ(5),ZJ=WJ(6);GJ.range,KJ.range,qJ.range,JJ.range,YJ.range,XJ.range,ZJ.range;function QJ(e){return DJ(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t*7)},(e,t)=>(t-e)/NJ)}var $J=QJ(0),eY=QJ(1),tY=QJ(2),nY=QJ(3),rY=QJ(4),iY=QJ(5),aY=QJ(6);$J.range,eY.range,tY.range,nY.range,rY.range,iY.range,aY.range;var oY=DJ(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());oY.range;var sY=DJ(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());sY.range;var cY=DJ(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());cY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:DJ(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)}),cY.range;var lY=DJ(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());lY.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:DJ(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)}),lY.range;function uY(e,t,n,r,i,a){let o=[[IJ,1,kJ],[IJ,5,5*kJ],[IJ,15,15*kJ],[IJ,30,30*kJ],[a,1,AJ],[a,5,5*AJ],[a,15,15*AJ],[a,30,30*AJ],[i,1,jJ],[i,3,3*jJ],[i,6,6*jJ],[i,12,12*jJ],[r,1,MJ],[r,2,2*MJ],[n,1,NJ],[t,1,PJ],[t,3,3*PJ],[e,1,FJ]];function s(e,t,n){let r=te).right(o,i);if(a===o.length)return e.every(qG(t/FJ,n/FJ,r));if(a===0)return OJ.every(Math.max(qG(t,n,r),1));let[s,c]=o[i/o[a-1][2]53)return null;`w`in r||(r.w=1),`Z`in r?(a=gY(_Y(r.y,0,1)),o=a.getUTCDay(),a=o>4||o===0?eY.ceil(a):eY(a),a=HJ.offset(a,(r.V-1)*7),r.y=a.getUTCFullYear(),r.m=a.getUTCMonth(),r.d=a.getUTCDate()+(r.w+6)%7):(a=hY(_Y(r.y,0,1)),o=a.getDay(),a=o>4||o===0?KJ.ceil(a):KJ(a),a=VJ.offset(a,(r.V-1)*7),r.y=a.getFullYear(),r.m=a.getMonth(),r.d=a.getDate()+(r.w+6)%7)}else (`W`in r||`U`in r)&&(`w`in r||(r.w=`u`in r?r.u%7:+(`W`in r)),o=`Z`in r?gY(_Y(r.y,0,1)).getUTCDay():hY(_Y(r.y,0,1)).getDay(),r.m=0,r.d=`W`in r?(r.w+6)%7+r.W*7-(o+5)%7:r.w+r.U*7-(o+6)%7);return`Z`in r?(r.H+=r.Z/100|0,r.M+=r.Z%100,gY(r)):hY(r)}}function w(e,t,n,r){for(var i=0,a=t.length,o=n.length,s,c;i=o)return-1;if(s=t.charCodeAt(i++),s===37){if(s=t.charAt(i++),c=x[s in yY?t.charAt(i++):s],!c||(r=c(e,n,r))<0)return-1}else if(s!=n.charCodeAt(r++))return-1}return r}function T(e,t,n){var r=l.exec(t.slice(n));return r?(e.p=u.get(r[0].toLowerCase()),n+r[0].length):-1}function E(e,t,n){var r=p.exec(t.slice(n));return r?(e.w=m.get(r[0].toLowerCase()),n+r[0].length):-1}function D(e,t,n){var r=d.exec(t.slice(n));return r?(e.w=f.get(r[0].toLowerCase()),n+r[0].length):-1}function O(e,t,n){var r=_.exec(t.slice(n));return r?(e.m=v.get(r[0].toLowerCase()),n+r[0].length):-1}function k(e,t,n){var r=h.exec(t.slice(n));return r?(e.m=g.get(r[0].toLowerCase()),n+r[0].length):-1}function A(e,n,r){return w(e,t,n,r)}function j(e,t,r){return w(e,n,t,r)}function M(e,t,n){return w(e,r,t,n)}function N(e){return o[e.getDay()]}function P(e){return a[e.getDay()]}function F(e){return c[e.getMonth()]}function I(e){return s[e.getMonth()]}function ee(e){return i[+(e.getHours()>=12)]}function te(e){return 1+~~(e.getMonth()/3)}function ne(e){return o[e.getUTCDay()]}function re(e){return a[e.getUTCDay()]}function ie(e){return c[e.getUTCMonth()]}function ae(e){return s[e.getUTCMonth()]}function oe(e){return i[+(e.getUTCHours()>=12)]}function se(e){return 1+~~(e.getUTCMonth()/3)}return{format:function(e){var t=S(e+=``,y);return t.toString=function(){return e},t},parse:function(e){var t=C(e+=``,!1);return t.toString=function(){return e},t},utcFormat:function(e){var t=S(e+=``,b);return t.toString=function(){return e},t},utcParse:function(e){var t=C(e+=``,!0);return t.toString=function(){return e},t}}}var yY={"-":``,_:` `,0:`0`},bY=/^\s*\d+/,xY=/^%/,SY=/[\\^$*+?|[\]().{}]/g;function CY(e,t,n){var r=e<0?`-`:``,i=(r?-e:e)+``,a=i.length;return r+(a[e.toLowerCase(),t]))}function DY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.w=+r[0],n+r[0].length):-1}function OY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.u=+r[0],n+r[0].length):-1}function kY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.U=+r[0],n+r[0].length):-1}function AY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.V=+r[0],n+r[0].length):-1}function jY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.W=+r[0],n+r[0].length):-1}function MY(e,t,n){var r=bY.exec(t.slice(n,n+4));return r?(e.y=+r[0],n+r[0].length):-1}function NY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function PY(e,t,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return r?(e.Z=r[1]?0:-(r[2]+(r[3]||`00`)),n+r[0].length):-1}function FY(e,t,n){var r=bY.exec(t.slice(n,n+1));return r?(e.q=r[0]*3-3,n+r[0].length):-1}function IY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.m=r[0]-1,n+r[0].length):-1}function LY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.d=+r[0],n+r[0].length):-1}function RY(e,t,n){var r=bY.exec(t.slice(n,n+3));return r?(e.m=0,e.d=+r[0],n+r[0].length):-1}function zY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.H=+r[0],n+r[0].length):-1}function BY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.M=+r[0],n+r[0].length):-1}function VY(e,t,n){var r=bY.exec(t.slice(n,n+2));return r?(e.S=+r[0],n+r[0].length):-1}function HY(e,t,n){var r=bY.exec(t.slice(n,n+3));return r?(e.L=+r[0],n+r[0].length):-1}function UY(e,t,n){var r=bY.exec(t.slice(n,n+6));return r?(e.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function WY(e,t,n){var r=xY.exec(t.slice(n,n+1));return r?n+r[0].length:-1}function GY(e,t,n){var r=bY.exec(t.slice(n));return r?(e.Q=+r[0],n+r[0].length):-1}function KY(e,t,n){var r=bY.exec(t.slice(n));return r?(e.s=+r[0],n+r[0].length):-1}function qY(e,t){return CY(e.getDate(),t,2)}function JY(e,t){return CY(e.getHours(),t,2)}function YY(e,t){return CY(e.getHours()%12||12,t,2)}function XY(e,t){return CY(1+VJ.count(cY(e),e),t,3)}function ZY(e,t){return CY(e.getMilliseconds(),t,3)}function QY(e,t){return ZY(e,t)+`000`}function $Y(e,t){return CY(e.getMonth()+1,t,2)}function eX(e,t){return CY(e.getMinutes(),t,2)}function tX(e,t){return CY(e.getSeconds(),t,2)}function nX(e){var t=e.getDay();return t===0?7:t}function rX(e,t){return CY(GJ.count(cY(e)-1,e),t,2)}function iX(e){var t=e.getDay();return t>=4||t===0?YJ(e):YJ.ceil(e)}function aX(e,t){return e=iX(e),CY(YJ.count(cY(e),e)+(cY(e).getDay()===4),t,2)}function oX(e){return e.getDay()}function sX(e,t){return CY(KJ.count(cY(e)-1,e),t,2)}function cX(e,t){return CY(e.getFullYear()%100,t,2)}function lX(e,t){return e=iX(e),CY(e.getFullYear()%100,t,2)}function uX(e,t){return CY(e.getFullYear()%1e4,t,4)}function dX(e,t){var n=e.getDay();return e=n>=4||n===0?YJ(e):YJ.ceil(e),CY(e.getFullYear()%1e4,t,4)}function fX(e){var t=e.getTimezoneOffset();return(t>0?`-`:(t*=-1,`+`))+CY(t/60|0,`0`,2)+CY(t%60,`0`,2)}function pX(e,t){return CY(e.getUTCDate(),t,2)}function mX(e,t){return CY(e.getUTCHours(),t,2)}function hX(e,t){return CY(e.getUTCHours()%12||12,t,2)}function gX(e,t){return CY(1+HJ.count(lY(e),e),t,3)}function _X(e,t){return CY(e.getUTCMilliseconds(),t,3)}function vX(e,t){return _X(e,t)+`000`}function yX(e,t){return CY(e.getUTCMonth()+1,t,2)}function bX(e,t){return CY(e.getUTCMinutes(),t,2)}function xX(e,t){return CY(e.getUTCSeconds(),t,2)}function SX(e){var t=e.getUTCDay();return t===0?7:t}function CX(e,t){return CY($J.count(lY(e)-1,e),t,2)}function wX(e){var t=e.getUTCDay();return t>=4||t===0?rY(e):rY.ceil(e)}function TX(e,t){return e=wX(e),CY(rY.count(lY(e),e)+(lY(e).getUTCDay()===4),t,2)}function EX(e){return e.getUTCDay()}function DX(e,t){return CY(eY.count(lY(e)-1,e),t,2)}function OX(e,t){return CY(e.getUTCFullYear()%100,t,2)}function kX(e,t){return e=wX(e),CY(e.getUTCFullYear()%100,t,2)}function AX(e,t){return CY(e.getUTCFullYear()%1e4,t,4)}function jX(e,t){var n=e.getUTCDay();return e=n>=4||n===0?rY(e):rY.ceil(e),CY(e.getUTCFullYear()%1e4,t,4)}function MX(){return`+0000`}function NX(){return`%`}function PX(e){return+e}function FX(e){return Math.floor(e/1e3)}var IX,LX,RX;zX({dateTime:`%x, %X`,date:`%-m/%-d/%Y`,time:`%-I:%M:%S %p`,periods:[`AM`,`PM`],days:[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],shortDays:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],months:[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],shortMonths:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`]});function zX(e){return IX=vY(e),LX=IX.format,IX.parse,RX=IX.utcFormat,IX.utcParse,IX}function BX(e){return new Date(e)}function VX(e){return e instanceof Date?+e:+new Date(+e)}function HX(e,t,n,r,i,a,o,s,c,l){var u=Cq(),d=u.invert,f=u.domain,p=l(`.%L`),m=l(`:%S`),h=l(`%I:%M`),g=l(`%I %p`),_=l(`%a %d`),v=l(`%b %d`),y=l(`%B`),b=l(`%Y`);function x(e){return(c(e)t(r/(e.length-1)))},n.quantiles=function(t){return Array.from({length:t+1},(n,r)=>QG(e,r/t))},n.copy=function(){return QX(t).domain(e)},nK.apply(n,arguments)}function $X(){var e=0,t=.5,n=1,r=1,i,a,o,s,c,l=gq,u,d=!1,f;function p(e){return isNaN(e=+e)?f:(e=.5+((e=+u(e))-a)*(r*eaK,scaleDiverging:()=>eZ,scaleDivergingLog:()=>tZ,scaleDivergingPow:()=>rZ,scaleDivergingSqrt:()=>iZ,scaleDivergingSymlog:()=>nZ,scaleIdentity:()=>Zq,scaleImplicit:()=>rK,scaleLinear:()=>Xq,scaleLog:()=>cJ,scaleOrdinal:()=>iK,scalePoint:()=>sK,scalePow:()=>_J,scaleQuantile:()=>SJ,scaleQuantize:()=>CJ,scaleRadial:()=>xJ,scaleSequential:()=>qX,scaleSequentialLog:()=>JX,scaleSequentialPow:()=>XX,scaleSequentialQuantile:()=>QX,scaleSequentialSqrt:()=>ZX,scaleSequentialSymlog:()=>YX,scaleSqrt:()=>vJ,scaleSymlog:()=>fJ,scaleThreshold:()=>wJ,scaleTime:()=>UX,scaleUtc:()=>WX,tickFormat:()=>Jq}),oZ=o(((e,t)=>{var n=KI();function r(e,t,r){for(var i=-1,a=e.length;++i{function n(e,t){return e>t}t.exports=n})),cZ=o(((e,t)=>{var n=oZ(),r=sZ(),i=BV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),lZ=o(((e,t)=>{function n(e,t){return e{var n=oZ(),r=lZ(),i=BV();function a(e){return e&&e.length?n(e,i,r):void 0}t.exports=a})),dZ=o(((e,t)=>{var n=oL(),r=WV(),i=MH(),a=BI();function o(e,t){return(a(e)?n:i)(e,r(t,3))}t.exports=o})),fZ=o(((e,t)=>{var n=EH(),r=dZ();function i(e,t){return n(r(e,t),1)}t.exports=i})),pZ=o(((e,t)=>{var n=AV();function r(e,t){return n(e,t)}t.exports=r})),mZ=o(((e,t)=>{(function(e){var n=1e9,r={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:`2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286`},i=!0,a=`[DecimalError] `,o=a+`Invalid argument: `,s=a+`Exponent out of range: `,c=Math.floor,l=Math.pow,u=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,d,f=1e7,p=7,m=9007199254740991,h=c(m/p),g={};g.absoluteValue=g.abs=function(){var e=new this.constructor(this);return e.s&&=1,e},g.comparedTo=g.cmp=function(e){var t,n,r,i,a=this;if(e=new a.constructor(e),a.s!==e.s)return a.s||-e.s;if(a.e!==e.e)return a.e>e.e^a.s<0?1:-1;for(r=a.d.length,i=e.d.length,t=0,n=re.d[t]^a.s<0?1:-1;return r===i?0:r>i^a.s<0?1:-1},g.decimalPlaces=g.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*p;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n},g.dividedBy=g.div=function(e){return b(this,new this.constructor(e))},g.dividedToIntegerBy=g.idiv=function(e){var t=this,n=t.constructor;return D(b(t,new n(e),0,1),n.precision)},g.equals=g.eq=function(e){return!this.cmp(e)},g.exponent=function(){return S(this)},g.greaterThan=g.gt=function(e){return this.cmp(e)>0},g.greaterThanOrEqualTo=g.gte=function(e){return this.cmp(e)>=0},g.isInteger=g.isint=function(){return this.e>this.d.length-2},g.isNegative=g.isneg=function(){return this.s<0},g.isPositive=g.ispos=function(){return this.s>0},g.isZero=function(){return this.s===0},g.lessThan=g.lt=function(e){return this.cmp(e)<0},g.lessThanOrEqualTo=g.lte=function(e){return this.cmp(e)<1},g.logarithm=g.log=function(e){var t,n=this,r=n.constructor,o=r.precision,s=o+5;if(e===void 0)e=new r(10);else if(e=new r(e),e.s<1||e.eq(d))throw Error(a+`NaN`);if(n.s<1)throw Error(a+(n.s?`NaN`:`-Infinity`));return n.eq(d)?new r(0):(i=!1,t=b(T(n,s),T(e,s),s),i=!0,D(t,o))},g.minus=g.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?O(t,e):_(t,(e.s=-e.s,e))},g.modulo=g.mod=function(e){var t,n=this,r=n.constructor,o=r.precision;if(e=new r(e),!e.s)throw Error(a+`NaN`);return n.s?(i=!1,t=b(n,e,0,1).times(e),i=!0,n.minus(t)):D(new r(n),o)},g.naturalExponential=g.exp=function(){return x(this)},g.naturalLogarithm=g.ln=function(){return T(this)},g.negated=g.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e},g.plus=g.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?_(t,e):O(t,(e.s=-e.s,e))},g.precision=g.sd=function(e){var t,n,r,i=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(o+e);if(t=S(i)+1,r=i.d.length-1,n=r*p+1,r=i.d[r],r){for(;r%10==0;r/=10)n--;for(r=i.d[0];r>=10;r/=10)n++}return e&&t>n?t:n},g.squareRoot=g.sqrt=function(){var e,t,n,r,o,s,l,u=this,d=u.constructor;if(u.s<1){if(!u.s)return new d(0);throw Error(a+`NaN`)}for(e=S(u),i=!1,o=Math.sqrt(+u),o==0||o==1/0?(t=y(u.d),(t.length+e)%2==0&&(t+=`0`),o=Math.sqrt(t),e=c((e+1)/2)-(e<0||e%2),o==1/0?t=`5e`+e:(t=o.toExponential(),t=t.slice(0,t.indexOf(`e`)+1)+e),r=new d(t)):r=new d(o.toString()),n=d.precision,o=l=n+3;;)if(s=r,r=s.plus(b(u,s,l+2)).times(.5),y(s.d).slice(0,l)===(t=y(r.d)).slice(0,l)){if(t=t.slice(l-3,l+1),o==l&&t==`4999`){if(D(s,n+1,0),s.times(s).eq(u)){r=s;break}}else if(t!=`9999`)break;l+=4}return i=!0,D(r,n)},g.times=g.mul=function(e){var t,n,r,a,o,s,c,l,u,d=this,p=d.constructor,m=d.d,h=(e=new p(e)).d;if(!d.s||!e.s)return new p(0);for(e.s*=d.s,n=d.e+e.e,l=m.length,u=h.length,l=0;){for(t=0,a=l+r;a>r;)c=o[a]+h[r]*m[a-r-1]+t,o[a--]=c%f|0,t=c/f|0;o[a]=(o[a]+t)%f|0}for(;!o[--s];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,i?D(e,p.precision):e},g.toDecimalPlaces=g.todp=function(e,t){var r=this,i=r.constructor;return r=new i(r),e===void 0?r:(v(e,0,n),t===void 0?t=i.rounding:v(t,0,8),D(r,e+S(r)+1,t))},g.toExponential=function(e,t){var r,i=this,a=i.constructor;return e===void 0?r=k(i,!0):(v(e,0,n),t===void 0?t=a.rounding:v(t,0,8),i=D(new a(i),e+1,t),r=k(i,!0,e+1)),r},g.toFixed=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?k(a):(v(e,0,n),t===void 0?t=o.rounding:v(t,0,8),i=D(new o(a),e+S(a)+1,t),r=k(i.abs(),!1,e+S(i)+1),a.isneg()&&!a.isZero()?`-`+r:r)},g.toInteger=g.toint=function(){var e=this,t=e.constructor;return D(new t(e),S(e)+1,t.rounding)},g.toNumber=function(){return+this},g.toPower=g.pow=function(e){var t,n,r,o,s,l,u=this,f=u.constructor,h=12,g=+(e=new f(e));if(!e.s)return new f(d);if(u=new f(u),!u.s){if(e.s<1)throw Error(a+`Infinity`);return u}if(u.eq(d))return u;if(r=f.precision,e.eq(d))return D(u,r);if(t=e.e,n=e.d.length-1,l=t>=n,s=u.s,!l){if(s<0)throw Error(a+`NaN`)}else if((n=g<0?-g:g)<=m){for(o=new f(d),t=Math.ceil(r/p+4),i=!1;n%2&&(o=o.times(u),A(o.d,t)),n=c(n/2),n!==0;)u=u.times(u),A(u.d,t);return i=!0,e.s<0?new f(d).div(o):D(o,r)}return s=s<0&&e.d[Math.max(t,n)]&1?-1:1,u.s=1,i=!1,o=e.times(T(u,r+h)),i=!0,o=x(o),o.s=s,o},g.toPrecision=function(e,t){var r,i,a=this,o=a.constructor;return e===void 0?(r=S(a),i=k(a,r<=o.toExpNeg||r>=o.toExpPos)):(v(e,1,n),t===void 0?t=o.rounding:v(t,0,8),a=D(new o(a),e,t),r=S(a),i=k(a,e<=r||r<=o.toExpNeg,e)),i},g.toSignificantDigits=g.tosd=function(e,t){var r=this,i=r.constructor;return e===void 0?(e=i.precision,t=i.rounding):(v(e,1,n),t===void 0?t=i.rounding:v(t,0,8)),D(new i(r),e,t)},g.toString=g.valueOf=g.val=g.toJSON=function(){var e=this,t=S(e),n=e.constructor;return k(e,t<=n.toExpNeg||t>=n.toExpPos)};function _(e,t){var n,r,a,o,s,c,l,u,d=e.constructor,m=d.precision;if(!e.s||!t.s)return t.s||(t=new d(e)),i?D(t,m):t;if(l=e.d,u=t.d,s=e.e,a=t.e,l=l.slice(),o=s-a,o){for(o<0?(r=l,o=-o,c=u.length):(r=u,a=s,c=l.length),s=Math.ceil(m/p),c=s>c?s+1:c+1,o>c&&(o=c,r.length=1),r.reverse();o--;)r.push(0);r.reverse()}for(c=l.length,o=u.length,c-o<0&&(o=c,r=u,u=l,l=r),n=0;o;)n=(l[--o]=l[o]+u[o]+n)/f|0,l[o]%=f;for(n&&(l.unshift(n),++a),c=l.length;l[--c]==0;)l.pop();return t.d=l,t.e=a,i?D(t,m):t}function v(e,t,n){if(e!==~~e||en)throw Error(o+e)}function y(e){var t,n,r,i=e.length-1,a=``,o=e[0];if(i>0){for(a+=o,t=1;tr?1:-1;else for(i=a=0;it[i]?1:-1;break}return a}function n(e,t,n){for(var r=0;n--;)e[n]-=r,r=+(e[n]1;)e.shift()}return function(r,i,o,s){var c,l,u,d,m,h,g,_,v,y,b,x,C,w,T,E,O,k,A=r.constructor,j=r.s==i.s?1:-1,M=r.d,N=i.d;if(!r.s)return new A(r);if(!i.s)throw Error(a+`Division by zero`);for(l=r.e-i.e,O=N.length,T=M.length,g=new A(j),_=g.d=[],u=0;N[u]==(M[u]||0);)++u;if(N[u]>(M[u]||0)&&--l,x=o==null?o=A.precision:s?o+(S(r)-S(i))+1:o,x<0)return new A(0);if(x=x/p+2|0,u=0,O==1)for(d=0,N=N[0],x++;(u1&&(N=e(N,d),M=e(M,d),O=N.length,T=M.length),w=O,v=M.slice(0,O),y=v.length;y=f/2&&++E;do d=0,c=t(N,v,O,y),c<0?(b=v[0],O!=y&&(b=b*f+(v[1]||0)),d=b/E|0,d>1?(d>=f&&(d=f-1),m=e(N,d),h=m.length,y=v.length,c=t(m,v,h,y),c==1&&(d--,n(m,O16)throw Error(s+S(e));if(!e.s)return new m(d);for(t==null?(i=!1,u=h):u=t,c=new m(.03125);e.abs().gte(.1);)e=e.times(c),p+=5;for(r=Math.log(l(2,p))/Math.LN10*2+5|0,u+=r,n=a=o=new m(d),m.precision=u;;){if(a=D(a.times(e),u),n=n.times(++f),c=o.plus(b(a,n,u)),y(c.d).slice(0,u)===y(o.d).slice(0,u)){for(;p--;)o=D(o.times(o),u);return m.precision=h,t==null?(i=!0,D(o,h)):o}o=c}}function S(e){for(var t=e.e*p,n=e.d[0];n>=10;n/=10)t++;return t}function C(e,t,n){if(t>e.LN10.sd())throw i=!0,n&&(e.precision=n),Error(a+`LN10 precision limit exceeded`);return D(new e(e.LN10),t)}function w(e){for(var t=``;e--;)t+=`0`;return t}function T(e,t){var n,r,o,s,c,l,u,f,p,m=1,h=10,g=e,_=g.d,v=g.constructor,x=v.precision;if(g.s<1)throw Error(a+(g.s?`NaN`:`-Infinity`));if(g.eq(d))return new v(0);if(t==null?(i=!1,f=x):f=t,g.eq(10))return t??(i=!0),C(v,f);if(f+=h,v.precision=f,n=y(_),r=n.charAt(0),s=S(g),Math.abs(s)<0x5543df729c000){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)g=g.times(e),n=y(g.d),r=n.charAt(0),m++;s=S(g),r>1?(g=new v(`0.`+n),s++):g=new v(r+`.`+n.slice(1))}else return u=C(v,f+2,x).times(s+``),g=T(new v(r+`.`+n.slice(1)),f-h).plus(u),v.precision=x,t==null?(i=!0,D(g,x)):g;for(l=c=g=b(g.minus(d),g.plus(d),f),p=D(g.times(g),f),o=3;;){if(c=D(c.times(p),f),u=l.plus(b(c,new v(o),f)),y(u.d).slice(0,f)===y(l.d).slice(0,f))return l=l.times(2),s!==0&&(l=l.plus(C(v,f+2,x).times(s+``))),l=b(l,new v(m),f),v.precision=x,t==null?(i=!0,D(l,x)):l;l=u,o+=2}}function E(e,t){var n,r,a;for((n=t.indexOf(`.`))>-1&&(t=t.replace(`.`,``)),(r=t.search(/e/i))>0?(n<0&&(n=r),n+=+t.slice(r+1),t=t.substring(0,r)):n<0&&(n=t.length),r=0;t.charCodeAt(r)===48;)++r;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(r,a),t){if(a-=r,n=n-r-1,e.e=c(n/p),e.d=[],r=(n+1)%p,n<0&&(r+=p),rh||e.e<-h))throw Error(s+n)}else e.s=0,e.e=0,e.d=[0];return e}function D(e,t,n){var r,a,o,u,d,m,g,_,v=e.d;for(u=1,o=v[0];o>=10;o/=10)u++;if(r=t-u,r<0)r+=p,a=t,g=v[_=0];else{if(_=Math.ceil((r+1)/p),o=v.length,_>=o)return e;for(g=o=v[_],u=1;o>=10;o/=10)u++;r%=p,a=r-p+u}if(n!==void 0&&(o=l(10,u-a-1),d=g/o%10|0,m=t<0||v[_+1]!==void 0||g%o,m=n<4?(d||m)&&(n==0||n==(e.s<0?3:2)):d>5||d==5&&(n==4||m||n==6&&(r>0?a>0?g/l(10,u-a):0:v[_-1])%10&1||n==(e.s<0?8:7))),t<1||!v[0])return m?(o=S(e),v.length=1,t=t-o-1,v[0]=l(10,(p-t%p)%p),e.e=c(-t/p)||0):(v.length=1,v[0]=e.e=e.s=0),e;if(r==0?(v.length=_,o=1,_--):(v.length=_+1,o=l(10,p-r),v[_]=a>0?(g/l(10,u-a)%l(10,a)|0)*o:0),m)for(;;)if(_==0){(v[0]+=o)==f&&(v[0]=1,++e.e);break}else{if(v[_]+=o,v[_]!=f)break;v[_--]=0,o=1}for(r=v.length;v[--r]===0;)v.pop();if(i&&(e.e>h||e.e<-h))throw Error(s+S(e));return e}function O(e,t){var n,r,a,o,s,c,l,u,d,m,h=e.constructor,g=h.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new h(e),i?D(t,g):t;if(l=e.d,m=t.d,r=t.e,u=e.e,l=l.slice(),s=u-r,s){for(d=s<0,d?(n=l,s=-s,c=m.length):(n=m,r=u,c=l.length),a=Math.max(Math.ceil(g/p),c)+2,s>a&&(s=a,n.length=1),n.reverse(),a=s;a--;)n.push(0);n.reverse()}else{for(a=l.length,c=m.length,d=a0;--a)l[c++]=0;for(a=m.length;a>s;){if(l[--a]0?a=a.charAt(0)+`.`+a.slice(1)+w(r):o>1&&(a=a.charAt(0)+`.`+a.slice(1)),a=a+(i<0?`e`:`e+`)+i):i<0?(a=`0.`+w(-i-1)+a,n&&(r=n-o)>0&&(a+=w(r))):i>=o?(a+=w(i+1-o),n&&(r=n-i-1)>0&&(a=a+`.`+w(r))):((r=i+1)0&&(i+1===o&&(a+=`.`),a+=w(r))),e.s<0?`-`+a:a}function A(e,t){if(e.length>t)return e.length=t,!0}function j(e){var t,n,r;function i(e){var t=this;if(!(t instanceof i))return new i(e);if(t.constructor=i,e instanceof i){t.s=e.s,t.e=e.e,t.d=(e=e.d)?e.slice():e;return}if(typeof e==`number`){if(e*0!=0)throw Error(o+e);if(e>0)t.s=1;else if(e<0)e=-e,t.s=-1;else{t.s=0,t.e=0,t.d=[0];return}if(e===~~e&&e<1e7){t.e=0,t.d=[e];return}return E(t,e.toString())}else if(typeof e!=`string`)throw Error(o+e);if(e.charCodeAt(0)===45?(e=e.slice(1),t.s=-1):t.s=1,u.test(e))E(t,e);else throw Error(o+e)}if(i.prototype=g,i.ROUND_UP=0,i.ROUND_DOWN=1,i.ROUND_CEIL=2,i.ROUND_FLOOR=3,i.ROUND_HALF_UP=4,i.ROUND_HALF_DOWN=5,i.ROUND_HALF_EVEN=6,i.ROUND_HALF_CEIL=7,i.ROUND_HALF_FLOOR=8,i.clone=j,i.config=i.set=M,e===void 0&&(e={}),e)for(r=[`precision`,`rounding`,`toExpNeg`,`toExpPos`,`LN10`],t=0;t=s[t+1]&&i<=s[t+2])this[r]=i;else throw Error(o+r+`: `+i);if((i=e[r=`LN10`])!==void 0)if(i==Math.LN10)this[r]=new this(i);else throw Error(o+r+`: `+i);return this}r=j(r),r.default=r.Decimal=r,d=new r(1),typeof define==`function`&&define.amd?define(function(){return r}):t!==void 0&&t.exports?t.exports=r:(e||=typeof self<`u`&&self&&self.self==self?self:Function(`return this`)(),e.Decimal=r)})(e)}));function hZ(e){return yZ(e)||vZ(e)||_Z(e)||gZ()}function gZ(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _Z(e,t){if(e){if(typeof e==`string`)return bZ(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bZ(e,t)}}function vZ(e){if(typeof Symbol<`u`&&Symbol.iterator in Object(e))return Array.from(e)}function yZ(e){if(Array.isArray(e))return bZ(e)}function bZ(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=t?n.apply(void 0,r):e(t-i,wZ(function(){var e=[...arguments],t=r.map(function(t){return CZ(t)?e.shift():t});return n.apply(void 0,hZ(t).concat(e))}))})},EZ=function(e){return TZ(e.length,e)},DZ=function(e,t){for(var n=[],r=e;re.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!(Symbol.iterator in Object(e)))){var n=[],r=!0,i=!1,a=void 0;try{for(var o=e[Symbol.iterator](),s;!(r=(s=o.next()).done)&&(n.push(s.value),!(t&&n.length===t));r=!0);}catch(e){i=!0,a=e}finally{try{!r&&o.return!=null&&o.return()}finally{if(i)throw a}}return n}}function GZ(e){if(Array.isArray(e))return e}function KZ(e){var t=BZ(e,2),n=t[0],r=t[1],i=n,a=r;return n>r&&(i=r,a=n),[i,a]}function qZ(e,t,n){if(e.lte(0))return new MZ.default(0);var r=FZ.getDigitCount(e.toNumber()),i=new MZ.default(10).pow(r),a=e.div(i),o=r===1?.1:.05,s=new MZ.default(Math.ceil(a.div(o).toNumber())).add(n).mul(o).mul(i);return t?s:new MZ.default(Math.ceil(s))}function JZ(e,t,n){var r=1,i=new MZ.default(e);if(!i.isint()&&n){var a=Math.abs(e);a<1?(r=new MZ.default(10).pow(FZ.getDigitCount(e)-1),i=new MZ.default(Math.floor(i.div(r).toNumber())).mul(r)):a>1&&(i=new MZ.default(Math.floor(e)))}else e===0?i=new MZ.default(Math.floor((t-1)/2)):n||(i=new MZ.default(Math.floor(e)));var o=Math.floor((t-1)/2);return kZ(OZ(function(e){return i.add(new MZ.default(e-o).mul(r)).toNumber()}),DZ)(0,t)}function YZ(e,t,n,r){var i=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new MZ.default(0),tickMin:new MZ.default(0),tickMax:new MZ.default(0)};var a=qZ(new MZ.default(t).sub(e).div(n-1),r,i),o;e<=0&&t>=0?o=new MZ.default(0):(o=new MZ.default(e).add(t).div(2),o=o.sub(new MZ.default(o).mod(a)));var s=Math.ceil(o.sub(e).div(a).toNumber()),c=Math.ceil(new MZ.default(t).sub(o).div(a).toNumber()),l=s+c+1;return l>n?YZ(e,t,n,r,i+1):(l0?c+(n-l):c,s=t>0?s:s+(n-l)),{step:a,tickMin:o.sub(new MZ.default(s).mul(a)),tickMax:o.add(new MZ.default(c).mul(a))})}function XZ(e){var t=BZ(e,2),n=t[0],r=t[1],i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(i,2),s=BZ(KZ([n,r]),2),c=s[0],l=s[1];if(c===-1/0||l===1/0){var u=l===1/0?[c].concat(IZ(DZ(0,i-1).map(function(){return 1/0}))):[].concat(IZ(DZ(0,i-1).map(function(){return-1/0})),[l]);return n>r?AZ(u):u}if(c===l)return JZ(c,i,a);var d=YZ(c,l,o,a),f=d.step,p=d.tickMin,m=d.tickMax,h=FZ.rangeStep(p,m.add(new MZ.default(.1).mul(f)),f);return n>r?AZ(h):h}function ZZ(e,t){var n=BZ(e,2),r=n[0],i=n[1],a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=BZ(KZ([r,i]),2),s=o[0],c=o[1];if(s===-1/0||c===1/0)return[r,i];if(s===c)return[s];var l=Math.max(t,2),u=qZ(new MZ.default(c).sub(s).div(l-1),a,0),d=[].concat(IZ(FZ.rangeStep(new MZ.default(s),new MZ.default(c).sub(new MZ.default(.99).mul(u)),u)),[c]);return r>i?AZ(d):d}var QZ=jZ(XZ),$Z=jZ(ZZ),eQ=!0,tQ=`Invariant failed`;function nQ(e,t){if(!e){if(eQ)throw Error(tQ);var n=typeof t==`function`?t():t,r=n?`${tQ}: ${n}`:tQ;throw Error(r)}}var rQ=[`offset`,`layout`,`width`,`dataKey`,`data`,`dataPointFormatter`,`xAxis`,`yAxis`];function iQ(e){"@babel/helpers - typeof";return iQ=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},iQ(e)}function aQ(){return aQ=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function pQ(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function mQ(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function hQ(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=-1,a=t?.length??0;if(a<=1)return 0;if(r&&r.axisType===`angleAxis`&&Math.abs(Math.abs(r.range[1]-r.range[0])-360)<=1e-6)for(var o=r.range,s=0;s0?n[s-1].coordinate:n[a-1].coordinate,l=n[s].coordinate,u=s>=a-1?n[0].coordinate:n[s+1].coordinate,d=void 0;if(_L(l-c)!==_L(u-l)){var f=[];if(_L(u-l)===_L(o[1]-o[0])){d=u;var p=l+o[1]-o[0];f[0]=Math.min(p,(p+c)/2),f[1]=Math.max(p,(p+c)/2)}else{d=c;var m=u+o[1]-o[0];f[0]=Math.min(l,(m+l)/2),f[1]=Math.max(l,(m+l)/2)}var h=[Math.min(l,(d+l)/2),Math.max(l,(d+l)/2)];if(e>h[0]&&e<=h[1]||e>=f[0]&&e<=f[1]){i=n[s].index;break}}else{var g=Math.min(c,u),_=Math.max(c,u);if(e>(g+l)/2&&e<=(_+l)/2){i=n[s].index;break}}}else for(var v=0;v0&&v(t[v].coordinate+t[v-1].coordinate)/2&&e<=(t[v].coordinate+t[v+1].coordinate)/2||v===a-1&&e>(t[v].coordinate+t[v-1].coordinate)/2){i=t[v].index;break}return i},e$=function(e){var t,n=e.type.displayName,r=(t=e.type)!=null&&t.defaultProps?qQ(qQ({},e.type.defaultProps),e.props):e.props,i=r.stroke,a=r.fill,o;switch(n){case`Line`:o=i;break;case`Area`:case`Radar`:o=i&&i!==`none`?i:a;break;default:o=a;break}return o},t$=function(e){var t=e.barSize,n=e.totalSize,r=e.stackGroups,i=r===void 0?{}:r;if(!i)return{};for(var a={},o=Object.keys(i),s=0,c=o.length;s=0});if(g&&g.length){var _=g[0].type.defaultProps,v=_===void 0?g[0].props:qQ(qQ({},_),g[0].props),y=v.barSize,b=v[h];a[b]||(a[b]=[]);var x=(0,gL.default)(y)?t:y;a[b].push({item:g[0],stackList:g.slice(1),barSize:(0,gL.default)(x)?void 0:CL(x,n,0)})}}return a},n$=function(e){var t=e.barGap,n=e.barCategoryGap,r=e.bandSize,i=e.sizeList,a=i===void 0?[]:i,o=e.maxBarSize,s=a.length;if(s<1)return null;var c=CL(t,r,0,!0),l,u=[];if(a[0].barSize===+a[0].barSize){var d=!1,f=r/s,p=a.reduce(function(e,t){return e+t.barSize||0},0);p+=(s-1)*c,p>=r&&(p-=(s-1)*c,c=0),p>=r&&f>0&&(d=!0,f*=.9,p=s*f);var m={offset:((r-p)/2>>0)-c,size:0};l=a.reduce(function(e,t){var n={item:t.item,position:{offset:m.offset+m.size+c,size:d?f:t.barSize}},r=[].concat(BQ(e),[n]);return m=r[r.length-1].position,t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:m})}),r},u)}else{var h=CL(n,r,0,!0);r-2*h-(s-1)*c<=0&&(c=0);var g=(r-2*h-(s-1)*c)/s;g>1&&(g>>=0);var _=o===+o?Math.min(g,o):g;l=a.reduce(function(e,t,n){var r=[].concat(BQ(e),[{item:t.item,position:{offset:h+(g+c)*n+(g-_)/2,size:_}}]);return t.stackList&&t.stackList.length&&t.stackList.forEach(function(e){r.push({item:e,position:r[r.length-1].position})}),r},u)}return l},r$=function(e,t,n,r){var i=n.children,a=n.width,o=n.margin,s=PQ({children:i,legendWidth:a-(o.left||0)-(o.right||0)});if(s){var c=r||{},l=c.width,u=c.height,d=s.align,f=s.verticalAlign,p=s.layout;if((p===`vertical`||p===`horizontal`&&f===`middle`)&&d!==`center`&&Q(e[d]))return qQ(qQ({},e),{},JQ({},d,e[d]+(l||0)));if((p===`horizontal`||p===`vertical`&&d===`center`)&&f!==`middle`&&Q(e[f]))return qQ(qQ({},e),{},JQ({},f,e[f]+(u||0)))}return e},i$=function(e,t,n){return(0,gL.default)(t)?!0:e===`horizontal`?t===`yAxis`:e===`vertical`||n===`x`?t===`xAxis`:n===`y`?t===`yAxis`:!0},a$=function(e,t,n,r,i){var a=t.props.children,o=QL(a,DQ).filter(function(e){return i$(r,i,e.props.direction)});if(o&&o.length){var s=o.map(function(e){return e.props.dataKey});return e.reduce(function(e,t){var r=ZQ(t,n);if((0,gL.default)(r))return e;var i=Array.isArray(r)?[(0,IQ.default)(r),(0,FQ.default)(r)]:[r,r],a=s.reduce(function(e,n){var r=ZQ(t,n,0),a=i[0]-Math.abs(Array.isArray(r)?r[0]:r),o=i[1]+Math.abs(Array.isArray(r)?r[1]:r);return[Math.min(a,e[0]),Math.max(o,e[1])]},[1/0,-1/0]);return[Math.min(a[0],e[0]),Math.max(a[1],e[1])]},[1/0,-1/0])}return null},o$=function(e,t,n,r,i){var a=t.map(function(t){return a$(e,t,n,i,r)}).filter(function(e){return!(0,gL.default)(e)});return a&&a.length?a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]):null},s$=function(e,t,n,r,i){var a=t.map(function(t){var a=t.props.dataKey;return n===`number`&&a&&a$(e,t,a,r)||QQ(e,a,n,i)});if(n===`number`)return a.reduce(function(e,t){return[Math.min(e[0],t[0]),Math.max(e[1],t[1])]},[1/0,-1/0]);var o={};return a.reduce(function(e,t){for(var n=0,r=t.length;n=2?_L(o[0]-o[1])*2*c:c,t&&(e.ticks||e.niceTicks)?(e.ticks||e.niceTicks).map(function(e){return{coordinate:r(i?i.indexOf(e):e)+c,value:e,offset:c}}).filter(function(e){return!(0,mL.default)(e.coordinate)}):e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(e,t){return{coordinate:r(e)+c,value:e,index:t,offset:c}}):r.ticks&&!n?r.ticks(e.tickCount).map(function(e){return{coordinate:r(e)+c,value:e,offset:c}}):r.domain().map(function(e,t){return{coordinate:r(e)+c,value:i?i[e]:e,index:t,offset:c}})},u$=new WeakMap,d$=function(e,t){if(typeof t!=`function`)return e;u$.has(e)||u$.set(e,new WeakMap);var n=u$.get(e);if(n.has(t))return n.get(t);var r=function(){e.apply(void 0,arguments),t.apply(void 0,arguments)};return n.set(t,r),r},f$=function(e,t,n){var r=e.scale,i=e.type,a=e.layout,o=e.axisType;if(r===`auto`)return a===`radial`&&o===`radiusAxis`?{scale:aK(),realScaleType:`band`}:a===`radial`&&o===`angleAxis`?{scale:Xq(),realScaleType:`linear`}:i===`category`&&t&&(t.indexOf(`LineChart`)>=0||t.indexOf(`AreaChart`)>=0||t.indexOf(`ComposedChart`)>=0&&!n)?{scale:sK(),realScaleType:`point`}:i===`category`?{scale:aK(),realScaleType:`band`}:{scale:Xq(),realScaleType:`linear`};if((0,pL.default)(r)){var s=`scale${(0,tB.default)(r)}`;return{scale:(aZ[s]||sK)(),realScaleType:aZ[s]?s:`point`}}return(0,BL.default)(r)?{scale:r}:{scale:sK(),realScaleType:`point`}},p$=1e-4,m$=function(e){var t=e.domain();if(!(!t||t.length<=2)){var n=t.length,r=e.range(),i=Math.min(r[0],r[1])-p$,a=Math.max(r[0],r[1])+p$,o=e(t[0]),s=e(t[n-1]);(oa||sa)&&e.domain([t[0],t[n-1]])}},h$=function(e,t){if(!e)return null;for(var n=0,r=e.length;nr)&&(i[1]=r),i[0]>r&&(i[0]=r),i[1]=0?(e[o][n][0]=i,e[o][n][1]=i+s,i=e[o][n][1]):(e[o][n][0]=a,e[o][n][1]=a+s,a=e[o][n][1])}},expand:Qz,none:qz,silhouette:$z,wiggle:eB,positive:function(e){var t=e.length;if(!(t<=0))for(var n=0,r=e[0].length;n=0?(e[a][n][0]=i,e[a][n][1]=i+o,i=e[a][n][1]):(e[a][n][0]=0,e[a][n][1]=0)}}},v$=function(e,t,n){var r=t.map(function(e){return e.props.dataKey}),i=_$[n];return Zz().keys(r).value(function(e,t){return+ZQ(e,t,0)}).order(Jz).offset(i)(e)},y$=function(e,t,n,r,i,a){if(!e)return null;var o=(a?t.reverse():t).reduce(function(e,t){var i,a=(i=t.type)!=null&&i.defaultProps?qQ(qQ({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(a.hide)return e;var s=a[n],c=e[s]||{hasStack:!1,stackGroups:{}};if(bL(o)){var l=c.stackGroups[o]||{numericAxisId:n,cateAxisId:r,items:[]};l.items.push(t),c.hasStack=!0,c.stackGroups[o]=l}else c.stackGroups[SL(`_stackId_`)]={numericAxisId:n,cateAxisId:r,items:[t]};return qQ(qQ({},e),{},JQ({},s,c))},{});return Object.keys(o).reduce(function(t,a){var s=o[a];return s.hasStack&&(s.stackGroups=Object.keys(s.stackGroups).reduce(function(t,a){var o=s.stackGroups[a];return qQ(qQ({},t),{},JQ({},a,{numericAxisId:n,cateAxisId:r,items:o.items,stackedData:v$(e,o.items,i)}))},{})),qQ(qQ({},t),{},JQ({},a,s))},{})},b$=function(e,t){var n=t.realScaleType,r=t.type,i=t.tickCount,a=t.originalDomain,o=t.allowDecimals,s=n||t.scale;if(s!==`auto`&&s!==`linear`)return null;if(i&&r===`number`&&a&&(a[0]===`auto`||a[1]===`auto`)){var c=e.domain();if(!c.length)return null;var l=QZ(c,i,o);return e.domain([(0,IQ.default)(l),(0,FQ.default)(l)]),{niceTicks:l}}return i&&r===`number`?{niceTicks:$Z(e.domain(),i,o)}:null};function x$(e){var t=e.axis,n=e.ticks,r=e.bandSize,i=e.entry,a=e.index,o=e.dataKey;if(t.type===`category`){if(!t.allowDuplicatedCategory&&t.dataKey&&!(0,gL.default)(i[t.dataKey])){var s=DL(n,`value`,i[t.dataKey]);if(s)return s.coordinate+r/2}return n[a]?n[a].coordinate+r/2:null}var c=ZQ(i,(0,gL.default)(o)?t.dataKey:o);return(0,gL.default)(c)?null:t.scale(c)}var S$=function(e){var t=e.axis,n=e.ticks,r=e.offset,i=e.bandSize,a=e.entry,o=e.index;if(t.type===`category`)return n[o]?n[o].coordinate+r:null;var s=ZQ(a,t.dataKey,t.domain[o]);return(0,gL.default)(s)?null:t.scale(s)-i/2+r},C$=function(e){var t=e.numericAxis,n=t.scale.domain();if(t.type===`number`){var r=Math.min(n[0],n[1]),i=Math.max(n[0],n[1]);return r<=0&&i>=0?0:i<0?i:r}return n[0]},w$=function(e,t){var n,r=((n=e.type)!=null&&n.defaultProps?qQ(qQ({},e.type.defaultProps),e.props):e.props).stackId;if(bL(r)){var i=t[r];if(i){var a=i.items.indexOf(e);return a>=0?i.stackedData[a]:null}}return null},T$=function(e){return e.reduce(function(e,t){return[(0,IQ.default)(t.concat([e[0]]).filter(Q)),(0,FQ.default)(t.concat([e[1]]).filter(Q))]},[1/0,-1/0])},E$=function(e,t,n){return Object.keys(e).reduce(function(r,i){var a=e[i].stackedData.reduce(function(e,r){var i=T$(r.slice(t,n+1));return[Math.min(e[0],i[0]),Math.max(e[1],i[1])]},[1/0,-1/0]);return[Math.min(a[0],r[0]),Math.max(a[1],r[1])]},[1/0,-1/0]).map(function(e){return e===1/0||e===-1/0?0:e})},D$=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,O$=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,k$=function(e,t,n){if((0,BL.default)(e))return e(t,n);if(!Array.isArray(e))return t;var r=[];if(Q(e[0]))r[0]=n?e[0]:Math.min(e[0],t[0]);else if(D$.test(e[0])){var i=+D$.exec(e[0])[1];r[0]=t[0]-i}else (0,BL.default)(e[0])?r[0]=e[0](t[0]):r[0]=t[0];if(Q(e[1]))r[1]=n?e[1]:Math.max(e[1],t[1]);else if(O$.test(e[1])){var a=+O$.exec(e[1])[1];r[1]=t[1]+a}else (0,BL.default)(e[1])?r[1]=e[1](t[1]):r[1]=t[1];return r},A$=function(e,t,n){if(e&&e.scale&&e.scale.bandwidth){var r=e.scale.bandwidth();if(!n||r>0)return r}if(e&&t&&t.length>=2){for(var i=(0,KH.default)(t,function(e){return e.coordinate}),a=1/0,o=1,s=i.length;oa&&(c=2*Math.PI-c),{radius:o,angle:B$(c),angleInRadian:c}},W$=function(e){var t=e.startAngle,n=e.endAngle,r=Math.floor(t/360),i=Math.floor(n/360),a=Math.min(r,i);return{startAngle:t-a*360,endAngle:n-a*360}},G$=function(e,t){var n=t.startAngle,r=t.endAngle,i=Math.floor(n/360),a=Math.floor(r/360);return e+Math.min(i,a)*360},K$=function(e,t){var n=e.x,r=e.y,i=U$({x:n,y:r},t),a=i.radius,o=i.angle,s=t.innerRadius,c=t.outerRadius;if(ac)return!1;if(a===0)return!0;var l=W$(t),u=l.startAngle,d=l.endAngle,f=o,p;if(u<=d){for(;f>d;)f-=360;for(;f=u&&f<=d}else{for(;f>u;)f-=360;for(;f=d&&f<=u}return p?F$(F$({},t),{},{radius:a,angle:G$(f,t)}):null};function q$(e){"@babel/helpers - typeof";return q$=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},q$(e)}var J$=[`offset`];function Y$(e){return $$(e)||Q$(e)||Z$(e)||X$()}function X$(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Z$(e,t){if(e){if(typeof e==`string`)return e1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e1(e,t)}}function Q$(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function $$(e){if(Array.isArray(e))return e1(e)}function e1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function n1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function r1(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function i1(e){for(var t=1;t=0?1:-1,y,b;r===`insideStart`?(y=f+v*a,b=m):r===`insideEnd`?(y=p-v*a,b=!m):r===`end`&&(y=p+v*a,b=m),b=g<=0?b:!b;var x=V$(c,l,h,y),S=V$(c,l,h,y+(b?1:-1)*359),C=`M${x.x},${x.y} - A${h},${h},0,1,${+!b}, - ${S.x},${S.y}`,w=(0,gL.default)(e.id)?SL(`recharts-radial-line-`):e.id;return _.createElement(`text`,c1({},n,{dominantBaseline:`central`,className:pa(`recharts-radial-bar-label`,o)}),_.createElement(`defs`,null,_.createElement(`path`,{id:w,d:C})),_.createElement(`textPath`,{xlinkHref:`#${w}`},t))},f1=function(e){var t=e.viewBox,n=e.offset,r=e.position,i=t,a=i.cx,o=i.cy,s=i.innerRadius,c=i.outerRadius,l=(i.startAngle+i.endAngle)/2;if(r===`outside`){var u=V$(a,o,c+n,l),d=u.x;return{x:d,y:u.y,textAnchor:d>=a?`start`:`end`,verticalAnchor:`middle`}}if(r===`center`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`middle`};if(r===`centerTop`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`start`};if(r===`centerBottom`)return{x:a,y:o,textAnchor:`middle`,verticalAnchor:`end`};var f=V$(a,o,(s+c)/2,l);return{x:f.x,y:f.y,textAnchor:`middle`,verticalAnchor:`middle`}},p1=function(e){var t=e.viewBox,n=e.parentViewBox,r=e.offset,i=e.position,a=t,o=a.x,s=a.y,c=a.width,l=a.height,u=l>=0?1:-1,d=u*r,f=u>0?`end`:`start`,p=u>0?`start`:`end`,m=c>=0?1:-1,h=m*r,g=m>0?`end`:`start`,_=m>0?`start`:`end`;if(i===`top`)return i1(i1({},{x:o+c/2,y:s-u*r,textAnchor:`middle`,verticalAnchor:f}),n?{height:Math.max(s-n.y,0),width:c}:{});if(i===`bottom`)return i1(i1({},{x:o+c/2,y:s+l+d,textAnchor:`middle`,verticalAnchor:p}),n?{height:Math.max(n.y+n.height-(s+l),0),width:c}:{});if(i===`left`){var v={x:o-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`};return i1(i1({},v),n?{width:Math.max(v.x-n.x,0),height:l}:{})}if(i===`right`){var y={x:o+c+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`};return i1(i1({},y),n?{width:Math.max(n.x+n.width-y.x,0),height:l}:{})}var b=n?{width:c,height:l}:{};return i===`insideLeft`?i1({x:o+h,y:s+l/2,textAnchor:_,verticalAnchor:`middle`},b):i===`insideRight`?i1({x:o+c-h,y:s+l/2,textAnchor:g,verticalAnchor:`middle`},b):i===`insideTop`?i1({x:o+c/2,y:s+d,textAnchor:`middle`,verticalAnchor:p},b):i===`insideBottom`?i1({x:o+c/2,y:s+l-d,textAnchor:`middle`,verticalAnchor:f},b):i===`insideTopLeft`?i1({x:o+h,y:s+d,textAnchor:_,verticalAnchor:p},b):i===`insideTopRight`?i1({x:o+c-h,y:s+d,textAnchor:g,verticalAnchor:p},b):i===`insideBottomLeft`?i1({x:o+h,y:s+l-d,textAnchor:_,verticalAnchor:f},b):i===`insideBottomRight`?i1({x:o+c-h,y:s+l-d,textAnchor:g,verticalAnchor:f},b):(0,AL.default)(i)&&(Q(i.x)||vL(i.x))&&(Q(i.y)||vL(i.y))?i1({x:o+CL(i.x,c),y:s+CL(i.y,l),textAnchor:`end`,verticalAnchor:`end`},b):i1({x:o+c/2,y:s+l/2,textAnchor:`middle`,verticalAnchor:`middle`},b)},m1=function(e){return`cx`in e&&Q(e.cx)};function h1(e){var t=e.offset,n=t===void 0?5:t,r=t1(e,J$),i=i1({offset:n},r),a=i.viewBox,o=i.position,s=i.value,c=i.children,l=i.content,u=i.className,d=u===void 0?``:u,f=i.textBreakAll;if(!a||(0,gL.default)(s)&&(0,gL.default)(c)&&!(0,_.isValidElement)(l)&&!(0,BL.default)(l))return null;if((0,_.isValidElement)(l))return(0,_.cloneElement)(l,i);var p;if((0,BL.default)(l)){if(p=(0,_.createElement)(l,i),(0,_.isValidElement)(p))return p}else p=l1(i);var m=m1(a),h=aR(i,!0);if(m&&(o===`insideStart`||o===`insideEnd`||o===`end`))return d1(i,p,h);var g=m?f1(i):p1(i);return _.createElement(TG,c1({className:pa(`recharts-label`,d)},h,g,{breakAll:f}),p)}h1.displayName=`Label`;var g1=function(e){var t=e.cx,n=e.cy,r=e.angle,i=e.startAngle,a=e.endAngle,o=e.r,s=e.radius,c=e.innerRadius,l=e.outerRadius,u=e.x,d=e.y,f=e.top,p=e.left,m=e.width,h=e.height,g=e.clockWise,_=e.labelViewBox;if(_)return _;if(Q(m)&&Q(h)){if(Q(u)&&Q(d))return{x:u,y:d,width:m,height:h};if(Q(f)&&Q(p))return{x:f,y:p,width:m,height:h}}return Q(u)&&Q(d)?{x:u,y:d,width:0,height:0}:Q(t)&&Q(n)?{cx:t,cy:n,startAngle:i||r||0,endAngle:a||r||0,innerRadius:c||0,outerRadius:l||s||o||0,clockWise:g}:e.viewBox?e.viewBox:{}},_1=function(e,t){return e?e===!0?_.createElement(h1,{key:`label-implicit`,viewBox:t}):bL(e)?_.createElement(h1,{key:`label-implicit`,viewBox:t,value:e}):(0,_.isValidElement)(e)?e.type===h1?(0,_.cloneElement)(e,{key:`label-implicit`,viewBox:t}):_.createElement(h1,{key:`label-implicit`,content:e,viewBox:t}):(0,BL.default)(e)?_.createElement(h1,{key:`label-implicit`,content:e,viewBox:t}):(0,AL.default)(e)?_.createElement(h1,c1({viewBox:t},e,{key:`label-implicit`})):null:null};h1.parseViewBox=g1,h1.renderCallByParent=function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=g1(e),a=QL(r,h1).map(function(e,n){return(0,_.cloneElement)(e,{viewBox:t||i,key:`label-${n}`})});return n?[_1(e.label,t||i)].concat(Y$(a)):a};var v1=l(o(((e,t)=>{function n(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}t.exports=n}))());function y1(e){"@babel/helpers - typeof";return y1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y1(e)}var b1=[`valueAccessor`],x1=[`data`,`dataKey`,`clockWise`,`id`,`textBreakAll`];function S1(e){return E1(e)||T1(e)||w1(e)||C1()}function C1(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function w1(e,t){if(e){if(typeof e==`string`)return D1(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return D1(e,t)}}function T1(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function E1(e){if(Array.isArray(e))return D1(e)}function D1(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function F1(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var I1=function(e){return Array.isArray(e.value)?(0,v1.default)(e.value):e.value};function L1(e){var t=e.valueAccessor,n=t===void 0?I1:t,r=P1(e,b1),i=r.data,a=r.dataKey,o=r.clockWise,s=r.id,c=r.textBreakAll,l=P1(r,x1);return!i||!i.length?null:_.createElement(bR,{className:`recharts-label-list`},i.map(function(e,t){var r=(0,gL.default)(a)?n(e,t):ZQ(e&&e.payload,a),i=(0,gL.default)(s)?{}:{id:`${s}-${t}`};return _.createElement(h1,O1({},aR(e,!0),l,i,{parentViewBox:e.parentViewBox,value:r,textBreakAll:c,viewBox:h1.parseViewBox((0,gL.default)(o)?e:A1(A1({},e),{},{clockWise:o})),key:`label-${t}`,index:t}))}))}L1.displayName=`LabelList`;function R1(e,t){return e?e===!0?_.createElement(L1,{key:`labelList-implicit`,data:t}):_.isValidElement(e)||(0,BL.default)(e)?_.createElement(L1,{key:`labelList-implicit`,data:t,content:e}):(0,AL.default)(e)?_.createElement(L1,O1({data:t},e,{key:`labelList-implicit`})):null:null}function z1(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var r=e.children,i=QL(r,L1).map(function(e,n){return(0,_.cloneElement)(e,{data:t,key:`labelList-${n}`})});return n?[R1(e.label,t)].concat(S1(i)):i}L1.renderCallByParent=z1;function B1(e){"@babel/helpers - typeof";return B1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},B1(e)}function V1(){return V1=Object.assign?Object.assign.bind():function(e){for(var t=1;t180)},${+(a>c)}, - ${u.x},${u.y} - `;if(r>0){var f=V$(t,n,r,a),p=V$(t,n,r,c);d+=`L ${p.x},${p.y} - A ${r},${r},0, - ${+(Math.abs(s)>180)},${+(a<=c)}, - ${f.x},${f.y} Z`}else d+=`L ${t},${n} Z`;return d},X1=function(e){var t=e.cx,n=e.cy,r=e.innerRadius,i=e.outerRadius,a=e.cornerRadius,o=e.forceCornerRadius,s=e.cornerIsExternal,c=e.startAngle,l=e.endAngle,u=_L(l-c),d=J1({cx:t,cy:n,radius:i,angle:c,sign:u,cornerRadius:a,cornerIsExternal:s}),f=d.circleTangency,p=d.lineTangency,m=d.theta,h=J1({cx:t,cy:n,radius:i,angle:l,sign:-u,cornerRadius:a,cornerIsExternal:s}),g=h.circleTangency,_=h.lineTangency,v=h.theta,y=s?Math.abs(c-l):Math.abs(c-l)-m-v;if(y<0)return o?`M ${p.x},${p.y} - a${a},${a},0,0,1,${a*2},0 - a${a},${a},0,0,1,${-a*2},0 - `:Y1({cx:t,cy:n,innerRadius:r,outerRadius:i,startAngle:c,endAngle:l});var b=`M ${p.x},${p.y} - A${a},${a},0,0,${+(u<0)},${f.x},${f.y} - A${i},${i},0,${+(y>180)},${+(u<0)},${g.x},${g.y} - A${a},${a},0,0,${+(u<0)},${_.x},${_.y} - `;if(r>0){var x=J1({cx:t,cy:n,radius:r,angle:c,sign:u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),S=x.circleTangency,C=x.lineTangency,w=x.theta,T=J1({cx:t,cy:n,radius:r,angle:l,sign:-u,isExternal:!0,cornerRadius:a,cornerIsExternal:s}),E=T.circleTangency,D=T.lineTangency,O=T.theta,k=s?Math.abs(c-l):Math.abs(c-l)-w-O;if(k<0&&a===0)return`${b}L${t},${n}Z`;b+=`L${D.x},${D.y} - A${a},${a},0,0,${+(u<0)},${E.x},${E.y} - A${r},${r},0,${+(k>180)},${+(u>0)},${S.x},${S.y} - A${a},${a},0,0,${+(u<0)},${C.x},${C.y}Z`}else b+=`L${t},${n}Z`;return b},Z1={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},Q1=function(e){var t=U1(U1({},Z1),e),n=t.cx,r=t.cy,i=t.innerRadius,a=t.outerRadius,o=t.cornerRadius,s=t.forceCornerRadius,c=t.cornerIsExternal,l=t.startAngle,u=t.endAngle,d=t.className;if(a0&&Math.abs(l-u)<360?X1({cx:n,cy:r,innerRadius:i,outerRadius:a,cornerRadius:Math.min(m,p/2),forceCornerRadius:s,cornerIsExternal:c,startAngle:l,endAngle:u}):Y1({cx:n,cy:r,innerRadius:i,outerRadius:a,startAngle:l,endAngle:u});return _.createElement(`path`,V1({},aR(t,!0),{className:f,d:h,role:`img`}))};function $1(e){"@babel/helpers - typeof";return $1=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},$1(e)}function e0(){return e0=Object.assign?Object.assign.bind():function(e){for(var t=1;t{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),m0=o(((e,t)=>{var n=p0();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),h0=o(((e,t)=>{t.exports=m0()()})),{getOwnPropertyNames:g0,getOwnPropertySymbols:_0}=Object,{hasOwnProperty:v0}=Object.prototype;function y0(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function b0(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function x0(e){return e?.[Symbol.toStringTag]}function S0(e){return g0(e).concat(_0(e))}var C0=Object.hasOwn||((e,t)=>v0.call(e,t));function w0(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var T0=`__v`,E0=`__o`,D0=`_owner`,{getOwnPropertyDescriptor:O0,keys:k0}=Object;function A0(e,t){return e.byteLength===t.byteLength&&U0(new Uint8Array(e),new Uint8Array(t))}function j0(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function M0(e,t){return e.byteLength===t.byteLength&&U0(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function N0(e,t){return w0(e.getTime(),t.getTime())}function P0(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function F0(e,t){return e===t}function I0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var L0=w0;function R0(e,t,n){let r=k0(e),i=r.length;if(k0(t).length!==i)return!1;for(;i-- >0;)if(!G0(e,t,n,r[i]))return!1;return!0}function z0(e,t,n){let r=S0(e),i=r.length;if(S0(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!G0(e,t,n,a)||(o=O0(e,a),s=O0(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function B0(e,t){return w0(e.valueOf(),t.valueOf())}function V0(e,t){return e.source===t.source&&e.flags===t.flags}function H0(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function U0(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function W0(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function G0(e,t,n,r){return(r===D0||r===E0||r===T0)&&(e.$$typeof||t.$$typeof)?!0:C0(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var K0=`[object ArrayBuffer]`,q0=`[object Arguments]`,J0=`[object Boolean]`,Y0=`[object DataView]`,X0=`[object Date]`,Z0=`[object Error]`,Q0=`[object Map]`,$0=`[object Number]`,e2=`[object Object]`,t2=`[object RegExp]`,n2=`[object Set]`,r2=`[object String]`,i2={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},a2=`[object URL]`,o2=Object.prototype.toString;function s2({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`?a(h,g,_):!1;let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);let b=o2.call(h);if(b===X0)return r(h,g,_);if(b===t2)return u(h,g,_);if(b===Q0)return o(h,g,_);if(b===n2)return d(h,g,_);if(b===e2)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===a2)return p(h,g,_);if(b===Z0)return i(h,g,_);if(b===q0)return c(h,g,_);if(i2[b])return f(h,g,_);if(b===K0)return e(h,g,_);if(b===Y0)return n(h,g,_);if(b===J0||b===$0||b===r2)return l(h,g,_);if(m){let e=m[b];if(!e){let t=x0(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function c2({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:A0,areArraysEqual:n?z0:j0,areDataViewsEqual:M0,areDatesEqual:N0,areErrorsEqual:P0,areFunctionsEqual:F0,areMapsEqual:n?y0(I0,z0):I0,areNumbersEqual:L0,areObjectsEqual:n?z0:R0,arePrimitiveWrappersEqual:B0,areRegExpsEqual:V0,areSetsEqual:n?y0(H0,z0):H0,areTypedArraysEqual:n?y0(U0,z0):U0,areUrlsEqual:W0,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=b0(r.areArraysEqual),t=b0(r.areMapsEqual),n=b0(r.areObjectsEqual),i=b0(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areMapsEqual:t,areObjectsEqual:n,areSetsEqual:i})}return r}function l2(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function u2({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}var d2=f2();f2({strict:!0}),f2({circular:!0}),f2({circular:!0,strict:!0}),f2({createInternalComparator:()=>w0}),f2({strict:!0,createInternalComparator:()=>w0}),f2({circular:!0,createInternalComparator:()=>w0}),f2({circular:!0,createInternalComparator:()=>w0,strict:!0});function f2(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=s2(c2(e));return u2({circular:t,comparator:a,createState:r,equals:n?n(a):l2(a),strict:i})}function p2(e){typeof requestAnimationFrame<`u`&&requestAnimationFrame(e)}function m2(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1;requestAnimationFrame(function r(i){n<0&&(n=i),i-n>t?(e(i),n=-1):p2(r)})}function h2(e){"@babel/helpers - typeof";return h2=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},h2(e)}function g2(e){return x2(e)||b2(e)||v2(e)||_2()}function _2(){throw TypeError(`Invalid attempt to destructure non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function v2(e,t){if(e){if(typeof e==`string`)return y2(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return y2(e,t)}}function y2(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);ne.length)&&(t=e.length);for(var n=0,r=Array(t);n=0&&e<=1}),`[configBezier]: arguments should be x1, y1, x2, y2 of [0, 1] instead received %s`,e);var s=Y2(t,r),c=Y2(n,i),l=X2(t,r),u=function(e){return e>1?1:e<0?0:e},d=function(e){for(var t=e>1?1:e,n=t,r=0;r<8;++r){var i=s(n)-t,a=l(n);if(Math.abs(i-t)0&&arguments[0]!==void 0?arguments[0]:{},t=e.stiff,n=t===void 0?100:t,r=e.damping,i=r===void 0?8:r,a=e.dt,o=a===void 0?17:a,s=function(e,t,r){var a=r+(-(e-t)*n-r*i)*o/1e3,s=r*o/1e3+e;return Math.abs(s-t)e.length)&&(t=e.length);for(var n=0,r=Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function w4(e,t){if(e==null)return{};var n={},r=Object.keys(e),i,a;for(a=0;a=0)&&(n[i]=e[i]);return n}function T4(e){return k4(e)||O4(e)||D4(e)||E4()}function E4(){throw TypeError(`Invalid attempt to spread non-iterable instance. -In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function D4(e,t){if(e){if(typeof e==`string`)return A4(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`)return Array.from(e);if(n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A4(e,t)}}function O4(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function k4(e){if(Array.isArray(e))return A4(e)}function A4(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n`u`||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy==`function`)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function G4(e){return G4=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},G4(e)}var K4=function(e){z4(n,e);var t=V4(n);function n(e,r){var i;P4(this,n),i=t.call(this,e,r);var a=i.props,o=a.isActive,s=a.attributeName,c=a.from,l=a.to,u=a.steps,d=a.children,f=a.duration;if(i.handleStyleChange=i.handleStyleChange.bind(U4(i)),i.changeStyle=i.changeStyle.bind(U4(i)),!o||f<=0)return i.state={style:{}},typeof d==`function`&&(i.state={style:l}),H4(i);if(u&&u.length)i.state={style:u[0].style};else if(c){if(typeof d==`function`)return i.state={style:c},H4(i);i.state={style:s?N4({},s,c):c}}else i.state={style:{}};return i}return I4(n,[{key:`componentDidMount`,value:function(){var e=this.props,t=e.isActive,n=e.canBegin;this.mounted=!0,!(!t||!n)&&this.runAnimation(this.props)}},{key:`componentDidUpdate`,value:function(e){var t=this.props,n=t.isActive,r=t.canBegin,i=t.attributeName,a=t.shouldReAnimate,o=t.to,s=t.from,c=this.state.style;if(r){if(!n){var l={style:i?N4({},i,o):o};this.state&&c&&(i&&c[i]!==o||!i&&c!==o)&&this.setState(l);return}if(!(d2(e.to,o)&&e.canBegin&&e.isActive)){var u=!e.canBegin||!e.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var d=u||a?s:e.to;if(this.state&&c){var f={style:i?N4({},i,d):d};(i&&c[i]!==d||!i&&c!==d)&&this.setState(f)}this.runAnimation(M4(M4({},this.props),{},{from:d,begin:0}))}}}},{key:`componentWillUnmount`,value:function(){this.mounted=!1;var e=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&=(this.manager.stop(),null),this.stopJSAnimation&&this.stopJSAnimation(),e&&e()}},{key:`handleStyleChange`,value:function(e){this.changeStyle(e)}},{key:`changeStyle`,value:function(e){this.mounted&&this.setState({style:e})}},{key:`runJSAnimation`,value:function(e){var t=this,n=e.from,r=e.to,i=e.duration,a=e.easing,o=e.begin,s=e.onAnimationEnd,c=e.onAnimationStart,l=y4(n,r,$2(a),i,this.changeStyle);this.manager.start([c,o,function(){t.stopJSAnimation=l()},i,s])}},{key:`runStepAnimation`,value:function(e){var t=this,n=e.steps,r=e.begin,i=e.onAnimationStart,a=n[0],o=a.style,s=a.duration,c=s===void 0?0:s;return this.manager.start([i].concat(T4(n.reduce(function(e,r,i){if(i===0)return e;var a=r.duration,o=r.easing,s=o===void 0?`ease`:o,c=r.style,l=r.properties,u=r.onAnimationEnd,d=i>0?n[i-1]:r,f=l||Object.keys(c);if(typeof s==`function`||s===`spring`)return[].concat(T4(e),[t.runJSAnimation.bind(t,{from:d.style,to:c,duration:a,easing:s}),a]);var p=N2(f,a,s),m=M4(M4(M4({},d.style),c),{},{transition:p});return[].concat(T4(e),[m,a,u]).filter(A2)},[o,Math.max(c,r)])),[e.onAnimationEnd]))}},{key:`runAnimation`,value:function(e){this.manager||=S2();var t=e.begin,n=e.duration,r=e.attributeName,i=e.to,a=e.easing,o=e.onAnimationStart,s=e.onAnimationEnd,c=e.steps,l=e.children,u=this.manager;if(this.unSubscribe=u.subscribe(this.handleStyleChange),typeof a==`function`||typeof l==`function`||a===`spring`){this.runJSAnimation(e);return}if(c.length>1){this.runStepAnimation(e);return}var d=r?N4({},r,i):i,f=N2(Object.keys(d),n,a);u.start([o,t,M4(M4({},d),{},{transition:f}),n,s])}},{key:`render`,value:function(){var e=this.props,t=e.children;e.begin;var n=e.duration;e.attributeName,e.easing;var r=e.isActive;e.steps,e.from,e.to,e.canBegin,e.onAnimationEnd,e.shouldReAnimate,e.onAnimationReStart;var i=C4(e,S4),a=_.Children.count(t),o=this.state.style;if(typeof t==`function`)return t(o);if(!r||a===0||n<=0)return t;var s=function(e){var t=e.props,n=t.style,r=n===void 0?{}:n,a=t.className;return(0,_.cloneElement)(e,M4(M4({},i),{},{style:M4(M4({},r),o),className:a}))};return a===1?s(_.Children.only(t)):_.createElement(`div`,null,_.Children.map(t,function(e){return s(e)}))}}]),n}(_.PureComponent);K4.displayName=`Animate`,K4.defaultProps={begin:0,duration:1e3,from:``,to:``,attributeName:``,easing:`ease`,isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}},K4.propTypes={from:b4.default.oneOfType([b4.default.object,b4.default.string]),to:b4.default.oneOfType([b4.default.object,b4.default.string]),attributeName:b4.default.string,duration:b4.default.number,begin:b4.default.number,easing:b4.default.oneOfType([b4.default.string,b4.default.func]),steps:b4.default.arrayOf(b4.default.shape({duration:b4.default.number.isRequired,style:b4.default.object.isRequired,easing:b4.default.oneOfType([b4.default.oneOf([`ease`,`ease-in`,`ease-out`,`ease-in-out`,`linear`]),b4.default.func]),properties:b4.default.arrayOf(`string`),onAnimationEnd:b4.default.func})),children:b4.default.oneOfType([b4.default.node,b4.default.func]),isActive:b4.default.bool,canBegin:b4.default.bool,onAnimationEnd:b4.default.func,shouldReAnimate:b4.default.bool,onAnimationStart:b4.default.func,onAnimationReStart:b4.default.func};var q4=K4;function J4(e){"@babel/helpers - typeof";return J4=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},J4(e)}function Y4(){return Y4=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n=0?1:-1,s=n>=0?1:-1,c=+(r>=0&&n>=0||r<0&&n<0),l;if(a>0&&i instanceof Array){for(var u=[0,0,0,0],d=0,f=4;da?a:i[d];l=`M${e},${t+o*u[0]}`,u[0]>0&&(l+=`A ${u[0]},${u[0]},0,0,${c},${e+s*u[0]},${t}`),l+=`L ${e+n-s*u[1]},${t}`,u[1]>0&&(l+=`A ${u[1]},${u[1]},0,0,${c}, - ${e+n},${t+o*u[1]}`),l+=`L ${e+n},${t+r-o*u[2]}`,u[2]>0&&(l+=`A ${u[2]},${u[2]},0,0,${c}, - ${e+n-s*u[2]},${t+r}`),l+=`L ${e+s*u[3]},${t+r}`,u[3]>0&&(l+=`A ${u[3]},${u[3]},0,0,${c}, - ${e},${t+r-o*u[3]}`),l+=`Z`}else if(a>0&&i===+i&&i>0){var p=Math.min(a,i);l=`M ${e},${t+o*p} - A ${p},${p},0,0,${c},${e+s*p},${t} - L ${e+n-s*p},${t} - A ${p},${p},0,0,${c},${e+n},${t+o*p} - L ${e+n},${t+r-o*p} - A ${p},${p},0,0,${c},${e+n-s*p},${t+r} - L ${e+s*p},${t+r} - A ${p},${p},0,0,${c},${e},${t+r-o*p} Z`}else l=`M ${e},${t} h ${n} v ${r} h ${-n} Z`;return l},c3=function(e,t){if(!e||!t)return!1;var n=e.x,r=e.y,i=t.x,a=t.y,o=t.width,s=t.height;if(Math.abs(o)>0&&Math.abs(s)>0){var c=Math.min(i,i+o),l=Math.max(i,i+o),u=Math.min(a,a+s),d=Math.max(a,a+s);return n>=c&&n<=l&&r>=u&&r<=d}return!1},l3={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:`ease`},u3=function(e){var t=r3(r3({},l3),e),n=(0,_.useRef)(),r=X4((0,_.useState)(-1),2),i=r[0],a=r[1];(0,_.useEffect)(function(){if(n.current&&n.current.getTotalLength)try{var e=n.current.getTotalLength();e&&a(e)}catch{}},[]);var o=t.x,s=t.y,c=t.width,l=t.height,u=t.radius,d=t.className,f=t.animationEasing,p=t.animationDuration,m=t.animationBegin,h=t.isAnimationActive,g=t.isUpdateAnimationActive;if(o!==+o||s!==+s||c!==+c||l!==+l||c===0||l===0)return null;var v=pa(`recharts-rectangle`,d);return g?_.createElement(q4,{canBegin:i>0,from:{width:c,height:l,x:o,y:s},to:{width:c,height:l,x:o,y:s},duration:p,animationEasing:f,isActive:g},function(e){var r=e.width,a=e.height,o=e.x,s=e.y;return _.createElement(q4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,isActive:h,easing:f},_.createElement(`path`,Y4({},aR(t,!0),{className:v,d:s3(o,s,r,a,u),ref:n})))}):_.createElement(`path`,Y4({},aR(t,!0),{className:v,d:s3(o,s,c,l,u)}))};function d3(){return d3=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function S3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}var C3=function(e,t,n,r,i,a){return`M${e},${i}v${r}M${a},${t}h${n}`},w3=function(e){var t=e.x,n=t===void 0?0:t,r=e.y,i=r===void 0?0:r,a=e.top,o=a===void 0?0:a,s=e.left,c=s===void 0?0:s,l=e.width,u=l===void 0?0:l,d=e.height,f=d===void 0?0:d,p=e.className,m=x3(e,m3),h=_3({x:n,y:i,top:o,left:c,width:u,height:f},m);return!Q(n)||!Q(i)||!Q(u)||!Q(f)||!Q(o)||!Q(c)?null:_.createElement(`path`,h3({},aR(h,!0),{className:pa(`recharts-cross`,p),d:C3(n,i,u,f,o,c)}))},T3=o(((e,t)=>{t.exports=_V()(Object.getPrototypeOf,Object)})),E3=o(((e,t)=>{var n=WI(),r=T3(),i=GI(),a=`[object Object]`,o=Function.prototype,s=Object.prototype,c=o.toString,l=s.hasOwnProperty,u=c.call(Object);function d(e){if(!i(e)||n(e)!=a)return!1;var t=r(e);if(t===null)return!0;var o=l.call(t,`constructor`)&&t.constructor;return typeof o==`function`&&o instanceof o&&c.call(o)==u}t.exports=d})),D3=o(((e,t)=>{var n=WI(),r=GI(),i=`[object Boolean]`;function a(e){return e===!0||e===!1||r(e)&&n(e)==i}t.exports=a}));function O3(e){"@babel/helpers - typeof";return O3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},O3(e)}function k3(){return k3=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:u,x:o,y:s},to:{upperWidth:c,lowerWidth:l,height:u,x:o,y:s},duration:p,animationEasing:f,isActive:h},function(e){var r=e.upperWidth,a=e.lowerWidth,o=e.height,s=e.x,c=e.y;return _.createElement(q4,{canBegin:i>0,from:`0px ${i===-1?1:i}px`,to:`${i}px 0px`,attributeName:`strokeDasharray`,begin:m,duration:p,easing:f},_.createElement(`path`,k3({},aR(t,!0),{className:g,d:V3(s,c,r,a,o),ref:n})))}):_.createElement(`g`,null,_.createElement(`path`,k3({},aR(t,!0),{className:g,d:V3(o,s,c,l,u)})))},W3=l(E3()),G3=l(D3()),K3=[`option`,`shapeType`,`propTransformer`,`activeClassName`,`isActive`];function q3(e){"@babel/helpers - typeof";return q3=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},q3(e)}function J3(e,t){if(e==null)return{};var n=Y3(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Y3(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function X3(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function Z3(e){for(var t=1;t{var n=Math.ceil,r=Math.max;function i(e,t,i,a){for(var o=-1,s=r(n((t-e)/(i||1)),0),c=Array(s);s--;)c[a?s:++o]=e,e+=i;return c}t.exports=i})),_6=o(((e,t)=>{var n=aW(),r=1/0,i=17976931348623157e292;function a(e){return e?(e=n(e),e===r||e===-r?(e<0?-1:1)*i:e===e?e:0):e===0?e:0}t.exports=a})),v6=o(((e,t)=>{var n=g6(),r=GH(),i=_6();function a(e){return function(t,a,o){return o&&typeof o!=`number`&&r(t,a,o)&&(a=o=void 0),t=i(t),a===void 0?(a=t,t=0):a=i(a),o=o===void 0?t{t.exports=v6()()}));function b6(e){"@babel/helpers - typeof";return b6=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},b6(e)}function x6(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function S6(e){for(var t=1;t0&&n.handleDrag(e.changedTouches[0])}),U6(n,`handleDragEnd`,function(){n.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var e=n.props,t=e.endIndex,r=e.onDragEnd,i=e.startIndex;r?.({endIndex:t,startIndex:i})}),n.detachDragEndListener()}),U6(n,`handleLeaveWrapper`,function(){(n.state.isTravellerMoving||n.state.isSlideMoving)&&(n.leaveTimer=window.setTimeout(n.handleDragEnd,n.props.leaveTimeOut))}),U6(n,`handleEnterSlideOrTraveller`,function(){n.setState({isTextActive:!0})}),U6(n,`handleLeaveSlideOrTraveller`,function(){n.setState({isTextActive:!1})}),U6(n,`handleSlideDragStart`,function(e){var t=q6(e)?e.changedTouches[0]:e;n.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:t.pageX}),n.attachDragEndListener()}),n.travellerDragStartHandlers={startX:n.handleTravellerDragStart.bind(n,`startX`),endX:n.handleTravellerDragStart.bind(n,`endX`)},n.state={},n}return V6(t,e),F6(t,[{key:`componentWillUnmount`,value:function(){this.leaveTimer&&=(clearTimeout(this.leaveTimer),null),this.detachDragEndListener()}},{key:`getIndex`,value:function(e){var n=e.startX,r=e.endX,i=this.state.scaleValues,a=this.props,o=a.gap,s=a.data.length-1,c=Math.min(n,r),l=Math.max(n,r),u=t.getIndexInRange(i,c),d=t.getIndexInRange(i,l);return{startIndex:u-u%o,endIndex:d===s?s:d-d%o}}},{key:`getTextOfTick`,value:function(e){var t=this.props,n=t.data,r=t.tickFormatter,i=t.dataKey,a=ZQ(n[e],i,e);return(0,BL.default)(r)?r(a,e):a}},{key:`attachDragEndListener`,value:function(){window.addEventListener(`mouseup`,this.handleDragEnd,!0),window.addEventListener(`touchend`,this.handleDragEnd,!0),window.addEventListener(`mousemove`,this.handleDrag,!0)}},{key:`detachDragEndListener`,value:function(){window.removeEventListener(`mouseup`,this.handleDragEnd,!0),window.removeEventListener(`touchend`,this.handleDragEnd,!0),window.removeEventListener(`mousemove`,this.handleDrag,!0)}},{key:`handleSlideDrag`,value:function(e){var t=this.state,n=t.slideMoveStartX,r=t.startX,i=t.endX,a=this.props,o=a.x,s=a.width,c=a.travellerWidth,l=a.startIndex,u=a.endIndex,d=a.onChange,f=e.pageX-n;f>0?f=Math.min(f,o+s-c-i,o+s-c-r):f<0&&(f=Math.max(f,o-r,o-i));var p=this.getIndex({startX:r+f,endX:i+f});(p.startIndex!==l||p.endIndex!==u)&&d&&d(p),this.setState({startX:r+f,endX:i+f,slideMoveStartX:e.pageX})}},{key:`handleTravellerDragStart`,value:function(e,t){var n=q6(t)?t.changedTouches[0]:t;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:e,brushMoveStartX:n.pageX}),this.attachDragEndListener()}},{key:`handleTravellerMove`,value:function(e){var t=this.state,n=t.brushMoveStartX,r=t.movingTravellerId,i=t.endX,a=t.startX,o=this.state[r],s=this.props,c=s.x,l=s.width,u=s.travellerWidth,d=s.onChange,f=s.gap,p=s.data,m={startX:this.state.startX,endX:this.state.endX},h=e.pageX-n;h>0?h=Math.min(h,c+l-u-o):h<0&&(h=Math.max(h,c-o)),m[r]=o+h;var g=this.getIndex(m),_=g.startIndex,v=g.endIndex,y=function(){var e=p.length-1;return r===`startX`&&(i>a?_%f===0:v%f===0)||ia?v%f===0:_%f===0)||i>a&&v===e};this.setState(U6(U6({},r,o+h),`brushMoveStartX`,e.pageX),function(){d&&y()&&d(g)})}},{key:`handleTravellerMoveKeyboard`,value:function(e,t){var n=this,r=this.state,i=r.scaleValues,a=r.startX,o=r.endX,s=this.state[t],c=i.indexOf(s);if(c!==-1){var l=c+e;if(!(l===-1||l>=i.length)){var u=i[l];t===`startX`&&u>=o||t===`endX`&&u<=a||this.setState(U6({},t,u),function(){n.props.onChange(n.getIndex({startX:n.state.startX,endX:n.state.endX}))})}}}},{key:`renderBackground`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.fill,o=e.stroke;return _.createElement(`rect`,{stroke:o,fill:a,x:t,y:n,width:r,height:i})}},{key:`renderPanorama`,value:function(){var e=this.props,t=e.x,n=e.y,r=e.width,i=e.height,a=e.data,o=e.children,s=e.padding,c=_.Children.only(o);return c?_.cloneElement(c,{x:t,y:n,width:r,height:i,margin:s,compact:!0,data:a}):null}},{key:`renderTravellerLayer`,value:function(e,n){var r=this,i=this.props,a=i.y,o=i.travellerWidth,s=i.height,c=i.traveller,l=i.ariaLabel,u=i.data,d=i.startIndex,f=i.endIndex,p=Math.max(e,this.props.x),m=M6(M6({},aR(this.props,!1)),{},{x:p,y:a,width:o,height:s}),h=l||`Min value: ${u[d]?.name}, Max value: ${u[f]?.name}`;return _.createElement(bR,{tabIndex:0,role:`slider`,"aria-label":h,"aria-valuenow":e,className:`recharts-brush-traveller`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[n],onTouchStart:this.travellerDragStartHandlers[n],onKeyDown:function(e){[`ArrowLeft`,`ArrowRight`].includes(e.key)&&(e.preventDefault(),e.stopPropagation(),r.handleTravellerMoveKeyboard(e.key===`ArrowRight`?1:-1,n))},onFocus:function(){r.setState({isTravellerFocused:!0})},onBlur:function(){r.setState({isTravellerFocused:!1})},style:{cursor:`col-resize`}},t.renderTraveller(c,m))}},{key:`renderSlide`,value:function(e,t){var n=this.props,r=n.y,i=n.height,a=n.stroke,o=n.travellerWidth,s=Math.min(e,t)+o,c=Math.max(Math.abs(t-e)-o,0);return _.createElement(`rect`,{className:`recharts-brush-slide`,onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:`move`},stroke:`none`,fill:a,fillOpacity:.2,x:s,y:r,width:c,height:i})}},{key:`renderText`,value:function(){var e=this.props,t=e.startIndex,n=e.endIndex,r=e.y,i=e.height,a=e.travellerWidth,o=e.stroke,s=this.state,c=s.startX,l=s.endX,u=5,d={pointerEvents:`none`,fill:o};return _.createElement(bR,{className:`recharts-brush-texts`},_.createElement(TG,A6({textAnchor:`end`,verticalAnchor:`middle`,x:Math.min(c,l)-u,y:r+i/2},d),this.getTextOfTick(t)),_.createElement(TG,A6({textAnchor:`start`,verticalAnchor:`middle`,x:Math.max(c,l)+a+u,y:r+i/2},d),this.getTextOfTick(n)))}},{key:`render`,value:function(){var e=this.props,t=e.data,n=e.className,r=e.children,i=e.x,a=e.y,o=e.width,s=e.height,c=e.alwaysShowText,l=this.state,u=l.startX,d=l.endX,f=l.isTextActive,p=l.isSlideMoving,m=l.isTravellerMoving,h=l.isTravellerFocused;if(!t||!t.length||!Q(i)||!Q(a)||!Q(o)||!Q(s)||o<=0||s<=0)return null;var g=pa(`recharts-brush`,n),v=_.Children.count(r)===1,y=D6(`userSelect`,`none`);return _.createElement(bR,{className:g,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:y},this.renderBackground(),v&&this.renderPanorama(),this.renderSlide(u,d),this.renderTravellerLayer(u,`startX`),this.renderTravellerLayer(d,`endX`),(f||p||m||h||c)&&this.renderText())}}],[{key:`renderDefaultTraveller`,value:function(e){var t=e.x,n=e.y,r=e.width,i=e.height,a=e.stroke,o=Math.floor(n+i/2)-1;return _.createElement(_.Fragment,null,_.createElement(`rect`,{x:t,y:n,width:r,height:i,fill:a,stroke:`none`}),_.createElement(`line`,{x1:t+1,y1:o,x2:t+r-1,y2:o,fill:`none`,stroke:`#fff`}),_.createElement(`line`,{x1:t+1,y1:o+2,x2:t+r-1,y2:o+2,fill:`none`,stroke:`#fff`}))}},{key:`renderTraveller`,value:function(e,n){return _.isValidElement(e)?_.cloneElement(e,n):(0,BL.default)(e)?e(n):t.renderDefaultTraveller(n)}},{key:`getDerivedStateFromProps`,value:function(e,t){var n=e.data,r=e.width,i=e.x,a=e.travellerWidth,o=e.updateId,s=e.startIndex,c=e.endIndex;if(n!==t.prevData||o!==t.prevUpdateId)return M6({prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r},n&&n.length?K6({data:n,width:r,x:i,travellerWidth:a,startIndex:s,endIndex:c}):{scale:null,scaleValues:null});if(t.scale&&(r!==t.prevWidth||i!==t.prevX||a!==t.prevTravellerWidth)){t.scale.range([i,i+r-a]);var l=t.scale.domain().map(function(e){return t.scale(e)});return{prevData:n,prevTravellerWidth:a,prevUpdateId:o,prevX:i,prevWidth:r,startX:t.scale(e.startIndex),endX:t.scale(e.endIndex),scaleValues:l}}return null}},{key:`getIndexInRange`,value:function(e,t){for(var n=e.length,r=0,i=n-1;i-r>1;){var a=Math.floor((r+i)/2);e[a]>t?i=a:r=a}return t>=e[i]?i:r}}])}(_.PureComponent);U6(J6,`displayName`,`Brush`),U6(J6,`defaultProps`,{height:40,travellerWidth:5,gap:1,fill:`#fff`,stroke:`#666`,padding:{top:1,right:1,bottom:1,left:1},leaveTimeOut:1e3,alwaysShowText:!1});var Y6=o(((e,t)=>{var n=jH();function r(e,t){var r;return n(e,function(e,n,i){return r=t(e,n,i),!r}),!!r}t.exports=r})),X6=o(((e,t)=>{var n=KB(),r=WV(),i=Y6(),a=BI(),o=GH();function s(e,t,s){var c=a(e)?n:i;return s&&o(e,t,s)&&(t=void 0),c(e,r(t,3))}t.exports=s})),Z6=function(e,t){var n=e.alwaysShow,r=e.ifOverflow;return n&&(r=`extendDomain`),r===t},Q6=o(((e,t)=>{var n=BH();function r(e,t,r){t==`__proto__`&&n?n(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}t.exports=r})),$6=o(((e,t)=>{var n=Q6(),r=kH(),i=WV();function a(e,t){var a={};return t=i(t,3),r(e,function(e,r,i){n(a,r,t(e,r,i))}),a}t.exports=a})),e8=o(((e,t)=>{function n(e,t){for(var n=-1,r=e==null?0:e.length;++n{var n=jH();function r(e,t){var r=!0;return n(e,function(e,n,i){return r=!!t(e,n,i),r}),r}t.exports=r})),n8=o(((e,t)=>{var n=e8(),r=t8(),i=WV(),a=BI(),o=GH();function s(e,t,s){var c=a(e)?n:r;return s&&o(e,t,s)&&(t=void 0),c(e,i(t,3))}t.exports=s})),r8=[`x`,`y`];function i8(e){"@babel/helpers - typeof";return i8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},i8(e)}function a8(){return a8=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function f8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function p8(e,t){var n=e.x,r=e.y,i=d8(e,r8),a=`${n}`,o=parseInt(a,10),s=`${r}`,c=parseInt(s,10),l=`${t.height||i.height}`,u=parseInt(l,10),d=`${t.width||i.width}`,f=parseInt(d,10);return s8(s8(s8(s8(s8({},t),i),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:f,name:t.name,radius:t.radius})}function m8(e){return _.createElement(a6,a8({shapeType:`rectangle`,propTransformer:p8,activeClassName:`recharts-active-bar`},e))}var h8=function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(n,r){if(typeof e==`number`)return e;var i=Q(n)||yL(n);return i?e(n,r):(!i&&nQ(!1),t)}},g8=[`value`,`background`],_8;function v8(e){"@babel/helpers - typeof";return v8=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},v8(e)}function y8(e,t){if(e==null)return{};var n=b8(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function b8(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function x8(){return x8=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(g)0&&Math.abs(h)0&&(w=Math.min((e||0)-(T[t-1]||0),w))}),Number.isFinite(w)){var E=w/C,D=c.layout===`vertical`?n.height:n.width;if(c.padding===`gap`&&(v=E*D/2),c.padding===`no-gap`){var O=CL(e.barCategoryGap,E*D),k=E*D/2;v=k-O-(k-O)/D*O}}}y=r===`xAxis`?[n.left+(m.left||0)+(v||0),n.left+n.width-(m.right||0)-(v||0)]:r===`yAxis`?s===`horizontal`?[n.top+n.height-(m.bottom||0),n.top+(m.top||0)]:[n.top+(m.top||0)+(v||0),n.top+n.height-(m.bottom||0)-(v||0)]:c.range,g&&(y=[y[1],y[0]]);var A=f$(c,i,d),j=A.scale,M=A.realScaleType;j.domain(f).range(y),m$(j);var N=b$(j,G8(G8({},c),{},{realScaleType:M}));r===`xAxis`?(S=l===`top`&&!h||l===`bottom`&&h,b=n.left,x=u[_]-S*c.height):r===`yAxis`&&(S=l===`left`&&!h||l===`right`&&h,b=u[_]-S*c.width,x=n.top);var P=G8(G8(G8({},c),N),{},{realScaleType:M,x:b,y:x,scale:j,width:r===`xAxis`?n.width:c.width,height:r===`yAxis`?n.height:c.height});return P.bandSize=A$(P,N),!c.hide&&r===`xAxis`?u[_]+=(S?-1:1)*P.height:c.hide||(u[_]+=(S?-1:1)*P.width),G8(G8({},a),{},K8({},o,P))},{})},X8=function(e,t){var n=e.x,r=e.y,i=t.x,a=t.y;return{x:Math.min(n,i),y:Math.min(r,a),width:Math.abs(i-n),height:Math.abs(a-r)}},Z8=function(e){var t=e.x1,n=e.y1,r=e.x2,i=e.y2;return X8({x:t,y:n},{x:r,y:i})},Q8=function(){function e(t){V8(this,e),this.scale=t}return U8(e,[{key:`domain`,get:function(){return this.scale.domain}},{key:`range`,get:function(){return this.scale.range}},{key:`rangeMin`,get:function(){return this.range()[0]}},{key:`rangeMax`,get:function(){return this.range()[1]}},{key:`bandwidth`,get:function(){return this.scale.bandwidth}},{key:`apply`,value:function(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=t.bandAware,r=t.position;if(e!==void 0){if(r)switch(r){case`start`:return this.scale(e);case`middle`:var i=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+i;case`end`:var a=this.bandwidth?this.bandwidth():0;return this.scale(e)+a;default:return this.scale(e)}if(n){var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(e)+o}return this.scale(e)}}},{key:`isInRange`,value:function(e){var t=this.range(),n=t[0],r=t[t.length-1];return n<=r?e>=n&&e<=r:e>=r&&e<=n}}],[{key:`create`,value:function(t){return new e(t)}}])}();K8(Q8,`EPS`,1e-4);var $8=function(e){var t=Object.keys(e).reduce(function(t,n){return G8(G8({},t),{},K8({},n,Q8.create(e[n])))},{});return G8(G8({},t),{},{apply:function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.bandAware,i=n.position;return(0,R8.default)(e,function(e,n){return t[n].apply(e,{bandAware:r,position:i})})},isInRange:function(e){return(0,z8.default)(e,function(e,n){return t[n].isInRange(e)})}})};function e5(e){return(e%180+180)%180}var t5=function(e){var t=e.width,n=e.height,r=e5(arguments.length>1&&arguments[1]!==void 0?arguments[1]:0)*Math.PI/180,i=Math.atan(n/t),a=r>i&&r{var n=WV(),r=bV(),i=xV();function a(e){return function(t,a,o){var s=Object(t);if(!r(t)){var c=n(a,3);t=i(t),a=function(e){return c(s[e],e,s)}}var l=e(t,a,o);return l>-1?s[c?t[l]:l]:void 0}}t.exports=a})),r5=o(((e,t)=>{var n=_6();function r(e){var t=n(e),r=t%1;return t===t?r?t-r:t:0}t.exports=r})),i5=o(((e,t)=>{var n=GV(),r=WV(),i=r5(),a=Math.max;function o(e,t,o){var s=e==null?0:e.length;if(!s)return-1;var c=o==null?0:i(o);return c<0&&(c=a(s+c,0)),n(e,r(t,3),c)}t.exports=o})),a5=o(((e,t)=>{t.exports=n5()(i5())})),o5=(0,l(aL()).default)(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return[`l`,e.left,`t`,e.top,`w`,e.width,`h`,e.height].join(``)});a5();var s5=(0,_.createContext)(void 0),c5=(0,_.createContext)(void 0),l5=(0,_.createContext)(void 0),u5=(0,_.createContext)({}),d5=(0,_.createContext)(void 0),f5=(0,_.createContext)(0),p5=(0,_.createContext)(0),m5=function(e){var t=e.state,n=t.xAxisMap,r=t.yAxisMap,i=t.offset,a=e.clipPathId,o=e.children,s=e.width,c=e.height,l=o5(i);return _.createElement(s5.Provider,{value:n},_.createElement(c5.Provider,{value:r},_.createElement(u5.Provider,{value:i},_.createElement(l5.Provider,{value:l},_.createElement(d5.Provider,{value:a},_.createElement(f5.Provider,{value:c},_.createElement(p5.Provider,{value:s},o)))))))},h5=function(){return(0,_.useContext)(d5)},g5=function(e){var t=(0,_.useContext)(s5);t??nQ(!1);var n=t[e];return n??nQ(!1),n},_5=function(e){var t=(0,_.useContext)(c5);t??nQ(!1);var n=t[e];return n??nQ(!1),n},v5=function(){return(0,_.useContext)(l5)},y5=function(){return(0,_.useContext)(p5)},b5=function(){return(0,_.useContext)(f5)},x5=l(X6());function S5(e){"@babel/helpers - typeof";return S5=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S5(e)}function C5(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function w5(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);ne*i)return!1;var a=n();return e*(t-e*a/2-r)>=0&&e*(t+e*a/2-i)<=0}function Pne(e,t){return _7(e,t+1)}function Fne(e,t,n,r,i){for(var a=(r||[]).slice(),o=t.start,s=t.end,c=0,l=1,u=o,d=function(){var t=r?.[c];if(t===void 0)return{v:_7(r,l)};var a=c,d,f=function(){return d===void 0&&(d=n(t,a)),d},p=t.coordinate,m=c===0||v7(e,p,f,u,s);m||(c=0,u=o,l+=1),m&&(u=p+e*(f()/2+i),c+=l)},f;l<=a.length;)if(f=d(),f)return f.v;return[]}function y7(e){"@babel/helpers - typeof";return y7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},y7(e)}function b7(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function x7(e){for(var t=1;t0?r.coordinate-d*e:r.coordinate})}else a[t]=r=x7(x7({},r),{},{tickCoord:r.coordinate});v7(e,r.tickCoord,u,s,c)&&(c=r.tickCoord-e*(u()/2+i),a[t]=x7(x7({},r),{},{isShow:!0}))},u=o-1;u>=0;u--)l(u);return a}function Bne(e,t,n,r,i,a){var o=(r||[]).slice(),s=o.length,c=t.start,l=t.end;if(a){var u=r[s-1],d=n(u,s-1),f=e*(u.coordinate+e*d/2-l);o[s-1]=u=x7(x7({},u),{},{tickCoord:f>0?u.coordinate-f*e:u.coordinate}),v7(e,u.tickCoord,function(){return d},c,l)&&(l=u.tickCoord-e*(d/2+i),o[s-1]=x7(x7({},u),{},{isShow:!0}))}for(var p=a?s-1:s,m=function(t){var r=o[t],a,s=function(){return a===void 0&&(a=n(r,t)),a};if(t===0){var u=e*(r.coordinate-e*s()/2-c);o[t]=r=x7(x7({},r),{},{tickCoord:u<0?r.coordinate-u*e:r.coordinate})}else o[t]=r=x7(x7({},r),{},{tickCoord:r.coordinate});v7(e,r.tickCoord,s,c,l)&&(c=r.tickCoord+e*(s()/2+i),o[t]=x7(x7({},r),{},{isShow:!0}))},h=0;h=2?_L(i[1].coordinate-i[0].coordinate):1,_=Nne(a,g,p);return c===`equidistantPreserveStart`?Fne(g,_,h,i,o):(f=c===`preserveStart`||c===`preserveStartEnd`?Bne(g,_,h,i,o,c===`preserveStartEnd`):zne(g,_,h,i,o),f.filter(function(e){return e.isShow}))}var Hne=[`viewBox`],Une=[`viewBox`],Wne=[`ticks`];function S7(e){"@babel/helpers - typeof";return S7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},S7(e)}function C7(){return C7=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Gne(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Kne(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function D7(e,t){for(var n=0;n0?a(this.props):a(l)),r<=0||i<=0||!u||!u.length?null:_.createElement(bR,{className:pa(`recharts-cartesian-axis`,o),ref:function(t){e.layerReference=t}},n&&this.renderAxisLine(),this.renderTicks(u,this.state.fontSize,this.state.letterSpacing),h1.renderCallByParent(this.props))}}],[{key:`renderTickItem`,value:function(e,t,n){var r,i=pa(t.className,`recharts-cartesian-axis-tick-value`);return r=_.isValidElement(e)?_.cloneElement(e,T7(T7({},t),{},{className:i})):(0,BL.default)(e)?e(T7(T7({},t),{},{className:i})):_.createElement(TG,C7({},t,{className:`recharts-cartesian-axis-tick-value`}),n),r}}])}(_.Component);j7(N7,`displayName`,`CartesianAxis`),j7(N7,`defaultProps`,{x:0,y:0,width:0,height:0,viewBox:{x:0,y:0,width:0,height:0},orientation:`bottom`,ticks:[],stroke:`#666`,tickLine:!0,axisLine:!0,tick:!0,mirror:!1,minTickGap:5,tickSize:6,tickMargin:2,interval:`preserveEnd`});var $ne=[`type`,`layout`,`connectNulls`,`ref`],ere=[`key`];function P7(e){"@babel/helpers - typeof";return P7=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},P7(e)}function F7(e,t){if(e==null)return{};var n=tre(e,t),r,i;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function tre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function I7(){return I7=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=Array(t);ns){l=[].concat(z7(i.slice(0,u)),[s-d]);break}var f=l.length%2==0?[0,c]:[c];return[].concat(z7(t.repeat(i,o)),z7(l),f).map(function(e){return`${e}px`}).join(`, `)}),G7(e,`id`,SL(`recharts-line-`)),G7(e,`pathRef`,function(t){e.mainCurve=t}),G7(e,`handleAnimationEnd`,function(){e.setState({isAnimationFinished:!0}),e.props.onAnimationEnd&&e.props.onAnimationEnd()}),G7(e,`handleAnimationStart`,function(){e.setState({isAnimationFinished:!1}),e.props.onAnimationStart&&e.props.onAnimationStart()}),e}return dre(t,e),sre(t,[{key:`componentDidMount`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();this.setState({totalLength:e})}}},{key:`componentDidUpdate`,value:function(){if(this.props.isAnimationActive){var e=this.getTotalLength();e!==this.state.totalLength&&this.setState({totalLength:e})}}},{key:`getTotalLength`,value:function(){var e=this.mainCurve;try{return e&&e.getTotalLength&&e.getTotalLength()||0}catch{return 0}}},{key:`renderErrorBar`,value:function(e,t){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var n=this.props,r=n.points,i=n.xAxis,a=n.yAxis,o=n.layout,s=n.children,c=QL(s,DQ);if(!c)return null;var l=function(e,t){return{x:e.x,y:e.y,value:e.value,errorVal:ZQ(e.payload,t)}},u={clipPath:e?`url(#clipPath-${t})`:null};return _.createElement(bR,u,c.map(function(e){return _.cloneElement(e,{key:`bar-${e.props.dataKey}`,data:r,xAxis:i,yAxis:a,layout:o,dataPointFormatter:l})}))}},{key:`renderDots`,value:function(e,n,r){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,a=i.dot,o=i.points,s=i.dataKey,c=aR(this.props,!1),l=aR(a,!0),u=o.map(function(e,n){var r=R7(R7(R7({key:`dot-${n}`,r:3},c),l),{},{index:n,cx:e.x,cy:e.y,value:e.value,dataKey:s,payload:e.payload,points:o});return t.renderDotItem(a,r)}),d={clipPath:e?`url(#clipPath-${n?``:`dots-`}${r})`:null};return _.createElement(bR,I7({className:`recharts-line-dots`,key:`dots`},d),u)}},{key:`renderCurveStatically`,value:function(e,t,n,r){var i=this.props,a=i.type,o=i.layout,s=i.connectNulls;i.ref;var c=R7(R7(R7({},aR(F7(i,$ne),!0)),{},{fill:`none`,className:`recharts-line-curve`,clipPath:t?`url(#clipPath-${n})`:null,points:e},r),{},{type:a,layout:o,connectNulls:s});return _.createElement(f0,I7({},c,{pathRef:this.pathRef}))}},{key:`renderCurveWithAnimation`,value:function(e,t){var n=this,r=this.props,i=r.points,a=r.strokeDasharray,o=r.isAnimationActive,s=r.animationBegin,c=r.animationDuration,l=r.animationEasing,u=r.animationId,d=r.animateNewValues,f=r.width,p=r.height,m=this.state,h=m.prevPoints,g=m.totalLength;return _.createElement(q4,{begin:s,duration:c,isActive:o,easing:l,from:{t:0},to:{t:1},key:`line-${u}`,onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(r){var o=r.t;if(h){var s=h.length/i.length,c=i.map(function(e,t){var n=Math.floor(t*s);if(h[n]){var r=h[n],i=EL(r.x,e.x),a=EL(r.y,e.y);return R7(R7({},e),{},{x:i(o),y:a(o)})}if(d){var c=EL(f*2,e.x),l=EL(p/2,e.y);return R7(R7({},e),{},{x:c(o),y:l(o)})}return R7(R7({},e),{},{x:e.x,y:e.y})});return n.renderCurveStatically(c,e,t)}var l=EL(0,g)(o),u;if(a){var m=`${a}`.split(/[,\s]+/gim).map(function(e){return parseFloat(e)});u=n.getStrokeDasharray(l,g,m)}else u=n.generateSimpleStrokeDasharray(g,l);return n.renderCurveStatically(i,e,t,{strokeDasharray:u})})}},{key:`renderCurve`,value:function(e,t){var n=this.props,r=n.points,i=n.isAnimationActive,a=this.state,o=a.prevPoints,s=a.totalLength;return i&&r&&r.length&&(!o&&s>0||!(0,RQ.default)(o,r))?this.renderCurveWithAnimation(e,t):this.renderCurveStatically(r,e,t)}},{key:`render`,value:function(){var e=this.props,t=e.hide,n=e.dot,r=e.points,i=e.className,a=e.xAxis,o=e.yAxis,s=e.top,c=e.left,l=e.width,u=e.height,d=e.isAnimationActive,f=e.id;if(t||!r||!r.length)return null;var p=this.state.isAnimationFinished,m=r.length===1,h=pa(`recharts-line`,i),g=a&&a.allowDataOverflow,v=o&&o.allowDataOverflow,y=g||v,b=(0,gL.default)(f)?this.id:f,x=aR(n,!1)??{r:3,strokeWidth:2},S=x.r,C=S===void 0?3:S,w=x.strokeWidth,T=w===void 0?2:w,E=(rR(n)?n:{}).clipDot,D=E===void 0?!0:E,O=C*2+T;return _.createElement(bR,{className:h},g||v?_.createElement(`defs`,null,_.createElement(`clipPath`,{id:`clipPath-${b}`},_.createElement(`rect`,{x:g?c:c-l/2,y:v?s:s-u/2,width:g?l:l*2,height:v?u:u*2})),!D&&_.createElement(`clipPath`,{id:`clipPath-dots-${b}`},_.createElement(`rect`,{x:c-O/2,y:s-O/2,width:l+O,height:u+O}))):null,!m&&this.renderCurve(y,b),this.renderErrorBar(y,b),(m||n)&&this.renderDots(y,D,b),(!d||p)&&L1.renderCallByParent(this.props,r))}}],[{key:`getDerivedStateFromProps`,value:function(e,t){return e.animationId===t.prevAnimationId?e.points===t.curPoints?null:{curPoints:e.points}:{prevAnimationId:e.animationId,curPoints:e.points,prevPoints:t.curPoints}}},{key:`repeat`,value:function(e,t){for(var n=e.length%2==0?e:[].concat(z7(e),[0]),r=[],i=0;ie.length)&&(t=e.length);for(var n=0,r=Array(t);n{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function Yre(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function Xre(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}function k9(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n0?a:e&&e.length&&Q(r)&&Q(i)?e.slice(r,i+1):[]};function H9(e){return e===`number`?[0,`auto`]:void 0}var U9=function(e,t,n,r){var i=e.graphicalItems,a=e.tooltipAxis,o=V9(t,e);return n<0||!i||!i.length||n>=o.length?null:i.reduce(function(i,s){var c=s.props.data??t;c&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=n&&(c=c.slice(e.dataStartIndex,e.dataEndIndex+1));var l=a.dataKey&&!a.allowDuplicatedCategory?DL(c===void 0?o:c,a.dataKey,r):c&&c[n]||o[n];return l?[].concat(N9(i),[M$(s,l)]):i},[])},W9=function(e,t,n,r){var i=r||{x:e.chartX,y:e.chartY},a=cie(i,n),o=e.orderedTooltipTicks,s=e.tooltipAxis,c=e.tooltipTicks,l=$Q(a,o,c,s);if(l>=0&&c){var u=c[l]&&c[l].value;return{activeTooltipIndex:l,activeLabel:u,activePayload:U9(e,t,l,u),activeCoordinate:lie(n,o,l,i)}}return null},uie=function(e,t){var n=t.axes,r=t.graphicalItems,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=e.stackOffset,f=c$(l,i);return n.reduce(function(t,n){var p=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),m=p.type,h=p.dataKey,g=p.allowDataOverflow,_=p.allowDuplicatedCategory,v=p.scale,y=p.ticks,b=p.includeHidden,x=p[a];if(t[x])return t;var S=V9(e.data,{graphicalItems:r.filter(function(e){return(a in e.props?e.props[a]:e.type.defaultProps?.[a])===x}),dataStartIndex:s,dataEndIndex:c}),C=S.length,w,T,E;Lre(p.domain,g,m)&&(w=k$(p.domain,null,g),f&&(m===`number`||v!==`auto`)&&(E=QQ(S,h,`category`)));var D=H9(m);if(!w||w.length===0){var O=p.domain??D;if(h){if(w=QQ(S,h,m),m===`category`&&f){var k=TL(w);_&&k?(T=w,w=(0,O6.default)(0,C)):_||(w=j$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0?e:[].concat(N9(e),[t])},[]))}else if(m===`category`)w=_?w.filter(function(e){return e!==``&&!(0,gL.default)(e)}):j$(O,w,n).reduce(function(e,t){return e.indexOf(t)>=0||t===``||(0,gL.default)(t)?e:[].concat(N9(e),[t])},[]);else if(m===`number`){var A=o$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===x&&(b||!n)}),h,i,l);A&&(w=A)}f&&(m===`number`||v!==`auto`)&&(E=QQ(S,h,`category`))}else w=f?(0,O6.default)(0,C):o&&o[x]&&o[x].hasStack&&m===`number`?d===`expand`?[0,1]:E$(o[x].stackGroups,s,c):s$(S,r.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps.hide;return t===x&&(b||!n)}),m,l,!0);if(m===`number`)w=m9(u,w,x,i,y),O&&(w=k$(O,w,g));else if(m===`category`&&O){var j=O;w.every(function(e){return j.indexOf(e)>=0})&&(w=j)}}return $($({},t),{},L9({},x,$($({},p),{},{axisType:i,domain:w,categoricalDomain:E,duplicateDomain:T,originalDomain:p.domain??D,isCategorical:f,layout:l})))},{})},die=function(e,t){var n=t.graphicalItems,r=t.Axis,i=t.axisType,a=t.axisIdKey,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.layout,u=e.children,d=V9(e.data,{graphicalItems:n,dataStartIndex:s,dataEndIndex:c}),f=d.length,p=c$(l,i),m=-1;return n.reduce(function(e,t){var h=(t.type.defaultProps===void 0?t.props:$($({},t.type.defaultProps),t.props))[a],g=H9(`number`);if(!e[h]){m++;var _;return p?_=(0,O6.default)(0,f):o&&o[h]&&o[h].hasStack?(_=E$(o[h].stackGroups,s,c),_=m9(u,_,h,i)):(_=k$(g,s$(d,n.filter(function(e){var t=a in e.props?e.props[a]:e.type.defaultProps?.[a],n=`hide`in e.props?e.props.hide:e.type.defaultProps?.hide;return t===h&&!n}),`number`,l),r.defaultProps.allowDataOverflow),_=m9(u,_,h,i)),$($({},e),{},L9({},h,$($({axisType:i},r.defaultProps),{},{hide:!0,orientation:(0,hL.default)(oie,`${i}.${m%2}`,null),domain:_,originalDomain:g,isCategorical:p,layout:l})))}return e},{})},fie=function(e,t){var n=t.axisType,r=n===void 0?`xAxis`:n,i=t.AxisComp,a=t.graphicalItems,o=t.stackGroups,s=t.dataStartIndex,c=t.dataEndIndex,l=e.children,u=`${r}Id`,d=QL(l,i),f={};return d&&d.length?f=uie(e,{axes:d,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c}):a&&a.length&&(f=die(e,{Axis:i,graphicalItems:a,axisType:r,axisIdKey:u,stackGroups:o,dataStartIndex:s,dataEndIndex:c})),f},pie=function(e){var t=wL(e),n=l$(t,!1,!0);return{tooltipTicks:n,orderedTooltipTicks:(0,KH.default)(n,function(e){return e.coordinate}),tooltipAxis:t,tooltipAxisBandSize:A$(t,n)}},G9=function(e){var t=e.children,n=e.defaultShowTooltip,r=$L(t,J6),i=0,a=0;return e.data&&e.data.length!==0&&(a=e.data.length-1),r&&r.props&&(r.props.startIndex>=0&&(i=r.props.startIndex),r.props.endIndex>=0&&(a=r.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:a,activeTooltipIndex:-1,isTooltipActive:!!n}},mie=function(e){return!e||!e.length?!1:e.some(function(e){var t=JL(e&&e.type);return t&&t.indexOf(`Bar`)>=0})},K9=function(e){return e===`horizontal`?{numericAxisName:`yAxis`,cateAxisName:`xAxis`}:e===`vertical`?{numericAxisName:`xAxis`,cateAxisName:`yAxis`}:e===`centric`?{numericAxisName:`radiusAxis`,cateAxisName:`angleAxis`}:{numericAxisName:`angleAxis`,cateAxisName:`radiusAxis`}},hie=function(e,t){var n=e.props,r=e.graphicalItems,i=e.xAxisMap,a=i===void 0?{}:i,o=e.yAxisMap,s=o===void 0?{}:o,c=n.width,l=n.height,u=n.children,d=n.margin||{},f=$L(u,J6),p=$L(u,wH),m=Object.keys(s).reduce(function(e,t){var n=s[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},L9({},r,e[r]+n.width)):e},{left:d.left||0,right:d.right||0}),h=$($({},Object.keys(a).reduce(function(e,t){var n=a[t],r=n.orientation;return!n.mirror&&!n.hide?$($({},e),{},L9({},r,(0,hL.default)(e,`${r}`)+n.height)):e},{top:d.top||0,bottom:d.bottom||0})),m),g=h.bottom;f&&(h.bottom+=f.props.height||J6.defaultProps.height),p&&t&&(h=r$(h,r,n,t));var _=c-h.left-h.right,v=l-h.top-h.bottom;return $($({brushBottom:g},h),{},{width:Math.max(_,0),height:Math.max(v,0)})},gie=function(e,t){if(t===`xAxis`)return e[t].width;if(t===`yAxis`)return e[t].height},q9=function(e){var t=e.chartName,n=e.GraphicalChild,r=e.defaultTooltipEventType,i=r===void 0?`axis`:r,a=e.validateTooltipEventTypes,o=a===void 0?[`axis`]:a,s=e.axisComponents,c=e.legendContent,l=e.formatAxisMap,u=e.defaultProps,d=function(e,t){var n=t.graphicalItems,r=t.stackGroups,i=t.offset,a=t.updateId,o=t.dataStartIndex,c=t.dataEndIndex,l=e.barSize,u=e.layout,d=e.barGap,f=e.barCategoryGap,p=e.maxBarSize,m=K9(u),h=m.numericAxisName,g=m.cateAxisName,_=mie(n),v=[];return n.forEach(function(n,m){var y=V9(e.data,{graphicalItems:[n],dataStartIndex:o,dataEndIndex:c}),b=n.type.defaultProps===void 0?n.props:$($({},n.type.defaultProps),n.props),x=b.dataKey,S=b.maxBarSize,C=b[`${h}Id`],w=b[`${g}Id`],T=s.reduce(function(e,n){var r=t[`${n.axisType}Map`],i=b[`${n.axisType}Id`];!(r&&r[i]||n.axisType===`zAxis`)&&nQ(!1);var a=r[i];return $($({},e),{},L9(L9({},n.axisType,a),`${n.axisType}Ticks`,l$(a)))},{}),E=T[g],D=T[`${g}Ticks`],O=r&&r[C]&&r[C].hasStack&&w$(n,r[C].stackGroups),k=JL(n.type).indexOf(`Bar`)>=0,A=A$(E,D),j=[],M=_&&t$({barSize:l,stackGroups:r,totalSize:gie(T,g)});if(k){var N=(0,gL.default)(S)?p:S,P=A$(E,D,!0)??N??0;j=n$({barGap:d,barCategoryGap:f,bandSize:P===A?A:P,sizeList:M[w],maxBarSize:N}),P!==A&&(j=j.map(function(e){return $($({},e),{},{position:$($({},e.position),{},{offset:e.position.offset-P/2})})}))}var F=n&&n.type&&n.type.getComposedData;F&&v.push({props:$($({},F($($({},T),{},{displayedData:y,props:e,dataKey:x,item:n,bandSize:A,barPosition:j,offset:i,stackedData:O,layout:u,dataStartIndex:o,dataEndIndex:c}))),{},L9(L9(L9({key:n.key||`item-${m}`},h,T[h]),g,T[g]),`animationId`,a)),childIndex:uR(n,e.children),item:n})}),v},f=function(e,r){var i=e.props,a=e.dataStartIndex,o=e.dataEndIndex,c=e.updateId;if(!eR({props:i}))return null;var u=i.children,f=i.layout,p=i.stackOffset,m=i.data,h=i.reverseStackOrder,g=K9(f),_=g.numericAxisName,v=g.cateAxisName,y=QL(u,n),b=y$(m,y,`${_}Id`,`${v}Id`,p,h),x=s.reduce(function(e,t){var n=`${t.axisType}Map`;return $($({},e),{},L9({},n,fie(i,$($({},t),{},{graphicalItems:y,stackGroups:t.axisType===_&&b,dataStartIndex:a,dataEndIndex:o}))))},{}),S=hie($($({},x),{},{props:i,graphicalItems:y}),r?.legendBBox);Object.keys(x).forEach(function(e){x[e]=l(i,x[e],S,e.replace(`Map`,``),t)});var C=x[`${v}Map`],w=pie(C);return $($({formattedGraphicalItems:d(i,$($({},x),{},{dataStartIndex:a,dataEndIndex:o,updateId:c,graphicalItems:y,stackGroups:b,offset:S})),graphicalItems:y,offset:S,stackGroups:b},w),x)},p=function(e){function n(e){var r;return Xre(this,n),r=Qre(this,n,[e]),L9(r,`eventEmitterSymbol`,Symbol(`rechartsEventEmitter`)),L9(r,`accessibilityManager`,new Ire),L9(r,`handleLegendBBoxUpdate`,function(e){if(e){var t=r.state,n=t.dataStartIndex,i=t.dataEndIndex,a=t.updateId;r.setState($({legendBBox:e},f({props:r.props,dataStartIndex:n,dataEndIndex:i,updateId:a},$($({},r.state),{},{legendBBox:e}))))}}),L9(r,`handleReceiveSyncEvent`,function(e,t,n){if(r.props.syncId===e){if(n===r.eventEmitterSymbol&&typeof r.props.syncMethod!=`function`)return;r.applySyncEvent(t)}}),L9(r,`handleBrushChange`,function(e){var t=e.startIndex,n=e.endIndex;if(t!==r.state.dataStartIndex||n!==r.state.dataEndIndex){var i=r.state.updateId;r.setState(function(){return $({dataStartIndex:t,dataEndIndex:n},f({props:r.props,dataStartIndex:t,dataEndIndex:n,updateId:i},r.state))}),r.triggerSyncEvent({dataStartIndex:t,dataEndIndex:n})}}),L9(r,`handleMouseEnter`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseEnter;(0,BL.default)(i)&&i(n,e)}}),L9(r,`triggeredAfterMouseMove`,function(e){var t=r.getMouseInfo(e),n=t?$($({},t),{},{isTooltipActive:!0}):{isTooltipActive:!1};r.setState(n),r.triggerSyncEvent(n);var i=r.props.onMouseMove;(0,BL.default)(i)&&i(n,e)}),L9(r,`handleItemMouseEnter`,function(e){r.setState(function(){return{isTooltipActive:!0,activeItem:e,activePayload:e.tooltipPayload,activeCoordinate:e.tooltipPosition||{x:e.cx,y:e.cy}}})}),L9(r,`handleItemMouseLeave`,function(){r.setState(function(){return{isTooltipActive:!1}})}),L9(r,`handleMouseMove`,function(e){e.persist(),r.throttleTriggeredAfterMouseMove(e)}),L9(r,`handleMouseLeave`,function(e){r.throttleTriggeredAfterMouseMove.cancel();var t={isTooltipActive:!1};r.setState(t),r.triggerSyncEvent(t);var n=r.props.onMouseLeave;(0,BL.default)(n)&&n(t,e)}),L9(r,`handleOuterEvent`,function(e){var t=lR(e),n=(0,hL.default)(r.props,`${t}`);t&&(0,BL.default)(n)&&n((/.*touch.*/i.test(t)?r.getMouseInfo(e.changedTouches[0]):r.getMouseInfo(e))??{},e)}),L9(r,`handleClick`,function(e){var t=r.getMouseInfo(e);if(t){var n=$($({},t),{},{isTooltipActive:!0});r.setState(n),r.triggerSyncEvent(n);var i=r.props.onClick;(0,BL.default)(i)&&i(n,e)}}),L9(r,`handleMouseDown`,function(e){var t=r.props.onMouseDown;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleMouseUp`,function(e){var t=r.props.onMouseUp;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleTouchMove`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.throttleTriggeredAfterMouseMove(e.changedTouches[0])}),L9(r,`handleTouchStart`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseDown(e.changedTouches[0])}),L9(r,`handleTouchEnd`,function(e){e.changedTouches!=null&&e.changedTouches.length>0&&r.handleMouseUp(e.changedTouches[0])}),L9(r,`handleDoubleClick`,function(e){var t=r.props.onDoubleClick;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`handleContextMenu`,function(e){var t=r.props.onContextMenu;(0,BL.default)(t)&&t(r.getMouseInfo(e),e)}),L9(r,`triggerSyncEvent`,function(e){r.props.syncId!==void 0&&h9.emit(g9,r.props.syncId,e,r.eventEmitterSymbol)}),L9(r,`applySyncEvent`,function(e){var t=r.props,n=t.layout,i=t.syncMethod,a=r.state.updateId,o=e.dataStartIndex,s=e.dataEndIndex;if(e.dataStartIndex!==void 0||e.dataEndIndex!==void 0)r.setState($({dataStartIndex:o,dataEndIndex:s},f({props:r.props,dataStartIndex:o,dataEndIndex:s,updateId:a},r.state)));else if(e.activeTooltipIndex!==void 0){var c=e.chartX,l=e.chartY,u=e.activeTooltipIndex,d=r.state,p=d.offset,m=d.tooltipTicks;if(!p)return;if(typeof i==`function`)u=i(m,e);else if(i===`value`){u=-1;for(var h=0;h=0){var D,O;if(c.dataKey&&!c.allowDuplicatedCategory){var k=typeof c.dataKey==`function`?E:`payload.${c.dataKey.toString()}`;D=DL(m,k,u),O=h&&g&&DL(g,k,u)}else D=m?.[l],O=h&&g&&g[l];if(S||x){var A=e.props.activeIndex===void 0?l:e.props.activeIndex;return[(0,_.cloneElement)(e,$($($({},i.props),w),{},{activeIndex:A})),null,null]}if(!(0,gL.default)(D))return[T].concat(N9(r.renderActivePoints({item:i,activePoint:D,basePoint:O,childIndex:l,isRange:h})))}else{var j=(r.getItemByXY(r.state.activeCoordinate)??{graphicalItem:T}).graphicalItem,M=j.item,N=M===void 0?e:M,P=j.childIndex;return[(0,_.cloneElement)(N,$($($({},i.props),w),{},{activeIndex:P})),null,null]}return h?[T,null,null]:[T,null]}),L9(r,`renderCustomized`,function(e,t,n){return(0,_.cloneElement)(e,$($({key:`recharts-customized-${n}`},r.props),r.state))}),L9(r,`renderMap`,{CartesianGrid:{handler:B9,once:!0},ReferenceArea:{handler:r.renderReferenceElement},ReferenceLine:{handler:B9},ReferenceDot:{handler:r.renderReferenceElement},XAxis:{handler:B9},YAxis:{handler:B9},Brush:{handler:r.renderBrush,once:!0},Bar:{handler:r.renderGraphicChild},Line:{handler:r.renderGraphicChild},Area:{handler:r.renderGraphicChild},Radar:{handler:r.renderGraphicChild},RadialBar:{handler:r.renderGraphicChild},Scatter:{handler:r.renderGraphicChild},Pie:{handler:r.renderGraphicChild},Funnel:{handler:r.renderGraphicChild},Tooltip:{handler:r.renderCursor,once:!0},PolarGrid:{handler:r.renderPolarGrid,once:!0},PolarAngleAxis:{handler:r.renderPolarAxis},PolarRadiusAxis:{handler:r.renderPolarAxis},Customized:{handler:r.renderCustomized}}),r.clipPathId=`${e.id??SL(`recharts`)}-clip`,r.throttleTriggeredAfterMouseMove=(0,sW.default)(r.triggeredAfterMouseMove,e.throttleDelay??1e3/60),r.state={},r}return tie(n,e),Zre(n,[{key:`componentDidMount`,value:function(){this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:this.props.margin.left??0,top:this.props.margin.top??0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:`displayDefaultTooltip`,value:function(){var e=this.props,t=e.children,n=e.data,r=e.height,i=e.layout,a=$L(t,tW);if(a){var o=a.props.defaultIndex;if(!(typeof o!=`number`||o<0||o>this.state.tooltipTicks.length-1)){var s=this.state.tooltipTicks[o]&&this.state.tooltipTicks[o].value,c=U9(this.state,n,o,s),l=this.state.tooltipTicks[o].coordinate,u=(this.state.offset.top+r)/2,d=i===`horizontal`?{x:l,y:u}:{y:l,x:u},f=this.state.formattedGraphicalItems.find(function(e){return e.item.type.name===`Scatter`});f&&(d=$($({},d),f.props.points[o].tooltipPosition),c=f.props.points[o].tooltipPayload);var p={activeTooltipIndex:o,isTooltipActive:!0,activeLabel:s,activePayload:c,activeCoordinate:d};this.setState(p),this.renderCursor(a),this.accessibilityManager.setIndex(o)}}}},{key:`getSnapshotBeforeUpdate`,value:function(e,t){return this.props.accessibilityLayer?(this.state.tooltipTicks!==t.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==e.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==e.margin&&this.accessibilityManager.setDetails({offset:{left:this.props.margin.left??0,top:this.props.margin.top??0}}),null):null}},{key:`componentDidUpdate`,value:function(e){oR([$L(e.children,tW)],[$L(this.props.children,tW)])||this.displayDefaultTooltip()}},{key:`componentWillUnmount`,value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:`getTooltipEventType`,value:function(){var e=$L(this.props.children,tW);if(e&&typeof e.props.shared==`boolean`){var t=e.props.shared?`axis`:`item`;return o.indexOf(t)>=0?t:i}return i}},{key:`getMouseInfo`,value:function(e){if(!this.container)return null;var t=this.container,n=t.getBoundingClientRect(),r=PW(n),i={chartX:Math.round(e.pageX-r.left),chartY:Math.round(e.pageY-r.top)},a=n.width/t.offsetWidth||1,o=this.inRange(i.chartX,i.chartY,a);if(!o)return null;var s=this.state,c=s.xAxisMap,l=s.yAxisMap,u=this.getTooltipEventType(),d=W9(this.state,this.props.data,this.props.layout,o);if(u!==`axis`&&c&&l){var f=wL(c).scale,p=wL(l).scale,m=f&&f.invert?f.invert(i.chartX):null,h=p&&p.invert?p.invert(i.chartY):null;return $($({},i),{},{xValue:m,yValue:h},d)}return d?$($({},i),d):null}},{key:`inRange`,value:function(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,r=this.props.layout,i=e/n,a=t/n;if(r===`horizontal`||r===`vertical`){var o=this.state.offset;return i>=o.left&&i<=o.left+o.width&&a>=o.top&&a<=o.top+o.height?{x:i,y:a}:null}var s=this.state,c=s.angleAxisMap,l=s.radiusAxisMap;if(c&&l){var u=wL(c);return K$({x:i,y:a},u)}return null}},{key:`parseEventsOfWrapper`,value:function(){var e=this.props.children,t=this.getTooltipEventType(),n=$L(e,tW),r={};return n&&t===`axis`&&(r=n.props.trigger===`click`?{onClick:this.handleClick}:{onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu}),$($({},LL(this.props,this.handleOuterEvent)),r)}},{key:`addListener`,value:function(){h9.on(g9,this.handleReceiveSyncEvent)}},{key:`removeListener`,value:function(){h9.removeListener(g9,this.handleReceiveSyncEvent)}},{key:`filterFormatItem`,value:function(e,t,n){for(var r=this.state.formattedGraphicalItems,i=0,a=r.length;i{let[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)([]),c=(0,_.useRef)(0),{baseUrl:l,fetchWithHeaders:u}=Rs();(0,_.useEffect)(()=>{let t=!1;return Iee(l,u,e).then(e=>{if(t||e.length===0)return;let n=e.filter(e=>e.loss!=null).map(e=>({step:e.step,loss:e.loss})).slice(-2e3),r=e.filter(e=>e.lr!=null).map(e=>({step:e.step,lr:e.lr})).slice(-2e3);a(n),s(r),c.current=e[e.length-1]?.step??0}).catch(()=>{}),()=>{t=!0}},[l,u,e]),(0,_.useEffect)(()=>{let e=t.current_step;if(e0&&t.current_loss!=null){let n=t.current_loss;a(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,loss:n}].slice(-2e3)})}if(e>0&&t.current_lr!=null){let n=t.current_lr;s(t=>{let r=t[t.length-1];return r&&r.step===e?t:[...t,{step:e,lr:n}].slice(-2e3)})}},[t.current_step,t.current_loss,t.current_lr]);let d=n(),f=t.training_active&&t.total_steps===0,p=f?`Training starting…`:`${t.current_step.toLocaleString()} / ${t.total_steps.toLocaleString()}`,m=t.eta_seconds==null?`—`:r(t.eta_seconds);return(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsx)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:(0,V.jsxs)(Tv,{className:`p-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-baseline justify-between mb-3`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(`div`,{className:`flex h-9 w-9 items-center justify-center rounded-lg bg-blue-500/20 text-blue-400`,children:(0,V.jsx)(Sa,{className:`w-5 h-5`})}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`text-sm text-slate-400`,children:`Progress`}),(0,V.jsx)(`div`,{className:`text-base font-semibold text-white`,children:p})]})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-slate-300`,children:[(0,V.jsx)(La,{className:`w-4 h-4 text-purple-400`}),(0,V.jsxs)(`span`,{className:`text-sm`,children:[`ETA `,(0,V.jsx)(`span`,{className:`font-semibold text-white`,children:m})]})]})]}),(0,V.jsxs)(`div`,{className:`relative h-8 w-full overflow-hidden rounded-md bg-slate-900 border border-slate-700`,children:[(0,V.jsx)(`div`,{className:`h-full bg-gradient-to-r from-blue-500 to-sky-400 transition-[width] duration-500`,style:{width:`${d}%`}}),(0,V.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center font-semibold text-white text-sm tabular-nums drop-shadow`,children:f?`warming up…`:`${d.toFixed(1)}%`})]})]})}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 lg:grid-cols-2 gap-6`,children:[(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{className:`pb-2`,children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-green-500/20 text-green-400`,children:(0,V.jsx)(Ma,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Loss`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_loss?.toFixed(4)??`—`,`)`]})]})]})}),(0,V.jsx)(Tv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:i.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(bW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(q9,{data:i,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(n9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(d9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48}),(0,V.jsx)(tW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#34d399`},formatter:e=>e.toFixed(4)}),(0,V.jsx)(q7,{type:`monotone`,dataKey:`loss`,stroke:`#34d399`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]}),(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{className:`pb-2`,children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white text-base`,children:[(0,V.jsx)(`div`,{className:`flex h-8 w-8 items-center justify-center rounded-lg bg-orange-500/20 text-orange-400`,children:(0,V.jsx)(Sa,{className:`w-4 h-4`})}),(0,V.jsxs)(`span`,{children:[`Learning Rate`,` `,(0,V.jsxs)(`span`,{className:`text-slate-400 text-sm font-normal`,children:[`(`,t.current_lr?.toExponential(2)??`—`,`)`]})]})]})}),(0,V.jsx)(Tv,{className:`pt-0`,children:(0,V.jsx)(`div`,{className:`h-48`,children:o.length===0?(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-slate-500 text-sm`,children:`Waiting for first metric tick…`}):(0,V.jsx)(bW,{width:`100%`,height:`100%`,children:(0,V.jsxs)(q9,{data:o,margin:{top:8,right:12,left:0,bottom:0},children:[(0,V.jsx)(n9,{dataKey:`step`,tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`}),(0,V.jsx)(d9,{tick:{fill:`#94a3b8`,fontSize:11},stroke:`#475569`,width:48,tickFormatter:e=>e.toExponential(0)}),(0,V.jsx)(tW,{contentStyle:{background:`#1e293b`,border:`1px solid #475569`,borderRadius:8},labelStyle:{color:`#cbd5e1`},itemStyle:{color:`#fb923c`},formatter:e=>e.toExponential(2)}),(0,V.jsx)(q7,{type:`monotone`,dataKey:`lr`,stroke:`#fb923c`,strokeWidth:2,dot:!1,isAnimationActive:!1})]})})})})]})]})]})},J9=({logs:e,logContainerRef:t})=>(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-lg bg-slate-700`,children:(0,V.jsx)(Ga,{className:`w-5 h-5 text-sky-400`})}),`Training Logs`]})}),(0,V.jsx)(Tv,{children:(0,V.jsx)(`div`,{ref:t,className:`bg-slate-900 rounded-lg p-4 h-96 overflow-y-auto font-mono text-sm border border-slate-700`,children:e.length===0?(0,V.jsx)(`div`,{className:`text-slate-500 py-8`,children:`No training logs yet. Start training to see output.`}):e.map((e,t)=>(0,V.jsxs)(`div`,{className:`text-slate-300 break-words whitespace-pre-wrap`,children:[(0,V.jsx)(`span`,{className:`text-slate-500 mr-2 select-none`,children:new Date(e.timestamp*1e3).toLocaleTimeString()}),e.message]},t))})})]}),vie=({installHint:e})=>{let t=NI(`system/training-extra`);return(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto`,children:(0,V.jsxs)(Sv,{className:`bg-slate-800/50 border-slate-700 rounded-xl`,children:[(0,V.jsx)(Cv,{children:(0,V.jsxs)(wv,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:t.state}),PI(t.state,`Training Extra Not Installed`)]})}),(0,V.jsx)(Tv,{className:`space-y-4`,children:(0,V.jsx)(II,{state:t.state,error:t.error,logs:t.logs,logBoxRef:t.logBoxRef,onInstall:t.handleInstall,onRetry:t.handleRetry,installHint:e,packageName:`accelerate`,idleTitle:`Training Extra Not Installed`,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training requires the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:`accelerate`}),` `,`package, which isn't installed in this environment. Install it to enable the Training page.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`training`})})})]})})},yie=({open:e,onOpenChange:t,policyType:n,packageName:r,installTarget:i,installHint:a})=>{let o=NI(`system/policy-extra/${n}`,e),s=`${n.toUpperCase()} needs an extra package`;return(0,V.jsx)(xu,{open:e,onOpenChange:t,children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-2xl`,children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(FI,{state:o.state}),PI(o.state,s)]}),(0,V.jsxs)(Ou,{className:`sr-only`,children:[`Install `,i,` to train `,n,`.`]})]}),(0,V.jsx)(`div`,{className:`space-y-4`,children:(0,V.jsx)(II,{state:o.state,error:o.error,logs:o.logs,logBoxRef:o.logBoxRef,onInstall:o.handleInstall,onRetry:o.handleRetry,installHint:a,packageName:i,idleTitle:s,idleDescription:(0,V.jsxs)(V.Fragment,{children:[`Training a `,(0,V.jsx)(`span`,{className:`font-semibold`,children:n}),` policy needs the`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:r}),` `,`package (installed via`,` `,(0,V.jsx)(`code`,{className:`px-1 py-0.5 rounded bg-slate-900 text-sky-300`,children:i}),`), which isn't in this environment yet. Install it to train this policy.`]}),doneDescription:(0,V.jsx)(LI,{purpose:`${n} training`})})})]})})},bie=()=>{let{auth:e,refetch:t}=Vs(),{baseUrl:n,fetchWithHeaders:r}=Rs(),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null);if(e.status===`authenticated`||e.status===`loading`)return null;let u=async()=>{let e=i.trim();if(e){s(!0),l(null);try{let i=await r(`${n}/hf-auth/login`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({token:e})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(e.detail||`HTTP ${i.status}`)}a(``),await t()}catch(e){l(e instanceof Error?e.message:String(e))}finally{s(!1)}}};return(0,V.jsx)(`div`,{className:`bg-amber-950/40 border border-amber-700/60 rounded-lg p-4 mb-6`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-amber-400 flex-shrink-0 mt-0.5`}),(0,V.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`p`,{className:`text-sm text-amber-100 font-medium`,children:`Hugging Face access required for cloud training`}),(0,V.jsxs)(`p`,{className:`text-xs text-amber-200/80 mt-1`,children:[`Create a token at`,` `,(0,V.jsxs)(`a`,{href:`https://huggingface.co/settings/tokens`,target:`_blank`,rel:`noreferrer`,className:`underline hover:text-amber-50 inline-flex items-center gap-1`,children:[`huggingface.co/settings/tokens`,(0,V.jsx)(Ha,{className:`w-3 h-3`})]}),` `,`with `,(0,V.jsx)(`span`,{className:`font-mono`,children:`Write`}),` access (so trained policies can upload to your account), then paste it below.`]})]}),(0,V.jsxs)(`form`,{onSubmit:e=>{e.preventDefault(),u()},className:`flex gap-2`,children:[(0,V.jsx)(Th,{type:`password`,placeholder:`hf_...`,value:i,onChange:e=>a(e.target.value),className:`bg-slate-900 border-slate-600 text-white placeholder:text-slate-500`,disabled:o,autoComplete:`off`}),(0,V.jsx)(G,{type:`submit`,disabled:o||!i.trim(),className:`bg-amber-600 hover:bg-amber-700 text-white`,children:o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Saving…`]}):`Save token`})]}),c&&(0,V.jsx)(`p`,{className:`text-xs text-red-300`,children:c})]})]})})},xie=1e3,Y9=5e3;function Sie(e,t){return e?{training_active:e.state===`running`,current_step:e.metrics.current_step,total_steps:e.metrics.total_steps,current_loss:e.metrics.current_loss??void 0,current_lr:e.metrics.current_lr??void 0,grad_norm:e.metrics.grad_norm??void 0,eta_seconds:e.metrics.eta_seconds??void 0,available_controls:{stop_training:e.state===`running`,pause_training:!1,resume_training:!1}}:{training_active:t,current_step:0,total_steps:0,available_controls:{stop_training:!1,pause_training:!1,resume_training:!1}}}function Cie(e){return{target:e.target,dataset_repo_id:e.dataset_repo_id,policy_type:e.policy_type,steps:e.steps,batch_size:e.batch_size,seed:e.seed,num_workers:e.num_workers,log_freq:e.log_freq,save_freq:e.save_freq,save_checkpoint:e.save_checkpoint,resume:e.resume,wandb_enable:e.wandb_enable,wandb_project:e.wandb_project,wandb_entity:e.wandb_entity,wandb_notes:e.wandb_notes,wandb_mode:e.wandb_mode,wandb_disable_artifact:e.wandb_disable_artifact,policy_device:e.policy_device,policy_use_amp:e.policy_use_amp,optimizer_type:e.optimizer_type,optimizer_lr:e.optimizer_lr,optimizer_weight_decay:e.optimizer_weight_decay,optimizer_grad_clip_norm:e.optimizer_grad_clip_norm,use_policy_training_preset:e.use_policy_training_preset,dataset_image_transforms_enable:e.dataset_image_transforms_enable,eval_steps:e.eval_steps,...e.policy_type===`groot`?{policy_base_model_path:e.policy_base_model_path,policy_embodiment_tag:e.policy_embodiment_tag,policy_chunk_size:e.policy_chunk_size,policy_n_action_steps:e.policy_n_action_steps,policy_use_relative_actions:e.policy_use_relative_actions,policy_relative_exclude_joints:e.policy_relative_exclude_joints,policy_use_bf16:e.policy_use_bf16}:{}}}var wie=()=>{let{baseUrl:e,fetchWithHeaders:t}=Rs(),{auth:n}=Vs(),{toast:r}=_r(),i=Re(),[a,o]=(0,_.useState)({target:{runner:`local`},dataset_repo_id:Ie().state?.datasetRepoId??``,policy_type:`act`,steps:1e4,batch_size:8,seed:1e3,num_workers:4,log_freq:250,save_freq:1e3,save_checkpoint:!0,resume:!1,wandb_enable:!1,wandb_mode:`online`,wandb_disable_artifact:!1,policy_device:`cuda`,policy_use_amp:!1,optimizer_type:`adam`,use_policy_training_preset:!0}),[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!0),[d,f]=(0,_.useState)(null),[p,m]=(0,_.useState)(`pip install accelerate`),[h,g]=(0,_.useState)(!1),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(null),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)([]),[E,D]=(0,_.useState)(!0);(0,_.useEffect)(()=>{u(!0),Kv(e,t).then(c).catch(()=>c([])).finally(()=>u(!1))},[e,t]),(0,_.useEffect)(()=>{t(`${e}/system/training-extra`).then(e=>e.json()).then(e=>{f(e.available),m(e.install_hint)}).catch(()=>f(!0))},[e,t]),(0,_.useEffect)(()=>{yv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>g(!1))},[e,t]),(0,_.useEffect)(()=>{D(!0),Bee(e,t).then(e=>{C(e.authenticated),T(e.flavors)}).catch(()=>{C(!1),T([])}).finally(()=>D(!1))},[e,t,n.status]);let O=(e,t)=>{o(n=>({...n,[e]:t}))},k=async()=>{if(!a.dataset_repo_id.trim()){r({title:`Error`,description:`Dataset repository ID is required`,variant:`destructive`});return}if(a.target.runner===`local`)try{let n=await t(`${e}/system/policy-extra/${a.policy_type}`);if(n.ok){let e=await n.json();if(e.needs_extra&&!e.available){x({policyType:a.policy_type,packageName:e.package,installTarget:e.install_target,installHint:e.install_hint});return}}}catch{}y(!0);try{let n=await Lee(e,t,Cie(a));r({title:`Training Started`,description:n.name}),i(`/training/${n.id}`)}catch(n){r({title:`Error`,description:n instanceof Error?n.message:String(n),variant:`destructive`}),yv(e,t,200).then(e=>g(e.some(e=>e.runner===`local`&&e.state===`running`))).catch(()=>{})}finally{y(!1)}};if(d===null)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsxs)(`div`,{className:`flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),`Checking training environment…`]})]})});if(d===!1)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(vie,{installHint:p})]})});let A=a.target.runner===`hf_cloud`,j=a.target.runner===`hf_cloud`&&!a.target.flavor,M=a.target.runner===`local`&&h,N=v||!a.dataset_repo_id.trim()||M||A&&!S||j,P=M?`Another local training is already running`:A&&!S?`Log in to Hugging Face to use cloud compute`:j?`Select a hardware flavor`:void 0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:[(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto`,children:[(0,V.jsx)(jI,{}),(0,V.jsx)(bie,{}),(0,V.jsx)(Lte,{config:a,updateConfig:O,datasets:s,datasetsLoading:l,authenticated:S,flavors:w,hardwareLoading:E}),(0,V.jsx)(`div`,{className:`max-w-3xl mx-auto mt-6 flex justify-end`,children:(()=>{let e=(0,V.jsx)(G,{onClick:k,disabled:N,size:`lg`,className:`bg-green-500 hover:bg-green-600 text-white font-semibold px-6`,children:v?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),` Starting…`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Xa,{className:`w-5 h-5 mr-2`}),` Start Training`]})});return P?(0,V.jsxs)(Wp,{children:[(0,V.jsx)(Gp,{asChild:!0,children:(0,V.jsx)(`span`,{tabIndex:0,children:e})}),(0,V.jsx)(Kp,{children:P})]}):e})()})]}),b&&(0,V.jsx)(yie,{open:!!b,onOpenChange:e=>!e&&x(null),policyType:b.policyType,packageName:b.packageName,installTarget:b.installTarget,installHint:b.installHint})]})},Tie=({jobId:e})=>{let{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),i=Re(),{selectedRecord:a}=Lv(),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)([]),f=(0,_.useRef)(null),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let r=!1;return Fee(t,n,e).then(e=>{!r&&e.length>0&&d(e)}).catch(()=>{}),()=>{r=!0}},[t,n,e]);let b=(0,_.useRef)(o?.state);b.current=o?.state,(0,_.useEffect)(()=>{let r=!1,i=()=>{Ev(t,n,e).then(e=>{if(!r)if(m(e),e.length>0){let t=e[e.length-1].step;g(n=>n!=null&&e.some(e=>e.step===n)?n:t)}else g(null)}).catch(()=>{r||(m([]),g(null))})};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},5e3);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{let r=!1,i=async()=>{try{let i=await Nee(t,n,e);if(r)return;if(s(i),i.state===`running`){let i=await Pee(t,n,e);!r&&i.length>0&&d(e=>{let t=[...e,...i];return t.length>Y9?t.slice(t.length-Y9):t})}}catch(e){r||l(e instanceof Error?e.message:String(e))}};i();let a=setInterval(()=>{r||b.current&&b.current!==`running`||i()},xie);return()=>{r=!0,clearInterval(a)}},[t,n,e]),(0,_.useEffect)(()=>{f.current&&(f.current.scrollTop=f.current.scrollHeight)},[u]);let x=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=Math.floor(e%60);return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}:${r.toString().padStart(2,`0`)}`},S=()=>!o||o.metrics.total_steps===0?0:o.metrics.current_step/o.metrics.total_steps*100,C=async()=>{if(o&&window.confirm(`Stop this run?`))try{s(await bv(t,n,o.id)),r({title:`Stopping…`})}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}},w=async()=>{if(o&&window.confirm(`Delete this run? This wipes the output directory.`))try{await xv(t,n,o.id),r({title:`Job removed`}),i(`/`)}catch(e){r({title:`Delete failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(c&&!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-4`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Back to Jobs`]}),(0,V.jsxs)(`p`,{className:`text-red-300`,children:[`Couldn't load job `,e,`: `,c]})]})});if(!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto flex items-center justify-center py-24 text-slate-400`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Loading job…`]})});let T=o.state===`running`;return(0,V.jsx)(`div`,{className:`min-h-screen bg-slate-900 text-white p-4`,children:(0,V.jsxs)(`div`,{className:`max-w-7xl mx-auto space-y-6`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{variant:`ghost`,onClick:()=>i(`/`),className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),` Jobs`]}),(0,V.jsxs)(`div`,{children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`h1`,{className:`text-xl font-semibold text-white`,children:o.name}),o.runner===`hf_cloud`?(0,V.jsxs)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-amber-900/40 text-amber-200 border border-amber-700`,children:[`HF · `,o.hf_flavor??`cloud`]}):(0,V.jsx)(`span`,{className:`text-xs px-2 py-0.5 rounded bg-slate-700 text-slate-200 border border-slate-600`,children:`Local`}),o.runner===`hf_cloud`&&o.hf_repo_id&&o.state===`done`&&(0,V.jsx)(`a`,{href:`https://huggingface.co/${o.hf_repo_id}`,target:`_blank`,rel:`noreferrer`,className:`text-xs text-amber-300 hover:text-amber-200 underline`,children:`View on Hub ↗`}),o.wandb_run_url&&(0,V.jsx)(`a`,{href:o.wandb_run_url,target:`_blank`,rel:`noreferrer`,className:`text-xs text-yellow-300 hover:text-yellow-200 underline`,children:`View on W&B ↗`})]}),(0,V.jsxs)(`p`,{className:`text-xs text-slate-400`,children:[o.state,o.error_message?` — ${o.error_message}`:``]})]})]}),T?(0,V.jsxs)(G,{onClick:C,className:`bg-red-500 hover:bg-red-600 text-white`,children:[(0,V.jsx)(ao,{className:`w-4 h-4 mr-2`}),` Stop`]}):(0,V.jsxs)(G,{onClick:w,variant:`ghost`,className:`text-slate-400 hover:text-white`,children:[(0,V.jsx)(so,{className:`w-4 h-4 mr-2`}),` Delete`]})]}),(0,V.jsx)(_ie,{jobId:e,trainingStatus:Sie(o,!1),getProgressPercentage:S,formatTime:x}),(0,V.jsxs)(`div`,{className:`bg-slate-800/40 border border-slate-700 rounded-lg p-4 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`text-sm font-semibold text-slate-300`,children:`Run inference`}),p.length===0?(0,V.jsx)(`span`,{className:`text-xs text-slate-500`,children:`No checkpoints yet — wait for the first save.`}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Dv,{checkpoints:p,selectedStep:h,onChange:g}),(0,V.jsxs)(G,{onClick:()=>y(!0),disabled:h==null,className:`bg-green-500 hover:bg-green-600 text-white`,children:[(0,V.jsx)(Xa,{className:`w-4 h-4 mr-2`}),`Run on robot`]})]})]}),(0,V.jsx)(Mv,{open:v,onOpenChange:y,robot:a,jobId:e,initialStep:h}),(0,V.jsx)(J9,{logs:u,logContainerRef:f})]})})},X9=()=>{let{jobId:e}=Be();return e?(0,V.jsx)(Tie,{jobId:e}):(0,V.jsx)(wie,{})},Eie=1e3;function Z9(e){let t=Math.max(0,Math.floor(e)),n=Math.floor(t/60),r=t%60;return`${String(n).padStart(2,`0`)}:${String(r).padStart(2,`0`)}`}var Die=()=>{let e=Re(),{baseUrl:t,fetchWithHeaders:n}=Rs(),{toast:r}=_r(),[i,a]=(0,_.useState)(null),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(!1),l=(0,_.useRef)(!1);(0,_.useEffect)(()=>{let i=!1,o=async()=>{try{await jv(t,n)}catch{}},s=async()=>{try{let s=await Qee(t,n);if(i)return;if(a(s),!s.inference_active&&!c.current){c.current=!0,s.exited&&r({title:`Inference finished`,description:s.exit_code===0?`Run completed.`:`Exit code ${s.exit_code}. See ${s.log_path}.`,variant:s.exit_code===0?`default`:`destructive`}),e(`/`);return}s.inference_active&&s.rollout_started_at!=null&&s.duration_s!=null&&s.duration_s>0&&s.rollout_elapsed_s>s.duration_s+10&&!l.current&&(l.current=!0,r({title:`Inference seems hung`,description:`Rollout past duration by ${Math.round(s.rollout_elapsed_s-s.duration_s)}s. Stopping.`,variant:`destructive`}),o())}catch(e){i||r({title:`Lost connection to backend`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};s();let u=setInterval(s,Eie);return()=>{i=!0,clearInterval(u)}},[t,n,e,r]);let u=async()=>{s(!1);try{await jv(t,n)}catch(e){r({title:`Stop failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}};if(!i)return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:[(0,V.jsx)(qa,{className:`w-6 h-6 animate-spin mr-3`}),` Connecting to inference…`]});let d=i.elapsed_s??0,f=i.rollout_elapsed_s??0,p=i.duration_s??0,m=i.inference_active&&i.rollout_started_at==null,h=i.inference_active&&i.rollout_started_at!=null,g=h&&p>0?Math.min(100,f/p*100):0;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col p-4 sm:p-6 lg:p-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-4 mb-8`,children:[(0,V.jsx)(G,{variant:`ghost`,size:`icon`,onClick:()=>e(`/`),className:`text-slate-400 hover:bg-slate-800 hover:text-white rounded-lg`,children:(0,V.jsx)(Ca,{className:`w-5 h-5`})}),(0,V.jsx)(zj,{}),(0,V.jsx)(`h1`,{className:`font-bold text-white text-2xl`,children:`Inference`})]}),(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg border border-gray-700 p-8 w-full max-w-xl`,children:[(0,V.jsx)(`div`,{className:`text-center mb-6`,children:(0,V.jsxs)(`div`,{className:`inline-flex items-center gap-2 px-3 py-1 rounded-full text-xs font-bold tracking-widest ${m?`bg-amber-500/15 text-amber-300`:`bg-green-500/15 text-green-300`}`,children:[(0,V.jsx)(`span`,{className:`w-2 h-2 rounded-full ${m?`bg-amber-500`:`bg-green-500`} animate-pulse`}),m?`SETTING UP`:h?`RUNNING`:`FINISHED`]})}),(0,V.jsxs)(`div`,{className:`text-center mb-4`,children:[(0,V.jsx)(`div`,{className:`text-7xl font-mono font-bold leading-none ${m?`text-amber-400`:`text-green-400`}`,children:Z9(h?f:d)}),(0,V.jsx)(`div`,{className:`text-sm text-gray-500 mt-2`,children:m?`Loading policy & connecting hardware…`:`/ ${Z9(p)}`})]}),(0,V.jsx)(`div`,{className:`w-full bg-gray-800 rounded-full h-1.5 mb-8`,children:(0,V.jsx)(`div`,{className:`h-1.5 rounded-full transition-all duration-500 ${m?`bg-amber-500/40 animate-pulse w-full`:`bg-green-500`}`,style:m?void 0:{width:`${g}%`}})}),(0,V.jsxs)(`div`,{className:`text-xs text-slate-500 break-all mb-6`,children:[`policy: `,i.policy_ref??`(unknown)`]}),(0,V.jsxs)(G,{onClick:()=>s(!0),disabled:!i.inference_active,className:`w-full bg-red-500 hover:bg-red-600 text-white font-semibold py-6 text-lg disabled:opacity-50`,children:[(0,V.jsx)(ao,{className:`w-5 h-5 mr-2`}),`Stop`]})]})}),(0,V.jsx)(xI,{open:o,onOpenChange:s,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Stop inference?`}),(0,V.jsx)(OI,{className:`text-gray-400`,children:`The follower will hold its current pose. You can launch another run from the job tile.`})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep running`}),(0,V.jsx)(kI,{onClick:u,className:`bg-red-500 hover:bg-red-600 text-white`,children:`Stop`})]})]})})]})},Oie=()=>(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white flex flex-col items-center justify-center p-4`,children:[(0,V.jsx)(`h1`,{className:`text-5xl font-bold tracking-tight`,children:`Edit Dataset`}),(0,V.jsx)(`p`,{className:`mt-4 text-xl text-gray-400`,children:`This page is under construction.`})]}),kie=()=>{let e=Ie(),t=Re(),{toast:n}=_r(),{baseUrl:r,fetchWithHeaders:i}=Rs(),a=e.state?.datasetInfo,[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!0),[u,d]=(0,_.useState)({tags:[`robotics`,`lerobot`],private:!1}),[f,p]=(0,_.useState)(u.tags.join(`, `)),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(!1);_.useEffect(()=>{(async()=>{if(!a?.dataset_repo_id){n({title:`No Dataset Information`,description:`Please complete a recording session first.`,variant:`destructive`}),t(`/`);return}try{let e=await i(`${r}/dataset-info`,{method:`POST`,body:JSON.stringify({dataset_repo_id:a.dataset_repo_id})}),t=await e.json();e.ok&&t.success?s({...t,saved_episodes:t.num_episodes,session_elapsed_seconds:a.session_elapsed_seconds||0,source:a.source}):(n({title:`Warning`,description:`Could not load complete dataset information. Using session data.`,variant:`destructive`}),s(a))}catch(e){console.error(`Error loading dataset info:`,e),n({title:`Warning`,description:`Could not connect to backend. Using session data.`,variant:`destructive`}),s(a)}finally{l(!1)}})()},[a,t,n]);let C=e=>{let t=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${e}`)}`,n=`https://huggingface.co/login?next=${encodeURIComponent(t)}`;window.open(n,`_blank`,`noopener,noreferrer`)},w=e=>{let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60;return t>0?`${t}h ${n}m ${r}s`:n>0?`${n}m ${r}s`:`${r}s`},T=async()=>{if(o){h(!0);try{let e=f.split(`,`).map(e=>e.trim()).filter(e=>e.length>0),t=await i(`${r}/upload-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id,tags:e,private:u.private})}),a=await t.json();if(t.ok&&a.success)v(!0),n({title:`Upload Successful!`,description:`Dataset ${o.dataset_repo_id} has been uploaded to HuggingFace Hub.`});else{let e=`Failed to upload dataset to HuggingFace Hub.`;n({title:`Upload Failed`,description:a.docs_url?(0,V.jsxs)(`span`,{children:[a.message||e,` `,(0,V.jsx)(`a`,{href:a.docs_url,target:`_blank`,rel:`noopener noreferrer`,className:`underline font-medium`,children:`Open setup guide`})]}):a.message||e,variant:`destructive`})}}catch(e){console.error(`Error uploading dataset:`,e),n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{h(!1)}}},E=()=>{n({title:`Upload Skipped`,description:`Dataset saved locally. You can upload it manually later.`}),t(`/`)},D=async()=>{if(o){S(!0);try{let e=await i(`${r}/delete-dataset`,{method:`POST`,body:JSON.stringify({dataset_repo_id:o.dataset_repo_id})}),a=await e.json();e.ok&&a.success?(n({title:`Dataset Deleted`,description:`${o.dataset_repo_id} has been removed from disk.`}),t(`/`)):n({title:`Delete Failed`,description:a.message||`Could not delete the dataset.`,variant:`destructive`})}catch{n({title:`Connection Error`,description:`Could not connect to the backend server.`,variant:`destructive`})}finally{S(!1),b(!1)}}};if(c||!o)return(0,V.jsx)(`div`,{className:`min-h-screen bg-black text-white flex items-center justify-center`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`div`,{className:`animate-spin rounded-full h-12 w-12 border-b-2 border-blue-500 mx-auto mb-4`}),(0,V.jsx)(`p`,{className:`text-lg`,children:`Loading dataset information...`})]})});let O=o.source===`both`;return(0,V.jsxs)(`div`,{className:`min-h-screen bg-black text-white p-8`,children:[(0,V.jsxs)(`div`,{className:`max-w-4xl mx-auto`,children:[(0,V.jsxs)(`div`,{className:`flex items-center justify-between mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsxs)(G,{onClick:()=>t(`/`),variant:`outline`,className:`border-gray-500 hover:border-gray-200 text-gray-300 hover:text-white`,children:[(0,V.jsx)(Ca,{className:`w-4 h-4 mr-2`}),`Back to Home`]}),(0,V.jsx)(G,{onClick:()=>b(!0),variant:`outline`,size:`icon`,disabled:x,"aria-label":`Delete dataset from disk`,className:`border-red-500/40 text-red-400 hover:border-red-400 hover:text-red-300 hover:bg-red-500/10`,children:(0,V.jsx)(so,{className:`w-4 h-4`})})]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g?(0,V.jsx)(Ma,{className:`w-8 h-8 text-green-500`}):(0,V.jsx)(za,{className:`w-8 h-8 text-blue-500`}),(0,V.jsx)(`h1`,{className:`text-3xl font-bold`,children:g?`Upload Complete`:`Dataset Upload`})]})]}),g&&(0,V.jsxs)(`div`,{className:`bg-green-900/20 border border-green-600 rounded-lg p-6 mb-8`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3 mb-4`,children:[(0,V.jsx)(Ma,{className:`w-6 h-6 text-green-500`}),(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-green-400`,children:`Successfully Uploaded!`})]}),(0,V.jsx)(`p`,{className:`text-gray-300 mb-4`,children:`Your dataset has been uploaded to HuggingFace Hub and is now available for training and sharing.`}),(0,V.jsxs)(`div`,{className:`flex flex-col sm:flex-row gap-4`,children:[(0,V.jsxs)(G,{onClick:()=>{let e=`/spaces/lerobot/visualize_dataset?path=${encodeURIComponent(`/${o.dataset_repo_id}`)}`,t=u.private?`https://huggingface.co/login?next=${encodeURIComponent(e)}`:`https://huggingface.co${e}`;window.open(t,`_blank`,`noopener,noreferrer`)},className:`bg-blue-500 hover:bg-blue-600 text-white`,children:[(0,V.jsx)(Ha,{className:`w-4 h-4 mr-2`}),`View on HuggingFace Hub`]}),(0,V.jsx)(G,{onClick:()=>t(`/training`,{state:{datasetRepoId:o.dataset_repo_id}}),className:`bg-purple-500 hover:bg-purple-600 text-white`,children:`Start Training`})]})]}),!g&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-4`,children:`Dataset Summary`}),(0,V.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-6`,children:[(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Repository ID:`}),(0,V.jsx)(`p`,{className:`text-white font-mono text-lg`,children:o.dataset_repo_id})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Task:`}),(0,V.jsx)(`p`,{className:`text-white`,children:o.single_task})]})]}),(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Episodes Recorded:`}),(0,V.jsx)(`p`,{className:`text-white text-2xl font-bold text-green-400`,children:o.saved_episodes||o.num_episodes}),o.total_frames&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.total_frames,` total frames`]})]}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`span`,{className:`text-gray-400`,children:`Session Duration:`}),(0,V.jsx)(`p`,{className:`text-white`,children:w(o.session_elapsed_seconds||0)}),o.fps&&(0,V.jsxs)(`p`,{className:`text-gray-400 text-sm`,children:[o.fps,` FPS`]})]})]})]})]}),!O&&(0,V.jsxs)(`div`,{className:`bg-gray-900 rounded-lg p-6 border border-gray-700 mb-8`,children:[(0,V.jsx)(`h2`,{className:`text-xl font-semibold text-white mb-6`,children:`Upload Configuration`}),(0,V.jsxs)(`div`,{className:`space-y-6`,children:[(0,V.jsxs)(`div`,{children:[(0,V.jsx)(q,{htmlFor:`tags`,className:`text-gray-300 mb-2 block`,children:`Tags (comma-separated)`}),(0,V.jsx)(Th,{id:`tags`,value:f,onChange:e=>p(e.target.value),placeholder:`robotics, lerobot, manipulation`,className:`bg-gray-800 border-gray-600 text-white`}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 mt-1`,children:`Tags help others discover your dataset on HuggingFace Hub`})]}),(0,V.jsxs)(`div`,{className:`flex items-center space-x-3`,children:[(0,V.jsx)(Jh,{id:`private`,checked:u.private,onCheckedChange:e=>d({...u,private:e})}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[u.private?(0,V.jsx)(Ua,{className:`w-4 h-4 text-gray-400`}):(0,V.jsx)(Wa,{className:`w-4 h-4 text-gray-400`}),(0,V.jsx)(q,{htmlFor:`private`,className:`text-gray-300`,children:`Make dataset private`})]})]}),(0,V.jsx)(`p`,{className:`text-sm text-gray-500 ml-6`,children:u.private?`Only you will be able to access this dataset`:`Dataset will be publicly accessible on HuggingFace Hub`})]})]}),(0,V.jsx)(`div`,{className:`flex flex-col sm:flex-row gap-4 justify-center`,children:O?(0,V.jsxs)(G,{onClick:()=>C(o.dataset_repo_id),className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:[(0,V.jsx)(Ha,{className:`w-5 h-5 mr-2`}),`View on Hugging Face Hub`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(G,{onClick:T,disabled:m,className:`bg-blue-500 hover:bg-blue-600 text-white font-semibold py-4 px-8 text-lg`,children:m?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-5 h-5 mr-2 animate-spin`}),`Uploading to Hub...`]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(lo,{className:`w-5 h-5 mr-2`}),`Upload to HuggingFace Hub`]})}),(0,V.jsx)(G,{onClick:E,disabled:m,variant:`outline`,className:`border-gray-600 text-gray-300 hover:bg-gray-800 hover:text-white py-4 px-8 text-lg`,children:`Skip Upload`})]})}),!O&&(0,V.jsx)(`div`,{className:`mt-8 p-4 bg-blue-900/20 border border-blue-600 rounded-lg`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,V.jsx)(ja,{className:`w-5 h-5 text-blue-400 mt-0.5`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`h3`,{className:`font-semibold text-blue-400 mb-2`,children:`About HuggingFace Hub Upload`}),(0,V.jsxs)(`ul`,{className:`text-sm text-gray-300 space-y-1`,children:[(0,V.jsx)(`li`,{children:`• Your dataset will be uploaded to HuggingFace Hub for sharing and collaboration`}),(0,V.jsx)(`li`,{children:`• You need to be logged in to HuggingFace CLI on the server`}),(0,V.jsx)(`li`,{children:`• Uploaded datasets can be used for training models and sharing with the community`}),(0,V.jsx)(`li`,{children:`• You can always upload manually later using the HuggingFace CLI`})]})]})]})})]})]}),(0,V.jsx)(xI,{open:y,onOpenChange:b,children:(0,V.jsxs)(wI,{className:`bg-gray-900 border-gray-700 text-white`,children:[(0,V.jsxs)(TI,{children:[(0,V.jsx)(DI,{children:`Delete dataset from disk?`}),(0,V.jsxs)(OI,{className:`text-gray-400`,children:[`This permanently removes `,(0,V.jsx)(`span`,{className:`font-mono text-white`,children:o.dataset_repo_id}),` from your local cache. This action cannot be undone.`]})]}),(0,V.jsxs)(EI,{children:[(0,V.jsx)(AI,{className:`bg-gray-800 border-gray-700 text-white hover:bg-gray-700`,children:`Keep dataset`}),(0,V.jsx)(kI,{onClick:D,disabled:x,className:`bg-red-500 hover:bg-red-600 text-white`,children:x?`Deleting…`:`Delete`})]})]})})]})},Aie=()=>{let e=Ie();return(0,_.useEffect)(()=>{console.error(`404 Error: User attempted to access non-existent route:`,e.pathname)},[e.pathname]),(0,V.jsx)(`div`,{className:`min-h-screen flex items-center justify-center bg-gray-100`,children:(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`h1`,{className:`text-4xl font-bold mb-4`,children:`404`}),(0,V.jsx)(`p`,{className:`text-xl text-gray-600 mb-4`,children:`Oops! Page not found`}),(0,V.jsx)(`a`,{href:`/`,className:`text-blue-500 hover:text-blue-700 underline`,children:`Return to Home`})]})})},jie=`lelab-tabs-v1`,Mie=1e3,Nie=3e3,Pie=({children:e})=>{let[t,n]=(0,_.useState)(!0),r=(0,_.useRef)(new Map),i=(0,_.useRef)(``),a=(0,_.useRef)(0),o=(0,_.useRef)(null),s=(0,_.useCallback)(()=>{let e=r.current,t=Date.now()-Nie;for(let[n,r]of e)r.lastSeen{if(typeof window>`u`||typeof BroadcastChannel>`u`)return;i.current=crypto.randomUUID(),a.current=Date.now();let e=new BroadcastChannel(jie);o.current=e;let t=t=>{e.postMessage({type:t,id:i.current,openedAt:a.current})};e.onmessage=e=>{let t=e.data;if(!t||t.id===i.current)return;let n=r.current;t.type===`HEARTBEAT`?n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}):t.type===`RELEASE`?n.delete(t.id):t.type===`TAKEOVER`&&(n.set(t.id,{id:t.id,openedAt:t.openedAt,lastSeen:Date.now()}),a.current<=t.openedAt&&(a.current=t.openedAt+1)),s()},t(`HEARTBEAT`);let n=setInterval(()=>{t(`HEARTBEAT`),s()},Mie),c=()=>t(`RELEASE`);return window.addEventListener(`beforeunload`,c),()=>{window.removeEventListener(`beforeunload`,c),clearInterval(n),t(`RELEASE`),e.close(),o.current=null}},[s]);let c=(0,_.useCallback)(()=>{a.current=0,o.current?.postMessage({type:`TAKEOVER`,id:i.current,openedAt:0}),s()},[s]);return(0,V.jsxs)(V.Fragment,{children:[e,!t&&(0,V.jsx)(`div`,{className:`fixed inset-0 z-[9999] flex items-center justify-center bg-black/80 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,children:(0,V.jsxs)(`div`,{className:`mx-4 max-w-md space-y-4 rounded-lg border bg-background p-6 text-center shadow-lg`,children:[(0,V.jsx)(`h2`,{className:`text-lg font-semibold`,children:`LeLab is already open in another tab`}),(0,V.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Only one tab can control the robot at a time. Switch back to the original tab, or take over here — the other tab will lock.`}),(0,V.jsx)(G,{onClick:c,children:`Use this tab`})]})})]})},Q9=`lelab:teleop-stopped`,Fie=()=>{let{toast:e}=_r();return(0,_.useEffect)(()=>{let t=!1;try{t=sessionStorage.getItem(Q9)===`1`,t&&sessionStorage.removeItem(Q9)}catch{}t&&e({title:`Teleoperation stopped`,description:`The arm was disconnected cleanly when you left the page.`})},[e]),null},$9=`lelab:update-dismissed-sha`;function Iie(){let{baseUrl:e,fetchWithHeaders:t}=Rs(),[n,r]=(0,_.useState)(null),[i,a]=(0,_.useState)(!1);return(0,_.useEffect)(()=>{if(qv())return;let n=!1;return t(`${e}/system/update-check`).then(e=>e.ok?e.json():null).then(e=>{if(n||!e||!e.update_available)return;let t=null;try{t=localStorage.getItem($9)}catch{}t&&t===e.latest_commit||(r(e),a(!0))}).catch(()=>{}),()=>{n=!0}},[e,t]),{status:n,open:i,dismiss:(0,_.useCallback)(e=>{if(e&&n?.latest_commit)try{localStorage.setItem($9,n.latest_commit)}catch{}a(!1)},[n])}}var Lie=()=>{let{status:e,open:t,dismiss:n}=Iie(),{baseUrl:r,fetchWithHeaders:i}=Rs(),{toast:a}=_r(),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(null);if(!e)return null;let f=typeof e.commits_behind==`number`&&e.commits_behind>0?`${e.commits_behind} commit${e.commits_behind===1?``:`s`} behind`:`A new version is available`;return(0,V.jsx)(xu,{open:t,onOpenChange:e=>{!e&&!c&&n(o)},children:(0,V.jsxs)(wu,{className:`bg-slate-800 border-slate-700 text-white max-w-lg`,onOpenAutoFocus:e=>e.preventDefault(),children:[(0,V.jsxs)(Tu,{children:[(0,V.jsxs)(Du,{className:`flex items-center gap-3 text-white`,children:[(0,V.jsx)(io,{className:`w-5 h-5 text-amber-400`}),`LeLab update available`]}),(0,V.jsxs)(Ou,{className:`text-slate-300`,children:[`You're `,f,` 😱.`,(0,V.jsx)(`br`,{}),`Update to get the latest fixes and features 🤗.`,e.compare_url&&(0,V.jsxs)(V.Fragment,{children:[` `,(0,V.jsx)(`a`,{href:e.compare_url,target:`_blank`,rel:`noreferrer`,className:`text-sky-300 underline hover:text-sky-200`,children:`See what changed`}),`.`]})]})]}),(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(og,{children:[(0,V.jsxs)(sg,{className:`group flex items-center gap-1.5 text-xs font-medium text-slate-300 hover:text-white transition-colors`,children:[(0,V.jsx)(Oa,{className:`w-3.5 h-3.5 transition-transform group-data-[state=open]:rotate-90`}),`Or update manually`]}),(0,V.jsx)(cg,{className:`pt-2`,children:(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(`code`,{className:`min-w-0 flex-1 px-2 py-1.5 rounded bg-slate-900 text-sky-300 text-xs break-all whitespace-pre-wrap`,children:e.update_command}),(0,V.jsx)(G,{variant:`outline`,size:`icon`,onClick:async()=>{if(e.update_command)try{await navigator.clipboard.writeText(e.update_command),a({title:`Copied`,description:`Update command copied to clipboard.`})}catch{a({title:`Copy failed`,description:`Select and copy the command manually.`,variant:`destructive`})}},title:`Copy command`,className:`shrink-0 bg-slate-900 border-slate-600 text-white hover:bg-slate-700`,children:(0,V.jsx)(Ra,{className:`w-4 h-4`})})]})})]}),u&&(0,V.jsx)(`pre`,{className:`max-h-40 overflow-auto rounded bg-slate-900 p-2 text-xs text-slate-300 whitespace-pre-wrap`,children:u}),(0,V.jsxs)(`div`,{className:`flex items-center justify-between gap-3 pt-1`,children:[(0,V.jsxs)(`label`,{className:`flex items-center gap-2 text-sm text-slate-300`,children:[(0,V.jsx)(Jh,{checked:o,onCheckedChange:e=>s(e===!0),className:`border-slate-300 data-[state=checked]:bg-slate-300 data-[state=checked]:text-slate-900`}),`Don't ask me again`]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G,{variant:`ghost`,onClick:()=>n(o),disabled:c,className:`text-slate-300 hover:bg-slate-700 hover:text-white`,children:`Later`}),e.can_auto_update&&(0,V.jsx)(G,{onClick:async()=>{l(!0),d(null);try{let e=await(await i(`${r}/system/update`,{method:`POST`})).json();e.success?(a({title:`Updated`,description:e.message}),n(!1)):(d(e.output||e.message),a({title:`Update failed`,description:e.message,variant:`destructive`}))}catch(e){a({title:`Update failed`,description:e instanceof Error?e.message:String(e),variant:`destructive`})}finally{l(!1)}},disabled:c,children:c?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(qa,{className:`w-4 h-4 mr-2 animate-spin`}),`Updating…`]}):`Update now`})]})]})]})]})})},Rie=new mn;function zie(){return(0,V.jsx)(_n,{client:Rie,children:(0,V.jsx)(hp,{children:(0,V.jsx)(yn,{children:(0,V.jsx)(Ls,{children:(0,V.jsx)(Bs,{children:(0,V.jsx)(nr,{children:(0,V.jsx)(ar,{children:(0,V.jsxs)(pt,{children:[(0,V.jsxs)(Pie,{children:[(0,V.jsx)(Fie,{}),(0,V.jsx)(Lie,{}),(0,V.jsxs)(ct,{children:[(0,V.jsx)(ot,{path:`/`,element:(0,V.jsx)(Yv,{})}),(0,V.jsx)(ot,{path:`/teleoperation`,element:(0,V.jsx)(nM,{})}),(0,V.jsx)(ot,{path:`/recording`,element:(0,V.jsx)(Dte,{})}),(0,V.jsx)(ot,{path:`/upload`,element:(0,V.jsx)(kie,{})}),(0,V.jsx)(ot,{path:`/training`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/training/:jobId`,element:(0,V.jsx)(X9,{})}),(0,V.jsx)(ot,{path:`/inference`,element:(0,V.jsx)(Die,{})}),(0,V.jsx)(ot,{path:`/calibration`,element:(0,V.jsx)(bM,{})}),(0,V.jsx)(ot,{path:`/edit-dataset`,element:(0,V.jsx)(Oie,{})}),(0,V.jsx)(ot,{path:`*`,element:(0,V.jsx)(Aie,{})})]})]}),(0,V.jsx)(ys,{})]})})})})})})})})}(0,y.createRoot)(document.getElementById(`root`)).render((0,V.jsx)(zie,{})); \ No newline at end of file diff --git a/frontend/dist/index.html b/frontend/dist/index.html index d0717022..68b7a7ee 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -1,20 +1,20 @@ - - - - - - LeLab - - - - - - - - - - - -
- - + + + + + + LeLab + + + + + + + + + + + +
+ + diff --git a/frontend/src/components/training/types.ts b/frontend/src/components/training/types.ts index d459a7ef..cd4882dd 100644 --- a/frontend/src/components/training/types.ts +++ b/frontend/src/components/training/types.ts @@ -44,7 +44,6 @@ export interface TrainingConfig { // GR00T-specific configuration (only used when policy_type === "groot"). dataset_image_transforms_enable?: boolean; - eval_steps?: number; policy_base_model_path?: string; policy_embodiment_tag?: string; policy_chunk_size?: number; diff --git a/frontend/src/lib/jobsApi.ts b/frontend/src/lib/jobsApi.ts index fa9a262f..8cd82f70 100644 --- a/frontend/src/lib/jobsApi.ts +++ b/frontend/src/lib/jobsApi.ts @@ -52,7 +52,6 @@ export interface TrainingRequest { // GR00T-specific (only sent when policy_type === "groot"); backend ignores // the policy_* ones for other policies. dataset_image_transforms_enable?: boolean; - eval_steps?: number; policy_base_model_path?: string; policy_embodiment_tag?: string; policy_chunk_size?: number; diff --git a/frontend/src/pages/Training.tsx b/frontend/src/pages/Training.tsx index a74b2ab4..ca15ae0f 100644 --- a/frontend/src/pages/Training.tsx +++ b/frontend/src/pages/Training.tsx @@ -96,7 +96,6 @@ function configToRequest(c: TrainingConfig): TrainingRequest { // GR00T-specific. Only forward the policy_* fields for groot so other // policies never receive flags their config doesn't define. dataset_image_transforms_enable: c.dataset_image_transforms_enable, - eval_steps: c.eval_steps, ...(c.policy_type === "groot" ? { policy_base_model_path: c.policy_base_model_path, diff --git a/lelab/rollout.py b/lelab/rollout.py index c117de2d..fa02e507 100644 --- a/lelab/rollout.py +++ b/lelab/rollout.py @@ -179,7 +179,7 @@ def _rollout_inference_args(policy_path: str) -> list[str]: if isinstance(n_action_steps, int) and n_action_steps > 0: args.append(f"--inference.rtc.execution_horizon={n_action_steps}") elif policy_type == "groot": - args.append("--inference.rtc.execution_horizon=8") + args.append("--inference.rtc.execution_horizon=16") # Wait until the current chunk is consumed before replanning. GROOT docs # recommend keeping this at 0 (never > 5) for stable real-robot rollout. diff --git a/lelab/train.py b/lelab/train.py index 871f3491..257edeaf 100644 --- a/lelab/train.py +++ b/lelab/train.py @@ -51,7 +51,6 @@ class TrainingRequest(BaseModel): log_freq: int = 250 save_freq: int = 1000 env_eval_freq: int = 0 - eval_steps: int = 0 save_checkpoint: bool = True # Output configuration @@ -186,7 +185,6 @@ def build_training_command( cmd.extend(["--log_freq", str(request.log_freq)]) cmd.extend(["--save_freq", str(request.save_freq)]) cmd.extend(["--env_eval_freq", str(request.env_eval_freq)]) - cmd.extend(["--eval_steps", str(request.eval_steps)]) cmd.extend(["--save_checkpoint", "true" if request.save_checkpoint else "false"]) # Output. On HF Cloud the pod, not this host, runs the trainer: an absolute host diff --git a/tests/test_rollout.py b/tests/test_rollout.py index fa2a74e1..49200b4c 100644 --- a/tests/test_rollout.py +++ b/tests/test_rollout.py @@ -310,6 +310,22 @@ def test_rollout_inference_args_omits_rtc_for_absolute_policies(tmp_path) -> Non assert _rollout_inference_args(str(policy_dir)) == [] +def test_rollout_inference_args_uses_groot_chunk_default_when_missing(tmp_path) -> None: + from lelab.rollout import _rollout_inference_args + + policy_dir = tmp_path / "pretrained_model" + policy_dir.mkdir() + (policy_dir / "config.json").write_text( + json.dumps({"type": "groot", "use_relative_actions": True}), + encoding="utf-8", + ) + assert _rollout_inference_args(str(policy_dir)) == [ + "--inference.type=rtc", + "--inference.rtc.execution_horizon=16", + "--inference.queue_threshold=0", + ] + + def test_friendly_hint_maps_common_failures() -> None: from lelab.rollout import _friendly_hint diff --git a/tests/test_train.py b/tests/test_train.py index 58fd0d15..be8a6537 100644 --- a/tests/test_train.py +++ b/tests/test_train.py @@ -175,3 +175,50 @@ def test_local_target_keeps_push_to_hub() -> None: assert _arg_value(cmd, "--policy.push_to_hub") == "true" assert _arg_value(cmd, "--policy.repo_id") == "me/x" assert "--job.target" not in cmd + + +def test_groot_policy_flags_are_emitted_only_for_groot() -> None: + from lelab.train import TrainingRequest, build_training_command + + req = TrainingRequest( + dataset_repo_id="x", + policy_type="groot", + policy_base_model_path="nvidia/GR00T-N1.7-3B", + policy_embodiment_tag="new_embodiment", + policy_chunk_size=16, + policy_n_action_steps=16, + policy_use_relative_actions=True, + policy_relative_exclude_joints=["gripper"], + policy_use_bf16=True, + ) + cmd = build_training_command(req, "/tmp/out") + + assert _arg_value(cmd, "--policy.base_model_path") == "nvidia/GR00T-N1.7-3B" + assert _arg_value(cmd, "--policy.embodiment_tag") == "new_embodiment" + assert _arg_value(cmd, "--policy.chunk_size") == "16" + assert _arg_value(cmd, "--policy.n_action_steps") == "16" + assert _arg_value(cmd, "--policy.use_relative_actions") == "true" + assert _arg_value(cmd, "--policy.relative_exclude_joints") == '["gripper"]' + assert _arg_value(cmd, "--policy.use_bf16") == "true" + + non_groot = build_training_command( + TrainingRequest( + dataset_repo_id="x", + policy_type="act", + policy_base_model_path="nvidia/GR00T-N1.7-3B", + policy_embodiment_tag="new_embodiment", + policy_chunk_size=16, + policy_n_action_steps=16, + policy_use_relative_actions=True, + policy_relative_exclude_joints=["gripper"], + policy_use_bf16=True, + ), + "/tmp/out", + ) + assert "--policy.base_model_path" not in non_groot + assert "--policy.embodiment_tag" not in non_groot + assert "--policy.chunk_size" not in non_groot + assert "--policy.n_action_steps" not in non_groot + assert "--policy.use_relative_actions" not in non_groot + assert "--policy.relative_exclude_joints" not in non_groot + assert "--policy.use_bf16" not in non_groot From 25a0c4e7555b5dbcf8d9f7c14533a6e0e055b70d Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 16 Jul 2026 08:55:07 -0500 Subject: [PATCH 5/5] Address GR00T PR review feedback --- frontend/src/components/training/config/GrootCard.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/training/config/GrootCard.tsx b/frontend/src/components/training/config/GrootCard.tsx index c02fbe9f..ea820f0e 100644 --- a/frontend/src/components/training/config/GrootCard.tsx +++ b/frontend/src/components/training/config/GrootCard.tsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React, { useEffect, useRef } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { NumberInput } from '@/components/ui/number-input'; @@ -21,11 +21,13 @@ const GROOT_DEFAULTS = { const GrootCard: React.FC = ({ config, updateConfig }) => { const isGroot = config.policy_type === 'groot'; + const seededDefaults = useRef(false); // Seed defaults once when groot is selected. Each key is only written when // still undefined, so the effect can't loop and never clobbers user edits. useEffect(() => { - if (!isGroot) return; + if (!isGroot || seededDefaults.current) return; + seededDefaults.current = true; (Object.keys(GROOT_DEFAULTS) as (keyof typeof GROOT_DEFAULTS)[]).forEach((key) => { if (config[key] === undefined) { updateConfig(key, GROOT_DEFAULTS[key] as never);