From 9642ae2407a7ed941fc46e98141026d1655d4d78 Mon Sep 17 00:00:00 2001 From: lloyd-brown Date: Wed, 8 Jul 2026 13:32:47 -0700 Subject: [PATCH 01/16] [Azure] Fix NIC provisioning broken by azure-mgmt-network 31.0.0 (#10062) Every Azure launch was failing at network interface creation with "TypeError: Object of type SubResource is not JSON serializable". _create_network_interface built the subnet reference with compute.SubResource (an azure.mgmt.compute.models type) but embedded it in a network.IPConfiguration sent to the network client. azure-mgmt-network 31.0.0 (2026-07-01) regenerated its models with the TypeSpec toolchain and a strict SdkJSONEncoder that only serializes network-SDK models, so passing a foreign compute model now raises. The previous serializer (<=30.2.0) accepted any object exposing `.id`, which had masked this bug since the SDK refactor in PR #4139. Use network.Subnet(id=...), the declared type of IPConfiguration.subnet, which serializes correctly on both 30.x and 31.x. Also drop the now-unused compute models alias in that function. Co-authored-by: Claude Opus 4.8 --- sky/provision/azure/instance.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sky/provision/azure/instance.py b/sky/provision/azure/instance.py index 974ec04d4..b5ead4a72 100644 --- a/sky/provision/azure/instance.py +++ b/sky/provision/azure/instance.py @@ -200,13 +200,12 @@ def _create_network_interface( provider_config: Dict[str, Any]) -> 'azure_network_models.NetworkInterface': network = azure.azure_mgmt_models('network') - compute = azure.azure_mgmt_models('compute') logger.info(f'Start creating network interface for {vm_name}...') if provider_config.get('use_internal_ips', False): name = f'{vm_name}-nic-private' ip_config = network.IPConfiguration( name=f'ip-config-private-{vm_name}', - subnet=compute.SubResource(id=provider_config['subnet']), + subnet=network.Subnet(id=provider_config['subnet']), private_ip_allocation_method=network.IPAllocationMethod.DYNAMIC) else: name = f'{vm_name}-nic-public' @@ -223,7 +222,7 @@ def _create_network_interface( f'with address {ip_poller.result().ip_address}.') ip_config = network.IPConfiguration( name=f'ip-config-public-{vm_name}', - subnet=compute.SubResource(id=provider_config['subnet']), + subnet=network.Subnet(id=provider_config['subnet']), private_ip_allocation_method=network.IPAllocationMethod.DYNAMIC, public_ip_address=network.PublicIPAddress(id=ip_poller.result().id)) From b1431e52d97c22e9bb8fa8b67f162543754ddaf5 Mon Sep 17 00:00:00 2001 From: Zhanghao Wu Date: Wed, 22 Jul 2026 10:26:03 -0700 Subject: [PATCH 02/16] Release 0.13.0 (#10191) Co-authored-by: GitHub Action --- sky/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sky/__init__.py b/sky/__init__.py index 42b41bbc0..a988e4a6d 100644 --- a/sky/__init__.py +++ b/sky/__init__.py @@ -45,7 +45,7 @@ def _get_git_commit(): __commit__ = _get_git_commit() -__version__ = '1.0.0-dev0' +__version__ = '0.13.0' __root_dir__ = directory_utils.get_sky_dir() From fb5b46961b7abc66dad25ca98f87dcc2d92ac97c Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 03/16] [SSH] Reuse an externally managed ControlMaster (opt-in) SKYPILOT_SSH_CONTROL_PATH and SKYPILOT_SSH_CONTROL_PERSIST point the SSH command runner at a ControlMaster the user opened by hand. SkyPilot multiplexes under a private %C-keyed path it can never share, so a login node that demands a password and a one-time code per connection prompts on every remote command. Unset, nothing changes. Signed-off-by: Taufeeque --- sky/utils/command_runner.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/sky/utils/command_runner.py b/sky/utils/command_runner.py index 44f981ac5..c7de2b5b6 100644 --- a/sky/utils/command_runner.py +++ b/sky/utils/command_runner.py @@ -264,7 +264,19 @@ def ssh_options_list( if (ssh_control_name is not None and docker_ssh_proxy_command is None and ssh_proxy_command is None and ssh_proxy_jump is None and not disable_control_master): - control_path = f'{_ssh_control_path(ssh_control_name)}/%C' + # --- nemo-rl: external ControlMaster support --- + # An externally-managed ControlMaster, when the operator asks for one. + # Sites that force an interactive second factor on every connection + # cannot use a SkyPilot-private control path: it is keyed by %C under a + # private directory, so it can never attach to a master the user opened + # with plain `ssh`. Given a template, one hand-authenticated master + # serves every SkyPilot connection. + _external_control_path = os.environ.get('SKYPILOT_SSH_CONTROL_PATH') + _control_persist = os.environ.get('SKYPILOT_SSH_CONTROL_PERSIST', '300s') + if _external_control_path: + control_path = os.path.expanduser(_external_control_path) + else: + control_path = f'{_ssh_control_path(ssh_control_name)}/%C' if escape_percent_expand: control_path = control_path.replace('%', '%%') arg_dict.update({ @@ -272,7 +284,7 @@ def ssh_options_list( # sky.launch(). 'ControlMaster': 'auto', 'ControlPath': control_path, - 'ControlPersist': '300s', + 'ControlPersist': _control_persist, }) ssh_key_option = [ '-i', From ea79112a9ffbe7697f29fc487f8f6c04ec96667b Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 04/16] [SSH] Run remote commands non-interactively `bash --login -i -c` makes the shell interactive, and RHEL's /etc/profile then sources /etc/profile.d with output visible, so a login banner lands in the captured output SkyPilot parses (`Failed to set up SkyPilot runtime on cluster` with a banner for stdout). --login already provides /etc/profile, where PATH and module setup live on an HPC login node. Signed-off-by: Taufeeque --- sky/utils/command_runner.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sky/utils/command_runner.py b/sky/utils/command_runner.py index c7de2b5b6..e28cbed4d 100644 --- a/sky/utils/command_runner.py +++ b/sky/utils/command_runner.py @@ -394,9 +394,10 @@ def _get_command_to_run( ] if use_login else ['/bin/bash', '-c'] if source_bashrc: command += [ - # Need this `-i` option to make sure `source ~/.bashrc` work. - # Sourcing bashrc may take a few seconds causing overheads. - '-i', + # --- nemo-rl: no interactive shell (login banners pollute output) --- + # `-i` removed: it makes /etc/profile emit /etc/profile.d output, which on + # sites with a login banner lands in the output SkyPilot parses. `--login` + # still supplies /etc/profile. shlex.quote( f'true && source ~/.bashrc && export OMP_NUM_THREADS=1 ' f'PYTHONWARNINGS=ignore && ({cmd})'), From a4206862b28da0f89750011c70968d0ed65840fe Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 05/16] [Slurm] Retry a transient squeue failure instead of cancelling the job slurmctld intermittently fails a query (`slurm_load_job_state: Unable to query jobs state`) and squeue exits non-zero. Raising out of _wait_for_job_nodes declares the provision failed and cancels a healthy PENDING job, losing its accumulated queue priority. Retry the poll. Signed-off-by: Taufeeque --- sky/provision/slurm/instance.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/sky/provision/slurm/instance.py b/sky/provision/slurm/instance.py index 186151f13..0dcc1b6d6 100644 --- a/sky/provision/slurm/instance.py +++ b/sky/provision/slurm/instance.py @@ -200,7 +200,17 @@ def _wait_for_job_nodes( last_state = None while timeout < 0 or time.time() - start_time < timeout: - state = client.get_job_state(job_id) + # --- nemo-rl: transient slurmctld errors must not cancel a queued job --- + # A TRANSIENT slurmctld failure makes `squeue` exit non-zero, which raises + # CommandError. That must NOT abort the wait: the job is still PENDING. Letting it + # propagate tears the provision down and cancels the job. + try: + state = client.get_job_state(job_id) + except exceptions.CommandError as e: + logger.warning(f'Transient error polling Slurm job {job_id} state; ' + f'retrying (job remains queued): {e}') + time.sleep(5) + continue if state != last_state: logger.debug(f'Job {job_id} state: {state}') @@ -228,7 +238,16 @@ def _wait_for_job_nodes( logger.debug(f'Failed to get pending status for job ' f'{job_id}: {e}') - if client.check_job_has_nodes(job_id): + # --- nemo-rl: transient slurmctld guard (node poll) --- + # Same guard as the get_job_state poll above. + try: + has_nodes = client.check_job_has_nodes(job_id) + except exceptions.CommandError as e: + logger.warning(f'Transient error checking nodes for Slurm job {job_id}; ' + f'retrying (job remains queued): {e}') + time.sleep(5) + continue + if has_nodes: logger.debug(f'Job {job_id} has nodes allocated') return From dd77548ad9e9f94fa6e24684c8355feba4878af3 Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 06/16] [Slurm] Retry empty node results right after allocation Immediately after an allocation the compound squeue/scontrol node query can exit 0 with empty stdout during a transient slurmctld failure, and get_job_nodes then raises and tears down the allocation. Retry that narrow query for a bounded interval; persistent failures still raise. Signed-off-by: Taufeeque --- sky/provision/slurm/instance.py | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/sky/provision/slurm/instance.py b/sky/provision/slurm/instance.py index 0dcc1b6d6..3d5f19038 100644 --- a/sky/provision/slurm/instance.py +++ b/sky/provision/slurm/instance.py @@ -257,6 +257,26 @@ def _wait_for_job_nodes( f'{timeout} seconds. Last state: {last_state}') +# --- nemo-rl: retry transient empty node results after allocation --- +def _get_job_nodes_with_retry( + client: 'slurm.SlurmClient', + job_id: str, +) -> Tuple[List[str], List[str]]: + max_attempts = 6 + for attempt in range(1, max_attempts): + try: + return client.get_job_nodes(job_id) + except RuntimeError as e: + if not str(e).startswith(f'No nodes found for job {job_id}.'): + raise + logger.warning(f'Transient error getting nodes for Slurm job {job_id}; ' + f'retrying after allocation (attempt {attempt}/' + f'{max_attempts}): {e}') + time.sleep(POLL_INTERVAL_SECONDS) + # Let the final exception propagate without another warning or sleep. + return client.get_job_nodes(job_id) + + def _sky_cluster_home_dir(base_dir: str, cluster_name_on_cloud: str) -> str: """Returns the SkyPilot cluster's home directory path on the Slurm cluster. @@ -446,7 +466,8 @@ def _on_pending(state: str, reason: Optional[str], # Wait for nodes to be allocated (job might be in PENDING state) _wait_for_job_nodes(client, job_id, provision_timeout, partition, _on_pending) - nodes, _ = client.get_job_nodes(job_id) + # --- nemo-rl: retry node lookup for an existing allocation --- + nodes, _ = _get_job_nodes_with_retry(client, job_id) # Reset spinner since nodes are now allocated rich_utils.force_update_status( ux_utils.spinner_message('Launching', cluster_name=cluster_name)) @@ -730,7 +751,8 @@ def _on_pending(state: str, reason: Optional[str], _wait_for_job_nodes(client, job_id, provision_timeout, partition, _on_pending) - nodes, _ = client.get_job_nodes(job_id) + # --- nemo-rl: retry node lookup for a new allocation --- + nodes, _ = _get_job_nodes_with_retry(client, job_id) # Reset spinner since nodes are now allocated rich_utils.force_update_status( ux_utils.spinner_message('Launching', cluster_name=cluster_name)) From 35eae152662f0d6a1e8c80b4e22d50e955c9ea91 Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 07/16] [Kubernetes] Pin the system Ray to the pod IP on multi-NIC hostNetwork nodes Backport of skypilot-org/skypilot#9924, merged after 0.13.0. Without a node IP, Ray on a hostNetwork node with several NICs can report an interface other than status.podIP, which is what SkyPilot recorded for the node. Signed-off-by: Taufeeque --- sky/provision/instance_setup.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sky/provision/instance_setup.py b/sky/provision/instance_setup.py index 250041351..14caecdaa 100644 --- a/sky/provision/instance_setup.py +++ b/sky/provision/instance_setup.py @@ -380,6 +380,8 @@ def _ray_gpu_options(custom_resource: str) -> str: # vanish when unset, so non-hostNetwork bootstraps defer to Ray's own # defaults. Kept in one place so the head/worker flag sets can't drift. _SHARED_RAY_PORT_FLAGS = ( + # --- nemo-rl: pin system Ray to the Kubernetes pod IP --- + '${SKYPILOT_RAY_NODE_IP:+--node-ip-address=$SKYPILOT_RAY_NODE_IP} ' '--object-manager-port=${SKYPILOT_RAY_OBJECT_MANAGER_PORT:-8076} ' '${SKYPILOT_RAY_NODE_MANAGER_PORT:+' '--node-manager-port=$SKYPILOT_RAY_NODE_MANAGER_PORT} ' From 17bd1bd232e790a2fc3d9bb03af1fcdca894faaf Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 08/16] [Kubernetes] Tolerate unmapped Ray IPs in multi-node rank ordering Backport of skypilot-org/skypilot#9924. The rank sorter looked the reported IP up in the recorded map and crashed (`'<' not supported between 'int' and 'NoneType'`) before the run block started. Signed-off-by: Taufeeque --- sky/backends/task_codegen.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sky/backends/task_codegen.py b/sky/backends/task_codegen.py index abdc3b866..9715964e4 100644 --- a/sky/backends/task_codegen.py +++ b/sky/backends/task_codegen.py @@ -563,7 +563,10 @@ def check_ip(): ]) cluster_ips_to_node_id = {{ip: i for i, ip in enumerate({stable_cluster_internal_ips!r})}} - job_ip_rank_list = sorted(gang_scheduling_id_to_ip, key=cluster_ips_to_node_id.get) + # --- nemo-rl: tolerate multi-NIC Ray IP mismatches --- + job_ip_rank_list = sorted( + gang_scheduling_id_to_ip, + key=lambda ip: (cluster_ips_to_node_id.get(ip, len(cluster_ips_to_node_id)), ip)) job_ip_rank_map = {{ip: i for i, ip in enumerate(job_ip_rank_list)}} job_ip_list_str = '\\n'.join(job_ip_rank_list) """), @@ -656,8 +659,9 @@ def _add_ray_task(self, name_str = '{task_name},' if {task_name!r} != None else 'task,' log_path = os.path.expanduser(os.path.join({log_dir!r}, 'run.log')) else: # Single-node or multi-node task on multi-node cluster - idx_in_cluster = cluster_ips_to_node_id[ip] - if cluster_ips_to_node_id[ip] == 0: + # --- nemo-rl: name an unmapped multi-NIC rank safely --- + idx_in_cluster = cluster_ips_to_node_id.get(ip, len(cluster_ips_to_node_id) + {gang_scheduling_id!r}) + if idx_in_cluster == 0: node_name = 'head' else: node_name = f'worker{{idx_in_cluster}}' From 053dea92712cf4cb7cdd544fe1b976e041321a6b Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 09/16] [Kubernetes] Give the pod IP to the system Ray bootstrap via the downward API Backport of skypilot-org/skypilot#9924: expose status.podIP to the pod so the Ray bootstrap can bind to it. Signed-off-by: Taufeeque --- sky/templates/kubernetes-ray.yml.j2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/sky/templates/kubernetes-ray.yml.j2 b/sky/templates/kubernetes-ray.yml.j2 index b814b2bbc..5e46ac455 100644 --- a/sky/templates/kubernetes-ray.yml.j2 +++ b/sky/templates/kubernetes-ray.yml.j2 @@ -626,6 +626,11 @@ available_node_types: fi {% endif %} env: + # --- nemo-rl: expose status.podIP to the system Ray bootstrap --- + - name: SKYPILOT_RAY_NODE_IP + valueFrom: + fieldRef: + fieldPath: status.podIP - name: SKYPILOT_POD_NODE_TYPE valueFrom: fieldRef: From 1a4f27f92036730cf86e2885cb7858e82ed09bb9 Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 10/16] [Kubernetes] Read HA Deployment readiness without deployments/status RBAC An ordinary Deployment GET already carries .status. Waiting for an HA jobs controller via the dedicated /deployments//status subresource needs a separate RBAC grant that namespaced users often lack, so the Deployment is created and provisioning then fails 403. Signed-off-by: Taufeeque --- sky/provision/kubernetes/instance.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sky/provision/kubernetes/instance.py b/sky/provision/kubernetes/instance.py index ab3eb8906..eabfb1d22 100644 --- a/sky/provision/kubernetes/instance.py +++ b/sky/provision/kubernetes/instance.py @@ -1304,10 +1304,11 @@ def _wait_for_deployment_pod(context, deployment_name = deployment.metadata.name start_time = time.time() while time.time() - start_time < timeout: - # Refresh the deployment status - deployment = kubernetes.apps_api( - context).read_namespaced_deployment_status(deployment_name, - namespace) + # --- nemo-rl: read HA Deployment status through ordinary Deployment RBAC --- + # An ordinary Deployment GET includes `.status` and avoids requiring a + # separate deployments/status RBAC grant. + deployment = kubernetes.apps_api(context).read_namespaced_deployment( + deployment_name, namespace) if (deployment.status and deployment.status.ready_replicas is not None and deployment.status.ready_replicas >= target_replicas): From 0bc4805c09aba71e7a8b720d67874fa3affe5fc5 Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:34 -0700 Subject: [PATCH 11/16] [Kubernetes] Set resources on the HA init-copy-home container Clusters with namespace quotas require CPU and memory requests on every container. The HA-only init container specified neither, so the Deployment controller could not create a Pod. Equal requests and limits keep the Guaranteed QoS; init scheduling uses max(init, app), so the controller Pod's effective request is unchanged. Signed-off-by: Taufeeque --- sky/templates/kubernetes-ray.yml.j2 | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/sky/templates/kubernetes-ray.yml.j2 b/sky/templates/kubernetes-ray.yml.j2 index 5e46ac455..60f3c462c 100644 --- a/sky/templates/kubernetes-ray.yml.j2 +++ b/sky/templates/kubernetes-ray.yml.j2 @@ -1673,6 +1673,14 @@ available_node_types: initContainers: - name: init-copy-home image: {{image_id}} + # --- nemo-rl: resource requests for the HA home-copy init container --- + resources: + requests: + cpu: 100m + memory: 128Mi + limits: + cpu: 100m + memory: 128Mi command: ["/bin/sh", "-c"] args: - | From 0879e47c5652d0ecac75ca2e2c365d8ea949af44 Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:35 -0700 Subject: [PATCH 12/16] [Kubernetes] Honor provision_timeout while waiting for an HA Deployment kubernetes.provision_timeout applied to ordinary Pods, but an HA Deployment was gated by a separate hard-coded 300 s wait. The init container copies the controller home onto durable storage and can legitimately exceed that on a fresh PVC. Pass the configured timeout through, including the documented negative value for an indefinite wait. Signed-off-by: Taufeeque --- sky/provision/kubernetes/instance.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sky/provision/kubernetes/instance.py b/sky/provision/kubernetes/instance.py index eabfb1d22..7147bfa29 100644 --- a/sky/provision/kubernetes/instance.py +++ b/sky/provision/kubernetes/instance.py @@ -1303,7 +1303,8 @@ def _wait_for_deployment_pod(context, target_replicas = deployment.spec.replicas deployment_name = deployment.metadata.name start_time = time.time() - while time.time() - start_time < timeout: + # --- nemo-rl: honor provision_timeout for HA Deployment readiness --- + while timeout < 0 or time.time() - start_time < timeout: # --- nemo-rl: read HA Deployment status through ordinary Deployment RBAC --- # An ordinary Deployment GET includes `.status` and avoids requiring a # separate deployments/status RBAC grant. @@ -1704,9 +1705,12 @@ def _create_resource_thread(i: int): if to_create_deployment: deployments = copy.deepcopy(created_resources) + # --- nemo-rl: pass provision_timeout to HA Deployment readiness --- + deployment_timeout = provider_config['timeout'] pods = [ pod for deployment in deployments - for pod in _wait_for_deployment_pod(context, namespace, deployment) + for pod in _wait_for_deployment_pod( + context, namespace, deployment, timeout=deployment_timeout) ] else: # If not creating deployments, 'created_resources' already holds Pod objects From 79764030356dbaff6b499f02fd5e7111f24805cd Mon Sep 17 00:00:00 2001 From: Taufeeque Date: Tue, 1 Sep 2026 15:30:35 -0700 Subject: [PATCH 13/16] [Build] Vendor the prebuilt dashboard from the 0.13.0 wheel The wheel is built from this branch without npm, and MANIFEST.in ships sky/dashboard/out when present. These files are byte-identical to the PyPI 0.13.0 wheel's. Signed-off-by: Taufeeque --- sky/dashboard/out/404.html | 1 + sky/dashboard/out/[...path].html | 1 + .../CLqXjw8HCPK4_OiqauvBK/_buildManifest.js | 1 + .../CLqXjw8HCPK4_OiqauvBK/_ssgManifest.js | 1 + .../static/chunks/111.ee0ae633bd4cb952.js | 26 +++++ .../static/chunks/192.869abb892841fabb.js | 31 ++++++ .../static/chunks/195-d38091b2de5396cf.js | 11 ++ .../static/chunks/256-426bc47289752b8f.js | 11 ++ .../static/chunks/37-1ceb6ddb802bc6c9.js | 6 ++ .../static/chunks/400.f86a54d1da11a290.js | 46 ++++++++ .../static/chunks/45-c7883b1e5aaf1496.js | 6 ++ .../static/chunks/464-2734b71a6ac0e7ad.js | 26 +++++ .../static/chunks/495.476be8fb9a3add7a.js | 16 +++ .../static/chunks/542-a506bfa12fc1edfb.js | 31 ++++++ .../static/chunks/583.846bef62e026e4d9.js | 11 ++ .../static/chunks/699.132d4816f55d9991.js | 6 ++ .../static/chunks/725.12953dd9757fcf0b.js | 16 +++ .../static/chunks/739-e8580e965e4977a9.js | 8 ++ .../static/chunks/785.667a00e638587b45.js | 1 + .../static/chunks/798-c0525dc3f21e488d.js | 1 + .../static/chunks/824-a6fcebad57a60268.js | 6 ++ .../static/chunks/850-1fe11f1330a693e3.js | 1 + .../static/chunks/872-34e0443f37403e69.js | 16 +++ .../static/chunks/937.72796f7afe54075b.js | 1 + .../static/chunks/940.e8189d1486fccb3d.js | 56 ++++++++++ .../chunks/fd9d1056-2821b0f0cabcd8bd.js | 1 + .../chunks/framework-5c7da2e0e187e3b5.js | 33 ++++++ .../chunks/main-app-241eb28595532291.js | 1 + .../static/chunks/main-e344280b08a651ae.js | 1 + .../pages/[...path]-1543afc4e1acf875.js | 1 + .../chunks/pages/_app-e81a18ce7bb2b32b.js | 99 ++++++++++++++++++ .../chunks/pages/_error-1be831200e60c5c0.js | 1 + .../chunks/pages/clusters-fb9ac2d8e0286647.js | 1 + .../clusters/[cluster]-abf8cbba64ef8931.js | 6 ++ .../[cluster]/[job]-a143688946362ec1.js | 26 +++++ .../chunks/pages/index-b1968f4d2ef3eb1d.js | 1 + .../chunks/pages/infra-67c0322f9748fd7c.js | 1 + .../infra/[...context]-23770245f4e0ca95.js | 1 + .../chunks/pages/jobs-1aa02679b9d045f1.js | 1 + .../pages/jobs/[job]-d97be269ee14957a.js | 36 +++++++ .../jobs/[job]/[task]-ed7b4150ca2349ca.js | 31 ++++++ .../jobs/pools/[pool]-bde81a1c85ce6bae.js | 11 ++ .../plugins/[...slug]-cbefcf06fc65123c.js | 1 + .../chunks/pages/recipes-9194ca654692cb90.js | 1 + .../recipes/[recipe]-43105dd8c6fae621.js | 1 + .../chunks/pages/settings-c4100c1e48c14546.js | 1 + .../pages/settings/config-9e2545ed41da01b3.js | 1 + .../chunks/pages/users-dd08050b3556dfdf.js | 1 + .../chunks/pages/volumes-9766aec66a89cd8c.js | 1 + .../volumes/[volume]-f820ba412386a495.js | 26 +++++ .../pages/workspace/new-d3c28b748a2b6b92.js | 1 + .../pages/workspaces-0355783b8d059299.js | 1 + .../workspaces/[name]-4a292a08afabb882.js | 1 + .../chunks/polyfills-78c92fac7aa8fdd8.js | 1 + .../static/chunks/webpack-45982c64a14663b4.js | 1 + .../out/_next/static/css/b9d558a5c9adf7e4.css | 3 + sky/dashboard/out/clusters.html | 1 + sky/dashboard/out/clusters/[cluster].html | 1 + .../out/clusters/[cluster]/[job].html | 1 + sky/dashboard/out/favicon.ico | Bin 0 -> 93590 bytes sky/dashboard/out/index.html | 1 + sky/dashboard/out/infra.html | 1 + sky/dashboard/out/infra/[...context].html | 1 + sky/dashboard/out/jobs.html | 1 + sky/dashboard/out/jobs/[job].html | 1 + sky/dashboard/out/jobs/[job]/[task].html | 1 + sky/dashboard/out/jobs/pools/[pool].html | 1 + sky/dashboard/out/plugins/[...slug].html | 1 + sky/dashboard/out/recipes.html | 1 + sky/dashboard/out/recipes/[recipe].html | 1 + sky/dashboard/out/routes-manifest.json | 1 + sky/dashboard/out/settings.html | 1 + sky/dashboard/out/settings/config.html | 1 + sky/dashboard/out/skypilot.svg | 15 +++ sky/dashboard/out/users.html | 1 + sky/dashboard/out/videos/cursor-small.mp4 | Bin 0 -> 203285 bytes sky/dashboard/out/volumes.html | 1 + sky/dashboard/out/volumes/[volume].html | 1 + sky/dashboard/out/workspace/new.html | 1 + sky/dashboard/out/workspaces.html | 1 + sky/dashboard/out/workspaces/[name].html | 1 + 81 files changed, 667 insertions(+) create mode 100644 sky/dashboard/out/404.html create mode 100644 sky/dashboard/out/[...path].html create mode 100644 sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_buildManifest.js create mode 100644 sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_ssgManifest.js create mode 100644 sky/dashboard/out/_next/static/chunks/111.ee0ae633bd4cb952.js create mode 100644 sky/dashboard/out/_next/static/chunks/192.869abb892841fabb.js create mode 100644 sky/dashboard/out/_next/static/chunks/195-d38091b2de5396cf.js create mode 100644 sky/dashboard/out/_next/static/chunks/256-426bc47289752b8f.js create mode 100644 sky/dashboard/out/_next/static/chunks/37-1ceb6ddb802bc6c9.js create mode 100644 sky/dashboard/out/_next/static/chunks/400.f86a54d1da11a290.js create mode 100644 sky/dashboard/out/_next/static/chunks/45-c7883b1e5aaf1496.js create mode 100644 sky/dashboard/out/_next/static/chunks/464-2734b71a6ac0e7ad.js create mode 100644 sky/dashboard/out/_next/static/chunks/495.476be8fb9a3add7a.js create mode 100644 sky/dashboard/out/_next/static/chunks/542-a506bfa12fc1edfb.js create mode 100644 sky/dashboard/out/_next/static/chunks/583.846bef62e026e4d9.js create mode 100644 sky/dashboard/out/_next/static/chunks/699.132d4816f55d9991.js create mode 100644 sky/dashboard/out/_next/static/chunks/725.12953dd9757fcf0b.js create mode 100644 sky/dashboard/out/_next/static/chunks/739-e8580e965e4977a9.js create mode 100644 sky/dashboard/out/_next/static/chunks/785.667a00e638587b45.js create mode 100644 sky/dashboard/out/_next/static/chunks/798-c0525dc3f21e488d.js create mode 100644 sky/dashboard/out/_next/static/chunks/824-a6fcebad57a60268.js create mode 100644 sky/dashboard/out/_next/static/chunks/850-1fe11f1330a693e3.js create mode 100644 sky/dashboard/out/_next/static/chunks/872-34e0443f37403e69.js create mode 100644 sky/dashboard/out/_next/static/chunks/937.72796f7afe54075b.js create mode 100644 sky/dashboard/out/_next/static/chunks/940.e8189d1486fccb3d.js create mode 100644 sky/dashboard/out/_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js create mode 100644 sky/dashboard/out/_next/static/chunks/framework-5c7da2e0e187e3b5.js create mode 100644 sky/dashboard/out/_next/static/chunks/main-app-241eb28595532291.js create mode 100644 sky/dashboard/out/_next/static/chunks/main-e344280b08a651ae.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/[...path]-1543afc4e1acf875.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/_app-e81a18ce7bb2b32b.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/_error-1be831200e60c5c0.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/clusters-fb9ac2d8e0286647.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]-abf8cbba64ef8931.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/clusters/[cluster]/[job]-a143688946362ec1.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/index-b1968f4d2ef3eb1d.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/infra-67c0322f9748fd7c.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/infra/[...context]-23770245f4e0ca95.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/jobs-1aa02679b9d045f1.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/jobs/[job]-d97be269ee14957a.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/jobs/[job]/[task]-ed7b4150ca2349ca.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/jobs/pools/[pool]-bde81a1c85ce6bae.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/plugins/[...slug]-cbefcf06fc65123c.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/recipes-9194ca654692cb90.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/recipes/[recipe]-43105dd8c6fae621.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/settings-c4100c1e48c14546.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/settings/config-9e2545ed41da01b3.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/users-dd08050b3556dfdf.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/volumes-9766aec66a89cd8c.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/volumes/[volume]-f820ba412386a495.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/workspace/new-d3c28b748a2b6b92.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/workspaces-0355783b8d059299.js create mode 100644 sky/dashboard/out/_next/static/chunks/pages/workspaces/[name]-4a292a08afabb882.js create mode 100644 sky/dashboard/out/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js create mode 100644 sky/dashboard/out/_next/static/chunks/webpack-45982c64a14663b4.js create mode 100644 sky/dashboard/out/_next/static/css/b9d558a5c9adf7e4.css create mode 100644 sky/dashboard/out/clusters.html create mode 100644 sky/dashboard/out/clusters/[cluster].html create mode 100644 sky/dashboard/out/clusters/[cluster]/[job].html create mode 100644 sky/dashboard/out/favicon.ico create mode 100644 sky/dashboard/out/index.html create mode 100644 sky/dashboard/out/infra.html create mode 100644 sky/dashboard/out/infra/[...context].html create mode 100644 sky/dashboard/out/jobs.html create mode 100644 sky/dashboard/out/jobs/[job].html create mode 100644 sky/dashboard/out/jobs/[job]/[task].html create mode 100644 sky/dashboard/out/jobs/pools/[pool].html create mode 100644 sky/dashboard/out/plugins/[...slug].html create mode 100644 sky/dashboard/out/recipes.html create mode 100644 sky/dashboard/out/recipes/[recipe].html create mode 100644 sky/dashboard/out/routes-manifest.json create mode 100644 sky/dashboard/out/settings.html create mode 100644 sky/dashboard/out/settings/config.html create mode 100755 sky/dashboard/out/skypilot.svg create mode 100644 sky/dashboard/out/users.html create mode 100644 sky/dashboard/out/videos/cursor-small.mp4 create mode 100644 sky/dashboard/out/volumes.html create mode 100644 sky/dashboard/out/volumes/[volume].html create mode 100644 sky/dashboard/out/workspace/new.html create mode 100644 sky/dashboard/out/workspaces.html create mode 100644 sky/dashboard/out/workspaces/[name].html diff --git a/sky/dashboard/out/404.html b/sky/dashboard/out/404.html new file mode 100644 index 000000000..2594fe0e0 --- /dev/null +++ b/sky/dashboard/out/404.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/sky/dashboard/out/[...path].html b/sky/dashboard/out/[...path].html new file mode 100644 index 000000000..99d08075f --- /dev/null +++ b/sky/dashboard/out/[...path].html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_buildManifest.js b/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_buildManifest.js new file mode 100644 index 000000000..63534be08 --- /dev/null +++ b/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_buildManifest.js @@ -0,0 +1 @@ +self.__BUILD_MANIFEST=function(s,c,e,a,t,u,i,n){return{__rewrites:{afterFiles:[],beforeFiles:[],fallback:[]},"/":["static/chunks/pages/index-b1968f4d2ef3eb1d.js"],"/_error":["static/chunks/pages/_error-1be831200e60c5c0.js"],"/clusters":["static/chunks/pages/clusters-fb9ac2d8e0286647.js"],"/clusters/[cluster]":[s,e,c,t,a,u,i,n,"static/chunks/37-1ceb6ddb802bc6c9.js","static/chunks/pages/clusters/[cluster]-abf8cbba64ef8931.js"],"/clusters/[cluster]/[job]":[s,c,"static/chunks/pages/clusters/[cluster]/[job]-a143688946362ec1.js"],"/infra":["static/chunks/pages/infra-67c0322f9748fd7c.js"],"/infra/[...context]":[s,"static/chunks/pages/infra/[...context]-23770245f4e0ca95.js"],"/jobs":["static/chunks/pages/jobs-1aa02679b9d045f1.js"],"/jobs/pools/[pool]":[s,e,"static/chunks/256-426bc47289752b8f.js",c,a,"static/chunks/pages/jobs/pools/[pool]-bde81a1c85ce6bae.js"],"/jobs/[job]":[s,e,c,"static/chunks/pages/jobs/[job]-d97be269ee14957a.js"],"/jobs/[job]/[task]":[s,c,"static/chunks/pages/jobs/[job]/[task]-ed7b4150ca2349ca.js"],"/plugins/[...slug]":[s,"static/chunks/pages/plugins/[...slug]-cbefcf06fc65123c.js"],"/recipes":["static/chunks/pages/recipes-9194ca654692cb90.js"],"/recipes/[recipe]":["static/chunks/pages/recipes/[recipe]-43105dd8c6fae621.js"],"/settings":["static/chunks/pages/settings-c4100c1e48c14546.js"],"/settings/config":["static/chunks/pages/settings/config-9e2545ed41da01b3.js"],"/users":["static/chunks/pages/users-dd08050b3556dfdf.js"],"/volumes":["static/chunks/pages/volumes-9766aec66a89cd8c.js"],"/volumes/[volume]":[s,e,c,"static/chunks/pages/volumes/[volume]-f820ba412386a495.js"],"/workspace/new":["static/chunks/pages/workspace/new-d3c28b748a2b6b92.js"],"/workspaces":["static/chunks/pages/workspaces-0355783b8d059299.js"],"/workspaces/[name]":[s,e,c,t,a,u,i,n,"static/chunks/195-d38091b2de5396cf.js","static/chunks/pages/workspaces/[name]-4a292a08afabb882.js"],"/[...path]":[s,"static/chunks/pages/[...path]-1543afc4e1acf875.js"],sortedPages:["/","/_app","/_error","/clusters","/clusters/[cluster]","/clusters/[cluster]/[job]","/infra","/infra/[...context]","/jobs","/jobs/pools/[pool]","/jobs/[job]","/jobs/[job]/[task]","/plugins/[...slug]","/recipes","/recipes/[recipe]","/settings","/settings/config","/users","/volumes","/volumes/[volume]","/workspace/new","/workspaces","/workspaces/[name]","/[...path]"]}}("static/chunks/739-e8580e965e4977a9.js","static/chunks/850-1fe11f1330a693e3.js","static/chunks/798-c0525dc3f21e488d.js","static/chunks/45-c7883b1e5aaf1496.js","static/chunks/542-a506bfa12fc1edfb.js","static/chunks/872-34e0443f37403e69.js","static/chunks/824-a6fcebad57a60268.js","static/chunks/464-2734b71a6ac0e7ad.js"),self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB(); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_ssgManifest.js b/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_ssgManifest.js new file mode 100644 index 000000000..5b3ff592f --- /dev/null +++ b/sky/dashboard/out/_next/static/CLqXjw8HCPK4_OiqauvBK/_ssgManifest.js @@ -0,0 +1 @@ +self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB() \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/111.ee0ae633bd4cb952.js b/sky/dashboard/out/_next/static/chunks/111.ee0ae633bd4cb952.js new file mode 100644 index 000000000..425cd907c --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/111.ee0ae633bd4cb952.js @@ -0,0 +1,26 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[111,583],{8507:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},1260:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},5134:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},7603:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("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"}]])},8586:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(5893),n=t(7294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[o,i]=(0,n.useState)(!1);if((0,n.useEffect)(()=>{s&&i(!1)},[s]),!s||o)return null;let c="string"==typeof s?s:a(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800 whitespace-pre-wrap",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},5443:function(e,s,t){t.r(s),t.d(s,{Workspaces:function(){return T},getWorkspaceClusters:function(){return J},getWorkspaceManagedJobs:function(){return W}});var r=t(5893),n=t(7294),a=t(1163),l=t(7324),o=t(7673),i=t(8764),c=t(2942),d=t(6990),u=t(803),m=t(5739),h=t(1272),x=t(1360),p=t(3850),g=t(1812),f=t(3626),j=t(1260),w=t(5134),v=t(7603),k=t(470),y=t(3001),b=t(2464),C=t(6378),N=t(1214),Z=t(6856),L=t(7145),E=t(4545),S=t(1428),z=t(3225),D=t(3266),M=t(8969),P=t(1664),R=t.n(P);async function J(e){try{return(await C.ZP.get(D.getClusters)||[]).filter(s=>s.workspace===e)}catch(t){let s="Error fetching clusters for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}async function W(e){try{let s=await C.ZP.get(M.getManagedJobs,[{allUsers:!0,skipFinished:!0}]);return{jobs:((null==s?void 0:s.jobs)||[]).filter(s=>s.workspace===e)}}catch(t){let s="Error fetching managed jobs for workspace ".concat(e,": ").concat(t);throw console.error(s),Error(s)}}let F=e=>{let{isPrivate:s}=e;return s?(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})};function T(){let[e,s]=(0,n.useState)([]),[t,P]=(0,n.useState)({runningClusters:0,totalClusters:0,managedJobs:0}),[J,W]=(0,n.useState)(!0),[T,I]=(0,n.useState)(!0),[O,A]=(0,n.useState)(null),[B,q]=(0,n.useState)(null),[V,H]=(0,n.useState)(!0),[K,_]=(0,n.useState)({key:"name",direction:"asc"}),[U,X]=(0,n.useState)(""),[$,G]=(0,n.useState)(!1),[Q,Y]=(0,n.useState)({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),[ee,es]=(0,n.useState)({open:!1,message:"",userName:""}),[et,er]=(0,n.useState)(null),[en,ea]=(0,n.useState)(!1),[el,eo]=(0,n.useState)(null),[ei,ec]=(0,n.useState)(null),ed=(0,a.useRouter)(),eu=(0,y.X)(),em=async()=>{if(et&&Date.now()-et.timestamp<3e5)return et;ea(!0);try{let e=await L.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,timestamp:Date.now()};return er(t),ea(!1),t}catch(e){throw ea(!1),e}},eh=async(e,s)=>{try{let t=await em();if("admin"!==t.role)return es({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),es({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},ex=(0,n.useCallback)(async(e,t)=>{try{let t=await C.ZP.get(D.getClusters),r={},n=0;e.forEach(e=>{r[e]={totalClusterCount:0,runningClusterCount:0}}),(t||[]).forEach(e=>{let s=e.workspace||"default";r[s]||(r[s]={totalClusterCount:0,runningClusterCount:0}),r[s].totalClusterCount++,("RUNNING"===e.status||"LAUNCHING"===e.status)&&(r[s].runningClusterCount++,n++)}),s(e=>e.map(e=>{var s,t;return{...e,totalClusterCount:(null===(s=r[e.name])||void 0===s?void 0:s.totalClusterCount)||0,runningClusterCount:(null===(t=r[e.name])||void 0===t?void 0:t.runningClusterCount)||0}})),P(e=>({...e,runningClusters:n,totalClusters:(t||[]).length}))}catch(e){console.error("Error fetching clusters:",e)}finally{W(!1)}},[]),ep=(0,n.useCallback)(async e=>{try{let t=await C.ZP.get(M.getManagedJobs,[{allUsers:!0,skipFinished:!0}]),r=(null==t?void 0:t.jobs)||[],n={},a=new Set(b.statusGroups.active),l=0;e.forEach(e=>{n[e]={managedJobsCount:0}}),r.forEach(e=>{let s=e.workspace||"default";n[s]||(n[s]={managedJobsCount:0}),a.has(e.status)&&(n[s].managedJobsCount++,l++)}),s(e=>e.map(e=>{var s;return{...e,managedJobsCount:(null===(s=n[e.name])||void 0===s?void 0:s.managedJobsCount)||0}})),P(e=>({...e,managedJobs:l}))}catch(e){console.error("Error fetching jobs:",e)}finally{I(!1)}},[]),eg=(0,n.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0},{showLoadingIndicators:t=!0}=e;t&&(W(!0),I(!0));try{let e=await C.ZP.get(l.getWorkspaces);A(e);let r=Object.keys(e),n={};try{n=await C.ZP.get(l.getEnabledCloudsBatch,[r])}catch(e){console.error("Error fetching enabled clouds batch:",e)}let a=r.map(e=>({name:e,totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:Array.isArray(n[e])?n[e]:[]})).sort((e,s)=>e.name.localeCompare(s.name));s(a),V&&t&&H(!1);let o=ex(r,n),i=ep(r);await Promise.all([o,i])}catch(e){console.error("Error fetching workspace data:",e),V&&(s([]),P({runningClusters:0,totalClusters:0,managedJobs:0})),t&&(W(!1),I(!1)),V&&t&&H(!1)}},[V,ex,ep]);(0,n.useEffect)(()=>{(async()=>{await Z.ZP.preloadForPage("workspaces"),await eg({showLoadingIndicators:!0}),q(new Date)})();let e=setInterval(()=>{"visible"===window.document.visibilityState&&eg({showLoadingIndicators:!1})},N.nb.REFRESH_INTERVAL);return()=>clearInterval(e)},[eg]);let ef=(0,n.useCallback)(async()=>{(0,S.D8)("refresh"),W(!0),I(!0),C.ZP.invalidate(l.getWorkspaces),C.ZP.invalidateFunction(l.getEnabledCloudsBatch),C.ZP.invalidate(D.getClusters),C.ZP.invalidateFunction(M.getManagedJobs);try{await L.x.fetch("/check",{},"POST"),await eg({showLoadingIndicators:!1}),q(new Date)}catch(e){console.error("Error during sky check refresh:",e)}finally{W(!1),I(!1)}},[eg]);(0,n.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),ef())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[ef]);let ej=e=>{let s="asc";K.key===e&&"asc"===K.direction&&(s="desc"),_({key:e,direction:s})},ew=e=>K.key===e?"asc"===K.direction?" ↑":" ↓":"",ev=n.useMemo(()=>{if(!e)return[];let s=e;if(U&&""!==U.trim()){let t=U.toLowerCase().trim();s=e.filter(e=>!!(e.name.toLowerCase().includes(t)||e.clouds.some(e=>{let s=z.Z2[e.toLowerCase()]||e;return e.toLowerCase().includes(t)||s.toLowerCase().includes(t)}))||!!(!0===((null==O?void 0:O[e.name])||{}).private?"private":"public").includes(t))}return(0,E.R0)(s,K.key,K.direction)},[e,K,U,O]),ek=e=>{(0,S.D8)("delete"),eh("cannot delete workspace",()=>{Y({confirmOpen:!0,workspaceToDelete:e,deleting:!1,error:null})})},ey=async()=>{if(Q.workspaceToDelete){Y(e=>({...e,deleting:!0,error:null}));try{await (0,l.zl)(Q.workspaceToDelete),ec('Workspace "'.concat(Q.workspaceToDelete,'" deleted successfully!')),Y({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null}),C.ZP.invalidate(l.getWorkspaces),C.ZP.invalidate(D.getClusters),C.ZP.invalidateFunction(M.getManagedJobs),await eg({showLoadingIndicators:!0})}catch(e){console.error("Error deleting workspace:",e),Y(e=>({...e,deleting:!1,error:null})),eo(e)}}},eb=()=>{Y({confirmOpen:!1,workspaceToDelete:null,deleting:!1,error:null})},eC=e=>{(0,S.D8)("edit"),eh("cannot edit workspace",()=>{ed.push("/workspaces/".concat(e))})};return V&&0===e.length?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(m.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading workspaces..."})]}):(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[ei&&(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:ei})})]}),(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsxs)("button",{type:"button",onClick:()=>ec(null),className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})]})}),(0,r.jsx)(g.X,{error:el,title:"Error",onDismiss:()=>eo(null)})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2 h-5",children:[(0,r.jsx)("div",{className:"text-base flex items-center",children:(0,r.jsx)("span",{className:"text-sky-blue leading-none",children:"Workspaces"})}),(0,r.jsxs)("div",{className:"flex items-center",children:[(J||T)&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(m.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-xs",children:"Loading..."})]}),!J&&!T&&B&&(0,r.jsx)(k.$3,{timestamp:B,className:"mr-2"}),(0,r.jsxs)("button",{onClick:ef,disabled:J||T,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),!eu&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"relative flex-1 sm:flex-none",children:[(0,r.jsx)("input",{type:"text",placeholder:"Filter workspaces",value:U,onChange:e=>X(e.target.value),className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-0 focus:outline-none"}),U&&(0,r.jsx)("button",{onClick:()=>X(""),className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),(0,r.jsx)("button",{onClick:()=>{(0,S.D8)("create"),eh("cannot create workspace",()=>{ed.push("/workspace/new")})},disabled:en,className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Workspace",children:en?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(m.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{children:"Create Workspace"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j.Z,{className:"h-4 w-4 mr-2"}),"Create Workspace"]})})]}),(0===e.length||(0,d.KL)())&&!V?(0,r.jsx)(o.Zb,{children:(0,r.jsx)(c.u,{icon:(0,r.jsx)(p.E9,{className:"w-5 h-5"}),title:"No workspaces found",description:"Create a workspace to organize your clusters and jobs"})}):(0,r.jsx)(o.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(i.iA,{className:"min-w-full",children:[(0,r.jsx)(i.xD,{children:(0,r.jsxs)(i.SC,{children:[(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ej("name"),children:["Workspace",ew("name")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ej("runningClusterCount"),children:["Running Clusters ",ew("runningClusterCount")]}),(0,r.jsxs)(i.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>ej("managedJobsCount"),children:["Jobs",ew("managedJobsCount")]}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Enabled infra"}),(0,r.jsx)(i.ss,{className:"whitespace-nowrap",children:"Actions"})]})}),(0,r.jsx)(i.RM,{children:V&&0===ev.length?(0,r.jsx)(i.SC,{children:(0,r.jsx)(i.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(m.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):ev.length>0?ev.map(e=>{let s=!0===((null==O?void 0:O[e.name])||{}).private;return(0,r.jsxs)(i.SC,{className:"hover:bg-gray-50",children:[(0,r.jsxs)(i.pj,{className:"",children:[(0,r.jsx)("button",{onClick:()=>eC(e.name),disabled:en,className:"text-blue-600 hover:text-blue-600 hover:underline text-left",children:e.name}),(0,r.jsx)("span",{className:"ml-2",children:(0,r.jsx)(F,{isPrivate:s})})]}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{ed.push({pathname:"/clusters",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-100 text-gray-700 rounded text-sm",children:J?(0,r.jsx)(m.Z,{size:12}):e.runningClusterCount})})}),(0,r.jsx)(i.pj,{children:(0,r.jsx)("button",{onClick:()=>{ed.push({pathname:"/jobs",query:{workspace:e.name}})},className:"text-gray-700 hover:text-blue-600 hover:underline",children:(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 bg-gray-100 text-gray-700 rounded text-sm",children:T?(0,r.jsx)(m.Z,{size:12}):e.managedJobsCount})})}),(0,r.jsx)(i.pj,{children:e.clouds.length>0?[...e.clouds].sort().map((s,t)=>{let n=z.Z2[s.toLowerCase()]||s;return(0,r.jsxs)("span",{children:[(0,r.jsx)(R(),{href:"/infra",className:"inline-flex items-center px-2 py-1 rounded text-sm bg-sky-100 text-sky-800 hover:bg-sky-200 hover:text-sky-900 transition-colors duration-200",children:n}),teC(e.name),disabled:en,className:"text-gray-600 hover:text-gray-800 mr-1",children:(0,r.jsx)(w.Z,{className:"w-4 h-4"})}),(0,r.jsx)(u.z,{variant:"ghost",size:"sm",onClick:()=>ek(e.name),disabled:"default"===e.name||en,title:"default"===e.name?"Cannot delete default workspace":"Delete workspace",className:"text-red-600 hover:text-red-700 hover:bg-red-50",children:(0,r.jsx)(v.Z,{className:"w-4 h-4"})})]})]},e.name)}):(0,r.jsx)(i.Iz,{colSpan:5,icon:(0,r.jsx)(p.E9,{className:"w-5 h-5"}),title:"No workspaces found",description:"Create a workspace to organize your clusters and jobs"})})]})})}),O&&(0,r.jsx)(x.Vq,{open:$,onOpenChange:G,children:(0,r.jsxs)(x.cZ,{className:"sm:max-w-md md:max-w-lg lg:max-w-xl xl:max-w-2xl w-full max-h-[90vh] flex flex-col",children:[(0,r.jsx)(x.fK,{children:(0,r.jsx)(x.$N,{className:"pr-10",children:"All Workspaces Configuration"})}),(0,r.jsx)("div",{className:"flex-grow overflow-y-auto py-4",children:(0,r.jsx)("pre",{style:{backgroundColor:"#f5f5f5",padding:"16px",borderRadius:"8px",overflowX:"auto",whiteSpace:"pre",wordBreak:"normal"},children:h.ZP.dump(O,{indent:2})})})]})}),(0,r.jsx)(x.Vq,{open:ee.open,onOpenChange:e=>{es(s=>({...s,open:e})),e||eo(null)},children:(0,r.jsxs)(x.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(x.fK,{children:[(0,r.jsx)(x.$N,{children:"Permission Denied"}),(0,r.jsx)(x.Be,{children:en?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(m.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:ee.userName?(0,r.jsxs)(r.Fragment,{children:[ee.userName," is logged in as non-admin and ",ee.message,"."]}):ee.message})})]}),(0,r.jsx)(x.cN,{children:(0,r.jsx)(u.z,{variant:"outline",onClick:()=>es(e=>({...e,open:!1})),disabled:en,children:"OK"})})]})}),(0,r.jsx)(x.Vq,{open:Q.confirmOpen,onOpenChange:e=>{e||(eb(),eo(null))},children:(0,r.jsxs)(x.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(x.fK,{children:[(0,r.jsx)(x.$N,{children:"Delete Workspace"}),(0,r.jsxs)(x.Be,{children:['Are you sure you want to delete workspace "',Q.workspaceToDelete,'"? This action cannot be undone.']})]}),(0,r.jsxs)(x.cN,{children:[(0,r.jsx)(u.z,{variant:"outline",onClick:eb,disabled:Q.deleting,children:"Cancel"}),(0,r.jsx)(u.z,{variant:"destructive",onClick:ey,disabled:Q.deleting,children:Q.deleting?"Deleting...":"Delete"})]})]})})]})}N.nb.REFRESH_INTERVAL},3001:function(e,s,t){t.d(s,{X:function(){return n}});var r=t(7294);function n(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let s=()=>{t(window.innerWidth{window.removeEventListener("resize",s)}},[e]),s}},5988:function(e,s,t){t.d(s,{j:function(){return a}});var r=t(5893);t(7294);var n=t(3800);function a(e){let{name:s,context:t={},fallback:a=null,wrapperClassName:l="",prefix:o=null}=e,i=(0,n.dL)(s);return 0===i.length?a:(0,r.jsxs)("div",{className:l||void 0,children:[o,i.map(e=>{let s=e.component;return(0,r.jsx)(s,{...t},e.id)})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/192.869abb892841fabb.js b/sky/dashboard/out/_next/static/chunks/192.869abb892841fabb.js new file mode 100644 index 000000000..cb9f6a905 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/192.869abb892841fabb.js @@ -0,0 +1,31 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[192],{1260:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},7603:function(e,s,t){t.d(s,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("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"}]])},1812:function(e,s,t){t.d(s,{X:function(){return l}});var r=t(5893),a=t(7294);let n=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:t="Error",onDismiss:l}=e,[o,i]=(0,a.useState)(!1);if((0,a.useEffect)(()=>{s&&i(!1)},[s]),!s||o)return null;let c="string"==typeof s?s:n(s);return(0,r.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsxs)("div",{className:"text-sm text-red-800 whitespace-pre-wrap",children:[(0,r.jsxs)("strong",{children:[t,":"]})," ",c]})})]}),(0,r.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,r.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},2192:function(e,s,t){t.r(s),t.d(s,{Users:function(){return eh},getJobGpuCount:function(){return ei}});var r=t(5893),a=t(7294),n=t(5697),l=t.n(n),o=t(5739),i=t(1664),c=t.n(i),d=t(1163),u=t(803),x=t(8764),m=t(3081),h=t(3266),p=t(8969),g=t(6378),f=t(6856),b=t(1214),y=t(4545),j=t(470),v=t(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let w=(0,v.Z)("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"}]]);var N=t(3626),k=t(1260);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let C=(0,v.Z)("EyeOff",[["path",{d:"M9.88 9.88a3 3 0 1 0 4.24 4.24",key:"1jxqfv"}],["path",{d:"M10.73 5.08A10.43 10.43 0 0 1 12 5c7 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68",key:"9wicm4"}],["path",{d:"M6.61 6.61A13.526 13.526 0 0 0 2 12s3 7 10 7a9.74 9.74 0 0 0 5.39-1.61",key:"1jreej"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]),_=(0,v.Z)("Eye",[["path",{d:"M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z",key:"rwhkz3"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);var S=t(6826),R=t(8586);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let E=(0,v.Z)("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);var T=t(282),I=t(3767);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let L=(0,v.Z)("Pen",[["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"}]]),D=(0,v.Z)("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);var Z=t(7603),U=t(8671),P=t(2942),A=t(6990);t(3872);var F=t(3001),z=t(9071),q=t(7673),M=t(7145),O=t(1360),V=t(1812),B=t(2935),K=t(7324);let G="min-w-[80px]";function W(e){let{result:s,idKey:t,idLabel:a}=e;if(!s)return null;let n=s.succeeded||[],l=s.failed||[];return(0,r.jsxs)("div",{className:"space-y-3 py-2 text-sm",children:[(0,r.jsxs)("div",{className:"text-gray-700",children:[(0,r.jsxs)("span",{className:"font-medium text-green-600",children:[n.length," succeeded"]}),l.length>0&&(0,r.jsxs)(r.Fragment,{children:[", ",(0,r.jsxs)("span",{className:"font-medium text-red-600",children:[l.length," failed"]})]}),"."]}),l.length>0&&(0,r.jsxs)("div",{className:"border border-gray-200 rounded-md max-h-48 overflow-y-auto",children:[(0,r.jsx)("div",{className:"px-3 py-2 text-xs font-medium text-gray-700 border-b border-gray-200 bg-gray-50",children:"Failures"}),(0,r.jsx)("ul",{className:"divide-y divide-gray-100",children:l.map((e,s)=>(0,r.jsxs)("li",{className:"px-3 py-2 text-xs text-gray-700",children:[(0,r.jsxs)("span",{className:"font-mono text-gray-500",children:[a,"=",e[t]]}),(0,r.jsx)("span",{className:"ml-2 text-red-600 whitespace-pre-wrap",children:e.error})]},s))})]})]})}function $(e){let{selectedUsers:s,includeRole:t=!1}=e;return(0,r.jsxs)("div",{className:"border border-gray-200 rounded-md",children:[(0,r.jsx)("div",{className:"px-3 py-2 text-xs font-medium text-gray-700 border-b border-gray-200 bg-gray-50",children:t?"Affected users":"Selected users (".concat(s.length,")")}),(0,r.jsx)("div",{className:"max-h-32 overflow-y-auto divide-y divide-gray-100",children:s.map(e=>(0,r.jsxs)("div",{className:"px-3 py-1.5 text-xs text-gray-700 truncate",children:[e.usernameDisplay||e.userId,t&&(0,r.jsxs)("span",{className:"text-gray-400",children:[" (",e.role||"-",")"]})]},e.userId))})]})}function J(e){let{open:s,onClose:t,selectedUsers:n}=e,[l,i]=(0,a.useState)("user"),[c,d]=(0,a.useState)(!1),[x,h]=(0,a.useState)(null),[p,g]=(0,a.useState)(null);(0,a.useEffect)(()=>{s&&(i("user"),d(!1),h(null),g(null))},[s]);let f=async()=>{d(!0),g(null);try{let e=n.map(e=>e.userId),s=await (0,m.Gx)(e,l);h(s)}catch(e){g((null==e?void 0:e.message)||String(e))}finally{d(!1)}},b=x&&(!x.failed||0===x.failed.length);return(0,r.jsx)(O.Vq,{open:s,onOpenChange:e=>{e||c||t(b)},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsxs)(O.$N,{children:["Change role for ",n.length," user(s)"]}),(0,r.jsx)(O.Be,{children:"Apply the selected role to all selected users."})]}),!x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{htmlFor:"batch-role-select",className:"text-sm font-medium text-gray-700",children:"New role"}),(0,r.jsxs)(B.Ph,{value:l,onValueChange:i,disabled:c,children:[(0,r.jsx)(B.i4,{id:"batch-role-select",className:"w-full focus:ring-0 focus:ring-offset-0",children:(0,r.jsx)(B.ki,{placeholder:"Select role"})}),(0,r.jsxs)(B.Bw,{children:[(0,r.jsx)(B.Ql,{value:"admin",children:"Admin"}),(0,r.jsx)(B.Ql,{value:"user",children:"User"})]})]})]}),(0,r.jsx)($,{selectedUsers:n,includeRole:!0}),p&&(0,r.jsx)("div",{className:"text-sm text-red-600",children:p})]}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)(u.z,{variant:"outline",onClick:()=>t(!1),disabled:c,className:G,children:"Cancel"}),(0,r.jsx)(u.z,{variant:"default",onClick:f,disabled:c,className:"bg-sky-600 text-white hover:bg-sky-700 ".concat(G),children:c?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{size:14,className:"mr-2"})," Applying..."]}):"Apply"})]})]}),x&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W,{result:x,idKey:"user_id",idLabel:"user_id"}),(0,r.jsx)(O.cN,{children:(0,r.jsx)(u.z,{variant:"outline",onClick:()=>t(b),className:G,children:"Close"})})]})]})})}function H(e){let{open:s,onClose:t,title:n,description:l,applyLabel:i,selectedUsers:c,variant:d}=e,[x,m]=(0,a.useState)({}),[h,p]=(0,a.useState)(!1),[f,b]=(0,a.useState)(null),[y,j]=(0,a.useState)(new Set),[v,w]=(0,a.useState)(!1),[N,k]=(0,a.useState)(null),[C,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(!s)return;let e=!1;return j(new Set),w(!1),k(null),_(null),p(!0),b(null),g.ZP.get(K.getWorkspaces).then(s=>{e||m(s||{})}).catch(s=>{e||(console.error("Error fetching workspaces:",s),b("Unable to load workspaces. Please try again."))}).finally(()=>{e||p(!1)}),()=>{e=!0}},[s]);let S=(0,a.useMemo)(()=>Object.entries(x).filter(e=>{let[,s]=e;return s&&s.private}).map(e=>{let[s,t]=e;return{name:s,config:t}}).sort((e,s)=>e.name.localeCompare(s.name)),[x]),R=e=>{let s=e.allowed_users||[];return c.filter(e=>s.includes(e.userId)||s.includes(e.username))},E=e=>{let s=new Set(y);s.has(e)?s.delete(e):s.add(e),j(s)},T=async()=>{w(!0),_(null);try{let e;let s=Array.from(y),t=c.map(e=>e.userId);e="add"===d?await (0,K.UR)(s,t):await (0,K.WU)(s,t),g.ZP.invalidate(K.getWorkspaces),k(e)}catch(e){_((null==e?void 0:e.message)||String(e))}finally{w(!1)}},I=N&&(!N.failed||0===N.failed.length);return(0,r.jsx)(O.Vq,{open:s,onOpenChange:e=>{e||v||t(I)},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-lg",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:n}),(0,r.jsx)(O.Be,{children:l})]}),!N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-2",children:[h&&(0,r.jsxs)("div",{className:"flex items-center text-sm text-gray-500",children:[(0,r.jsx)(o.Z,{size:14,className:"mr-2"}),"Loading workspaces..."]}),!h&&f&&(0,r.jsx)("div",{className:"text-sm text-red-600",children:f}),!h&&!f&&0===S.length&&(0,r.jsx)("div",{className:"text-sm text-gray-600 border border-gray-200 rounded-md px-3 py-2 bg-gray-50",children:"No private workspaces are configured. Allowed users only apply to private workspaces."}),!h&&!f&&S.length>0&&(0,r.jsx)("div",{className:"border border-gray-200 rounded-md max-h-64 overflow-y-auto",children:S.map(e=>{let{name:s,config:t}=e,a=y.has(s),n=R(t),l=c.filter(e=>!n.includes(e)),o=e=>e.map(e=>e.usernameDisplay||e.userId).join(", "),i=null;return"add"===d&&(i=0===l.length?"All selected users are already in this workspace (no-op).":0===n.length?"Will add: ".concat(o(l)):"Will add: ".concat(o(l),". Already in: ").concat(o(n))),(0,r.jsxs)("label",{className:"flex items-start gap-3 px-3 py-2 hover:bg-gray-50 border-b border-gray-100 last:border-b-0 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",className:"mt-0.5",checked:a,onChange:()=>E(s),disabled:v}),(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,r.jsx)("div",{className:"text-sm text-gray-700 truncate",children:s}),"remove"===d&&(0,r.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:0===n.length?"No selected user is in this workspace (no-op).":"Will remove: ".concat(o(n))}),"add"===d&&(0,r.jsx)("div",{className:"text-xs text-gray-500 mt-0.5",children:i})]})]},s)})}),(0,r.jsx)($,{selectedUsers:c}),C&&(0,r.jsx)("div",{className:"text-sm text-red-600",children:C})]}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)(u.z,{variant:"outline",onClick:()=>t(!1),disabled:v,className:G,children:"Cancel"}),"remove"===d?(0,r.jsx)(u.z,{variant:"destructive",onClick:T,disabled:v||0===y.size,className:G,children:v?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{size:14,className:"mr-2"})," ","Removing..."]}):i}):(0,r.jsx)(u.z,{variant:"default",onClick:T,disabled:v||0===y.size,className:"bg-sky-600 text-white hover:bg-sky-700 ".concat(G),children:v?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{size:14,className:"mr-2"})," Adding..."]}):i})]})]}),N&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(W,{result:N,idKey:"workspace_name",idLabel:"workspace"}),(0,r.jsx)(O.cN,{children:(0,r.jsx)(u.z,{variant:"outline",onClick:()=>t(I),className:G,children:"Close"})})]})]})})}function Q(e){return(0,r.jsx)(H,{...e,title:"Add ".concat(e.selectedUsers.length," user(s) to workspaces"),description:"Pick the private workspaces to add the selected users to. Only private workspaces are listed because allowed_users has no effect on public workspaces.",applyLabel:"Add",variant:"add"})}function X(e){return(0,r.jsx)(H,{...e,title:"Remove ".concat(e.selectedUsers.length," user(s) from workspaces"),description:"Pick the private workspaces to remove the selected users from. Removal is blocked if a user has active resources in that workspace.",applyLabel:"Remove",variant:"remove"})}W.propTypes={result:l().object,idKey:l().string.isRequired,idLabel:l().string.isRequired},$.propTypes={selectedUsers:l().array.isRequired,includeRole:l().bool},J.propTypes={open:l().bool.isRequired,onClose:l().func.isRequired,selectedUsers:l().array.isRequired},H.propTypes={open:l().bool.isRequired,onClose:l().func.isRequired,title:l().string.isRequired,description:l().string.isRequired,applyLabel:l().string.isRequired,selectedUsers:l().array.isRequired,variant:l().oneOf(["add","remove"]).isRequired},Q.propTypes={open:l().bool.isRequired,onClose:l().func.isRequired,selectedUsers:l().array.isRequired},X.propTypes={open:l().bool.isRequired,onClose:l().func.isRequired,selectedUsers:l().array.isRequired};var Y=t(5988),ee=t(2464),es=t(299),et=t(1428);let er=new Set(ee.statusGroups.active),ea=new Set(["RUNNING","RECOVERING","CANCELLING"]),en=[{label:"Name",value:"name"},{label:"GPU",value:"gpu type"},{label:"Infra",value:"infra"},{label:"User ID",value:"user id"},{label:"Role",value:"role"}],el=(e,s)=>{if(!e)return 0;let t=e;if("string"==typeof e)try{let s=e.replace(/'/g,'"').replace(/None/g,"null");t=JSON.parse(s)}catch(s){return console.error("Failed to parse accelerators string:",e,s),0}if("object"==typeof t&&null!==t){let e=Object.entries(t);return 0===e.length?0:(e.length>1&&console.warn("".concat(s," has ").concat(e.length," accelerator entries:"),t),Number(e[0][1])||0)}return 0},eo=e=>{if(!e||"string"!=typeof e)return 1;let s=e.match(/^(\d+)x/);return s?parseInt(s[1],10):1},ei=e=>e&&ea.has(e.status)?el(e.accelerators,"Job ".concat(e.job_name||e.job_id))*eo(e.resources_str_full):0,ec=async()=>{let[e,s]=await Promise.allSettled([g.ZP.get(h.getClusters),g.ZP.get(p.getManagedJobs,[{allUsers:!0,skipFinished:!0}])]),t="fulfilled"===e.status&&e.value||[],r="fulfilled"===s.status&&s.value||{jobs:[]};return"rejected"===e.status&&console.error("Error fetching clusters:",e.reason),"rejected"===s.status&&console.error("Error fetching managed jobs:",s.reason),{clustersData:t,jobsResponse:r}},ed=(e,s)=>e&&e.includes("@")?e.split("@")[0]:e||"N/A",eu=(e,s)=>e&&e.includes("@")?e:s||"-",ex=b.nb.REFRESH_INTERVAL,em=e=>{let{message:s,onDismiss:t}=e;return s?(0,r.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("div",{className:"flex-shrink-0",children:(0,r.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,r.jsx)("div",{className:"ml-3",children:(0,r.jsx)("p",{className:"text-sm font-medium text-green-800",children:s})})]}),t&&(0,r.jsx)("div",{className:"ml-auto pl-3",children:(0,r.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,r.jsxs)("button",{type:"button",onClick:t,className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,r.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,r.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}):null};function eh(){let e=(0,d.useRouter)(),{userEmail:s}=(0,z.Ap)(),[t,n]=(0,a.useState)(!1),l=(0,a.useRef)(null),i=(0,F.X)(),[c,x]=(0,a.useState)(!1),[f,b]=(0,a.useState)({username:"",password:"",role:"user"}),[y,v]=(0,a.useState)(!1),[R,E]=(0,a.useState)({open:!1,message:"",userName:""}),[T,I]=(0,a.useState)(null),[L,D]=(0,a.useState)(!1),[Z,U]=(0,a.useState)(!1),[P,A]=(0,a.useState)(!1),[q,B]=(0,a.useState)(null),[K,G]=(0,a.useState)(!1),[W,$]=(0,a.useState)(null),[J,H]=(0,a.useState)("import"),[Q,X]=(0,a.useState)(!1),[ee,er]=(0,a.useState)(null),[ea,el]=(0,a.useState)(""),[eo,ei]=(0,a.useState)(!1),[ec,ed]=(0,a.useState)(null),[eu,eh]=(0,a.useState)(!1),[ef,eb]=(0,a.useState)(null),[ey,ej]=(0,a.useState)(null),[ev,ew]=(0,a.useState)(!1),[eN,ek]=(0,a.useState)(null),[eC,e_]=(0,a.useState)(null),[eS,eR]=(0,a.useState)(void 0),[eE,eT]=(0,a.useState)(void 0),[eI,eL]=(0,a.useState)(void 0),[eD,eZ]=(0,a.useState)(void 0),[eU,eP]=(0,a.useState)(!0),[eA,eF]=(0,a.useState)("users"),[ez,eq]=(0,a.useState)(!1),[eM,eO]=(0,a.useState)(!1),[eV,eB]=(0,a.useState)(null),[eK,eG]=(0,a.useState)(!1),[eW,e$]=(0,a.useState)(""),[eJ,eH]=(0,a.useState)(""),[eQ,eX]=(0,a.useState)([]),[eY,e0]=(0,a.useState)({name:[],"user id":[],role:[],"gpu type":[],infra:[]}),[e1,e2]=(0,a.useState)(null),[e4,e5]=(0,a.useState)(()=>{if(e.isReady){let s=e.query.deduplicate;if(void 0!==s)return"true"===s}return!0});(0,a.useEffect)(()=>{if(e.isReady){let t=e.query.deduplicate;if(void 0===t)e3(!s);else{let e="true"===t;e4!==e&&e5(e)}}},[e.isReady,e.query.deduplicate,s]);let e3=s=>{let t={...e.query};t.deduplicate=s.toString(),e.replace({pathname:e.pathname,query:t},void 0,{shallow:!0})},e6=s=>{(0,es.eG)(e,s)},e7=new Map([["name","Name"],["user id","User ID"],["role","Role"],["gpu type","GPU"],["infra","Infra"]]);(0,a.useEffect)(()=>{if(e.isReady&&"users"===eA){let s=(0,es.Fu)(e,e7);s.length>0&&eX(s)}},[e.isReady,eA]),(0,a.useEffect)(()=>{if(e.isReady){let s=e.query.tab;"service-accounts"===s&&eE?eF("service-accounts"):s&&"users"!==s?eF(s):eF("users")}},[e.isReady,e.query.tab,eE]),(0,a.useEffect)(()=>{(async function(){eP(!0);try{let e=await M.x.get("/api/health");if(e.ok){let s=await e.json();eR(!!s.basic_auth_enabled),eT(!!s.service_account_token_enabled),eL(!!s.ingress_basic_auth_enabled),eZ(!!s.external_proxy_auth_enabled)}else eR(!1),eT(!1),eL(!1),eZ(!1)}catch(e){eR(!1),eT(!1),eL(!1),eZ(!1)}finally{eP(!1)}})()},[]);let e8=(0,a.useCallback)(async()=>{if(T&&Date.now()-T.timestamp<3e5)return T;D(!0);try{let e=await M.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),t={role:s.role,name:s.name,id:s.id,timestamp:Date.now()};return I(t),D(!1),t}catch(e){throw D(!1),e}},[T]);(0,a.useEffect)(()=>{e8().catch(()=>{console.error("Failed to get user role")})},[e8]);let e9=async(e,s)=>{try{let t=await e8();if("admin"!==t.role)return E({open:!0,message:e,userName:t.name.toLowerCase()}),!1;return s(),!0}catch(e){return console.error("Failed to check user role:",e),E({open:!0,message:"Error: ".concat(e.message),userName:""}),!1}},se=()=>{(0,et.Vc)("refresh"),g.ZP.invalidate(m.Rf),g.ZP.invalidate(h.getClusters),g.ZP.invalidate(p.getManagedJobs,[{allUsers:!0,skipFinished:!0}]),l.current&&l.current()};(0,a.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),e.stopPropagation(),se())};return document.addEventListener("keydown",e,!0),()=>{document.removeEventListener("keydown",e,!0)}},[]);let ss=async()=>{if(!f.username||!f.password){e_(Error("Username and password are required.")),x(!1);return}(0,et.Vc)("create"),v(!0),e_(null),ek(null);try{let e=await M.x.post("/users/create",f);if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to create user")}ek('User "'.concat(f.username,'" created successfully!')),x(!1),b({username:"",password:"",role:"user"}),se()}catch(e){e_(e),x(!1),b({username:"",password:"",role:"user"})}finally{v(!1)}},st=async e=>{let s=e.target.files[0];s&&(B(s),$(null))},sr=async()=>{if(!q){alert("Please select a CSV file first.");return}G(!0);try{let e=new FileReader;e.onload=async e=>{try{let s=e.target.result,t=await M.x.post("/users/import",{csv_content:s});if(!t.ok){let e=await t.json();throw Error(e.detail||"Failed to import users")}let r=await t.json(),a="Import completed. ".concat(r.success_count," users created successfully.");r.error_count>0&&(a+="\n".concat(r.error_count," failed."),r.creation_errors.length>0&&(a+="\nErrors: ".concat(r.creation_errors.slice(0,3).join(", ")),r.creation_errors.length>3&&(a+=" and ".concat(r.creation_errors.length-3," more...")))),$({message:a}),r.success_count>0&&se()}catch(e){alert("Error importing users: ".concat(e.message))}finally{G(!1)}},e.readAsText(q)}catch(e){alert("Error reading file: ".concat(e.message)),G(!1)}},sa=async e=>{er(e),el(""),X(!0)},sn=async()=>{if(!ea){e_(Error("Please enter a new password."));return}ei(!0),ed(null);try{let e=await M.x.post("/users/update",{user_id:ee.userId,password:ea});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to reset password")}ek('Password reset successfully for user "'.concat(ee.usernameDisplay,'"!')),X(!1),er(null),el("")}catch(e){X(!1),er(null),el(""),ed(null),e_(e)}finally{ei(!1)}},sl=async()=>{if(ef){ew(!0),ej(null);try{let e=await M.x.post("/users/delete",{user_id:ef.userId});if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to delete user")}ek('User "'.concat(ef.usernameDisplay,'" deleted successfully!')),eh(!1),eb(null),se()}catch(e){eh(!1),eb(null),ej(null),e_(e)}finally{ew(!1)}}},so=()=>{eh(!1),eb(null)},si=()=>{X(!1),er(null),el("")},sc=(0,a.useCallback)(s=>{(0,et.Vc)("tab_change",{tab:s}),eF(s),"users"===s?e.push("/users",void 0,{shallow:!0}):e.push("/users?tab=".concat(s),void 0,{shallow:!0})},[e]);return eU?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(o.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,r.jsxs)("div",{className:"text-base flex items-center",children:[(0,r.jsx)("button",{className:"leading-none mr-6 pb-2 px-2 border-b-2 ".concat("users"===eA?"text-sky-blue border-sky-500":"text-gray-500 hover:text-gray-700 border-transparent"),onClick:()=>sc("users"),children:"Users"}),eE&&(0,r.jsx)("button",{className:"leading-none mr-6 pb-2 px-2 border-b-2 ".concat("service-accounts"===eA?"text-sky-blue border-sky-500":"text-gray-500 hover:text-gray-700 border-transparent"),onClick:()=>sc("service-accounts"),children:"Service Accounts"}),(0,r.jsx)(Y.j,{name:"users.tabs",context:{activeTab:eA,onTabChange:sc},wrapperClassName:"contents"})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[t&&(0,r.jsxs)("div",{className:"flex items-center mr-2",children:[(0,r.jsx)(o.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),"users"===eA&&eS&&(null==T?void 0:T.role)==="admin"&&(0,r.jsx)("button",{onClick:async()=>{await e9("cannot create users",()=>{x(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center rounded px-2 py-1 mr-2",title:"Create New User",children:"+ New User"}),"users"===eA&&eS&&(null==T?void 0:T.role)==="admin"&&(0,r.jsxs)("button",{onClick:async()=>{await e9("cannot import users",()=>{A(!0)})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center rounded px-2 py-1 mr-2",title:"Import/Export Users",children:[(0,r.jsx)(w,{className:"h-4 w-4 mr-1"}),"Import/Export"]}),!t&&e1&&(0,r.jsx)(j.$3,{timestamp:e1,className:"mr-2"}),(0,r.jsxs)("button",{onClick:se,disabled:t,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,r.jsx)(N.Z,{className:"h-4 w-4 mr-1.5"}),!i&&(0,r.jsx)("span",{children:"Refresh"})]})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:["users"===eA?(0,r.jsx)("div",{className:"w-full sm:w-auto max-w-xl",children:(0,r.jsx)(es.ML,{propertyList:en,valueList:eY,setFilters:eX,updateURLParams:e6,onFilterAdd:(e,s)=>(0,et.ZY)("user",{property:e,value:s}),placeholder:"Filter users"})}):"service-accounts"===eA?(0,r.jsxs)("div",{className:"relative flex-1 max-w-md",children:[(0,r.jsx)("input",{type:"text",placeholder:"Search by service account name, or created by",value:eJ,onChange:e=>{eH(e.target.value)},className:"h-8 w-full px-3 pr-8 text-sm border border-gray-300 rounded-md focus:ring-1 focus:ring-sky-500 focus:border-sky-500 outline-none"}),eJ&&(0,r.jsx)("button",{onClick:()=>{eH("")},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear search",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}):(0,r.jsx)(Y.j,{name:"users.tab-filter",context:{activeTab:eA},wrapperClassName:"contents"}),"users"===eA&&!s&&(0,r.jsxs)("label",{className:"flex items-center cursor-pointer ml-4",children:[(0,r.jsx)("input",{type:"checkbox",checked:e4,onChange:e=>{let s=e.target.checked;e5(s),e3(s)},className:"sr-only"}),(0,r.jsx)("div",{className:"relative inline-flex h-5 w-9 items-center rounded-full transition-colors ".concat(e4?"bg-sky-600":"bg-gray-300"),children:(0,r.jsx)("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white transition-transform ".concat(e4?"translate-x-5":"translate-x-1")})}),(0,r.jsx)("span",{className:"ml-2 text-sm text-gray-700",children:"Deduplicate users"})]}),"users"===eA&&(0,r.jsx)(Y.j,{name:"users.actions"}),"service-accounts"===eA&&eE&&(0,r.jsxs)("button",{onClick:()=>{e9("cannot create service account tokens",()=>{eq(!0)})},className:"ml-4 bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"Create Service Account",children:[(0,r.jsx)(k.Z,{className:"h-4 w-4 mr-2"}),"Create Service Account"]})]}),"users"===eA&&(0,r.jsx)(es.x$,{filters:eQ,setFilters:eX,updateURLParams:e6}),(0,r.jsxs)("div",{className:"fixed top-20 right-4 z-[9999] max-w-md",children:[(0,r.jsx)(em,{message:eN,onDismiss:()=>ek(null)}),(0,r.jsx)(V.X,{error:eC,title:"Error",onDismiss:()=>e_(null)})]}),"users"===eA?(0,r.jsx)(ep,{refreshInterval:ex,setLoading:n,refreshDataRef:l,checkPermissionAndAct:e9,roleLoading:L,onResetPassword:sa,onDeleteUser:e=>{(0,et.Vc)("delete"),e9("cannot delete users",()=>{eb(e),eh(!0)})},basicAuthEnabled:eS,ingressBasicAuthEnabled:eI,externalProxyAuthEnabled:eD,currentUserRole:null==T?void 0:T.role,currentUserId:null==T?void 0:T.id,filters:eQ,setValueList:e0,deduplicateUsers:e4,setLastFetchedTime:e2,setCreateError:e_}):"service-accounts"===eA?eE&&(0,r.jsx)(eg,{checkPermissionAndAct:e9,userRoleCache:T,setCreateSuccess:ek,setCreateError:e_,showCreateDialog:ez,setShowCreateDialog:eq,showRotateDialog:eM,setShowRotateDialog:eO,tokenToRotate:eV,setTokenToRotate:eB,rotating:eK,setRotating:eG,searchQuery:eJ,setSearchQuery:eH}):(0,r.jsx)(Y.j,{name:"users.tab-content",context:{activeTab:eA}}),(0,r.jsx)(O.Vq,{open:c,onOpenChange:e=>{x(e),e||e_(null)},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md",children:[(0,r.jsx)(O.fK,{children:(0,r.jsx)(O.$N,{children:"Create User"})}),(0,r.jsxs)("div",{className:"flex flex-col gap-4 py-4",children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Username"}),(0,r.jsx)("input",{className:"border rounded px-3 py-2 w-full",placeholder:"Username",value:f.username,onChange:e=>b({...f,username:e.target.value})})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Password"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("input",{className:"border rounded px-3 py-2 w-full pr-10",placeholder:"Password",type:Z?"text":"password",value:f.password,onChange:e=>b({...f,password:e.target.value})}),(0,r.jsx)("button",{type:"button",className:"absolute inset-y-0 right-0 pr-3 flex items-center text-gray-400 hover:text-gray-600",onClick:()=>U(!Z),children:Z?(0,r.jsx)(C,{className:"h-4 w-4"}):(0,r.jsx)(_,{className:"h-4 w-4"})})]})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Role"}),(0,r.jsxs)("select",{className:"border rounded px-3 py-2 w-full",value:f.role,onChange:e=>b({...f,role:e.target.value}),children:[(0,r.jsx)("option",{value:"user",children:"User"}),(0,r.jsx)("option",{value:"admin",children:"Admin"})]})]})]}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>x(!1),disabled:y,children:"Cancel"}),(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:ss,disabled:y,children:y?"Creating...":"Create"})]})]})}),(0,r.jsx)(O.Vq,{open:R.open,onOpenChange:e=>{E(s=>({...s,open:e})),e||e_(null)},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md transition-all duration-200 ease-in-out",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Permission Denied"}),(0,r.jsx)(O.Be,{children:L?(0,r.jsxs)("div",{className:"flex items-center py-2",children:[(0,r.jsx)(o.Z,{size:16,className:"mr-2"}),(0,r.jsx)("span",{children:"Checking permissions..."})]}):(0,r.jsx)(r.Fragment,{children:R.userName?(0,r.jsxs)(r.Fragment,{children:[R.userName," is logged in as non-admin and ",R.message,"."]}):R.message})})]}),(0,r.jsx)(O.cN,{children:(0,r.jsx)(u.z,{variant:"outline",onClick:()=>E(e=>({...e,open:!1})),disabled:L,children:"OK"})})]})}),(0,r.jsx)(O.Vq,{open:P,onOpenChange:e=>{A(e),e||e_(null)},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-lg",children:[(0,r.jsx)(O.fK,{children:(0,r.jsx)(O.$N,{children:"Import/Export Users"})}),(0,r.jsxs)("div",{className:"flex border-b border-gray-200 mb-4",children:[(0,r.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("import"===J?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>H("import"),children:"Import"}),(0,r.jsx)("button",{className:"px-4 py-2 text-sm font-medium ".concat("export"===J?"border-b-2 border-sky-500 text-sky-600":"text-gray-500 hover:text-gray-700"),onClick:()=>H("export"),children:"Export"})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:"import"===J?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"CSV File"}),(0,r.jsx)("input",{type:"file",accept:".csv",onChange:st,className:"border rounded px-3 py-2 w-full"}),(0,r.jsxs)("p",{className:"text-xs text-gray-500",children:["CSV should have columns: username, password, role",(0,r.jsx)("br",{}),"Supports both plain text passwords and exported password hashes."]})]}),W&&(0,r.jsx)("div",{className:"p-3 bg-green-50 border border-green-200 rounded text-green-700 text-sm",children:W.message})]}):(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Export Users to CSV"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Download all users as a CSV file with password hashes."}),(0,r.jsxs)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:[(0,r.jsx)("p",{className:"text-sm text-amber-700",children:"⚠️ This will export all users with columns: username, password (hashed), role"}),(0,r.jsx)("p",{className:"text-xs text-amber-600 mt-1",children:"Password hashes can be imported directly for system backups."})]})]})})}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>A(!1),disabled:K,children:"Cancel"}),"import"===J?(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:sr,disabled:K||!q,children:K?"Importing...":"Import"}):(0,r.jsxs)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:async()=>{try{let e=await M.x.get("/users/export");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to export users")}let s=await e.json(),t=s.csv_content,r=new Blob([t],{type:"text/csv;charset=utf-8;"}),a=URL.createObjectURL(r),n=document.createElement("a");n.href=a;let l=new Date,o=e=>String(e).padStart(2,"0"),i=l.getFullYear(),c=o(l.getMonth()+1),d=o(l.getDate()),u=o(l.getHours()),x=o(l.getMinutes()),m=o(l.getSeconds());n.download="users_export_".concat(i,"-").concat(c,"-").concat(d,"-").concat(u,"-").concat(x,"-").concat(m,".csv"),n.click(),URL.revokeObjectURL(a),(0,et.Vc)("export_csv",{user_count:s.user_count,filename:n.download}),alert("Successfully exported ".concat(s.user_count," users to CSV file."))}catch(e){alert("Error exporting users: ".concat(e.message))}},children:[(0,r.jsx)(S.Z,{className:"h-4 w-4 mr-1"}),"Export"]})]})]})}),(0,r.jsx)(O.Vq,{open:Q,onOpenChange:e=>{e||(si(),e_(null))},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Reset Password"}),(0,r.jsxs)(O.Be,{children:["Enter a new password for"," ",(null==ee?void 0:ee.usernameDisplay)||"this user","."]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"New Password"}),(0,r.jsx)("input",{type:"password",className:"border rounded px-3 py-2 w-full",placeholder:"Enter new password",value:ea,onChange:e=>el(e.target.value),autoFocus:!0})]})}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)(u.z,{variant:"outline",onClick:si,disabled:eo,children:"Cancel"}),(0,r.jsx)(u.z,{variant:"default",onClick:sn,disabled:eo||!ea,className:"bg-sky-600 text-white hover:bg-sky-700",children:eo?"Resetting...":"Reset Password"})]})]})}),(0,r.jsx)(O.Vq,{open:eu,onOpenChange:e=>{e||(so(),e_(null))},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Delete User"}),(0,r.jsxs)(O.Be,{children:['Are you sure you want to delete user "',(null==ef?void 0:ef.usernameDisplay)||"this user",'"? This action cannot be undone.']})]}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)(u.z,{variant:"outline",onClick:so,disabled:ev,children:"Cancel"}),(0,r.jsx)(u.z,{variant:"destructive",onClick:sl,disabled:ev,children:ev?"Deleting...":"Delete"})]})]})})]})}function ep(e){let{refreshInterval:s,setLoading:t,refreshDataRef:n,checkPermissionAndAct:l,roleLoading:i,onResetPassword:d,onDeleteUser:u,basicAuthEnabled:h,ingressBasicAuthEnabled:p,externalProxyAuthEnabled:b,currentUserRole:v,currentUserId:w,filters:N,setValueList:C,deduplicateUsers:_,setLastFetchedTime:S,setCreateError:U}=e,[F,z]=(0,a.useState)([]),[O,V]=(0,a.useState)(!0),[B,K]=(0,a.useState)(!1),[G,W]=(0,a.useState)({key:"default",direction:"descending"}),[$,H]=(0,a.useState)(null),[Y,ee]=(0,a.useState)(""),[et,ea]=(0,a.useState)(new Set),[en,eo]=(0,a.useState)(null),[ex,em]=(0,a.useState)({}),[eh,ep]=(0,a.useState)(!1),eg=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];t&&e&&t(!0),e&&V(!0),ep(!1);try{let s=await g.ZP.get(m.Rf),r=(s||[]).map(e=>({...e,usernameDisplay:ed(e.username,e.userId),fullEmailID:eu(e.username,e.userId),clusterCount:-1,jobCount:-1,gpuCount:-1}));z(r),K(!0),t&&e&&t(!1),e&&V(!1);let{clustersData:a,jobsResponse:n}=await ec(),l=n.jobs||[],o={},i=e=>{if(!e)return null;let s=e;if("string"==typeof e)try{let t=e.replace(/'/g,'"').replace(/None/g,"null");s=JSON.parse(t)}catch(e){return null}if("object"==typeof s&&null!==s){let e=Object.entries(s);if(e.length>0)return e[0][0]}return null},c=(e,s,t,r,a,n)=>{e&&s&&(o[e]||(o[e]={}),o[e][s]||(o[e][s]={}),o[e].Total||(o[e].Total={}),o[e][s].Total||(o[e][s].Total={clusterCount:0,jobCount:0,gpuCount:0}),o[e][s].Total.clusterCount+=r,o[e][s].Total.jobCount+=a,o[e][s].Total.gpuCount+=n,t&&(o[e][s][t]||(o[e][s][t]={clusterCount:0,jobCount:0,gpuCount:0}),o[e][s][t].clusterCount+=r,o[e][s][t].jobCount+=a,o[e][s][t].gpuCount+=n,o[e].Total[t]||(o[e].Total[t]={clusterCount:0,jobCount:0,gpuCount:0}),o[e].Total[t].clusterCount+=r,o[e].Total[t].jobCount+=a,o[e].Total[t].gpuCount+=n))};for(let e of a||[]){let s=e.user_hash;if(!s)continue;let t=i(e.gpus),r=e.infra,a=0;if("STOPPED"!==e.status&&"TERMINATED"!==e.status){let s=el(e.gpus,"Cluster ".concat(e.cluster)),t=e.num_nodes||1;a=s*t}c(s,r,t,1,0,a)}for(let e of l||[]){if(!er.has(e.status))continue;let s=e.user_hash;if(!s)continue;let t=i(e.accelerators),r=e.infra,a=ei(e);c(s,r,t,0,1,a)}em(o),ep(!0);let d=(s||[]).map(e=>{let s=0,t=0,r=0,n=0;for(let r of a||[])if(r.user_hash===e.userId&&(s++,"STOPPED"!==r.status&&"TERMINATED"!==r.status)){let e=el(r.gpus,"Cluster ".concat(r.cluster)),s=r.num_nodes||1;t+=e*s}for(let s of l||[])s.user_hash===e.userId&&er.has(s.status)&&(r++,n+=ei(s));return{...e,usernameDisplay:ed(e.username,e.userId),fullEmailID:eu(e.username,e.userId),clusterCount:s,jobCount:r,gpuCount:t+n}}),u=new Set,x=new Set;for(let e of Object.values(o)){for(let s of Object.keys(e))"Total"!==s&&u.add(s);if(e.Total)for(let s of Object.keys(e.Total))x.add(s)}let h=new Set,p=new Set,f=new Set;d.forEach(e=>{e.usernameDisplay&&h.add(e.usernameDisplay),e.userId&&p.add(e.userId),e.role&&f.add(e.role)}),C({name:Array.from(h).sort(),"user id":Array.from(p).sort(),role:Array.from(f).sort(),"gpu type":Array.from(x).sort(),infra:Array.from(u).sort()}),z(d)}catch(s){console.error("Failed to fetch or process user data:",s),z([]),K(!0),t&&e&&t(!1),e&&V(!1)}finally{S&&S(new Date)}},[t,S]);(0,a.useEffect)(()=>{n&&(n.current=()=>eg(!0))},[n,eg]),(0,a.useEffect)(()=>{(async()=>{K(!1),V(!0),await f.ZP.preloadForPage("users"),eg(!0)})();let e=setInterval(()=>{"visible"===window.document.visibilityState&&eg(!1)},s);return()=>clearInterval(e)},[eg,s]);let ef=(0,a.useMemo)(()=>{let e=F,s=N.filter(e=>"GPU"!==e.property&&"Infra"!==e.property),t=N.filter(e=>"GPU"===e.property),r=N.filter(e=>"Infra"===e.property);s.length>0&&(e=(0,es.cm)(F.map(e=>({...e,name:e.usernameDisplay,"user id":e.userId})),s));let a=(e,s,t)=>{let r=0,a=0,n=0,l=ex[e];if(!l)return{clusterCount:0,jobCount:0,gpuCount:0};let o=s.map(e=>e.toLowerCase()),i=t.map(e=>e.toLowerCase()),c=o.length>0,d=i.length>0;if(c&&d){for(let e of i)for(let[s,t]of Object.entries(l))if("Total"!==s&&s.toLowerCase()===e)for(let e of o)for(let[s,l]of Object.entries(t))"Total"!==s&&s.toLowerCase()===e&&(r+=l.clusterCount,a+=l.jobCount,n+=l.gpuCount)}else if(d){for(let e of i)for(let[s,t]of Object.entries(l))if("Total"!==s&&s.toLowerCase()===e&&t.Total){let e=t.Total;r+=e.clusterCount,a+=e.jobCount,n+=e.gpuCount}}else if(c&&l.Total)for(let e of o)for(let[s,t]of Object.entries(l.Total))s.toLowerCase()===e&&(r+=t.clusterCount,a+=t.jobCount,n+=t.gpuCount);return{clusterCount:r,jobCount:a,gpuCount:n}},n=t.length>0,l=r.length>0;if(n||l){let s=t.map(e=>e.value).filter(Boolean),o=r.map(e=>e.value).filter(Boolean),i=s.map(e=>e.toLowerCase()),c=o.map(e=>e.toLowerCase());e=(e=e.filter(e=>{let s=ex[e.userId];if(!s)return!1;if(n&&l){for(let e of c)for(let[t,r]of Object.entries(s))if("Total"!==t&&t.toLowerCase()===e){for(let e of i)for(let s of Object.keys(r))if("Total"!==s&&s.toLowerCase()===e)return!0}}else if(l){for(let e of c)for(let t of Object.keys(s))if("Total"!==t&&t.toLowerCase()===e)return!0}else if(n&&s.Total){for(let e of i)for(let t of Object.keys(s.Total))if(t.toLowerCase()===e)return!0}return!1})).map(e=>{let t=a(e.userId,s,o);return{...e,clusterCount:t.clusterCount,jobCount:t.jobCount,gpuCount:t.gpuCount}})}if(_){let s={};e.forEach(e=>{let t=e.usernameDisplay;s[t]?(s[t].userIds.push(e.userId),-1!==e.clusterCount&&(-1===s[t].clusterCount?s[t].clusterCount=e.clusterCount:s[t].clusterCount+=e.clusterCount),-1!==e.jobCount&&(-1===s[t].jobCount?s[t].jobCount=e.jobCount:s[t].jobCount+=e.jobCount),-1!==e.gpuCount&&(-1===s[t].gpuCount?s[t].gpuCount=e.gpuCount:s[t].gpuCount+=e.gpuCount),e.created_at&&(!s[t].created_at||e.created_at{let t=(null!=e?e:"").toString().toLowerCase(),r=(null!=s?s:"").toString().toLowerCase();return tr?1:0},t=(e,s)=>(null!=e?e:0)-(null!=s?s:0);return[...e].sort((e,r)=>{let a=t(r.gpuCount,e.gpuCount);if(0!==a)return a;let n=t(r.clusterCount,e.clusterCount);if(0!==n)return n;let l=t(r.jobCount,e.jobCount);if(0!==l)return l;let o=t(r.created_at,e.created_at);return 0!==o?o:s(e.usernameDisplay,r.usernameDisplay)})}return(0,y.R0)(e,G.key,G.direction)},[F,G,N,_,ex]),eb=e=>{let s="ascending";G.key===e&&"ascending"===G.direction&&(s="descending"),W({key:e,direction:s})},ey=e=>G.key===e?"ascending"===G.direction?" ↑":" ↓":"",ej=async(e,s)=>{await l("cannot edit user role",()=>{H(e),ee(s)})},ev=()=>{H(null),ee("")},ew=async e=>{if(!e||!Y){console.error("User ID or role is missing."),U(Error("User ID or role is missing."));return}V(!0);try{let s=await M.x.post("/users/update",{user_id:e,role:Y});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to update role")}g.ZP.invalidate(m.Rf),await eg(!0),ev()}catch(e){console.error("Failed to update user role:",e),ev(),U(e)}finally{V(!1)}},eN=(0,a.useMemo)(()=>(ef||[]).filter(e=>"system"!==e.userType),[ef]),ek=eN.length>0&&eN.every(e=>et.has(e.userId)),eC=!ek&&eN.some(e=>et.has(e.userId)),e_="admin"===v&&!_&&!p,eS=e=>{let s=new Set(et);s.has(e)?s.delete(e):s.add(e),ea(s)},eR=()=>ea(new Set),[eE,eT]=(0,a.useState)(!1),eI=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(0===et.size)return;let e=e=>{"Escape"===e.key&&(eE?eT(!1):eR())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[et.size,eE]),(0,a.useEffect)(()=>{if(!eE)return;let e=e=>{eI.current&&!eI.current.contains(e.target)&&eT(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[eE]);let eL=async e=>{eo(null),e?(eR(),g.ZP.invalidate(m.Rf),await eg(!0)):(g.ZP.invalidate(m.Rf),await eg(!1))},eD=async e=>{await l("cannot perform bulk ".concat(e," on users"),()=>eo(e))},eZ=(0,a.useMemo)(()=>(F||[]).filter(e=>et.has(e.userId)),[F,et]);return O&&0===F.length&&!B?(0,r.jsx)("div",{className:"flex justify-center items-center h-64",children:(0,r.jsx)(o.Z,{})}):B?N.some(e=>"GPU"===e.property||"Infra"===e.property)&&!eh?(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(o.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading filtered data..."})]}):!ef||0===ef.length||(0,A.KL)()?(0,r.jsx)(q.Zb,{children:(0,r.jsx)(P.u,{icon:(0,r.jsx)(R.Z,{size:20,strokeWidth:1.75}),title:N.length>0?"No users match your filters":"No users found",description:N.length>0?"Try adjusting your filters":"Add a user to grant them access"})}):(0,r.jsxs)(r.Fragment,{children:[ef.length>0&&(0,r.jsxs)("div",{className:"text-sm text-gray-500 mb-2",children:[ef.length," ",1===ef.length?"user":"users"]}),e_&&(0,r.jsx)("div",{className:"fixed bottom-6 left-1/2 -translate-x-1/2 z-30 transition-all duration-200 ease-out ".concat(et.size>0?"opacity-100 translate-y-0":"opacity-0 translate-y-[200%] pointer-events-none"),role:"region","aria-label":"Batch user actions","aria-hidden":0===et.size,children:(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 bg-white border border-gray-200 shadow-lg rounded-full",children:[(0,r.jsxs)("div",{className:"text-sm text-gray-700 whitespace-nowrap",children:[(0,r.jsx)("span",{className:"font-medium text-sky-blue",children:et.size})," ","selected"]}),(0,r.jsx)("button",{type:"button",onClick:eR,className:"text-sm text-sky-blue hover:text-sky-blue-bright underline whitespace-nowrap",children:"Clear"}),(0,r.jsx)("div",{className:"h-5 w-px bg-gray-200","aria-hidden":"true"}),(0,r.jsx)("button",{type:"button",onClick:()=>eD("role"),disabled:i,className:"bg-sky-600 hover:bg-sky-700 text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap",children:"Role"}),(0,r.jsxs)("div",{className:"relative",ref:eI,children:[(0,r.jsxs)("button",{type:"button",onClick:()=>eT(e=>!e),disabled:i,"aria-haspopup":"menu","aria-expanded":eE,className:"bg-sky-600 hover:bg-sky-700 text-white inline-flex items-center gap-1 rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed whitespace-nowrap",children:[(0,r.jsx)("span",{children:"Workspaces"}),(0,r.jsx)("svg",{className:"w-3.5 h-3.5 transition-transform ".concat(eE?"rotate-180":""),fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})]}),eE&&(0,r.jsxs)("div",{role:"menu",className:"absolute bottom-full right-0 mb-2 bg-white rounded-lg shadow-xl border border-gray-200 z-40 py-1.5 px-1",children:[(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eT(!1),eD("add")},className:"flex items-center gap-2.5 w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50 rounded transition-colors whitespace-nowrap",children:[(0,r.jsx)(k.Z,{className:"h-4 w-4 text-gray-500 flex-shrink-0"}),(0,r.jsx)("span",{children:"Add to workspaces"})]}),(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>{eT(!1),eD("remove")},className:"flex items-center gap-2.5 w-full text-left px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-50 rounded transition-colors whitespace-nowrap",children:[(0,r.jsx)(E,{className:"h-4 w-4 text-gray-500 flex-shrink-0"}),(0,r.jsx)("span",{children:"Remove from workspaces"})]})]})]})]})}),(0,r.jsx)(q.Zb,{children:(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(x.iA,{className:"min-w-full",children:[(0,r.jsx)(x.xD,{children:(0,r.jsxs)(x.SC,{children:[e_&&(0,r.jsx)(x.ss,{className:"w-8 whitespace-nowrap",children:(0,r.jsx)("input",{type:"checkbox","aria-label":"Select all users on this page",checked:ek,ref:e=>{e&&(e.indeterminate=eC)},onChange:()=>{let e=new Set(et);ek?eN.forEach(s=>e.delete(s.userId)):eN.forEach(s=>e.add(s.userId)),ea(e)}})}),(0,r.jsxs)(x.ss,{onClick:()=>eb("usernameDisplay"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Name",ey("usernameDisplay")]}),!_&&(0,r.jsxs)(x.ss,{onClick:()=>eb("fullEmailID"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["User ID",ey("fullEmailID")]}),!_&&!p&&(0,r.jsxs)(x.ss,{onClick:()=>eb("role"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Role",ey("role")]}),!_&&!p&&!b&&(0,r.jsxs)(x.ss,{onClick:()=>eb("userType"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Type",ey("userType")]}),(0,r.jsxs)(x.ss,{onClick:()=>eb("created_at"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Joined",ey("created_at")]}),(0,r.jsxs)(x.ss,{onClick:()=>eb("gpuCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["GPUs",ey("gpuCount")]}),(0,r.jsxs)(x.ss,{onClick:()=>eb("clusterCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Clusters",ey("clusterCount")]}),(0,r.jsxs)(x.ss,{onClick:()=>eb("jobCount"),className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50 w-1/6",children:["Jobs",ey("jobCount")]}),!_&&(h||"admin"===v)&&(0,r.jsx)(x.ss,{className:"whitespace-nowrap w-1/7",children:"Actions"})]})}),(0,r.jsx)(x.RM,{children:ef.map(e=>{let s="system"===e.userType,t="basic"===e.userType,a=t&&("admin"===v||e.userId===w);return(0,r.jsxs)(x.SC,{className:"group",children:[e_&&(0,r.jsx)(x.pj,{className:"w-8 whitespace-nowrap",children:!s&&(0,r.jsx)("div",{className:"transition-opacity duration-150 ".concat(et.size>0?"opacity-100":"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:(0,r.jsx)("input",{type:"checkbox","aria-label":"Select user ".concat(e.usernameDisplay||e.userId),checked:et.has(e.userId),onChange:()=>eS(e.userId)})})}),(0,r.jsx)(x.pj,{className:"truncate",title:e.username,children:e.usernameDisplay}),!_&&(0,r.jsx)(x.pj,{className:"truncate",title:e.fullEmailID,children:e.fullEmailID}),!_&&!p&&(0,r.jsx)(x.pj,{className:"truncate",title:e.role,children:(0,r.jsx)("div",{className:"flex items-center gap-2",children:$===e.userId?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("select",{value:Y,onChange:e=>ee(e.target.value),"aria-label":"Select user role",className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,r.jsx)("option",{value:"admin",children:"Admin"}),(0,r.jsx)("option",{value:"user",children:"User"})]}),(0,r.jsx)("button",{onClick:()=>ew(e.userId),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,r.jsx)(T.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:ev,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,r.jsx)(I.Z,{className:"h-4 w-4"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"capitalize",children:e.role}),"admin"===v&&(0,r.jsx)("button",{onClick:s?void 0:()=>ej(e.userId,e.role),className:s?"text-gray-300 cursor-not-allowed p-1":"text-blue-600 hover:text-blue-700 p-1",title:s?"Cannot edit role for system users":"Edit role",disabled:s,children:(0,r.jsx)(L,{className:"h-3 w-3"})})]})})}),!_&&!p&&!b&&(0,r.jsx)(x.pj,{className:"truncate",title:e.userType,children:(0,r.jsx)("span",{className:"capitalize",children:"sso"===e.userType?"SSO":e.userType})}),(0,r.jsx)(x.pj,{className:"truncate",children:e.created_at?(0,r.jsx)(j.Zg,{date:new Date(1e3*e.created_at)}):"-"}),(0,r.jsx)(x.pj,{children:-1===e.gpuCount?(0,r.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(0,r.jsx)(o.Z,{size:12})}):(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(e.gpuCount>0?"bg-purple-100 text-purple-600":"bg-gray-100 text-gray-500"),title:"Total GPUs: ".concat(e.gpuCount),children:e.gpuCount})}),(0,r.jsx)(x.pj,{children:-1===e.clusterCount?(0,r.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(0,r.jsx)(o.Z,{size:12})}):(0,r.jsx)(c(),{href:"/clusters?property=user&operator=%3A&value=".concat(encodeURIComponent(e.username)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.clusterCount>0?"bg-blue-100 text-blue-600 hover:bg-blue-200 hover:text-blue-700":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.clusterCount," cluster").concat(1!==e.clusterCount?"s":""," for ").concat(e.usernameDisplay),children:e.clusterCount})}),(0,r.jsx)(x.pj,{children:-1===e.jobCount?(0,r.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(0,r.jsx)(o.Z,{size:12})}):(0,r.jsx)(c(),{href:"/jobs?property=user&operator=%3A&value=".concat(encodeURIComponent(e.username)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.jobCount>0?"bg-green-100 text-green-600 hover:bg-green-200 hover:text-green-700":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.jobCount," active job").concat(1!==e.jobCount?"s":""," for ").concat(e.usernameDisplay),children:e.jobCount})}),!_&&(h||"admin"===v)&&(0,r.jsx)(x.pj,{className:"relative",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[h&&(0,r.jsx)("button",{onClick:a?async()=>{d(e)}:void 0,className:a?"text-blue-600 hover:text-blue-700 p-1":"text-gray-300 cursor-not-allowed p-1",title:t?a?"Reset Password":"You can only reset your own password":"Password reset only available for basic auth users",disabled:!a,children:(0,r.jsx)(D,{className:"h-4 w-4"})}),"admin"===v&&(0,r.jsx)("button",{onClick:s?void 0:()=>u(e),className:s?"text-gray-300 cursor-not-allowed p-1":"text-red-600 hover:text-red-700 p-1",title:s?"Cannot delete system users":"Delete User",disabled:s,children:(0,r.jsx)(Z.Z,{className:"h-4 w-4"})})]})})]},e.userId)})})]})})}),"role"===en&&(0,r.jsx)(J,{open:"role"===en,onClose:eL,selectedUsers:eZ}),"add"===en&&(0,r.jsx)(Q,{open:"add"===en,onClose:eL,selectedUsers:eZ}),"remove"===en&&(0,r.jsx)(X,{open:"remove"===en,onClose:eL,selectedUsers:eZ})]}):(0,r.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,r.jsx)(o.Z,{}),(0,r.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading users..."})]})}function eg(e){var s;let{checkPermissionAndAct:t,userRoleCache:n,setCreateSuccess:l,setCreateError:i,showCreateDialog:d,setShowCreateDialog:u,showRotateDialog:h,setShowRotateDialog:p,tokenToRotate:f,setTokenToRotate:b,rotating:y,setRotating:v,searchQuery:w,setSearchQuery:k}=e,[C,_]=(0,a.useState)([]),[S,R]=(0,a.useState)(!0),[E,F]=(0,a.useState)(!1),[z,V]=(0,a.useState)(null),[B,K]=(0,a.useState)(null),[G,W]=(0,a.useState)({token_name:"",expires_in_days:30}),[$,J]=(0,a.useState)(""),[H,Q]=(0,a.useState)(!1),[X,Y]=(0,a.useState)(!1),[ee,es]=(0,a.useState)(""),[et,ea]=(0,a.useState)(null),[en,eo]=(0,a.useState)(null),[ed,eu]=(0,a.useState)(null),[ex,em]=(0,a.useState)(""),[eh,ep]=(0,a.useState)([]),[eg,ef]=(0,a.useState)(!1);(0,a.useEffect)(()=>{ef((0,m.Sz)())},[]);let[eb,ey]=(0,a.useState)(1),[ej,ev]=(0,a.useState)(20),[ew,eN]=(0,a.useState)(0),[ek,eC]=(0,a.useState)(1),[e_,eS]=(0,a.useState)(!1),[eR,eE]=(0,a.useState)(!1),[eT,eI]=(0,a.useState)(w||"");(0,a.useEffect)(()=>{if(!eg)return;let e=setTimeout(()=>eI(w||""),250);return()=>clearTimeout(e)},[w,eg]),(0,a.useEffect)(()=>{eg&&ey(1)},[eT,eg]);let eL=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];try{if(R(!0),eg){var s,t,r,a,n,l,o;e&&g.ZP.invalidate(m.m3);let i=await g.ZP.get(m.m3,[{page:eb,limit:ej,search:eT,sortBy:"created_at",sortOrder:"desc"}]),c=i.items||[];_(c),eN(null!==(s=i.total)&&void 0!==s?s:c.length),eC(null!==(r=null!==(t=i.total_pages)&&void 0!==t?t:i.totalPages)&&void 0!==r?r:1),eS(null!==(n=null!==(a=i.has_next)&&void 0!==a?a:i.hasNext)&&void 0!==n&&n),eE(null!==(o=null!==(l=i.has_prev)&&void 0!==l?l:i.hasPrev)&&void 0!==o&&o);let d=c.map(e=>({...e,clusterCount:void 0,jobCount:void 0,gpuCount:void 0,primaryRole:e.service_account_roles&&e.service_account_roles.length>0?e.service_account_roles[0]:"user"}));ep(d);return}e&&g.ZP.invalidate(m.iS);let i=await g.ZP.get(m.iS);_(i||[]);let{clustersData:c,jobsResponse:d}=await ec(),u=(null==d?void 0:d.jobs)||[],x=(i||[]).map(e=>{let s=e.service_account_user_id,t=0,r=0,a=0,n=0;for(let e of c)e.user_hash===s&&(t++,"STOPPED"!==e.status&&"TERMINATED"!==e.status&&(r+=el(e.gpus,"Cluster ".concat(e.cluster))));for(let e of u)e.user_hash===s&&er.has(e.status)&&(a++,n+=ei(e));return{...e,clusterCount:t,jobCount:a,gpuCount:r+n,primaryRole:e.service_account_roles&&e.service_account_roles.length>0?e.service_account_roles[0]:"user"}});ep(x)}catch(e){console.error("Error fetching tokens and counts:",e),_([]),ep([])}finally{R(!1)}},[eb,ej,eT,eg]);(0,a.useEffect)(()=>{eL()},[eL]);let eD=async(e,s)=>{await t("cannot edit service account role",()=>{eu(e),em(s)})},eZ=()=>{eu(null),em("")},eU=async e=>{if(!e||!ex){console.error("Token ID or role is missing."),i(Error("Token ID or role is missing."));return}R(!0);try{let s=await M.x.post("/users/service-account-tokens/update-role",{token_id:e,role:ex});if(!s.ok){let e=await s.json();throw Error(e.detail||"Failed to update role")}l("Service account role updated successfully!"),await eL(!0),eZ()}catch(e){console.error("Failed to update service account role:",e),i(e)}finally{R(!1)}},eP=async e=>{try{await navigator.clipboard.writeText(e),es("Copied!"),setTimeout(()=>es(""),2e3)}catch(e){console.error("Failed to copy:",e)}},eA=async()=>{if(!G.token_name.trim()){i(Error("Token name is required"));return}Q(!0);try{let e={token_name:G.token_name.trim(),expires_in_days:""===G.expires_in_days?null:G.expires_in_days},s=await M.x.post("/users/service-account-tokens",e);if(s.ok){let e=await s.json();ea(e.token),W({token_name:"",expires_in_days:30}),await eL(!0)}else{let e=await s.json();throw Error(e.detail||"Failed to create token")}}catch(e){i(e)}finally{Q(!1)}},eF=async()=>{if(z){Y(!0),K(null);try{let e=await M.x.post("/users/service-account-tokens/delete",{token_id:z.token_id});if(e.ok)l('Service account "'.concat(z.token_name,'" deleted successfully!')),F(!1),V(null),K(null),await eL(!0);else{let s=await e.json();throw Error(s.detail||"Failed to delete service account")}}catch(e){F(!1),V(null),K(null),i(e)}finally{Y(!1)}}},ez=async()=>{if(f){v(!0);try{let e={token_id:f.token_id,expires_in_days:""===$?null:parseInt($)},s=await M.x.post("/users/service-account-tokens/rotate",e);if(s.ok){let e=await s.json();eo(e.token),await eL(!0)}else{let e=await s.json();throw Error(e.detail||"Failed to rotate token")}}catch(e){i(e)}finally{v(!1)}}},eq=eg?eh:eh.filter(e=>{var s,t,r,a;if(!(null==w?void 0:w.trim()))return!0;let n=w.toLowerCase();return(null===(s=e.token_name)||void 0===s?void 0:s.toLowerCase().includes(n))||(null===(t=e.creator_name)||void 0===t?void 0:t.toLowerCase().includes(n))||(null===(r=e.service_account_name)||void 0===r?void 0:r.toLowerCase().includes(n))||(null===(a=e.primaryRole)||void 0===a?void 0:a.toLowerCase().includes(n))});return S&&0===eh.length?(0,r.jsxs)("div",{className:"flex items-center justify-center py-8",children:[(0,r.jsx)(o.Z,{size:32}),(0,r.jsx)("span",{className:"ml-3",children:"Loading tokens..."})]}):(0,r.jsxs)(r.Fragment,{children:[0===eq.length||(0,A.KL)()?(0,r.jsx)(q.Zb,{children:(0,r.jsx)(P.u,{icon:(0,r.jsx)(D,{size:20,strokeWidth:1.75}),title:(null==w?void 0:w.trim())?"No tokens match your search":"No service accounts",description:(null==w?void 0:w.trim())?"Try a different search term":"No service accounts have been created yet"})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"text-sm text-gray-500 mb-2",children:[eq.length," ",1===eq.length?"service account":"service accounts"]}),(0,r.jsx)(q.Zb,{children:(0,r.jsxs)(x.iA,{children:[(0,r.jsx)(x.xD,{children:(0,r.jsxs)(x.SC,{children:[(0,r.jsx)(x.ss,{children:"Name"}),(0,r.jsx)(x.ss,{children:"Created by"}),(0,r.jsx)(x.ss,{children:"Role"}),(0,r.jsx)(x.ss,{children:"Clusters"}),(0,r.jsx)(x.ss,{children:"Jobs"}),(0,r.jsx)(x.ss,{children:"GPUs"}),(0,r.jsx)(x.ss,{children:"Created"}),(0,r.jsx)(x.ss,{children:"Last used"}),(0,r.jsx)(x.ss,{children:"Expires"}),(0,r.jsx)(x.ss,{children:"Actions"})]})}),(0,r.jsx)(x.RM,{children:eq.map(e=>(0,r.jsxs)(x.SC,{children:[(0,r.jsx)(x.pj,{className:"truncate",title:e.token_name,children:e.token_name}),(0,r.jsx)(x.pj,{className:"truncate",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{children:e.creator_name||"Unknown"}),e.creator_user_hash!==(null==n?void 0:n.id)&&(0,r.jsx)("span",{className:"ml-2 px-1.5 py-0.5 text-xs bg-gray-100 text-gray-600 rounded",children:"Other"})]})}),(0,r.jsx)(x.pj,{className:"truncate",children:(0,r.jsx)("div",{className:"flex items-center gap-2",children:ed===e.token_id?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("select",{value:ex,onChange:e=>em(e.target.value),className:"block w-auto p-1 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-sky-blue focus:border-sky-blue sm:text-sm",children:[(0,r.jsx)("option",{value:"admin",children:"Admin"}),(0,r.jsx)("option",{value:"user",children:"User"})]}),(0,r.jsx)("button",{onClick:()=>eU(e.token_id),className:"text-green-600 hover:text-green-800 p-1",title:"Save",children:(0,r.jsx)(T.Z,{className:"h-4 w-4"})}),(0,r.jsx)("button",{onClick:eZ,className:"text-gray-500 hover:text-gray-700 p-1",title:"Cancel",children:(0,r.jsx)(I.Z,{className:"h-4 w-4"})})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"capitalize",children:e.primaryRole}),((null==n?void 0:n.role)==="admin"||e.creator_user_hash===(null==n?void 0:n.id))&&(0,r.jsx)("button",{onClick:()=>eD(e.token_id,e.primaryRole),className:"text-blue-600 hover:text-blue-700 p-1",title:"Edit role",children:(0,r.jsx)(L,{className:"h-3 w-3"})})]})})}),(0,r.jsx)(x.pj,{children:void 0===e.clusterCount?(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-400",title:"Counts hidden in server-paginated view",children:"—"}):(0,r.jsx)(c(),{href:"/clusters?property=user&operator=%3A&value=".concat(encodeURIComponent(e.service_account_name)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.clusterCount>0?"bg-blue-100 text-blue-600 hover:bg-blue-200 hover:text-blue-700":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.clusterCount," cluster").concat(1!==e.clusterCount?"s":""," for ").concat(e.token_name),children:e.clusterCount})}),(0,r.jsx)(x.pj,{children:void 0===e.jobCount?(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-400",title:"Counts hidden in server-paginated view",children:"—"}):(0,r.jsx)(c(),{href:"/jobs?property=user&operator=%3A&value=".concat(encodeURIComponent(e.service_account_name)),className:"px-2 py-0.5 rounded text-xs font-medium transition-colors duration-200 cursor-pointer inline-block ".concat(e.jobCount>0?"bg-green-100 text-green-600 hover:bg-green-200 hover:text-green-700":"bg-gray-100 text-gray-500 hover:bg-gray-200 hover:text-gray-700"),title:"View ".concat(e.jobCount," active job").concat(1!==e.jobCount?"s":""," for ").concat(e.token_name),children:e.jobCount})}),(0,r.jsx)(x.pj,{children:void 0===e.gpuCount?(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium bg-gray-100 text-gray-400",title:"Counts hidden in server-paginated view",children:"—"}):(0,r.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(e.gpuCount>0?"bg-purple-100 text-purple-600":"bg-gray-100 text-gray-500"),title:"Total GPUs: ".concat(e.gpuCount),children:e.gpuCount})}),(0,r.jsx)(x.pj,{className:"truncate",children:e.created_at?(0,r.jsx)(j.Zg,{date:new Date(1e3*e.created_at)}):"Never"}),(0,r.jsx)(x.pj,{className:"truncate",children:e.last_used_at?(0,r.jsx)(j.Zg,{date:new Date(1e3*e.last_used_at)}):"Never"}),(0,r.jsx)(x.pj,{className:"truncate",children:e.expires_at?new Date(1e3*e.expires_at){t("cannot rotate service account tokens",()=>{b(e),p(!0)})},className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:(0,r.jsx)(N.Z,{className:"h-4 w-4"})})}),((null==n?void 0:n.role)==="admin"||e.creator_user_hash===(null==n?void 0:n.id))&&(0,r.jsx)(j.WH,{content:"Delete ".concat(e.token_name),className:"capitalize text-sm text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>{t("cannot delete service account tokens",()=>{V(e),F(!0)})},className:"text-red-600 hover:text-red-800 font-medium inline-flex items-center",children:(0,r.jsx)(Z.Z,{className:"h-4 w-4"})})})]})})]},e.token_id))})]})}),eg&&(0,r.jsxs)("div",{className:"flex items-center justify-between mt-3 text-sm text-gray-600",children:[(0,r.jsxs)("div",{children:["Showing ",(eb-1)*ej+1,"-",Math.min(eb*ej,ew)," ","of ",ew]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("select",{value:ej,onChange:e=>{ev(Number(e.target.value)),ey(1)},className:"h-7 px-2 border border-gray-300 rounded text-sm",disabled:S,children:[10,20,50,100,200].map(e=>(0,r.jsxs)("option",{value:e,children:[e," / page"]},e))}),(0,r.jsx)("button",{onClick:()=>ey(e=>Math.max(1,e-1)),disabled:!eR||S,className:"h-7 px-3 border border-gray-300 rounded text-sm disabled:opacity-50 disabled:cursor-not-allowed",children:"Previous"}),(0,r.jsxs)("span",{children:["Page ",eb," of ",ek]}),(0,r.jsx)("button",{onClick:()=>ey(e=>e+1),disabled:!e_||S,className:"h-7 px-3 border border-gray-300 rounded text-sm disabled:opacity-50 disabled:cursor-not-allowed",children:"Next"})]})]})]}),(0,r.jsx)(O.Vq,{open:d,onOpenChange:e=>{u(e),e||(ea(null),i(null))},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-2xl",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Create Service Account"}),(0,r.jsx)(O.Be,{children:"Create a new service account with an API token for programmatic access to SkyPilot."})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:et?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center mb-3",children:[(0,r.jsx)("h4",{className:"text-sm font-medium text-green-900",children:"⚠️ Service account created successfully - save this token now!"}),(0,r.jsx)(j.WH,{content:ee?"Copied!":"Copy token",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>eP(et),className:"flex items-center text-green-600 hover:text-green-800 transition-colors duration-200 p-1 ml-2",children:ee?(0,r.jsx)(T.Z,{className:"w-4 h-4"}):(0,r.jsx)(U.Z,{className:"w-4 h-4"})})})]}),(0,r.jsx)("p",{className:"text-sm text-green-700 mb-3",children:"This service account token will not be shown again. Please copy and store it securely."}),(0,r.jsx)("div",{className:"bg-white border border-green-300 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all block",children:et})})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Service Account Name"}),(0,r.jsx)("input",{className:"border rounded px-3 py-2 w-full",placeholder:"e.g., ci-pipeline, monitoring-system",value:G.token_name,onChange:e=>W({...G,token_name:e.target.value})})]}),(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"Expiration (days)"}),(0,r.jsx)("input",{type:"number",className:"border rounded px-3 py-2 w-full",placeholder:"e.g., 30",min:"0",max:"365",value:null!==(s=G.expires_in_days)&&void 0!==s?s:"",onChange:e=>W({...G,expires_in_days:e.target.value?parseInt(e.target.value):null})}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Leave empty or enter 0 to never expire. Maximum 365 days."})]})]})}),(0,r.jsx)(O.cN,{children:et?(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:()=>{u(!1),ea(null)},children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>{u(!1),ea(null)},disabled:H,children:"Cancel"}),(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:eA,disabled:H||!G.token_name.trim(),children:H?"Creating...":"Create Token"})]})})]})}),(0,r.jsx)(O.Vq,{open:E,onOpenChange:e=>{F(e),e||(V(null),i(null))},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-md",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Delete Service Account Token"}),(0,r.jsxs)(O.Be,{children:['Are you sure you want to delete the service account "',null==z?void 0:z.token_name,'"',(null==z?void 0:z.creator_user_hash)!==(null==n?void 0:n.id)&&(null==n?void 0:n.role)==="admin"?" owned by ".concat(null==z?void 0:z.creator_name):"","? This action cannot be undone and will immediately revoke access for any systems using this token."]})]}),(0,r.jsxs)(O.cN,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>{F(!1),V(null)},disabled:X,children:"Cancel"}),(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-red-600 text-white hover:bg-red-700 h-10 px-4 py-2",onClick:eF,disabled:X,children:X?"Deleting...":"Delete Token"})]})]})}),(0,r.jsx)(O.Vq,{open:h,onOpenChange:e=>{p(e),e||(b(null),J(""),eo(null),i(null))},children:(0,r.jsxs)(O.cZ,{className:"sm:max-w-2xl",children:[(0,r.jsxs)(O.fK,{children:[(0,r.jsx)(O.$N,{children:"Rotate Service Account Token"}),(0,r.jsxs)(O.Be,{children:['Rotate the service account token "',null==f?void 0:f.token_name,'"',(null==f?void 0:f.creator_user_hash)!==(null==n?void 0:n.id)&&(null==n?void 0:n.role)==="admin"?" owned by ".concat(null==f?void 0:f.creator_name):"",". This will generate a new token value and invalidate the current one."]})]}),(0,r.jsx)("div",{className:"flex flex-col gap-4 py-4",children:en?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:[(0,r.jsxs)("div",{className:"flex items-center mb-3",children:[(0,r.jsx)("h4",{className:"text-sm font-medium text-green-900",children:"\uD83D\uDD04 Service account token rotated successfully - save this new token now!"}),(0,r.jsx)(j.WH,{content:ee?"Copied!":"Copy token",className:"text-muted-foreground",children:(0,r.jsx)("button",{onClick:()=>eP(en),className:"flex items-center text-green-600 hover:text-green-800 transition-colors duration-200 p-1 ml-2",children:ee?(0,r.jsx)(T.Z,{className:"w-4 h-4"}):(0,r.jsx)(U.Z,{className:"w-4 h-4"})})})]}),(0,r.jsx)("p",{className:"text-sm text-green-700 mb-3",children:"This new token replaces the old one. Please copy and store it securely. The old token is now invalid."}),(0,r.jsx)("div",{className:"bg-white border border-green-300 rounded-md p-3",children:(0,r.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all block",children:en})})]})}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"grid gap-2",children:[(0,r.jsx)("label",{className:"text-sm font-medium text-gray-700",children:"New Expiration (days)"}),(0,r.jsx)("input",{type:"number",className:"border rounded px-3 py-2 w-full",placeholder:"Leave empty to preserve current expiration",min:"0",max:"365",value:$,onChange:e=>J(e.target.value)}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Leave empty to preserve current expiration. Enter number of days for new expiration, or enter 0 to set to never expire. Maximum 365 days."})]}),(0,r.jsx)("div",{className:"p-3 bg-amber-50 border border-amber-200 rounded",children:(0,r.jsx)("p",{className:"text-sm text-amber-700",children:"⚠️ Any systems using the current token will need to be updated with the new token."})})]})}),(0,r.jsx)(O.cN,{children:en?(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-green-600 text-white hover:bg-green-700 h-10 px-4 py-2",onClick:()=>{p(!1),b(null),J(""),eo(null)},children:"Close"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{className:"inline-flex items-center justify-center 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 border border-input bg-background hover:bg-accent hover:text-accent-foreground h-10 px-4 py-2",onClick:()=>{p(!1),b(null),J(""),eo(null)},disabled:y,children:"Cancel"}),(0,r.jsx)("button",{className:"inline-flex items-center justify-center rounded-md text-sm font-medium 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 bg-sky-600 text-white hover:bg-sky-700 h-10 px-4 py-2",onClick:ez,disabled:y,children:y?"Rotating...":"Rotate Token"})]})})]})})]})}ep.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,checkPermissionAndAct:l().func.isRequired,roleLoading:l().bool.isRequired,onResetPassword:l().func.isRequired,onDeleteUser:l().func.isRequired,basicAuthEnabled:l().bool,ingressBasicAuthEnabled:l().bool,externalProxyAuthEnabled:l().bool,currentUserRole:l().string,currentUserId:l().string,setLastFetchedTime:l().func,setCreateError:l().func.isRequired}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/195-d38091b2de5396cf.js b/sky/dashboard/out/_next/static/chunks/195-d38091b2de5396cf.js new file mode 100644 index 000000000..1d314e98c --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/195-d38091b2de5396cf.js @@ -0,0 +1,11 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[195],{9333:function(e,s,a){a.d(s,{Z:function(){return t}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let t=(0,a(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},8418:function(e,s,a){a.d(s,{Z:function(){return t}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let t=(0,a(998).Z)("Trash",[["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"}]])},1812:function(e,s,a){a.d(s,{X:function(){return n}});var t=a(5893),r=a(7294);let l=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},n=e=>{let{error:s,title:a="Error",onDismiss:n}=e,[c,i]=(0,r.useState)(!1);if((0,r.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:l(s);return(0,t.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex",children:[(0,t.jsx)("div",{className:"flex-shrink-0",children:(0,t.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,t.jsx)("div",{className:"ml-3",children:(0,t.jsxs)("div",{className:"text-sm text-red-800 whitespace-pre-wrap",children:[(0,t.jsxs)("strong",{children:[a,":"]})," ",o]})})]}),(0,t.jsx)("button",{onClick:()=>{i(!0),n&&n()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,t.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,t.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},3195:function(e,s,a){a.r(s),a.d(s,{WorkspaceEditor:function(){return O}});var t=a(5893),r=a(7294),l=a(1163),n=a(7324),c=a(3266),i=a(8969);a(3872);var o=a(1664),d=a.n(o),x=a(9008),u=a.n(x),m=a(7673),h=a(803),f=a(5089),g=a(5739),p=a(282),b=a(6021),j=a(3626),y=a(8418),N=a(9333),k=a(1360),w=a(2242),v=a(3850),C=a(1812),L=a(2464),S=a(1272),E=a(3225),W=a(3081),Z=a(6378),A=a(7145);let D=e=>{let{message:s}=e;return s?(0,t.jsxs)(w.b,{className:"border-green-200 bg-green-50",children:[(0,t.jsx)(p.Z,{className:"h-4 w-4 text-green-600"}),(0,t.jsx)(w.X,{className:"text-green-800",children:s})]}):null},M=e=>{let{workspaceName:s,config:a,enabledClouds:r=[],isLoading:l=!1}=e;if(!a)return null;let n="default"===s,c=0===Object.keys(a).length;if(n&&c)return(0,t.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"Workspace 'default' can use all accessible infrastructure."});let i=[],o=[],d=[],x=new Set(r.map(e=>e.toLowerCase()));Object.entries(a).forEach(e=>{let[s,a]=e;if("private"===s||"allowed_users"===s)return;let r=E.Z2[s.toLowerCase()]||s.toUpperCase(),n=null==r?void 0:r.toLowerCase(),c=x.has(n)||Array.from(x).some(e=>e.startsWith(n+"/")),u=()=>"kubernetes"===s.toLowerCase()?Array.from(x).filter(e=>e.startsWith(n+"/")).map(e=>e.split("/")[1]):[];if((null==a?void 0:a.disabled)===!0)o.push(r);else if(a&&Object.keys(a).length>0){if(!l){let e="";if("gcp"===s.toLowerCase()&&a.project_id)e=" (Project ID: ".concat(a.project_id,")");else if("aws"===s.toLowerCase()&&a.region)e=" (Region: ".concat(a.region,")");else if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}c?i.push((0,t.jsxs)("span",{className:"block",children:[r,e," is enabled."]},"".concat(s,"-enabled"))):d.push((0,t.jsxs)("span",{className:"block text-amber-700",children:[r,e," is configured but not currently available."]},"".concat(s,"-configured-not-enabled")))}}else if(!l){if(c){let e="";if("kubernetes"===s.toLowerCase()){let s=u();s.length>0&&(e=" (Contexts: ".concat(s.join(", "),")"))}i.push((0,t.jsxs)("span",{className:"block",children:[r,e," is enabled (using default settings)."]},"".concat(s,"-default-enabled")))}else d.push((0,t.jsxs)("span",{className:"block text-amber-700",children:[r," is configured but not currently available."]},"".concat(s,"-default-not-enabled")))}});let u=[];if(o.length>0){let e=o.join(" and ");u.push((0,t.jsxs)("span",{className:"block",children:[e," ",1===o.length?"is":"are"," explicitly disabled."]},"disabled-clouds"))}return(u.push(...i),u.push(...d),u.length>0)?(0,t.jsx)("div",{className:"text-sm text-gray-700 mb-3 p-3 bg-sky-50 rounded border border-sky-200",children:u}):!n&&c?(0,t.jsx)("div",{className:"text-sm text-gray-500 mb-3 italic p-3 bg-sky-50 rounded border border-sky-200",children:"This workspace has no specific cloud resource configurations and can use all accessible infrastructure."}):null},P=e=>{let{isPrivate:s}=e;return s?(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-gray-100 text-gray-700 border border-gray-300",children:"Private"}):(0,t.jsx)("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-green-100 text-green-700 border border-green-300",children:"Public"})},R=e=>{let{workspaceConfig:s,allUsers:a}=e;if(!s.private)return null;let r=s.allowed_users||[],l=(a||[]).filter(e=>"admin"===e.role).map(e=>e.username),n=[...new Set([...r,...l])];return 0===n.length?(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Allowed Users (0)"}),(0,t.jsx)("div",{className:"text-amber-600 text-xs italic p-2 bg-amber-50 rounded border border-amber-200",children:"No users configured (workspace may be inaccessible)"})]}):(0,t.jsxs)("div",{className:"mt-4",children:[(0,t.jsxs)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:["Allowed Users (",n.length,")"]}),(0,t.jsx)("div",{className:"space-y-1 max-h-48 overflow-y-auto border border-gray-200 rounded",children:n.map(e=>{let s=l.includes(e);return(0,t.jsxs)("div",{className:"flex items-center justify-between text-xs p-2 bg-gray-50 hover:bg-gray-100 border-b border-gray-100 last:border-b-0",children:[(0,t.jsx)("span",{className:"font-medium text-gray-700",children:e}),s?(0,t.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,t.jsx)(v.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,t.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,t.jsx)(b.Z,{className:"w-3 h-3 mr-1"}),"User"]})]},e)})})]})};function O(e){let{workspaceName:s,isNewWorkspace:a=!1}=e,o=(0,l.useRouter)(),[x,p]=(0,r.useState)({}),[b,w]=(0,r.useState)({}),[E,O]=(0,r.useState)(""),[_,z]=(0,r.useState)(!0),[U,T]=(0,r.useState)(!1),[J,Y]=(0,r.useState)(!1),[F,I]=(0,r.useState)(null),[V,X]=(0,r.useState)(null),[q,B]=(0,r.useState)(null),[H,G]=(0,r.useState)([]),[K,Q]=(0,r.useState)({showDialog:!1,deleting:!1,error:null}),[$,ee]=(0,r.useState)({totalClusterCount:0,runningClusterCount:0,managedJobsCount:0,clouds:[]}),[es,ea]=(0,r.useState)(!1),et=(0,r.useCallback)(async function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0];e&&z(!0),I(null);try{let e;let[a,t]=await Promise.all([(0,n.getWorkspaces)(),(0,W.Rf)()]),r=a[s]||{};p(r),w(r),G(t||[]),e=0===Object.keys(r).length?"".concat(s,":\n # Empty workspace configuration - uses all accessible infrastructure\n"):S.ZP.dump({[s]:r},{indent:2,lineWidth:-1,noRefs:!0,skipInvalid:!0,flowLevel:-1}),O(e)}catch(e){console.error("Error fetching workspace config:",e),I(e)}finally{e&&z(!1)}},[s]),er=(0,r.useCallback)(async()=>{if(!a){ea(!0);try{let[e,a,t]=await Promise.all([Z.kq.get(c.getClusters),Z.kq.get(i.getManagedJobs,[{allUsers:!0,skipFinished:!0,workspaceMatch:s,fields:["workspace","status"]}]),Z.kq.get(n.yz,[s,!0])]),r=e.filter(e=>(e.workspace||"default")===s),l=r.filter(e=>"RUNNING"===e.status||"LAUNCHING"===e.status),o={};e.forEach(e=>{o[e.cluster]=e.workspace||"default"});let d=a.jobs||[],x=new Set(L.statusGroups.active),u=0;d.forEach(e=>{e.workspace===s&&x.has(e.status)&&u++}),ee({totalClusterCount:r.length,runningClusterCount:l.length,managedJobsCount:u,clouds:Array.isArray(t)?t:[]})}catch(e){console.error("Failed to fetch workspace stats:",e)}finally{ea(!1)}}},[s,a]);(0,r.useEffect)(()=>{a?(z(!1),O("".concat(s,":\n # New workspace configuration\n # Leave empty to use all accessible infrastructure\n"))):(et(),er())},[s,a,et,er]),(0,r.useEffect)(()=>{Y(JSON.stringify(x)!==JSON.stringify(b))},[x,b]);let el=e=>{O(e),B(null);try{let a=S.ZP.load(e)||{},t=Object.keys(a);if(0===t.length)p({});else if(1===t.length){let e=t[0];if(e!==s){B('Workspace name cannot be changed. Expected "'.concat(s,'" but found "').concat(e,'".'));return}let r=a[s]||{};p(r)}else B("Configuration must contain only one workspace. Found: ".concat(t.join(", ")))}catch(e){B("Invalid YAML: ".concat(e.message))}},en=async()=>{T(!0),I(null),X(null);try{if(q)throw Error("Please fix YAML errors before saving");let e=S.ZP.load(E)||{},t=Object.keys(e);if(t.length>0&&t[0]!==s)throw Error('Workspace name cannot be changed. Expected "'.concat(s,'".'));a?(await (0,n.MB)(s,x),X("Workspace created successfully!"),setTimeout(()=>{o.push("/workspaces/".concat(s))},1500)):(await (0,n.eA)(s,x),X("Workspace updated successfully!"),w(x),er())}catch(e){console.error("Error saving workspace:",e),I(e)}finally{T(!1)}},ec=async()=>{Q(e=>({...e,deleting:!0,error:null}));try{await (0,n.zl)(s),X("Workspace deleted successfully!"),setTimeout(()=>{o.push("/workspaces")},1500)}catch(e){console.error("Error deleting workspace:",e),Q(s=>({...s,deleting:!1,error:e}))}},ei=()=>{Q({showDialog:!1,deleting:!1,error:null})},eo=async()=>{z(!0);try{await A.x.fetch("/check",{},"POST"),await Promise.all([et(!1),er()])}catch(e){console.error("Error during sky check refresh:",e)}finally{z(!1)}};if(!o.isReady)return(0,t.jsx)("div",{children:"Loading..."});let ed=a?"Create New Workspace | SkyPilot Dashboard":"Workspace: ".concat(s," | SkyPilot Dashboard");return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(u(),{children:(0,t.jsx)("title",{children:ed})}),(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(d(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)(d(),{href:a?"/workspace/new":"/workspaces/".concat(s),className:"text-sky-blue hover:underline",children:a?"New Workspace":s}),J&&(0,t.jsx)("span",{className:"ml-3 px-2 py-1 bg-yellow-100 text-yellow-800 text-xs rounded",children:"Unsaved changes"})]}),(0,t.jsxs)("div",{className:"text-sm flex items-center",children:[(_||U||es)&&(0,t.jsxs)("div",{className:"flex items-center mr-4",children:[(0,t.jsx)(g.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500",children:U?"Saving...":"Loading..."})]}),(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[!a&&(0,t.jsxs)("button",{onClick:eo,disabled:_||U||es,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[(0,t.jsx)(j.Z,{className:"w-4 h-4 mr-1.5"}),"Refresh"]}),!a&&"default"!==s&&(0,t.jsxs)("button",{onClick:()=>Q({...K,showDialog:!0}),disabled:K.deleting||U,className:"text-red-600 hover:text-red-700 font-medium inline-flex items-center",children:[(0,t.jsx)(y.Z,{className:"w-4 h-4 mr-1.5"}),"Delete"]})]})]})]}),_?(0,t.jsxs)("div",{className:"flex justify-center items-center py-12",children:[(0,t.jsx)(g.Z,{size:24,className:"mr-2"}),(0,t.jsx)("span",{className:"text-gray-500",children:"Loading workspace configuration..."})]}):(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsx)(C.X,{error:F,title:"Error",onDismiss:()=>I(null)}),(0,t.jsx)(D,{message:V}),(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[!a&&(0,t.jsx)("div",{className:"lg:col-span-1",children:(0,t.jsxs)(m.Zb,{className:"h-full",children:[(0,t.jsx)(m.Ol,{children:(0,t.jsx)(m.ll,{className:"text-base font-normal",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"font-semibold",children:"Workspace:"})," ",s]}),(0,t.jsx)(P,{isPrivate:!0===b.private})]})})}),(0,t.jsxs)(m.aY,{className:"text-sm pb-2 flex-1",children:[(0,t.jsxs)("div",{className:"py-2 flex items-center justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(v.QT,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Clusters (Running / Total)"})]}),(0,t.jsx)("span",{className:"font-normal text-gray-800",children:es?"...":"".concat($.runningClusterCount," / ").concat($.totalClusterCount)})]}),(0,t.jsxs)("div",{className:"py-2 flex items-center justify-between border-t border-gray-100",children:[(0,t.jsxs)("div",{className:"flex items-center text-gray-600",children:[(0,t.jsx)(v.Vp,{className:"w-4 h-4 mr-2 text-gray-500"}),(0,t.jsx)("span",{children:"Managed Jobs"})]}),(0,t.jsx)("span",{className:"font-normal text-gray-800",children:es?"...":$.managedJobsCount})]})]}),(0,t.jsxs)("div",{className:"px-6 pb-6 text-sm pt-3",children:[(0,t.jsx)("h4",{className:"mb-2 text-xs text-gray-500 tracking-wider",children:"Enabled Infra"}),(0,t.jsx)("div",{className:"flex flex-wrap gap-x-4 gap-y-1",children:es?(0,t.jsx)("span",{className:"text-gray-500",children:"Loading..."}):$.clouds.length>0?$.clouds.map(e=>(0,t.jsxs)("div",{className:"flex items-center text-gray-700",children:[(0,t.jsx)(v.Ye,{className:"w-3.5 h-3.5 mr-1.5 text-green-500"}),(0,t.jsx)("span",{children:e})]},e)):(0,t.jsx)("span",{className:"text-gray-500 italic",children:"No enabled infrastructure"})}),(0,t.jsx)("div",{className:"mt-4",children:(0,t.jsx)(M,{workspaceName:s,config:b,enabledClouds:$.clouds,isLoading:es})}),(0,t.jsx)(R,{workspaceConfig:b,allUsers:H})]})]})}),(0,t.jsx)("div",{className:a?"lg:col-span-3":"lg:col-span-2",children:(0,t.jsxs)(m.Zb,{className:"h-full flex flex-col",children:[(0,t.jsx)(m.Ol,{children:(0,t.jsx)(m.ll,{className:"text-base font-normal",children:a?"New Workspace YAML":"Edit Workspace YAML"})}),(0,t.jsx)(m.aY,{className:"flex-1 flex flex-col",children:(0,t.jsxs)("div",{className:"space-y-4 flex-1 flex flex-col",children:[q&&(0,t.jsx)(C.X,{error:q,onDismiss:()=>B(null)}),(0,t.jsxs)("div",{className:"flex-1 flex flex-col",children:[(0,t.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Configure infra-specific settings for this workspace. Leave empty to use all accessible infrastructure. Refer to"," ",(0,t.jsx)("a",{href:"https://docs.skypilot.co/en/latest/admin/workspaces.html#configuration",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600",children:"SkyPilot Docs"})," ","for more details."]}),(0,t.jsxs)("div",{className:"mb-4",children:[(0,t.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Example configuration:"}),(0,t.jsx)("div",{className:"p-3 bg-gray-50 border rounded-lg",children:(0,t.jsx)("pre",{className:"text-xs font-mono text-gray-600 whitespace-pre-wrap",children:"".concat(s||"my-workspace",":\n private: true\n allowed_users:\n - user1@mydomain.com\n - user2@mydomain.com\n gcp:\n project_id: xxx\n disabled: false\n kubernetes:\n allowed_contexts:\n - context-1")})})]}),(0,t.jsx)(f.Xx,{value:E,onChange:e=>el(e),height:"400px"}),(0,t.jsx)("div",{className:"flex justify-end space-x-3 pt-3 border-gray-200",children:(0,t.jsxs)(h.z,{onClick:en,disabled:U||q||_,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:[(0,t.jsx)(N.Z,{className:"w-4 h-4 mr-1.5"}),U?"Applying...":"Apply"]})})]})]})})]})})]})]}),(0,t.jsx)(k.Vq,{open:K.showDialog,onOpenChange:ei,children:(0,t.jsxs)(k.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(k.fK,{className:"",children:[(0,t.jsx)(k.$N,{children:"Delete Workspace"}),(0,t.jsxs)(k.Be,{children:['Are you sure you want to delete workspace "',s,'"? This action cannot be undone.']})]}),K.error&&(0,t.jsx)(C.X,{error:K.error,title:"Deletion Failed",onDismiss:()=>Q(e=>({...e,error:null}))}),(0,t.jsxs)(k.cN,{className:"",children:[(0,t.jsx)(h.z,{variant:"outline",onClick:ei,disabled:K.deleting,children:"Cancel"}),(0,t.jsx)(h.z,{variant:"destructive",onClick:ec,disabled:K.deleting,children:K.deleting?"Deleting...":"Delete"})]})]})})]})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/256-426bc47289752b8f.js b/sky/dashboard/out/_next/static/chunks/256-426bc47289752b8f.js new file mode 100644 index 000000000..2d5de8805 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/256-426bc47289752b8f.js @@ -0,0 +1,11 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[256],{5168:function(e,t,n){n.d(t,{ZP:function(){return e_}});var r=n(7462),o=n(3366),i=n(7294),l=n(512),a=n(4780);function s(e,t){"function"==typeof e?e(t):e&&(e.current=t)}function u(...e){return i.useMemo(()=>e.every(e=>null==e)?null:t=>{e.forEach(e=>{s(e,t)})},e)}var c=function(e){return"string"==typeof e},d=function(e,t=[]){if(void 0===e)return{};let n={};return Object.keys(e).filter(n=>n.match(/^on[A-Z]/)&&"function"==typeof e[n]&&!t.includes(n)).forEach(t=>{n[t]=e[t]}),n},p=function(e){if(void 0===e)return{};let t={};return Object.keys(e).filter(t=>!(t.match(/^on[A-Z]/)&&"function"==typeof e[t])).forEach(n=>{t[n]=e[n]}),t},f=function(e){let{getSlotProps:t,additionalProps:n,externalSlotProps:o,externalForwardedProps:i,className:a}=e;if(!t){let e=(0,l.Z)(null==n?void 0:n.className,a,null==i?void 0:i.className,null==o?void 0:o.className),t=(0,r.Z)({},null==n?void 0:n.style,null==i?void 0:i.style,null==o?void 0:o.style),s=(0,r.Z)({},n,i,o);return e.length>0&&(s.className=e),Object.keys(t).length>0&&(s.style=t),{props:s,internalRef:void 0}}let s=d((0,r.Z)({},i,o)),u=p(o),c=p(i),f=t(s),h=(0,l.Z)(null==f?void 0:f.className,null==n?void 0:n.className,a,null==i?void 0:i.className,null==o?void 0:o.className),v=(0,r.Z)({},null==f?void 0:f.style,null==n?void 0:n.style,null==i?void 0:i.style,null==o?void 0:o.style),m=(0,r.Z)({},f,n,c,u);return h.length>0&&(m.className=h),Object.keys(v).length>0&&(m.style=v),{props:m,internalRef:f.ref}};let h=["elementType","externalSlotProps","ownerState","skipResolvingSlotProps"];var v=function(e){var t,n;let{elementType:i,externalSlotProps:l,ownerState:a,skipResolvingSlotProps:s=!1}=e,d=(0,o.Z)(e,h),p=s?{}:"function"==typeof l?l(a,void 0):l,{props:v,internalRef:m}=f((0,r.Z)({},d,{externalSlotProps:p})),E=u(m,null==p?void 0:p.ref,null==(t=e.additionalProps)?void 0:t.ref);return n=(0,r.Z)({},v,{ref:E}),void 0===i||c(i)?n:(0,r.Z)({},n,{ownerState:(0,r.Z)({},n.ownerState,a)})},m=n(957),E=n(9733),y=function(e,t=166){let n;function r(...o){clearTimeout(n),n=setTimeout(()=>{e.apply(this,o)},t)}return r.clear=()=>{clearTimeout(n)},r};function x(e){return e&&e.ownerDocument||document}function g(e){return x(e).defaultView||window}let b={},k=[];class Z{constructor(){this.currentId=null,this.clear=()=>{null!==this.currentId&&(clearTimeout(this.currentId),this.currentId=null)},this.disposeEffect=()=>this.clear}static create(){return new Z}start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=null,t()},e)}}function R(e){if(parseInt(i.version,10)>=19){var t;return(null==e||null==(t=e.props)?void 0:t.ref)||null}return(null==e?void 0:e.ref)||null}function P(e,t){return(P=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var T=n(3935),S={disabled:!1},N=i.createContext(null),w="unmounted",C="exited",O="entering",M="entered",I="exiting",j=function(e){function t(t,n){r=e.call(this,t,n)||this;var r,o,i=n&&!n.isMounting?t.enter:t.appear;return r.appearStatus=null,t.in?i?(o=C,r.appearStatus=O):o=M:o=t.unmountOnExit||t.mountOnEnter?w:C,r.state={status:o},r.nextCallback=null,r}t.prototype=Object.create(e.prototype),t.prototype.constructor=t,P(t,e),t.getDerivedStateFromProps=function(e,t){return e.in&&t.status===w?{status:C}:null};var n=t.prototype;return n.componentDidMount=function(){this.updateStatus(!0,this.appearStatus)},n.componentDidUpdate=function(e){var t=null;if(e!==this.props){var n=this.state.status;this.props.in?n!==O&&n!==M&&(t=O):(n===O||n===M)&&(t=I)}this.updateStatus(!1,t)},n.componentWillUnmount=function(){this.cancelNextCallback()},n.getTimeouts=function(){var e,t,n,r=this.props.timeout;return e=t=n=r,null!=r&&"number"!=typeof r&&(e=r.exit,t=r.enter,n=void 0!==r.appear?r.appear:t),{exit:e,enter:t,appear:n}},n.updateStatus=function(e,t){if(void 0===e&&(e=!1),null!==t){if(this.cancelNextCallback(),t===O){if(this.props.unmountOnExit||this.props.mountOnEnter){var n=this.props.nodeRef?this.props.nodeRef.current:T.findDOMNode(this);n&&n.scrollTop}this.performEnter(e)}else this.performExit()}else this.props.unmountOnExit&&this.state.status===C&&this.setState({status:w})},n.performEnter=function(e){var t=this,n=this.props.enter,r=this.context?this.context.isMounting:e,o=this.props.nodeRef?[r]:[T.findDOMNode(this),r],i=o[0],l=o[1],a=this.getTimeouts(),s=r?a.appear:a.enter;if(!e&&!n||S.disabled){this.safeSetState({status:M},function(){t.props.onEntered(i)});return}this.props.onEnter(i,l),this.safeSetState({status:O},function(){t.props.onEntering(i,l),t.onTransitionEnd(s,function(){t.safeSetState({status:M},function(){t.props.onEntered(i,l)})})})},n.performExit=function(){var e=this,t=this.props.exit,n=this.getTimeouts(),r=this.props.nodeRef?void 0:T.findDOMNode(this);if(!t||S.disabled){this.safeSetState({status:C},function(){e.props.onExited(r)});return}this.props.onExit(r),this.safeSetState({status:I},function(){e.props.onExiting(r),e.onTransitionEnd(n.exit,function(){e.safeSetState({status:C},function(){e.props.onExited(r)})})})},n.cancelNextCallback=function(){null!==this.nextCallback&&(this.nextCallback.cancel(),this.nextCallback=null)},n.safeSetState=function(e,t){t=this.setNextCallback(t),this.setState(e,t)},n.setNextCallback=function(e){var t=this,n=!0;return this.nextCallback=function(r){n&&(n=!1,t.nextCallback=null,e(r))},this.nextCallback.cancel=function(){n=!1},this.nextCallback},n.onTransitionEnd=function(e,t){this.setNextCallback(t);var n=this.props.nodeRef?this.props.nodeRef.current:T.findDOMNode(this),r=null==e&&!this.props.addEndListener;if(!n||r){setTimeout(this.nextCallback,0);return}if(this.props.addEndListener){var o=this.props.nodeRef?[this.nextCallback]:[n,this.nextCallback],i=o[0],l=o[1];this.props.addEndListener(i,l)}null!=e&&setTimeout(this.nextCallback,e)},n.render=function(){var e=this.state.status;if(e===w)return null;var t=this.props,n=t.children,r=(t.in,t.mountOnEnter,t.unmountOnExit,t.appear,t.enter,t.exit,t.timeout,t.addEndListener,t.onEnter,t.onEntering,t.onEntered,t.onExit,t.onExiting,t.onExited,t.nodeRef,(0,o.Z)(t,["children","in","mountOnEnter","unmountOnExit","appear","enter","exit","timeout","addEndListener","onEnter","onEntering","onEntered","onExit","onExiting","onExited","nodeRef"]));return i.createElement(N.Provider,{value:null},"function"==typeof n?n(e,r):i.cloneElement(i.Children.only(n),r))},t}(i.Component);function A(){}j.contextType=N,j.propTypes={},j.defaultProps={in:!1,mountOnEnter:!1,unmountOnExit:!1,appear:!1,enter:!0,exit:!0,onEnter:A,onEntering:A,onEntered:A,onExit:A,onExiting:A,onExited:A},j.UNMOUNTED=w,j.EXITED=C,j.ENTERING=O,j.ENTERED=M,j.EXITING=I;var D=n(7172),L=n(1941),F=function(e=null){let t=i.useContext(L.T);return t&&0!==Object.keys(t).length?t:e};let z=(0,D.Z)();var H=n(2418),B=n(2453);function U(){let e=function(e=z){return F(e)}(H.Z);return e[B.Z]||e}let q=e=>e.scrollTop;function W(e,t){var n,r;let{timeout:o,easing:i,style:l={}}=e;return{duration:null!=(n=l.transitionDuration)?n:"number"==typeof o?o:o[t.mode]||0,easing:null!=(r=l.transitionTimingFunction)?r:"object"==typeof i?i[t.mode]:i,delay:l.transitionDelay}}var _=n(5893);let K=["addEndListener","appear","children","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"];function V(e){return"scale(".concat(e,", ").concat(e**2,")")}let Y={entering:{opacity:1,transform:V(1)},entered:{opacity:1,transform:"none"}},X="undefined"!=typeof navigator&&/^((?!chrome|android).)*(safari|mobile)/i.test(navigator.userAgent)&&/(os |version\/)15(.|_)4/i.test(navigator.userAgent),G=i.forwardRef(function(e,t){let{addEndListener:n,appear:l=!0,children:a,easing:s,in:c,onEnter:d,onEntered:p,onEntering:f,onExit:h,onExited:v,onExiting:m,style:E,timeout:y="auto",TransitionComponent:x=j}=e,g=(0,o.Z)(e,K),P=function(){var e;let t=function(e,t){let n=i.useRef(b);return n.current===b&&(n.current=e(void 0)),n}(Z.create).current;return e=t.disposeEffect,i.useEffect(e,k),t}(),T=i.useRef(),S=U(),N=i.useRef(null),w=u(N,R(a),t),C=e=>t=>{if(e){let n=N.current;void 0===t?e(n):e(n,t)}},O=C(f),M=C((e,t)=>{let n;q(e);let{duration:r,delay:o,easing:i}=W({style:E,timeout:y,easing:s},{mode:"enter"});"auto"===y?(n=S.transitions.getAutoHeightDuration(e.clientHeight),T.current=n):n=r,e.style.transition=[S.transitions.create("opacity",{duration:n,delay:o}),S.transitions.create("transform",{duration:X?n:.666*n,delay:o,easing:i})].join(","),d&&d(e,t)}),I=C(p),A=C(m),D=C(e=>{let t;let{duration:n,delay:r,easing:o}=W({style:E,timeout:y,easing:s},{mode:"exit"});"auto"===y?(t=S.transitions.getAutoHeightDuration(e.clientHeight),T.current=t):t=n,e.style.transition=[S.transitions.create("opacity",{duration:t,delay:r}),S.transitions.create("transform",{duration:X?t:.666*t,delay:X?r:r||.333*t,easing:o})].join(","),e.style.opacity=0,e.style.transform=V(.75),h&&h(e)}),L=C(v);return(0,_.jsx)(x,(0,r.Z)({appear:l,in:c,nodeRef:N,onEnter:M,onEntered:I,onEntering:O,onExit:D,onExited:L,onExiting:A,addEndListener:e=>{"auto"===y&&P.start(T.current||0,e),n&&n(N.current,e)},timeout:"auto"===y?null:y},g,{children:(e,t)=>i.cloneElement(a,(0,r.Z)({style:(0,r.Z)({opacity:0,transform:V(.75),visibility:"exited"!==e||c?void 0:"hidden"},Y[e],E,a.props.style),ref:w},t))}))});function J(e){let t=[],n=[];return Array.from(e.querySelectorAll('input,select,textarea,a[href],button,[tabindex],audio[controls],video[controls],[contenteditable]:not([contenteditable="false"])')).forEach((e,r)=>{let o=function(e){let t=parseInt(e.getAttribute("tabindex")||"",10);return Number.isNaN(t)?"true"===e.contentEditable||("AUDIO"===e.nodeName||"VIDEO"===e.nodeName||"DETAILS"===e.nodeName)&&null===e.getAttribute("tabindex")?0:e.tabIndex:t}(e);-1===o||e.disabled||"INPUT"===e.tagName&&"hidden"===e.type||function(e){if("INPUT"!==e.tagName||"radio"!==e.type||!e.name)return!1;let t=t=>e.ownerDocument.querySelector('input[type="radio"]'.concat(t)),n=t('[name="'.concat(e.name,'"]:checked'));return n||(n=t('[name="'.concat(e.name,'"]'))),n!==e}(e)||(0===o?t.push(e):n.push({documentOrder:r,tabIndex:o,node:e}))}),n.sort((e,t)=>e.tabIndex===t.tabIndex?e.documentOrder-t.documentOrder:e.tabIndex-t.tabIndex).map(e=>e.node).concat(t)}function Q(){return!0}G.muiSupportAuto=!0;var $=function(e){let{children:t,disableAutoFocus:n=!1,disableEnforceFocus:r=!1,disableRestoreFocus:o=!1,getTabbable:l=J,isEnabled:a=Q,open:s}=e,c=i.useRef(!1),d=i.useRef(null),p=i.useRef(null),f=i.useRef(null),h=i.useRef(null),v=i.useRef(!1),m=i.useRef(null),E=u(R(t),m),y=i.useRef(null);i.useEffect(()=>{s&&m.current&&(v.current=!n)},[n,s]),i.useEffect(()=>{if(!s||!m.current)return;let e=x(m.current);return!m.current.contains(e.activeElement)&&(m.current.hasAttribute("tabIndex")||m.current.setAttribute("tabIndex","-1"),v.current&&m.current.focus()),()=>{o||(f.current&&f.current.focus&&(c.current=!0,f.current.focus()),f.current=null)}},[s]),i.useEffect(()=>{if(!s||!m.current)return;let e=x(m.current),t=t=>{y.current=t,!r&&a()&&"Tab"===t.key&&e.activeElement===m.current&&t.shiftKey&&(c.current=!0,p.current&&p.current.focus())},n=()=>{let t=m.current;if(null===t)return;if(!e.hasFocus()||!a()||c.current){c.current=!1;return}if(t.contains(e.activeElement)||r&&e.activeElement!==d.current&&e.activeElement!==p.current)return;if(e.activeElement!==h.current)h.current=null;else if(null!==h.current)return;if(!v.current)return;let n=[];if((e.activeElement===d.current||e.activeElement===p.current)&&(n=l(m.current)),n.length>0){var o,i;let e=!!((null==(o=y.current)?void 0:o.shiftKey)&&(null==(i=y.current)?void 0:i.key)==="Tab"),t=n[0],r=n[n.length-1];"string"!=typeof t&&"string"!=typeof r&&(e?r.focus():t.focus())}else t.focus()};e.addEventListener("focusin",n),e.addEventListener("keydown",t,!0);let o=setInterval(()=>{e.activeElement&&"BODY"===e.activeElement.tagName&&n()},50);return()=>{clearInterval(o),e.removeEventListener("focusin",n),e.removeEventListener("keydown",t,!0)}},[n,r,o,a,s,l]);let g=e=>{null===f.current&&(f.current=e.relatedTarget),v.current=!0};return(0,_.jsxs)(i.Fragment,{children:[(0,_.jsx)("div",{tabIndex:s?0:-1,onFocus:g,ref:d,"data-testid":"sentinelStart"}),i.cloneElement(t,{ref:E,onFocus:e=>{null===f.current&&(f.current=e.relatedTarget),v.current=!0,h.current=e.target;let n=t.props.onFocus;n&&n(e)}}),(0,_.jsx)("div",{tabIndex:s?0:-1,onFocus:g,ref:p,"data-testid":"sentinelEnd"})]})};let ee="undefined"!=typeof window?i.useLayoutEffect:i.useEffect,et=i.forwardRef(function(e,t){let{children:n,container:r,disablePortal:o=!1}=e,[l,a]=i.useState(null),c=u(i.isValidElement(n)?R(n):null,t);return(ee(()=>{!o&&a(("function"==typeof r?r():r)||document.body)},[r,o]),ee(()=>{if(l&&!o)return s(t,l),()=>{s(t,null)}},[t,l,o]),o)?i.isValidElement(n)?i.cloneElement(n,{ref:c}):(0,_.jsx)(i.Fragment,{children:n}):(0,_.jsx)(i.Fragment,{children:l?T.createPortal(n,l):l})}),en=["addEndListener","appear","children","easing","in","onEnter","onEntered","onEntering","onExit","onExited","onExiting","style","timeout","TransitionComponent"],er={entering:{opacity:1},entered:{opacity:1}},eo=i.forwardRef(function(e,t){let n=U(),l={enter:n.transitions.duration.enteringScreen,exit:n.transitions.duration.leavingScreen},{addEndListener:a,appear:s=!0,children:c,easing:d,in:p,onEnter:f,onEntered:h,onEntering:v,onExit:m,onExited:E,onExiting:y,style:x,timeout:g=l,TransitionComponent:b=j}=e,k=(0,o.Z)(e,en),Z=i.useRef(null),P=u(Z,R(c),t),T=e=>t=>{if(e){let n=Z.current;void 0===t?e(n):e(n,t)}},S=T(v),N=T((e,t)=>{q(e);let r=W({style:x,timeout:g,easing:d},{mode:"enter"});e.style.webkitTransition=n.transitions.create("opacity",r),e.style.transition=n.transitions.create("opacity",r),f&&f(e,t)}),w=T(h),C=T(y),O=T(e=>{let t=W({style:x,timeout:g,easing:d},{mode:"exit"});e.style.webkitTransition=n.transitions.create("opacity",t),e.style.transition=n.transitions.create("opacity",t),m&&m(e)}),M=T(E);return(0,_.jsx)(b,(0,r.Z)({appear:s,in:p,nodeRef:Z,onEnter:N,onEntered:w,onEntering:S,onExit:O,onExited:M,onExiting:C,addEndListener:e=>{a&&a(Z.current,e)},timeout:g},k,{children:(e,t)=>i.cloneElement(c,(0,r.Z)({style:(0,r.Z)({opacity:0,visibility:"exited"!==e||p?void 0:"hidden"},er[e],x,c.props.style),ref:P},t))}))});var ei=n(1588),el=n(7621);function ea(e){return(0,el.ZP)("MuiBackdrop",e)}(0,ei.Z)("MuiBackdrop",["root","invisible"]);let es=["children","className","component","components","componentsProps","invisible","open","slotProps","slots","TransitionComponent","transitionDuration"],eu=e=>{let{classes:t,invisible:n}=e;return(0,a.Z)({root:["root",n&&"invisible"]},ea,t)},ec=(0,m.ZP)("div",{name:"MuiBackdrop",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,n.invisible&&t.invisible]}})(e=>{let{ownerState:t}=e;return(0,r.Z)({position:"fixed",display:"flex",alignItems:"center",justifyContent:"center",right:0,bottom:0,top:0,left:0,backgroundColor:"rgba(0, 0, 0, 0.5)",WebkitTapHighlightColor:"transparent"},t.invisible&&{backgroundColor:"transparent"})}),ed=i.forwardRef(function(e,t){var n,i,a;let s=(0,E.i)({props:e,name:"MuiBackdrop"}),{children:u,className:c,component:d="div",components:p={},componentsProps:f={},invisible:h=!1,open:v,slotProps:m={},slots:y={},TransitionComponent:x=eo,transitionDuration:g}=s,b=(0,o.Z)(s,es),k=(0,r.Z)({},s,{component:d,invisible:h}),Z=eu(k),R=null!=(n=m.root)?n:f.root;return(0,_.jsx)(x,(0,r.Z)({in:v,timeout:g},b,{children:(0,_.jsx)(ec,(0,r.Z)({"aria-hidden":!0},R,{as:null!=(i=null!=(a=y.root)?a:p.Root)?i:d,className:(0,l.Z)(Z.root,c,null==R?void 0:R.className),ownerState:(0,r.Z)({},k,null==R?void 0:R.ownerState),classes:Z,ref:t,children:u}))}))});var ep=function(e){let t=i.useRef(e);return ee(()=>{t.current=e}),i.useRef((...e)=>(0,t.current)(...e)).current};function ef(...e){return e.reduce((e,t)=>null==t?e:function(...n){e.apply(this,n),t.apply(this,n)},()=>{})}function eh(e,t){t?e.setAttribute("aria-hidden","true"):e.removeAttribute("aria-hidden")}function ev(e){return parseInt(g(e).getComputedStyle(e).paddingRight,10)||0}function em(e,t,n,r,o){let i=[t,n,...r];[].forEach.call(e.children,e=>{let t=-1===i.indexOf(e),n=!function(e){let t=-1!==["TEMPLATE","SCRIPT","STYLE","LINK","MAP","META","NOSCRIPT","PICTURE","COL","COLGROUP","PARAM","SLOT","SOURCE","TRACK"].indexOf(e.tagName),n="INPUT"===e.tagName&&"hidden"===e.getAttribute("type");return t||n}(e);t&&n&&eh(e,o)})}function eE(e,t){let n=-1;return e.some((e,r)=>!!t(e)&&(n=r,!0)),n}class ey{add(e,t){let n=this.modals.indexOf(e);if(-1!==n)return n;n=this.modals.length,this.modals.push(e),e.modalRef&&eh(e.modalRef,!1);let r=function(e){let t=[];return[].forEach.call(e.children,e=>{"true"===e.getAttribute("aria-hidden")&&t.push(e)}),t}(t);em(t,e.mount,e.modalRef,r,!0);let o=eE(this.containers,e=>e.container===t);return -1!==o?this.containers[o].modals.push(e):this.containers.push({modals:[e],container:t,restore:null,hiddenSiblings:r}),n}mount(e,t){let n=eE(this.containers,t=>-1!==t.modals.indexOf(e)),r=this.containers[n];r.restore||(r.restore=function(e,t){let n=[],r=e.container;if(!t.disableScrollLock){let e;if(function(e){let t=x(e);return t.body===e?g(e).innerWidth>t.documentElement.clientWidth:e.scrollHeight>e.clientHeight}(r)){let e=function(e){let t=e.documentElement.clientWidth;return Math.abs(window.innerWidth-t)}(x(r));n.push({value:r.style.paddingRight,property:"padding-right",el:r}),r.style.paddingRight="".concat(ev(r)+e,"px");let t=x(r).querySelectorAll(".mui-fixed");[].forEach.call(t,t=>{n.push({value:t.style.paddingRight,property:"padding-right",el:t}),t.style.paddingRight="".concat(ev(t)+e,"px")})}if(r.parentNode instanceof DocumentFragment)e=x(r).body;else{let t=r.parentElement,n=g(r);e=(null==t?void 0:t.nodeName)==="HTML"&&"scroll"===n.getComputedStyle(t).overflowY?t:r}n.push({value:e.style.overflow,property:"overflow",el:e},{value:e.style.overflowX,property:"overflow-x",el:e},{value:e.style.overflowY,property:"overflow-y",el:e}),e.style.overflow="hidden"}return()=>{n.forEach(e=>{let{value:t,el:n,property:r}=e;t?n.style.setProperty(r,t):n.style.removeProperty(r)})}}(r,t))}remove(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1],n=this.modals.indexOf(e);if(-1===n)return n;let r=eE(this.containers,t=>-1!==t.modals.indexOf(e)),o=this.containers[r];if(o.modals.splice(o.modals.indexOf(e),1),this.modals.splice(n,1),0===o.modals.length)o.restore&&o.restore(),e.modalRef&&eh(e.modalRef,t),em(o.container,e.mount,e.modalRef,o.hiddenSiblings,!1),this.containers.splice(r,1);else{let e=o.modals[o.modals.length-1];e.modalRef&&eh(e.modalRef,!1)}return n}isTopModal(e){return this.modals.length>0&&this.modals[this.modals.length-1]===e}constructor(){this.containers=void 0,this.modals=void 0,this.modals=[],this.containers=[]}}let ex=new ey;var eg=function(e){let{container:t,disableEscapeKeyDown:n=!1,disableScrollLock:o=!1,manager:l=ex,closeAfterTransition:a=!1,onTransitionEnter:s,onTransitionExited:c,children:p,onClose:f,open:h,rootRef:v}=e,m=i.useRef({}),E=i.useRef(null),y=i.useRef(null),g=u(y,v),[b,k]=i.useState(!h),Z=!!p&&p.props.hasOwnProperty("in"),R=!0;("false"===e["aria-hidden"]||!1===e["aria-hidden"])&&(R=!1);let P=()=>x(E.current),T=()=>(m.current.modalRef=y.current,m.current.mount=E.current,m.current),S=()=>{l.mount(T(),{disableScrollLock:o}),y.current&&(y.current.scrollTop=0)},N=ep(()=>{let e=("function"==typeof t?t():t)||P().body;l.add(T(),e),y.current&&S()}),w=i.useCallback(()=>l.isTopModal(T()),[l]),C=ep(e=>{E.current=e,e&&(h&&w()?S():y.current&&eh(y.current,R))}),O=i.useCallback(()=>{l.remove(T(),R)},[R,l]);i.useEffect(()=>()=>{O()},[O]),i.useEffect(()=>{h?N():Z&&a||O()},[h,O,Z,a,N]);let M=e=>t=>{var r;null==(r=e.onKeyDown)||r.call(e,t),"Escape"===t.key&&229!==t.which&&w()&&!n&&(t.stopPropagation(),f&&f(t,"escapeKeyDown"))},I=e=>t=>{var n;null==(n=e.onClick)||n.call(e,t),t.target===t.currentTarget&&f&&f(t,"backdropClick")};return{getRootProps:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=d(e);delete n.onTransitionEnter,delete n.onTransitionExited;let o=(0,r.Z)({},n,t);return(0,r.Z)({role:"presentation"},o,{onKeyDown:M(o),ref:g})},getBackdropProps:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,r.Z)({"aria-hidden":!0},e,{onClick:I(e),open:h})},getTransitionProps:()=>({onEnter:ef(()=>{k(!1),s&&s()},null==p?void 0:p.props.onEnter),onExited:ef(()=>{k(!0),c&&c(),a&&O()},null==p?void 0:p.props.onExited)}),rootRef:g,portalRef:C,isTopModal:w,exited:b,hasTransition:Z}};function eb(e){return(0,el.ZP)("MuiModal",e)}(0,ei.Z)("MuiModal",["root","hidden","backdrop"]);let ek=["BackdropComponent","BackdropProps","classes","className","closeAfterTransition","children","container","component","components","componentsProps","disableAutoFocus","disableEnforceFocus","disableEscapeKeyDown","disablePortal","disableRestoreFocus","disableScrollLock","hideBackdrop","keepMounted","onBackdropClick","onClose","onTransitionEnter","onTransitionExited","open","slotProps","slots","theme"],eZ=e=>{let{open:t,exited:n,classes:r}=e;return(0,a.Z)({root:["root",!t&&n&&"hidden"],backdrop:["backdrop"]},eb,r)},eR=(0,m.ZP)("div",{name:"MuiModal",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,!n.open&&n.exited&&t.hidden]}})(e=>{let{theme:t,ownerState:n}=e;return(0,r.Z)({position:"fixed",zIndex:(t.vars||t).zIndex.modal,right:0,bottom:0,top:0,left:0},!n.open&&n.exited&&{visibility:"hidden"})}),eP=(0,m.ZP)(ed,{name:"MuiModal",slot:"Backdrop",overridesResolver:(e,t)=>t.backdrop})({zIndex:-1}),eT=i.forwardRef(function(e,t){var n,a,s,u,c,d;let p=(0,E.i)({name:"MuiModal",props:e}),{BackdropComponent:f=eP,BackdropProps:h,className:m,closeAfterTransition:y=!1,children:x,container:g,component:b,components:k={},componentsProps:Z={},disableAutoFocus:R=!1,disableEnforceFocus:P=!1,disableEscapeKeyDown:T=!1,disablePortal:S=!1,disableRestoreFocus:N=!1,disableScrollLock:w=!1,hideBackdrop:C=!1,keepMounted:O=!1,onBackdropClick:M,open:I,slotProps:j,slots:A}=p,D=(0,o.Z)(p,ek),L=(0,r.Z)({},p,{closeAfterTransition:y,disableAutoFocus:R,disableEnforceFocus:P,disableEscapeKeyDown:T,disablePortal:S,disableRestoreFocus:N,disableScrollLock:w,hideBackdrop:C,keepMounted:O}),{getRootProps:F,getBackdropProps:z,getTransitionProps:H,portalRef:B,isTopModal:U,exited:q,hasTransition:W}=eg((0,r.Z)({},L,{rootRef:t})),K=(0,r.Z)({},L,{exited:q}),V=eZ(K),Y={};if(void 0===x.props.tabIndex&&(Y.tabIndex="-1"),W){let{onEnter:e,onExited:t}=H();Y.onEnter=e,Y.onExited=t}let X=null!=(n=null!=(a=null==A?void 0:A.root)?a:k.Root)?n:eR,G=null!=(s=null!=(u=null==A?void 0:A.backdrop)?u:k.Backdrop)?s:f,J=null!=(c=null==j?void 0:j.root)?c:Z.root,Q=null!=(d=null==j?void 0:j.backdrop)?d:Z.backdrop,ee=v({elementType:X,externalSlotProps:J,externalForwardedProps:D,getSlotProps:F,additionalProps:{ref:t,as:b},ownerState:K,className:(0,l.Z)(m,null==J?void 0:J.className,null==V?void 0:V.root,!K.open&&K.exited&&(null==V?void 0:V.hidden))}),en=v({elementType:G,externalSlotProps:Q,additionalProps:h,getSlotProps:e=>z((0,r.Z)({},e,{onClick:t=>{M&&M(t),null!=e&&e.onClick&&e.onClick(t)}})),className:(0,l.Z)(null==Q?void 0:Q.className,null==h?void 0:h.className,null==V?void 0:V.backdrop),ownerState:K});return O||I||W&&!q?(0,_.jsx)(et,{ref:B,container:g,disablePortal:S,children:(0,_.jsxs)(X,(0,r.Z)({},ee,{children:[!C&&f?(0,_.jsx)(G,(0,r.Z)({},en)):null,(0,_.jsx)($,{disableEnforceFocus:P,disableAutoFocus:R,disableRestoreFocus:N,isEnabled:U,open:I,children:i.cloneElement(x,Y)})]}))}):null});var eS=n(2101),eN=e=>((e<1?5.11916*e**2:4.5*Math.log(e+1)+2)/100).toFixed(2);function ew(e){return(0,el.ZP)("MuiPaper",e)}(0,ei.Z)("MuiPaper",["root","rounded","outlined","elevation","elevation0","elevation1","elevation2","elevation3","elevation4","elevation5","elevation6","elevation7","elevation8","elevation9","elevation10","elevation11","elevation12","elevation13","elevation14","elevation15","elevation16","elevation17","elevation18","elevation19","elevation20","elevation21","elevation22","elevation23","elevation24"]);let eC=["className","component","elevation","square","variant"],eO=e=>{let{square:t,elevation:n,variant:r,classes:o}=e;return(0,a.Z)({root:["root",r,!t&&"rounded","elevation"===r&&"elevation".concat(n)]},ew,o)},eM=(0,m.ZP)("div",{name:"MuiPaper",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:n}=e;return[t.root,t[n.variant],!n.square&&t.rounded,"elevation"===n.variant&&t["elevation".concat(n.elevation)]]}})(e=>{var t;let{theme:n,ownerState:o}=e;return(0,r.Z)({backgroundColor:(n.vars||n).palette.background.paper,color:(n.vars||n).palette.text.primary,transition:n.transitions.create("box-shadow")},!o.square&&{borderRadius:n.shape.borderRadius},"outlined"===o.variant&&{border:"1px solid ".concat((n.vars||n).palette.divider)},"elevation"===o.variant&&(0,r.Z)({boxShadow:(n.vars||n).shadows[o.elevation]},!n.vars&&"dark"===n.palette.mode&&{backgroundImage:"linear-gradient(".concat((0,eS.Fq)("#fff",eN(o.elevation)),", ").concat((0,eS.Fq)("#fff",eN(o.elevation)),")")},n.vars&&{backgroundImage:null==(t=n.vars.overlays)?void 0:t[o.elevation]}))}),eI=i.forwardRef(function(e,t){let n=(0,E.i)({props:e,name:"MuiPaper"}),{className:i,component:a="div",elevation:s=1,square:u=!1,variant:c="elevation"}=n,d=(0,o.Z)(n,eC),p=(0,r.Z)({},n,{component:a,elevation:s,square:u,variant:c}),f=eO(p);return(0,_.jsx)(eM,(0,r.Z)({as:a,ownerState:p,className:(0,l.Z)(f.root,i),ref:t},d))});function ej(e){return(0,el.ZP)("MuiPopover",e)}(0,ei.Z)("MuiPopover",["root","paper"]);let eA=["onEntering"],eD=["action","anchorEl","anchorOrigin","anchorPosition","anchorReference","children","className","container","elevation","marginThreshold","open","PaperProps","slots","slotProps","transformOrigin","TransitionComponent","transitionDuration","TransitionProps","disableScrollLock"],eL=["slotProps"];function eF(e,t){let n=0;return"number"==typeof t?n=t:"center"===t?n=e.height/2:"bottom"===t&&(n=e.height),n}function ez(e,t){let n=0;return"number"==typeof t?n=t:"center"===t?n=e.width/2:"right"===t&&(n=e.width),n}function eH(e){return[e.horizontal,e.vertical].map(e=>"number"==typeof e?"".concat(e,"px"):e).join(" ")}function eB(e){return"function"==typeof e?e():e}let eU=e=>{let{classes:t}=e;return(0,a.Z)({root:["root"],paper:["paper"]},ej,t)},eq=(0,m.ZP)(eT,{name:"MuiPopover",slot:"Root",overridesResolver:(e,t)=>t.root})({}),eW=(0,m.ZP)(eI,{name:"MuiPopover",slot:"Paper",overridesResolver:(e,t)=>t.paper})({position:"absolute",overflowY:"auto",overflowX:"hidden",minWidth:16,minHeight:16,maxWidth:"calc(100% - 32px)",maxHeight:"calc(100% - 32px)",outline:0});var e_=i.forwardRef(function(e,t){var n,a,s;let d=(0,E.i)({props:e,name:"MuiPopover"}),{action:p,anchorEl:f,anchorOrigin:h={vertical:"top",horizontal:"left"},anchorPosition:m,anchorReference:b="anchorEl",children:k,className:Z,container:R,elevation:P=8,marginThreshold:T=16,open:S,PaperProps:N={},slots:w,slotProps:C,transformOrigin:O={vertical:"top",horizontal:"left"},TransitionComponent:M=G,transitionDuration:I="auto",TransitionProps:{onEntering:j}={},disableScrollLock:A=!1}=d,D=(0,o.Z)(d.TransitionProps,eA),L=(0,o.Z)(d,eD),F=null!=(n=null==C?void 0:C.paper)?n:N,z=i.useRef(),H=u(z,F.ref),B=(0,r.Z)({},d,{anchorOrigin:h,anchorReference:b,elevation:P,marginThreshold:T,externalPaperSlotProps:F,transformOrigin:O,TransitionComponent:M,transitionDuration:I,TransitionProps:D}),U=eU(B),q=i.useCallback(()=>{if("anchorPosition"===b)return m;let e=eB(f),t=(e&&1===e.nodeType?e:x(z.current).body).getBoundingClientRect();return{top:t.top+eF(t,h.vertical),left:t.left+ez(t,h.horizontal)}},[f,h.horizontal,h.vertical,m,b]),W=i.useCallback(e=>({vertical:eF(e,O.vertical),horizontal:ez(e,O.horizontal)}),[O.horizontal,O.vertical]),K=i.useCallback(e=>{let t={width:e.offsetWidth,height:e.offsetHeight},n=W(t);if("none"===b)return{top:null,left:null,transformOrigin:eH(n)};let r=q(),o=r.top-n.vertical,i=r.left-n.horizontal,l=o+t.height,a=i+t.width,s=g(eB(f)),u=s.innerHeight-T,c=s.innerWidth-T;if(null!==T&&ou){let e=l-u;o-=e,n.vertical+=e}if(null!==T&&ic){let e=a-c;i-=e,n.horizontal+=e}return{top:"".concat(Math.round(o),"px"),left:"".concat(Math.round(i),"px"),transformOrigin:eH(n)}},[f,b,q,W,T]),[V,Y]=i.useState(S),X=i.useCallback(()=>{let e=z.current;if(!e)return;let t=K(e);null!==t.top&&(e.style.top=t.top),null!==t.left&&(e.style.left=t.left),e.style.transformOrigin=t.transformOrigin,Y(!0)},[K]);i.useEffect(()=>(A&&window.addEventListener("scroll",X),()=>window.removeEventListener("scroll",X)),[f,A,X]),i.useEffect(()=>{S&&X()}),i.useImperativeHandle(p,()=>S?{updatePosition:()=>{X()}}:null,[S,X]),i.useEffect(()=>{if(!S)return;let e=y(()=>{X()}),t=g(f);return t.addEventListener("resize",e),()=>{e.clear(),t.removeEventListener("resize",e)}},[f,S,X]);let J=I;"auto"!==I||M.muiSupportAuto||(J=void 0);let Q=R||(f?x(eB(f)).body:void 0),$=null!=(a=null==w?void 0:w.root)?a:eq,ee=null!=(s=null==w?void 0:w.paper)?s:eW,et=v({elementType:ee,externalSlotProps:(0,r.Z)({},F,{style:V?F.style:(0,r.Z)({},F.style,{opacity:0})}),additionalProps:{elevation:P,ref:H},ownerState:B,className:(0,l.Z)(U.paper,null==F?void 0:F.className)}),en=v({elementType:$,externalSlotProps:(null==C?void 0:C.root)||{},externalForwardedProps:L,additionalProps:{ref:t,slotProps:{backdrop:{invisible:!0}},container:Q,open:S},ownerState:B,className:(0,l.Z)(U.root,Z)}),{slotProps:er}=en,eo=(0,o.Z)(en,eL);return(0,_.jsx)($,(0,r.Z)({},eo,!c($)&&{slotProps:er,disableScrollLock:A},{children:(0,_.jsx)(M,(0,r.Z)({appear:!0,in:S,onEntering:(e,t)=>{j&&j(e,t),X()},onExited:()=>{Y(!1)},timeout:J},D,{children:(0,_.jsx)(ee,(0,r.Z)({},et,{children:k}))}))}))})},8507:function(e,t,n){n.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,n(998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8586:function(e,t,n){n.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,n(998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/37-1ceb6ddb802bc6c9.js b/sky/dashboard/out/_next/static/chunks/37-1ceb6ddb802bc6c9.js new file mode 100644 index 000000000..0915cd06b --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/37-1ceb6ddb802bc6c9.js @@ -0,0 +1,6 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[37],{9037:function(e,s,r){r.r(s),r.d(s,{ClusterTable:function(){return Z},Clusters:function(){return O},Status2Actions:function(){return U},enabledActions:function(){return V},handleVSCodeConnection:function(){return z}});var t=r(5893),a=r(7294),l=r(1163),n=r(5739),i=r(470),o=r(1664),c=r.n(o),d=r(689);r(803);var u=r(7673),h=r(8764),p=r(6990),m=r(3266),x=r(7324),f=r(4545),g=r(3626),j=r(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let w=(0,j.Z)("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]),y=(0,j.Z)("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);var b=r(3850);r(3872);var v=r(9284),k=r(9307),N=r(3001),C=r(5988),S=r(3800),P=r(2935),L=r(6378),H=r(6856);r(1272);var I=r(546),R=r(299),E=r(1428);let _=[10,30,50,100,200],M="skypilot-clusters-page-size",K=[{label:"Status",value:"status"},{label:"Cluster",value:"cluster"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Infra",value:"infra"},{label:"Labels",value:"labels"}],D=(e,s)=>{if(e&&e.includes("@")){let r=e.split("@")[0];return s&&s!==r?"".concat(r," (").concat(s,")"):r}let r=e||s||"N/A";return s&&s!==r?"".concat(r," (").concat(s,")"):r},q=e=>{if(!e||0===e)return"-";let s=e=Math.floor(e),r="",t=0;for(let e of[{value:31536e3,label:"y"},{value:2592e3,label:"mo"},{value:86400,label:"d"},{value:3600,label:"h"},{value:60,label:"m"},{value:1,label:"s"}])if(s>=e.value&&t<2){let a=Math.floor(s/e.value);r+="".concat(a).concat(e.label," "),s%=e.value,t++}return r.trim()||"0s"};function O(){let e=(0,l.useRouter)(),[s,r]=(0,a.useState)(!1),o=a.useRef(null),[d,u]=(0,a.useState)(!1),[h,p]=(0,a.useState)(!1),[f,j]=(0,a.useState)(null),[w,y]=(0,a.useState)(()=>!!e.isReady&&"true"===e.query.history),[b,k]=(0,a.useState)(!0),[C,S]=(0,a.useState)(()=>{if(e.isReady){let s=e.query.historyDays;if(s&&"string"==typeof s&&["1","5","10","30"].includes(s))return parseInt(s)}return 1}),I=(0,N.X)(),[R,E]=(0,a.useState)([]),[_,M]=(0,a.useState)({status:[],cluster:[],user:[],workspace:[],infra:[],labels:[]}),[q,O]=(0,a.useState)(!1),[z,F]=(0,a.useState)(null);(0,a.useEffect)(()=>{if(e.isReady){Q();let s="true"===e.query.history;w!==s&&(k(!1),y(s),setTimeout(()=>k(!0),50));let r=e.query.historyDays;if(r&&"string"==typeof r&&["1","5","10","30"].includes(r)){let e=parseInt(r);C!==e&&S(e)}}},[e.isReady,e.query.history,e.query.historyDays]),(0,a.useEffect)(()=>{(async()=>{try{await H.ZP.preloadForPage("clusters");let e=await L.ZP.get(x.getWorkspaces),s=Object.keys(e),r=await L.ZP.get(m.getClusters),t=[...new Set(r.map(e=>e.workspace||"default").filter(e=>e))],a=new Set(s);t.includes("default")&&a.has("default"),t.forEach(e=>a.add(e));let l=[...new Set(r.map(e=>({userId:e.user_hash||e.user,username:e.user})).filter(e=>e.userId)).values()],n=new Map;l.forEach(e=>{n.set(e.userId,{userId:e.userId,username:e.username,display:D(e.username,e.userId)})}),O(!0),F(new Date)}catch(e){console.error("Error fetching data for filters:",e),O(!0),F(new Date)}})()},[]);let V=s=>{let r={...e.query},t=[],a=[],l=[];s.map((e,s)=>{var r;t.push(null!==(r=e.property.toLowerCase())&&void 0!==r?r:""),a.push(e.operator),l.push(e.value)}),r.property=t,r.operator=a,r.value=l,e.replace({pathname:e.pathname,query:r},void 0,{shallow:!0})},A=s=>{let r={...e.query};r.history=s.toString(),e.replace({pathname:e.pathname,query:r},void 0,{shallow:!0})},U=s=>{let r={...e.query};r.historyDays=s.toString(),e.replace({pathname:e.pathname,query:r},void 0,{shallow:!0})},Q=()=>{let s={...e.query},r=s.property,t=s.operator,a=s.value;if(void 0===r)return;let l=[],n=Array.isArray(r)?r.length:1,i=new Map;if(i.set("",""),i.set("status","Status"),i.set("cluster","Cluster"),i.set("user","User"),i.set("workspace","Workspace"),i.set("infra","Infra"),1===n)l.push({property:i.get(r),operator:t,value:a});else for(let e=0;e{let s=e.target.checked;y(s),A(s)},className:"sr-only"}),(0,t.jsx)("div",{className:"relative inline-flex h-5 w-9 items-center rounded-full ".concat(b?"transition-colors":""," ").concat(w?"bg-sky-600":"bg-gray-300"),children:(0,t.jsx)("span",{className:"inline-block h-3 w-3 transform rounded-full bg-white ".concat(b?"transition-transform":""," ").concat(w?"translate-x-5":"translate-x-1")})}),(0,t.jsx)("span",{className:"ml-2 text-sm text-gray-700",children:"Show history"})]}),w&&(0,t.jsxs)(P.Ph,{value:C.toString(),onValueChange:e=>{let s=parseInt(e);S(s),U(s)},children:[(0,t.jsx)(P.i4,{className:"w-24 h-8 text-xs",children:(0,t.jsx)(P.ki,{})}),(0,t.jsxs)(P.Bw,{children:[(0,t.jsx)(P.Ql,{value:"1",children:"1 day"}),(0,t.jsx)(P.Ql,{value:"5",children:"5 days"}),(0,t.jsx)(P.Ql,{value:"10",children:"10 days"}),(0,t.jsx)(P.Ql,{value:"30",children:"30 days"})]})]})]}),s&&(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsx)(n.Z,{size:15,className:"mt-0"}),(0,t.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),!s&&z&&(0,t.jsx)(i.$3,{timestamp:z}),(0,t.jsxs)("button",{onClick:()=>{L.ZP.invalidate(m.getClusters),L.ZP.invalidate(x.getWorkspaces),w&&L.ZP.invalidate(m.uR),O(!1),H.ZP.preloadForPage("clusters",{force:!0}).then(()=>{O(!0),F(new Date),o.current&&o.current()})},disabled:s,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,t.jsx)(g.Z,{className:"h-4 w-4 mr-1.5"}),!I&&(0,t.jsx)("span",{children:"Refresh"})]})]})]}),(0,t.jsx)(T,{filters:R,setFilters:E,updateURLParams:V}),(0,t.jsx)(Z,{refreshInterval:i.yc,setLoading:r,refreshDataRef:o,filters:R,showHistory:w,historyDays:C,onOpenSSHModal:e=>{j(e),u(!0)},onOpenVSCodeModal:e=>{j(e),p(!0)},setOptionValues:M,preloadingComplete:q}),(0,t.jsx)(v.Oh,{isOpen:d,onClose:()=>u(!1),cluster:f}),(0,t.jsx)(v._R,{isOpen:h,onClose:()=>p(!1),cluster:f})]})}function Z(e){let{refreshInterval:s,setLoading:r,refreshDataRef:l,filters:o,showHistory:x,historyDays:g,onOpenSSHModal:j,onOpenVSCodeModal:w,setOptionValues:y,preloadingComplete:v}=e,[N,P]=(0,a.useState)({key:null,direction:"ascending"}),{data:L,allData:H,total:E,page:K,limit:D,totalPages:O,hasNext:Z,hasPrev:z,setPage:F,setLimit:V,loading:A,refresh:W,isServerPagination:T}=(0,m.r7)({showHistory:x,historyDays:g,refreshInterval:v?s:null,sortConfig:N,filters:o,initialPage:(()=>{{let e=parseInt(new URLSearchParams(window.location.search).get("page"),10);return e>0?e:1}})(),initialLimit:(()=>{{let e=parseInt(new URLSearchParams(window.location.search).get("pageSize"),10);return _.includes(e)?e:(0,p.dp)(M,_,10)}})()});(0,a.useEffect)(()=>{let e=new URL(window.location.href);K>1?e.searchParams.set("page",String(K)):e.searchParams.delete("page"),10!==D?e.searchParams.set("pageSize",String(D)):e.searchParams.delete("pageSize"),e.href!==window.location.href&&window.history.replaceState(null,"",e.toString())},[K,D]);let[Q,B]=(0,a.useState)(!0);(0,a.useEffect)(()=>{!A&&Q&&B(!1)},[A,Q]),(0,a.useEffect)(()=>{r(A)},[A,r]);let X=e=>{let s={status:[],cluster:[],user:[],workspace:[],infra:[],labels:[]},r=(e,s)=>{e.includes(s)||e.push(s)};return e.map(e=>{r(s.status,e.status),r(s.cluster,e.cluster),r(s.user,e.user),r(s.workspace,e.workspace),r(s.infra,e.full_infra||e.infra);let t=e.labels||{};t&&"object"==typeof t&&Object.entries(t).forEach(e=>{let[t,a]=e;t&&a&&r(s.labels,"".concat(t,":").concat(a))})}),s};(0,a.useEffect)(()=>{H&&H.length>0&&y(X(H))},[H,y]);let G=a.useMemo(()=>{let e=T?L:H;if(!T){let e=(H||[]).filter(e=>e.isHistorical).length;console.log("[ClusterTable] Client-side - allData length:",(H||[]).length,", historical:",e,", filters:",o.length)}let s=T?e:0===o.length?e:e.filter(e=>{let s=null;for(let r=0;r{l&&(l.current=W)},[l,W]);let Y=e=>{let s="ascending";N.key===e&&"ascending"===N.direction&&(s="descending"),P({key:e,direction:s})},$=e=>N.key===e?"ascending"===N.direction?" ↑":" ↓":"",J=T?E:G.length,ee=T?O||Math.ceil(E/D)||1:Math.ceil(G.length/D)||1,es=(K-1)*D,er=es+D,et=T?G:G.slice(es,er),ea=[{id:"status",order:0,header:{label:"Status",sortKey:"status",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("status"),children:["Status",$("status")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:(0,t.jsx)(C.j,{name:"clusters.table.status.badge",context:e,fallback:(0,t.jsx)(k.OE,{status:e.status,statusTooltip:e.statusTooltip})})})},{id:"cluster",order:1,header:{label:"Cluster",sortKey:"cluster",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("cluster"),children:["Cluster",$("cluster")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:(0,t.jsx)(c(),{href:"/clusters/".concat(e.isHistorical?e.cluster_hash:e.cluster||e.name),className:"text-blue-600",children:e.cluster||e.name})})},{id:"user",order:2,header:{label:"User",sortKey:"user",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("user"),children:["User",$("user")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:e.user?(0,t.jsx)(I.H,{username:e.user,userHash:e.user_hash}):"-"})},{id:"workspace",order:3,header:{label:"Workspace",sortKey:"workspace",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("workspace"),children:["Workspace",$("workspace")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:(0,t.jsx)(c(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})})},{id:"infra",order:4,header:{label:"Infra",sortKey:"infra",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("infra"),children:["Infra",$("infra")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:(0,t.jsx)(i.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,t.jsxs)("span",{children:[(0,t.jsx)(c(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud}),e.infra.includes("(")&&(0,t.jsx)("span",{children:" "+e.infra.substring(e.infra.indexOf("("))})]})})})},{id:"resources",order:5,header:{label:"Resources",sortKey:"resources_str",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("resources_str"),children:["Resources",$("resources_str")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:e.resources_str_full||e.resources_str?(0,t.jsx)(i.Md,{content:e.resources_str_full||e.resources_str,className:"text-sm text-muted-foreground",children:(0,t.jsx)("span",{children:e.resources_str||"-"})}):(0,t.jsx)("span",{children:"-"})})},{id:"started",order:6,header:{label:"Started",sortKey:"time",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("time"),children:["Started",$("time")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:(0,t.jsx)(i.Zg,{date:e.time})})},{id:"duration",order:7,conditional:!0,header:{label:"Duration",sortKey:"duration",className:"sortable whitespace-nowrap"},renderHeader:()=>x?(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("duration"),children:["Duration",$("duration")]}):null,renderCell:e=>x?(0,t.jsx)(h.pj,{children:q(e.duration)}):null},{id:"autostop",order:8,header:{label:"Autostop",sortKey:"autostop",className:"sortable whitespace-nowrap"},renderHeader:()=>(0,t.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>Y("autostop"),children:["Autostop",$("autostop")]}),renderCell:e=>(0,t.jsx)(h.pj,{children:e.isHistorical?"-":(0,i.Kf)(e.autostop,e.to_down)})},{id:"actions",order:9,header:{label:"Actions",className:"md:sticky md:right-0 md:bg-white"},renderHeader:()=>(0,t.jsx)(h.ss,{className:"md:sticky md:right-0 md:bg-white",children:"Actions"}),renderCell:e=>(0,t.jsx)(h.pj,{className:"text-left md:sticky md:right-0 md:bg-white",children:!e.isHistorical&&(0,t.jsx)(U,{cluster:e.cluster,status:e.status,onOpenSSHModal:j,onOpenVSCodeModal:w})})},...(0,S._q)("clusters",{showHistory:x}).map(e=>({id:e.id,order:e.header.order,isPlugin:!0,pluginColumn:e,renderHeader:()=>{let s=e.header.sortKey?"sortable whitespace-nowrap":"whitespace-nowrap",r="".concat(s).concat(e.header.className?" "+e.header.className:"");return(0,t.jsxs)(h.ss,{className:r,onClick:e.header.sortKey?()=>Y(e.header.sortKey):void 0,children:[e.header.label,e.header.sortKey?$(e.header.sortKey):""]})},renderCell:s=>{let r=e.cell.render(s,{item:s,showHistory:x,historyDays:g});return(0,t.jsx)(h.pj,{className:e.cell.className||"",children:r})}}))].sort((e,s)=>e.order-s.order).filter(e=>!e.conditional||e.conditional&&x),el=ea.length;return(0,t.jsxs)("div",{children:[(0,t.jsx)(u.Zb,{children:(0,t.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,t.jsxs)(h.iA,{className:"min-w-full",children:[(0,t.jsx)(h.xD,{children:(0,t.jsx)(h.SC,{children:ea.map(e=>a.cloneElement(e.renderHeader(),{key:e.id}))})}),(0,t.jsx)(h.RM,{children:A||!v?(0,t.jsx)(h.SC,{children:(0,t.jsx)(h.pj,{colSpan:el,className:"text-center py-6 text-gray-500",children:(0,t.jsxs)("div",{className:"flex justify-center items-center",children:[(0,t.jsx)(n.Z,{size:20,className:"mr-2"}),(0,t.jsx)("span",{children:"Loading..."})]})})}):et.length>0&&!(0,p.KL)()?et.map((e,s)=>(0,t.jsx)(h.SC,{children:ea.map(s=>a.cloneElement(s.renderCell(e),{key:s.id}))},s)):(0,t.jsx)(h.Iz,{colSpan:el,icon:(0,t.jsx)(b.QT,{className:"w-5 h-5"}),title:x?"No clusters found":"No active clusters",description:x?"No clusters in the selected time range":"Launch a cluster to run your workloads"})})]})})}),J>0&&(0,t.jsx)(d.j,{currentPage:K,totalPages:ee,totalCount:J,startIndex:es,endIndex:er,onPageChange:F,onPreviousPage:()=>{T?z&&F(K-1):F(Math.max(K-1,1))},onNextPage:()=>{T?Z&&F(K+1):F(Math.min(K+1,ee))},isPrevDisabled:T?!z:1===K,isNextDisabled:T?!Z:K===ee||0===ee,pageSize:D,onPageSizeChange:e=>{let s=parseInt(e.target.value,10);V(s),(0,p.AW)(M,s)},pageSizeOptions:_})]})}let z=(e,s)=>{s&&s(e)},F=(e,s)=>{s?s(e):window.open("ssh://".concat(e))},V=e=>"RUNNING"===e?["connect","VSCode"]:[],A={connect:(0,t.jsx)(w,{className:"w-4 h-4 text-gray-500 inline-block"}),VSCode:(0,t.jsx)(y,{className:"w-4 h-4 text-gray-500 inline-block"})};function U(e){let{withLabel:s=!1,cluster:r,status:a,onOpenSSHModal:l,onOpenVSCodeModal:n}=e,o=V(a),c=(0,N.X)(),d=e=>{switch((0,E.rg)(e,{status:a}),e){case"connect":F(r,l);break;case"VSCode":z(r,n);break;default:return}};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"flex items-center space-x-4",children:Object.entries(A).map(e=>{let r,a,[l,n]=e;switch(l){case"connect":r="Connect",a="Connect with SSH";break;case"VSCode":r="VSCode",a="Open in VS Code"}return(s||(r=""),o.includes(l))?(0,t.jsx)(i.WH,{content:a,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("button",{onClick:()=>d(l),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center",children:[n,!c&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},l):(0,t.jsx)(i.WH,{content:a,className:"capitalize text-sm text-muted-foreground",children:(0,t.jsxs)("span",{className:"opacity-30 flex items-center cursor-not-allowed text-sm",title:l,children:[n,!c&&(0,t.jsx)("span",{className:"ml-1.5",children:r})]})},l)})})})}let W=e=>{let{propertyList:s=[],valueList:r,setFilters:l,updateURLParams:n,placeholder:i="Filter clusters",filters:o=[]}=e,c=(0,a.useRef)(null),d=(0,a.useRef)(null),[u,h]=(0,a.useState)(!1),[p,m]=(0,a.useState)(""),[x,f]=(0,a.useState)("cluster"),[g,j]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=e=>{d.current&&!d.current.contains(e.target)&&c.current&&!c.current.contains(e.target)&&h(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[],s=x||"";if(s.length>1){s=x[0].toUpperCase();for(let e=1;ee.property===s).map(e=>e.value);if(r&&"object"==typeof r)switch(x){case"status":e=r.status.filter(e=>!t.find(s=>s===e))||[];break;case"user":e=r.user.filter(e=>!t.find(s=>s===e))||[];break;case"cluster":e=r.cluster.filter(e=>!t.find(s=>s===e))||[];break;case"workspace":e=r.workspace.filter(e=>!t.find(s=>s===e))||[];break;case"infra":e=r.infra.filter(e=>!t.find(s=>s===e))||[];break;case"labels":e=r.labels.filter(e=>!t.find(s=>s===e))||[]}""!==p.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(p.toLowerCase()))),j(e)},[x,r,p,o]);let w=e=>{let r=s.find(s=>s.value===e);return r?r.label:e},y=e=>{(0,E.ZY)("cluster",{property:x,value:e}),l(s=>{let r=[...s,{property:w(x),operator:":",value:e}];return n(r),r}),h(!1),m(""),c.current.focus()};return(0,t.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible",children:[(0,t.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,t.jsxs)(P.Ph,{onValueChange:f,value:x,children:[(0,t.jsx)(P.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm",children:(0,t.jsx)(P.ki,{placeholder:"Status"})}),(0,t.jsx)(P.Bw,{children:s.map((e,s)=>(0,t.jsx)(P.Ql,{value:e.value,children:e.label},"property-item-".concat(s)))})]})}),(0,t.jsxs)("div",{className:"relative flex-1 sm:flex-none",children:[(0,t.jsx)("input",{type:"text",ref:c,placeholder:i,value:p,onChange:e=>{m(e.target.value),u||h(!0)},onFocus:()=>{h(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==p.trim()?(l(e=>{let s=[...e,{property:w(x),operator:":",value:p}];return n(s),s}),m(""),h(!1)):"Escape"===e.key&&(h(!1),c.current.blur())},className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),p&&(0,t.jsx)("button",{onClick:()=>{m(""),h(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,t.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),u&&g.length>0&&(0,t.jsx)("div",{ref:d,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:g.map((e,s)=>(0,t.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(s!==g.length-1?"border-b border-gray-100":""),onClick:()=>y(e),children:(0,t.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(s)))})]})]})},T=e=>{let{filters:s=[],setFilters:r,updateURLParams:a}=e,l=e=>{r(s=>{let r=s.filter((s,r)=>r!==e);return a(r),r})};return(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,t.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[s.map((e,s)=>(0,t.jsx)(Q,{filter:e,onRemove:()=>l(s)},"filteritem-".concat(s))),s.length>0&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)("button",{onClick:()=>{a([]),r([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},Q=e=>{let{filter:s,onRemove:r}=e;return(0,t.jsx)(t.Fragment,{children:(0,t.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,t.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,t.jsx)("span",{children:"".concat(s.property," ")}),(0,t.jsx)("span",{children:"".concat(s.operator," ")}),(0,t.jsx)("span",{children:" ".concat(s.value)})]}),(0,t.jsx)("button",{onClick:()=>r(),className:"p-0.5 ml-1 transform text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex flex-col items-center",title:"Clear filter",children:(0,t.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/400.f86a54d1da11a290.js b/sky/dashboard/out/_next/static/chunks/400.f86a54d1da11a290.js new file mode 100644 index 000000000..08637eafe --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/400.f86a54d1da11a290.js @@ -0,0 +1,46 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[400],{3359:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},172:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},1021:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]])},4544:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]])},1260:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},3626:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},7603:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("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"}]])},6122:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("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"}]])},1400:function(e,t,r){r.r(t),r.d(t,{RecipeHub:function(){return H}});var s=r(5893),a=r(7294),n=r(1163),l=r(1664),c=r.n(l),i=r(5739),o=r(1272),d=r(1021),p=r(3359),u=r(4544),h=r(7603),m=r(6122),x=r(3626),y=r(1260),f=r(7673),b=r(803),g=r(8764),j=r(2942),v=r(6990),w=r(4545),N=r(1360),k=r(2557),C=r(9749);r(9123);var _=r(5089),L=r(2935),Z=r(470),S=r(5821),R=r(1428),M=r(7719),E=r(2344),T=r(3800);let z=[{label:"Name",value:"name"},{label:"Type",value:"recipe_type"},{label:"Owner",value:"user_name"}];function O(e){let{name:t,className:r=""}=e;if(!t)return(0,s.jsx)("span",{className:r,children:"Unknown"});if(t.includes("@")){let e=t.split("@")[0];return(0,s.jsx)(Z.Md,{content:t,children:(0,s.jsx)("span",{className:"border-b border-dotted border-gray-400 cursor-help ".concat(r),children:e})})}return(0,s.jsx)("span",{className:r,children:t})}function A(e){let{recipe:t,onPin:r}=e,a=(0,T.uX)(),n=(0,E.NL)(t.recipe_type,a),l=n.icon,i=t.name;return(0,s.jsxs)("div",{className:"relative w-[300px]",children:[(0,s.jsx)(c(),{href:"/recipes/".concat(i),className:"block",onClick:()=>(0,R.h3)("view",{recipe_type:t.recipe_type}),children:(0,s.jsx)(f.Zb,{className:"h-full hover:bg-gray-50 transition-colors cursor-pointer group",children:(0,s.jsxs)(f.aY,{className:"p-3",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2 mb-1.5",children:[(0,s.jsx)(l,{className:"w-4 h-4 flex-shrink-0 mt-0.5 ".concat("sky"===n.color?"text-sky-600":"purple"===n.color?"text-purple-600":"green"===n.color?"text-green-600":"orange"===n.color?"text-orange-600":"text-gray-600")}),(0,s.jsx)("div",{className:"flex-1 min-w-0",children:(0,s.jsx)("h3",{className:"text-base font-medium text-blue-600 truncate group-hover:text-blue-800 transition-colors",children:t.name})})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("div",{className:"text-sm text-gray-500",children:n.label}),(0,s.jsx)("p",{className:"text-sm truncate ".concat(t.description?"text-gray-600":"invisible"),title:t.description||"",children:t.description||"\xa0"}),(0,s.jsxs)("div",{className:"text-sm text-gray-500 truncate",children:["Authored by"," ",(0,s.jsx)(O,{name:t.user_name||t.user_id})]}),(0,s.jsxs)("div",{className:"text-sm text-gray-500 truncate ".concat(t.is_editable&&"local"!==t.user_name?"":"invisible"),children:["Updated by"," ",(0,s.jsx)(O,{name:t.updated_by_name||t.user_name})," ",(0,s.jsx)(Z.Zg,{date:t.updated_at?new Date(1e3*t.updated_at):null})]})]})]})})}),r&&t.pinned&&!1!==t.is_pinnable&&(0,s.jsx)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),r(t.name,!1)},className:"absolute top-2 right-2 p-1 rounded transition-colors text-amber-500 hover:text-amber-700 hover:bg-amber-100",title:"Unpin recipe",children:(0,s.jsx)(d.Z,{className:"h-4 w-4"})})]})}function P(e){let{title:t,icon:r,recipes:a,emptyMessage:n,iconColor:l,onPin:c}=e;return 0===a.length?(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(r,{className:"w-4 h-4 ".concat(l)}),(0,s.jsx)("h2",{className:"text-base text-gray-700",children:t}),(0,s.jsxs)("span",{className:"text-sm text-gray-500",children:["(",a.length,")"]})]}),(0,s.jsx)("div",{className:"text-center py-6 bg-white rounded-lg border border-gray-200 shadow-sm",children:(0,s.jsx)("p",{className:"text-gray-500",children:n})})]}):(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,s.jsx)(r,{className:"w-4 h-4 ".concat(l)}),(0,s.jsx)("h2",{className:"text-base text-gray-700",children:t}),(0,s.jsxs)("span",{className:"text-sm text-gray-500",children:["(",a.length,")"]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-3",children:a.map(e=>(0,s.jsx)(A,{recipe:e,onPin:c},e.name))})]})}function U(e){let{recipes:t,onPin:r,onDelete:n}=e,l=(0,T.uX)(),[i,o]=(0,a.useState)(null),[m,x]=(0,a.useState)([]),[y,b]=(0,a.useState)({key:"updated_at",direction:"descending"}),j=(0,a.useMemo)(()=>{let e=new Set,r=new Set,s=new Set;return t.forEach(t=>{t.name&&e.add(t.name),t.recipe_type&&r.add(t.recipe_type),t.user_name?s.add(t.user_name):t.user_id&&s.add(t.user_id)}),{name:Array.from(e).sort(),recipe_type:Array.from(r).sort(),user_name:Array.from(s).sort()}},[t]),N=e=>{let t="ascending";y.key===e&&"ascending"===y.direction&&(t="descending"),b({key:e,direction:t})},k=e=>y.key===e?"ascending"===y.direction?" ↑":" ↓":"",C=(0,a.useMemo)(()=>{let e=t;return m.length>0&&(e=e.filter(e=>{for(let t of m){let r=t.property.toLowerCase().replace(" ","_"),s="";if("name"===r?s=e.name||"":"type"===r?s=e.recipe_type||"":"owner"===r&&(s=e.user_name||e.user_id||""),!s.toLowerCase().includes(t.value.toLowerCase()))return!1}return!0})),(0,w.R0)(e,y.key,y.direction)},[t,m,y]);return(0,s.jsxs)("div",{className:"mb-6",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[(0,s.jsx)("span",{className:"text-base text-gray-700",children:"All Recipes"}),(0,s.jsx)("div",{className:"w-full sm:w-auto max-w-xl",children:(0,s.jsx)(V,{propertyList:z,valueList:j,setFilters:x,placeholder:"Filter recipes",filters:m})}),(0,s.jsxs)("span",{className:"text-sm text-gray-500 ml-auto",children:[C.length," of ",t.length]})]}),m.length>0&&(0,s.jsx)(F,{filters:m,setFilters:x}),(0,s.jsx)(f.Zb,{children:(0,s.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,s.jsxs)(g.iA,{className:"min-w-full",children:[(0,s.jsx)(g.xD,{children:(0,s.jsxs)(g.SC,{children:[(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("recipe_type"),children:["Type",k("recipe_type")]}),(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("name"),children:["Name",k("name")]}),(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("description"),children:["Description",k("description")]}),(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("user_name"),children:["Owner",k("user_name")]}),(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("updated_by_name"),children:["Last Updated By",k("updated_by_name")]}),(0,s.jsxs)(g.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>N("updated_at"),children:["Updated",k("updated_at")]}),(0,s.jsx)(g.ss,{className:"whitespace-nowrap w-[100px]",children:"Actions"})]})}),(0,s.jsx)(g.RM,{children:0===C.length||(0,v.KL)()?(0,s.jsx)(g.Iz,{colSpan:7,icon:(0,s.jsx)(p.Z,{className:"w-5 h-5"}),title:0===t.length?"No recipes available":"No recipes match your filter criteria",description:0===t.length?"Create a recipe to get started":void 0}):C.map(e=>{let t=(0,E.NL)(e.recipe_type,l),a=t.icon,n=e.name,i=e.description?e.description.length>80?e.description.substring(0,80)+"...":e.description:"-";return(0,s.jsxs)(g.SC,{className:"hover:bg-gray-50",children:[(0,s.jsx)(g.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(a,{className:"w-4 h-4 ".concat("sky"===t.color?"text-sky-600":"purple"===t.color?"text-purple-600":"green"===t.color?"text-green-600":"orange"===t.color?"text-orange-600":"text-gray-600")}),(0,s.jsx)("span",{children:t.label})]})}),(0,s.jsx)(g.pj,{children:(0,s.jsx)(c(),{href:"/recipes/".concat(n),className:"text-blue-600 hover:text-blue-800 hover:underline",children:e.name})}),(0,s.jsx)(g.pj,{className:"text-gray-600 max-w-[400px]",title:e.description||"",children:(0,s.jsx)("span",{className:"cursor-default",children:i})}),(0,s.jsx)(g.pj,{className:"text-gray-600",children:(0,s.jsx)(O,{name:e.user_name||e.user_id})}),(0,s.jsx)(g.pj,{className:"text-gray-600",children:e.updated_by_name||e.user_name?(0,s.jsx)(O,{name:e.updated_by_name||e.user_name}):"-"}),(0,s.jsx)(g.pj,{className:"text-gray-500",children:(0,s.jsx)(Z.Zg,{date:e.updated_at?new Date(1e3*e.updated_at):null})}),(0,s.jsx)(g.pj,{children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),!1!==e.is_pinnable&&r(e.name,!e.pinned)},disabled:!1===e.is_pinnable,className:"p-1 rounded transition-colors ".concat(!1===e.is_pinnable?"text-gray-300 cursor-not-allowed":e.pinned?"text-amber-500 hover:text-amber-700 hover:bg-amber-100":"text-amber-400 hover:text-amber-600 hover:bg-amber-100"),title:!1===e.is_pinnable?"Default recipes cannot be pinned/unpinned":e.pinned?"Unpin recipe":"Pin recipe",children:e.pinned?(0,s.jsx)(d.Z,{className:"h-4 w-4"}):(0,s.jsx)(u.Z,{className:"h-4 w-4"})}),(0,s.jsx)("button",{onClick:t=>{t.stopPropagation(),!1!==e.is_editable&&o(e)},disabled:!1===e.is_editable,className:"p-1 rounded transition-colors ".concat(!1===e.is_editable?"text-gray-300 cursor-not-allowed":"text-red-400 hover:text-red-700 hover:bg-red-100"),title:!1===e.is_editable?"Default recipes cannot be deleted":"Delete recipe",children:(0,s.jsx)(h.Z,{className:"h-4 w-4"})})]})})]},e.name)})})]})})}),(0,s.jsx)(D,{recipe:i,onClose:()=>o(null),onDelete:n})]})}function D(e){let{recipe:t,onClose:r,onDelete:n}=e,[l,c]=(0,a.useState)(!1),o=async()=>{c(!0);try{await n(t.name),r()}catch(e){(0,S.C)("Delete failed: ".concat(e.message),"error")}finally{c(!1)}};return t?(0,s.jsx)(N.Vq,{open:!!t,onOpenChange:r,children:(0,s.jsxs)(N.cZ,{className:"sm:max-w-md",children:[(0,s.jsxs)(N.fK,{children:[(0,s.jsx)(N.$N,{className:"text-xl text-red-600",children:"Delete Recipe"}),(0,s.jsxs)(N.Be,{children:['Are you sure you want to delete "',t.name,'"? This action cannot be undone.']})]}),(0,s.jsxs)(N.cN,{className:"mt-4",children:[(0,s.jsx)(b.z,{variant:"outline",onClick:r,disabled:l,children:"Cancel"}),(0,s.jsx)(b.z,{onClick:o,disabled:l,className:"bg-red-600 hover:bg-red-700 text-white",children:l?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{size:16,className:"mr-2"}),"Deleting..."]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(h.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})})]})]})}):null}let V=e=>{let{propertyList:t=[],valueList:r,setFilters:n,placeholder:l="Filter recipes",filters:c=[]}=e,i=(0,a.useRef)(null),o=(0,a.useRef)(null),[d,p]=(0,a.useState)(!1),[u,h]=(0,a.useState)(""),[m,x]=(0,a.useState)("name"),[y,f]=(0,a.useState)([]),b=(0,a.useCallback)(e=>{let r=t.find(t=>t.value===e);return r?r.label:e},[t]);(0,a.useEffect)(()=>{let e=e=>{o.current&&!o.current.contains(e.target)&&i.current&&!i.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[],t=b(m),s=c.filter(e=>e.property===t).map(e=>e.value);r&&"object"==typeof r&&(e=(r[m]||[]).filter(e=>!s.includes(e))),""!==u.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(u.toLowerCase()))),f(e)},[m,r,u,c,b]);let g=e=>{(0,R.ZY)("recipe",{property:b(m),value:e}),n(t=>[...t,{property:b(m),operator:":",value:e}]),p(!1),h(""),i.current.focus()};return(0,s.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible",children:[(0,s.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,s.jsxs)(L.Ph,{onValueChange:x,value:m,children:[(0,s.jsx)(L.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm",children:(0,s.jsx)(L.ki,{placeholder:"Name"})}),(0,s.jsx)(L.Bw,{children:t.map((e,t)=>(0,s.jsx)(L.Ql,{value:e.value,children:e.label},"property-item-".concat(t)))})]})}),(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)("input",{type:"text",ref:i,placeholder:l,value:u,onChange:e=>{h(e.target.value),d||p(!0)},onFocus:()=>{p(!0)},onKeyDown:e=>{"Enter"===e.key&&""!==u.trim()?((0,R.ZY)("recipe",{property:b(m),value:u}),n(e=>[...e,{property:b(m),operator:":",value:u}]),h(""),p(!1)):"Escape"===e.key&&(p(!1),i.current.blur())},className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),u&&(0,s.jsx)("button",{onClick:()=>{h(""),p(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),d&&y.length>0&&(0,s.jsx)("div",{ref:o,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:y.map((e,t)=>(0,s.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(t!==y.length-1?"border-b border-gray-100":""),onClick:()=>g(e),children:(0,s.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(t)))})]})]})},F=e=>{let{filters:t=[],setFilters:r}=e,a=e=>{r(t=>t.filter((t,r)=>r!==e))};return(0,s.jsx)("div",{className:"flex items-center gap-4 py-2 px-2 mb-2",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[t.map((e,t)=>(0,s.jsx)(q,{filter:e,onRemove:()=>a(t)},"filteritem-".concat(t))),t.length>0&&(0,s.jsx)("button",{onClick:()=>{r([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})]})})},q=e=>{let{filter:t,onRemove:r}=e;return(0,s.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,s.jsx)("span",{children:t.property}),(0,s.jsx)("span",{children:t.operator}),(0,s.jsx)("span",{children:t.value})]}),(0,s.jsx)("button",{onClick:r,className:"p-0.5 ml-1 text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex items-center",title:"Remove filter",children:(0,s.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})};function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case E.nT.CLUSTER:return'name: my-cluster\nresources:\n infra: aws\n accelerators: A100:1\n\nrun: |\n echo "Hello, SkyPilot!"\n';case E.nT.JOB:return'name: my-job\nresources:\n infra: aws\n accelerators: A100:1\n\nrun: |\n echo "Running managed job..."\n';case E.nT.POOL:return"pool:\n name: my-pool\n\nresources:\n infra: aws\n accelerators: A100:1\n";default:{let r=t.find(t=>t.id===e);if(r&&r.template)return r.template;return"name: my-".concat(e,'\nresources:\n infra: aws\n accelerators: A100:1\n\nrun: |\n echo "Hello, SkyPilot!"\n')}}}function I(e){let{isOpen:t,onClose:r,onSubmit:n,initialData:l,isAuthenticated:c,visibleRecipeTypes:d,pluginRecipeTypes:p=[]}=e,[u,h]=(0,a.useState)(""),[x,y]=(0,a.useState)(""),[f,g]=(0,a.useState)(B(E.nT.CLUSTER,p)),[j,v]=(0,a.useState)(E.nT.CLUSTER),[w,Z]=(0,a.useState)(""),[S,R]=(0,a.useState)(!1),[M,T]=(0,a.useState)(null);(0,a.useEffect)(()=>{t&&(l?(h(l.name||""),y(l.description||""),g(l.content||""),v(l.recipe_type||E.nT.CLUSTER)):(h(""),y(""),v(E.nT.CLUSTER),g(B(E.nT.CLUSTER,p))),Z(""),T(null))},[l,t,p]);let z=async e=>{e.preventDefault(),R(!0),T(null);try{o.ZP.load(f)}catch(e){T("Invalid YAML: ".concat(e.message)),R(!1);return}try{await n({name:u,description:x||null,content:f,recipeType:j,ownerName:w||null}),r()}catch(e){T(e.message)}finally{R(!1)}};return(0,s.jsx)(N.Vq,{open:t,onOpenChange:r,children:(0,s.jsxs)(N.cZ,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto px-8",children:[(0,s.jsxs)(N.fK,{children:[(0,s.jsx)(N.$N,{className:"text-xl text-gray-900",children:"Create New Recipe"}),(0,s.jsx)(N.Be,{children:"Create a reusable recipe for clusters, jobs, and more."})]}),(0,s.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 flex items-start gap-2 mt-4",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4 text-amber-600 mt-0.5 flex-shrink-0"}),(0,s.jsx)("p",{className:"text-sm text-amber-800",children:"This recipe will be visible to everyone with access to this dashboard."})]}),(0,s.jsxs)("form",{onSubmit:z,className:"space-y-4 mt-4",children:[(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C._,{htmlFor:"name",children:"Name *"}),(0,s.jsx)(k.I,{id:"name",value:u,onChange:e=>{h(e.target.value),T(null)},placeholder:"my-gpu-training",className:"placeholder:text-gray-400",required:!0})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C._,{htmlFor:"recipe-type",children:"Type *"}),(0,s.jsxs)(L.Ph,{value:j,onValueChange:e=>{(f===B(j,p)||""===f)&&g(B(e,p)),v(e)},children:[(0,s.jsx)(L.i4,{children:(0,s.jsx)(L.ki,{placeholder:"Select type"})}),(0,s.jsx)(L.Bw,{children:(d||E.lz).map(e=>{let t=(0,E.NL)(e,p),r=t.icon;return(0,s.jsx)(L.Ql,{value:e,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(r,{className:"w-4 h-4 ".concat(t.colorClass)}),(0,s.jsx)("span",{children:t.fullLabel})]})},e)})})]})]})]}),!c&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C._,{htmlFor:"owner-name",children:"Your Name"}),(0,s.jsx)(k.I,{id:"owner-name",value:w,onChange:e=>Z(e.target.value),placeholder:"Enter your name (optional)",className:"placeholder:text-gray-400"}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:"This name will be shown as the template owner."})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C._,{htmlFor:"description",children:"Description"}),(0,s.jsx)(k.I,{id:"description",value:x,onChange:e=>y(e.target.value),placeholder:"A brief description of what this recipe does...",className:"placeholder:text-gray-400"})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)(C._,{htmlFor:"content",children:"YAML Content *"}),(0,s.jsx)(_.Xx,{value:f,onChange:e=>{g(e),T(null)},maxHeight:"400px"})]}),M&&(0,s.jsxs)("div",{className:"rounded-md border border-red-200 bg-red-50 p-3 flex items-start gap-2",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4 text-red-600 mt-0.5 flex-shrink-0"}),(0,s.jsx)("p",{className:"text-sm text-red-800",children:M})]}),(0,s.jsxs)(N.cN,{children:[(0,s.jsx)(b.z,{type:"button",variant:"outline",onClick:r,disabled:S,children:"Cancel"}),(0,s.jsx)(b.z,{type:"submit",disabled:S,className:"bg-[#1668e0] hover:bg-[#1257bd] text-white",children:S?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(i.Z,{size:16,className:"mr-2"}),"Creating..."]}):"Create Recipe"})]})]})]})})}function H(){let e=(0,n.useRouter)();(0,T.x1)();let t=(0,T.uX)(),[r,l]=(0,a.useState)([]),[c,o]=(0,a.useState)(null),[d,h]=(0,a.useState)(!1),[m,g]=(0,a.useState)(!0),[v,w]=(0,a.useState)(null),[N,k]=(0,a.useState)(!1),[C,_]=(0,a.useState)(null),L=(0,a.useCallback)(async()=>{try{let e=await fetch("".concat(window.location.origin,"/internal/dashboard/users/role"));if(e.ok){let t=await e.json();o(t.id||"local"),h(t.id&&"local"!==t.id)}else o("local"),h(!1)}catch(e){console.error("Failed to get user info:",e),o("local"),h(!1)}},[]),z=(0,a.useCallback)(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];e&&g(!0);try{let e=await (0,M.iM)();l(e||[]),w(new Date)}catch(e){console.error("Error fetching recipes:",e),(0,S.C)("Error loading recipes: ".concat(e.message),"error")}finally{e&&g(!1)}},[]);(0,a.useEffect)(()=>{if(e.query.copy)try{let t=JSON.parse(e.query.copy);_(t),k(!0),e.replace("/recipes",void 0,{shallow:!0})}catch(e){console.error("Failed to parse copy data:",e)}},[e.query.copy,e]),(0,a.useEffect)(()=>{L(),z(!0)},[L,z]);let O=r.filter(e=>e.pinned),A=d?r.filter(e=>!e.pinned&&e.user_id===c):[],D=async e=>{(0,R.h3)("create",{type:e.recipeType}),await (0,M.kW)({...e,...e.ownerName?{ownerName:e.ownerName}:{}}),(0,S.C)("Recipe created successfully!","success"),await z(),_(null)},V=async(e,t)=>{(0,R.h3)("pin");try{await (0,M.Uu)(e,t)&&((0,S.C)(t?"Recipe pinned!":"Recipe unpinned!","success"),await z())}catch(e){(0,S.C)("Pin operation failed: ".concat(e.message),"error")}},F=async e=>{if((0,R.h3)("delete"),await (0,M.eI)(e))(0,S.C)("Recipe deleted successfully!","success"),await z();else throw Error("Failed to delete recipe")};return m&&0===r.length?(0,s.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,s.jsx)(i.Z,{size:20,className:"mr-2"}),(0,s.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):(0,s.jsxs)("div",{className:"h-full",children:[(0,s.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-4 min-h-[20px]",children:[(0,s.jsx)("div",{className:"text-base flex items-center",children:(0,s.jsx)("span",{className:"text-sky-blue leading-none text-base",children:"Recipes"})}),(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-auto",children:[m&&(0,s.jsxs)("div",{className:"flex items-center mr-2",children:[(0,s.jsx)(i.Z,{size:16}),(0,s.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Refreshing..."})]}),!m&&v&&(0,s.jsx)(Z.$3,{timestamp:v,className:"mr-2"}),(0,s.jsxs)("button",{onClick:()=>{z(!0)},disabled:m,className:"text-[#1668e0] hover:text-[#1257bd] flex items-center",children:[(0,s.jsx)(x.Z,{className:"h-4 w-4 mr-1.5"}),(0,s.jsx)("span",{children:"Refresh"})]}),(0,s.jsxs)("button",{onClick:()=>k(!0),className:"ml-4 bg-[#1668e0] hover:bg-[#1257bd] text-white flex items-center rounded-md px-3 py-1 text-sm font-medium transition-colors duration-200",title:"New Recipe",children:[(0,s.jsx)(y.Z,{className:"h-4 w-4 mr-2"}),"New Recipe"]})]})]}),0===r.length?(0,s.jsx)(f.Zb,{children:(0,s.jsx)(j.u,{icon:(0,s.jsx)(p.Z,{size:20,strokeWidth:1.75}),title:"No recipes yet",description:"Create a reusable recipe for clusters, jobs, and more",action:(0,s.jsxs)(b.z,{size:"sm",onClick:()=>k(!0),className:"bg-[#1668e0] hover:bg-[#1257bd] text-white",children:[(0,s.jsx)(y.Z,{className:"h-4 w-4 mr-2"}),"Add Recipe"]})})}):(0,s.jsxs)("div",{children:[(0,s.jsx)(P,{title:"Pinned Recipes",icon:u.Z,iconColor:"text-amber-500",recipes:O,emptyMessage:"No pinned recipes. Pin important recipes for quick access.",onPin:V}),d&&(0,s.jsx)(P,{title:"My Recipes",icon:p.Z,iconColor:"text-sky-500",recipes:A,emptyMessage:"You haven't created any recipes yet."}),(0,s.jsx)(U,{recipes:r,onPin:V,onDelete:F})]}),(0,s.jsx)(I,{isOpen:N,onClose:()=>{k(!1),_(null)},onSubmit:D,initialData:C,isAuthenticated:d,visibleRecipeTypes:(0,E.B1)(t),pluginRecipeTypes:t})]})}},7719:function(e,t,r){r.d(t,{DI:function(){return c},G3:function(){return n},Uu:function(){return o},eI:function(){return i},iM:function(){return a},kW:function(){return l}});var s=r(7145);async function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t={pinned_only:e.pinnedOnly||!1,my_recipes_only:e.myRecipesOnly||!1,recipe_type:e.recipeType||null};return await s.x.fetch("/recipes/list",t,"POST")||[]}catch(e){throw console.error("Error fetching YAML templates:",e),e}}async function n(e){try{return await s.x.fetch("/recipes/get",{recipe_name:e})}catch(e){throw console.error("Error fetching Recipe:",e),e}}async function l(e){try{return await s.x.fetch("/recipes/create",{name:e.name,content:e.content,recipe_type:e.recipeType,description:e.description||null,owner_name:e.ownerName||null})}catch(e){throw console.error("Error creating Recipe:",e),e}}async function c(e,t){try{return await s.x.fetch("/recipes/update",{recipe_name:e,description:t.description,content:t.content})}catch(e){throw console.error("Error updating Recipe:",e),e}}async function i(e){try{return await s.x.fetch("/recipes/delete",{recipe_name:e})}catch(e){throw console.error("Error deleting Recipe:",e),e}}async function o(e,t){try{return await s.x.fetch("/recipes/pin",{recipe_name:e,pinned:t})}catch(e){throw console.error("Error toggling Recipe pin status:",e),e}}},2344:function(e,t,r){r.d(t,{lz:function(){return d},nT:function(){return o},UU:function(){return x},NL:function(){return m},B1:function(){return p}});var s=r(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,s.Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),n=(0,s.Z)("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]),l=(0,s.Z)("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"}]]);var c=r(172),i=r(3359);let o=Object.freeze({CLUSTER:"cluster",JOB:"job",POOL:"pool",VOLUME:"volume"}),d=Object.freeze(Object.values(o));function p(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...d,...e.map(e=>e.id)]}function u(e){return e?e.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):""}let h={sky:"text-sky-600",purple:"text-purple-600",green:"text-green-600",orange:"text-orange-600",gray:"text-gray-600"};function m(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case o.CLUSTER:t={icon:a,color:"sky",label:"Cluster",fullLabel:"Cluster"};break;case o.JOB:t={icon:n,color:"purple",label:"Job",fullLabel:"Managed Job"};break;case o.VOLUME:t={icon:l,color:"green",label:"Volume",fullLabel:"Volume"};break;case o.POOL:t={icon:c.Z,color:"orange",label:"Pool",fullLabel:"Job Pool"};break;default:{let s=r.find(t=>t.id===e);if(s){t={icon:s.icon||i.Z,color:s.color||"gray",label:s.label,fullLabel:s.fullLabel||s.label};break}t={icon:i.Z,color:"gray",label:u(e),fullLabel:u(e)}}}return t.colorClass=h[t.color]||"text-gray-600",t}function x(e,t){switch(e){case o.CLUSTER:return"sky launch recipes:".concat(t);case o.JOB:return"sky jobs launch recipes:".concat(t);case o.VOLUME:return"sky volumes apply recipes:".concat(t);case o.POOL:return"sky jobs pool apply recipes:".concat(t);default:return null}}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/45-c7883b1e5aaf1496.js b/sky/dashboard/out/_next/static/chunks/45-c7883b1e5aaf1496.js new file mode 100644 index 000000000..c85ee1206 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/45-c7883b1e5aaf1496.js @@ -0,0 +1,6 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[45],{8671:function(e,r,t){t.d(r,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,t(998).Z)("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"}]])},9307:function(e,r,t){t.d(r,{Cl:function(){return c},OE:function(){return i}});var s=t(5893);t(7294);var a=t(5739),n=t(470),l=t(3850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"UNHEALTHY":case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"AUTOSTOPPING":return"bg-purple-100 text-purple-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":return"bg-orange-50 text-orange-700";case"WINDING_DOWN":case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},o=e=>{switch(e){case"LAUNCHING":case"STARTING":case"AUTOSTOPPING":case"WINDING_DOWN":case"PROVISIONING":case"SHUTTING_DOWN":return(0,s.jsx)(a.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":case"UNHEALTHY":default:return(0,s.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,s.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,s.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,s.jsx)(l.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,s.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},u=e=>{let r=c(e),t=o(e);return(0,s.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(r),children:[t,e]})},i=e=>{let{status:r,statusTooltip:t}=e,a=t||r;return(0,s.jsx)(n.Md,{content:a,children:(0,s.jsx)("span",{children:u(r)})})}},299:function(e,r,t){t.d(r,{Fu:function(){return u},ML:function(){return d},P2:function(){return i},cm:function(){return c},eG:function(){return o},mu:function(){return l},x$:function(){return N}});var s=t(5893),a=t(7294),n=t(2935);let l=(e,r)=>{var t,s;let{property:a,operator:n,value:l}=r;if(!l)return!0;if(!a){let r=l.toLowerCase();return Object.values(e).some(e=>null==e?void 0:e.toString().toLowerCase().includes(r))}let c=a.toLowerCase();if("infra"===c){let r=null===(s=e.full_infra||e.infra)||void 0===s?void 0:s.toString().toLowerCase(),t=l.toString().toLowerCase();switch(n){case"=":return r===t;case":":return null==r?void 0:r.includes(t);default:return!0}}if("labels"===c){let r=e.labels||{},t=l.toString().toLowerCase();if(!t.includes(":"))return Object.values(r).some(e=>null==e?void 0:e.toString().toLowerCase().includes(t));{let[e,...s]=t.split(":"),a=s.join(":").trim();return r[e.trim()]===a}}let o=null===(t=e[c])||void 0===t?void 0:t.toString().toLowerCase(),u=l.toString().toLowerCase();switch(n){case"=":return o===u;case":":return null==o?void 0:o.includes(u);default:return!0}},c=(e,r)=>0===r.length?e:e.filter(e=>{let t=null;for(let s=0;s{let t={...e.query},s=[],a=[],n=[];r.map((e,r)=>{var t;s.push(null!==(t=e.property.toLowerCase())&&void 0!==t?t:""),a.push(e.operator),n.push(e.value)}),t.property=s,t.operator=a,t.value=n,e.replace({pathname:e.pathname,query:t},void 0,{shallow:!0})},u=(e,r)=>{let t={...e.query},s=t.property,a=t.operator,n=t.value;if(void 0===s)return[];let l=[],c=Array.isArray(s)?s.length:1;if(1===c)l.push({property:r.get(s),operator:a,value:n});else for(let e=0;e{if(!s)return e;let a=new URLSearchParams({property:r.toLowerCase(),operator:t,value:s});return"".concat(e,"?").concat(a.toString())},d=e=>{var r,t;let{propertyList:l=[],valueList:c,setFilters:o,updateURLParams:u,onFilterAdd:i,placeholder:d="Filter items"}=e,N=(0,a.useRef)(null),x=(0,a.useRef)(null),[E,p]=(0,a.useState)(!1),[f,h]=(0,a.useState)(""),[m,g]=(0,a.useState)((null===(r=l[0])||void 0===r?void 0:r.value)||"status"),[I,L]=(0,a.useState)([]);(0,a.useEffect)(()=>{let e=e=>{x.current&&!x.current.contains(e.target)&&N.current&&!N.current.contains(e.target)&&p(!1)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[]),(0,a.useEffect)(()=>{let e=[];if(c&&"object"==typeof c&&m){let r;e=Array.isArray(r="labels"===m&&c.labels?c.labels:c[m])?r:null!=r?[r]:[]}""!==f.trim()&&(e=e.filter(e=>e&&e.toString().toLowerCase().includes(f.toLowerCase()))),L(e)},[m,c,f]);let v=e=>{let r=l.find(r=>r.value===e);return r?r.label:e},b=e=>{let r=v(m);o(t=>{let s=[...t,{property:r,operator:":",value:e}];return u(s),s}),i&&i(r,e),p(!1),h(""),N.current.focus()};return(0,s.jsxs)("div",{className:"flex flex-row border border-gray-300 rounded-md overflow-visible bg-white",children:[(0,s.jsx)("div",{className:"border-r border-gray-300 flex-shrink-0",children:(0,s.jsxs)(n.Ph,{onValueChange:e=>{g(e),h("")},value:m,children:[(0,s.jsx)(n.i4,{"aria-label":"Filter Property",className:"focus:ring-0 focus:ring-offset-0 border-none rounded-l-md rounded-r-none w-20 sm:w-24 md:w-32 h-8 text-xs sm:text-sm bg-white",children:(0,s.jsx)(n.ki,{placeholder:(null===(t=l[0])||void 0===t?void 0:t.label)||"Status"})}),(0,s.jsx)(n.Bw,{children:l.map((e,r)=>(0,s.jsx)(n.Ql,{value:e.value,children:e.label},"property-item-".concat(r)))})]})}),(0,s.jsxs)("div",{className:"relative flex-1",children:[(0,s.jsx)("input",{type:"text",ref:N,placeholder:d,value:f,onChange:e=>{h(e.target.value),E||p(!0)},onFocus:()=>{p(!0)},onKeyDown:e=>{if("Enter"===e.key&&""!==f.trim()){let e=v(m);o(r=>{let t=[...r,{property:e,operator:":",value:f}];return u(t),t}),i&&i(e,f),h(""),p(!1)}else"Escape"===e.key&&(p(!1),N.current.blur())},className:"h-8 w-full sm:w-96 px-3 pr-8 text-sm border-none rounded-l-none rounded-r-md focus:ring-0 focus:outline-none",autoComplete:"off"}),f&&(0,s.jsx)("button",{onClick:()=>{h(""),p(!1)},className:"absolute right-2 top-1/2 transform -translate-y-1/2 text-gray-400 hover:text-gray-600",title:"Clear filter",tabIndex:-1,children:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})}),E&&I.length>0&&(0,s.jsx)("div",{ref:x,className:"absolute z-50 mt-1 w-full bg-white border border-gray-200 rounded-md shadow-lg max-h-60 overflow-y-auto",style:{zIndex:9999},children:I.map((e,r)=>(0,s.jsx)("div",{className:"px-3 py-2 cursor-pointer hover:bg-gray-50 text-sm ".concat(r!==I.length-1?"border-b border-gray-100":""),onClick:()=>b(e),children:(0,s.jsx)("span",{className:"text-sm text-gray-700",children:e})},"".concat(e,"-").concat(r)))})]})]})},N=e=>{let{filters:r=[],setFilters:t,updateURLParams:a}=e,n=e=>{t(r=>{let t=r.filter((r,t)=>t!==e);return a(t),t})};return(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("div",{className:"flex items-center gap-4 py-2 px-2",children:(0,s.jsxs)("div",{className:"flex flex-wrap items-content gap-2",children:[r.map((e,r)=>(0,s.jsx)(x,{filter:e,onRemove:()=>n(r)},"filteritem-".concat(r))),r.length>0&&(0,s.jsx)(s.Fragment,{children:(0,s.jsx)("button",{onClick:()=>{a([]),t([])},className:"rounded-full px-4 py-1 text-sm text-gray-700 bg-gray-200 hover:bg-gray-300",children:"Clear filters"})})]})})})},x=e=>{let{filter:r,onRemove:t}=e;return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("div",{className:"flex items-center text-blue-600 bg-blue-100 px-1 py-1 rounded-full text-sm",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1 px-2",children:[(0,s.jsx)("span",{children:"".concat(r.property," ")}),(0,s.jsx)("span",{children:"".concat(r.operator," ")}),(0,s.jsx)("span",{children:" ".concat(r.value)})]}),(0,s.jsx)("button",{onClick:()=>t(),className:"p-0.5 ml-1 transform text-gray-400 hover:text-gray-600 bg-blue-500 hover:bg-blue-600 rounded-full flex flex-col items-center",title:"Clear filter",children:(0,s.jsx)("svg",{className:"h-3 w-3",fill:"none",stroke:"white",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:5,d:"M6 18L18 6M6 6l12 12"})})})]})})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/464-2734b71a6ac0e7ad.js b/sky/dashboard/out/_next/static/chunks/464-2734b71a6ac0e7ad.js new file mode 100644 index 000000000..96989e49d --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/464-2734b71a6ac0e7ad.js @@ -0,0 +1,26 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[464],{6639:function(e,t,s){s.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,s(998).Z)("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},6826:function(e,t,s){s.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,s(998).Z)("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"}]])},172:function(e,t,s){s.d(t,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,s(998).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},4571:function(e,t,s){s.d(t,{J:function(){return n}});var r=s(5893);s(7294);var a=s(470);let n=e=>{let{showTooltip:t=!0,className:s=""}=e,n=(0,r.jsx)("span",{className:"text-xs font-medium bg-gray-200 text-gray-700 px-1.5 py-0.5 rounded whitespace-nowrap ".concat(s),children:"Batch"});return t?(0,r.jsx)(a.Md,{content:"Batch inference job – processes data in parallel batches across workers",className:"text-muted-foreground",children:n}):n}},8686:function(e,t,s){s.d(t,{N:function(){return n}});var r=s(5893);s(7294);var a=s(470);let n=e=>{let{showTooltip:t=!0,className:s=""}=e,n=(0,r.jsxs)("span",{className:"\n inline-flex items-center gap-0.5\n px-1.5 py-0.5\n text-[10px] font-semibold uppercase tracking-wide\n bg-gradient-to-r from-emerald-50 to-teal-50\n text-emerald-700\n border border-emerald-200\n rounded\n shadow-sm\n cursor-help\n select-none\n ".concat(s,"\n "),children:[(0,r.jsx)("svg",{className:"w-2.5 h-2.5 text-emerald-500",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:(0,r.jsx)("path",{fillRule:"evenodd",d:"M10.868 2.884c-.321-.772-1.415-.772-1.736 0l-1.83 4.401-4.753.381c-.833.067-1.171 1.107-.536 1.651l3.62 3.102-1.106 4.637c-.194.813.691 1.456 1.405 1.02L10 15.591l4.069 2.485c.713.436 1.598-.207 1.404-1.02l-1.106-4.637 3.62-3.102c.635-.544.297-1.584-.536-1.65l-4.752-.382-1.831-4.401z",clipRule:"evenodd"})}),(0,r.jsx)("span",{children:"Primary"})]});return t?(0,r.jsx)(a.Md,{content:"Primary task – other tasks will be terminated once all primary tasks finish",className:"text-muted-foreground",children:n}):n}},2464:function(e,t,s){s.r(t),s.d(t,{ClusterJobs:function(){return ed},ManagedJobs:function(){return el},ManagedJobsTable:function(){return ec},Status2Actions:function(){return eo},filterJobsByName:function(){return et},filterJobsByPool:function(){return ea},filterJobsByUser:function(){return er},filterJobsByWorkspace:function(){return es},getAggregatedStatus:function(){return Q},statusGroups:function(){return V}});var r=s(5893),a=s(7294),n=s(1163),l=s(1664),i=s.n(l),c=s(689),o=s(5739),d=s(803),u=s(7673),h=s(8764),m=s(2942),x=s(6990),p=s(3850),j=s(470),g=s(1214),f=s(8969),b=s(7335),y=s(3266),N=s(7324),w=s(3081),v=s(7145),k=s(5895),C=s(6639),S=s(282),E=s(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let _=(0,E.Z)("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);var L=s(3626);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let P=(0,E.Z)("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]),R=(0,E.Z)("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);var I=s(6826),M=s(172),D=s(9284),A=s(4545),T=s(9307),Z=s(8686),U=s(4571),F=s(546),z=s(3001),O=s(6378),H=s(6856),G=s(5988),J=s(3800),q=s(299),W=s(1428);let B=[10,30,50,100,200],K="skypilot-jobs-page-size",V={active:["PENDING","RUNNING","RECOVERING","SUBMITTED","STARTING","CANCELLING"],finished:["SUCCEEDED","FAILED","CANCELLED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"]},Y=["STARTING","RUNNING","SUCCEEDED"],$=["PENDING","SUBMITTED","RECOVERING","CANCELLING","CANCELLED","FAILED","FAILED_SETUP","FAILED_PRECHECKS","FAILED_NO_RESOURCE","FAILED_CONTROLLER"],X={SUCCEEDED:0,PENDING:1,SUBMITTED:2,STARTING:3,RUNNING:4,RECOVERING:5,CANCELLING:6,CANCELLED:7,FAILED_SETUP:8,FAILED_PRECHECKS:9,FAILED_NO_RESOURCE:10,FAILED:11,FAILED_CONTROLLER:12};function Q(e){if(!e||0===e.length)return"PENDING";if(1===e.length)return e[0].status;let t=e.filter(e=>null===e.is_primary_in_job_group||void 0===e.is_primary_in_job_group||!0===e.is_primary_in_job_group),s=t.length>0?t:e,r="SUCCEEDED",a=0;for(let e of s){var n;let t=null!==(n=X[e.status])&&void 0!==n?n:0;t>a&&(a=t,r=e.status)}return r}let ee=[{label:"Name",value:"name"},{label:"ID",value:"id"},{label:"User",value:"user"},{label:"Workspace",value:"workspace"},{label:"Pool",value:"pool"},{label:"Labels",value:"labels"}];function et(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.name||"").toLowerCase().includes(s))}function es(e,t){return t&&"ALL_WORKSPACES"!==t?e.filter(e=>(e.workspace||"default").toLowerCase()===t.toLowerCase()):e}function er(e,t){return t&&"ALL_USERS"!==t?e.filter(e=>(e.user_hash||e.user)===t):e}function ea(e,t){if(!t||""===t.trim())return e;let s=t.toLowerCase().trim();return e.filter(e=>(e.pool||"").toLowerCase().includes(s))}let en=e=>{if(!e)return"-";let t=e instanceof Date?e:new Date(1e3*e);return(0,r.jsx)(j.Zg,{date:t})};function el(){let e=(0,n.useRouter)(),[t,s]=(0,a.useState)(!1),[l,c]=(0,a.useState)(!0),[o,d]=(0,a.useState)(!0),u=a.useRef(null),h=a.useRef(null),[m,x]=(0,a.useState)([]),[p,g]=(0,a.useState)([]),[y,w]=(0,a.useState)({name:[],user:[],workspace:[],pool:[],labels:[]}),[v,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(null),E=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];s(!0),!e&&o&&c(!0);try{let[e]=await Promise.all([O.ZP.get(f.vs,[{}])]);x(e.pools||[])}catch(e){console.error("Error fetching data:",e)}finally{s(!1),!e&&o&&(c(!1),d(!1))}},[o]);(0,a.useEffect)(()=>{(async()=>{try{await H.ZP.preloadForPage("jobs")}catch(e){console.error("Error preloading jobs data:",e)}finally{k(!0),S(new Date),E()}})()},[E]);let _=t=>{(0,q.eG)(e,t)},L=a.useCallback(t=>{t&&(g(s=>{let r=[...s.filter(e=>"user"!==(e.property||"").toLowerCase()),{property:"User",operator:":",value:t}];return(0,q.eG)(e,r),r}),(0,W.ZY)("job",{property:"User",value:t}))},[e]),P=a.useCallback(()=>{let t=new Map;t.set("",""),t.set("id","ID"),t.set("status","Status"),t.set("name","Name"),t.set("user","User"),t.set("workspace","Workspace"),t.set("pool","Pool"),t.set("labels","Labels"),g((0,q.Fu)(e,t))},[e,g]);return(0,a.useEffect)(()=>{e.isReady&&P()},[e.isReady,e.query.tab,P]),(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-1",children:[(0,r.jsx)("div",{className:"text-base",children:(0,r.jsx)(i(),{href:"/jobs",className:"text-sky-blue hover:underline leading-none",children:"Managed Jobs"})}),(0,r.jsx)(G.j,{name:"jobs.header.badge",wrapperClassName:"flex items-center"}),(0,r.jsx)("div",{className:"w-full sm:w-auto max-w-xl",children:(0,r.jsx)(q.ML,{propertyList:ee,valueList:y,setFilters:g,updateURLParams:_,onFilterAdd:(e,t)=>{(0,W.ZY)("job",{property:e,value:t})},placeholder:"Filter jobs"})})]}),(0,r.jsx)(q.x$,{filters:p,setFilters:g,updateURLParams:_}),(0,r.jsx)(ec,{refreshInterval:j.yc,setLoading:s,refreshDataRef:u,filters:p,onUserFilter:L,onRefresh:()=>{b.Z.invalidateCache(),O.ZP.invalidate(f.vs,[{}]),O.ZP.invalidate(N.getWorkspaces),k(!1),H.ZP.preloadForPage("jobs",{force:!0}).then(()=>{k(!0),S(new Date),u.current&&u.current(),h.current&&h.current()})},poolsData:m,poolsLoading:l,setValueList:w,preloadingComplete:v,lastFetchedTime:C}),(0,r.jsx)("div",{className:"mb-4",children:(0,r.jsx)(em,{refreshInterval:j.yc,setLoading:s,refreshDataRef:h})})]})}function ei(e){let{completed:t,total:s}=e,a=s>0?Math.round(t/s*100):0,n=t>=s?"bg-green-500":"bg-blue-500";return(0,r.jsx)(j.Md,{content:"Batch progress: ".concat(t,"/").concat(s," (").concat(a,"%)"),className:"text-sm text-muted-foreground",children:(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"w-20 bg-gray-200 rounded-full h-2",children:(0,r.jsx)("div",{className:"".concat(n," h-2 rounded-full transition-all"),style:{width:"".concat(a,"%")}})}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[t,"/",s]})]})})}function ec(e){let{refreshInterval:t,setLoading:s,refreshDataRef:n,filters:l,onUserFilter:E,onRefresh:R,poolsData:I,poolsLoading:M,setValueList:H,preloadingComplete:W,lastFetchedTime:X}=e,[ee,et]=(0,a.useState)({key:"id",direction:"descending"}),[es,er]=(0,a.useState)(!1),[ea,el]=(0,a.useState)(!0),[ec,ed]=(0,a.useState)(()=>{{let e=parseInt(new URLSearchParams(window.location.search).get("page"),10);return e>0?e:1}}),[em,ex]=(0,a.useState)(()=>{{let e=parseInt(new URLSearchParams(window.location.search).get("pageSize"),10);return B.includes(e)?e:(0,x.dp)(K,B,10)}}),[ep,ej]=(0,a.useState)(null),eg=(0,a.useRef)(null),[ef,eb]=(0,a.useState)(new Set),[ey,eN]=(0,a.useState)([]),[ew,ev]=(0,a.useState)({}),[ek,eC]=(0,a.useState)(!1),eS=(0,a.useRef)(null),[eE,e_]=(0,a.useState)(!1),[eL,eP]=(0,a.useState)(!1),[eR,eI]=(0,a.useState)(!1),[eM,eD]=(0,a.useState)("all"),[eA,eT]=(0,a.useState)(!0),[eZ,eU]=(0,a.useState)("mine"),[eF,ez]=(0,a.useState)(null),[eO,eH]=(0,a.useState)(!1),[eG,eJ]=(0,a.useState)({isOpen:!1,title:"",message:"",onConfirm:null}),eq=(0,z.X)(),eW=(0,a.useRef)(0);(0,a.useEffect)(()=>{let e=new URL(window.location.href);ec>1?e.searchParams.set("page",String(ec)):e.searchParams.delete("page"),10!==em?e.searchParams.set("pageSize",String(em)):e.searchParams.delete("pageSize"),e.href!==window.location.href&&window.history.replaceState(null,"",e.toString())},[ec,em]);let[eB,eK]=(0,a.useState)([]),[eV,eY]=(0,a.useState)(0),[e$,eX]=(0,a.useState)(0),[eQ,e0]=(0,a.useState)(!1),e1=a.useMemo(()=>ey.length>0?ey:eA?"active"===eM?V.active:"finished"===eM?V.finished:[]:[],[ey,eA,eM]),e2=a.useMemo(()=>ee.key||"submitted_at",[ee.key]),e5=a.useMemo(()=>ee.key&&"ascending"===ee.direction?"asc":"desc",[ee.key,ee.direction]),e6=a.useMemo(()=>{if(!eB||0===eB.length)return!1;let e=new Set(eB.map(e=>e.workspace||"default"));return e.size>1||1===e.size&&!e.has("default")},[eB]),e4=a.useMemo(()=>I&&I.length>0,[I]),e3=async()=>{eJ({isOpen:!0,title:"Restart Controller",message:"Are you sure you want to restart the controller?",onConfirm:async()=>{try{eI(!0),er(!0),await (0,f.Ce)("restartcontroller"),await e8()}catch(e){console.error("Error restarting controller:",e)}finally{eI(!1),er(!1)}}})},e8=a.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=!1!==e.includeStatus,r=eW.current+1;eW.current=r,er(!0),s(!0);try{let e=e=>{let t=(l||[]).find(t=>(t.property||"").toLowerCase()===e);return t&&t.value?String(t.value):void 0},s=e("id"),a=e("user"),n=void 0!==a?a:"mine"===eZ&&eF?eF.name:void 0,i={allUsers:!0,jobIdMatch:s,nameMatch:e("name"),userMatch:n,workspaceMatch:e("workspace"),poolMatch:e("pool"),statuses:e1.length>0?e1:void 0,page:ec,limit:em,sortBy:e2,sortOrder:e5};console.log("[ManagedJobsTable] Fetching jobs with params:",i);let c=await b.Z.getPaginatedJobs(i);if(r===eW.current&&(c.controllerStopped?(e0(!0),eK([]),eY(0),eX(0),ev({})):(e0(!1),eK(c.jobs||[]),eY(c.total||0),eX(c.totalNoFilter||c.total||0),ev(c.statusCounts||{}),e_(!1),eP(!1)),el(!1),c.hasNext&&b.Z.prefetchNextPage(i).catch(()=>{})),t&&c.controllerStopped)try{let e=await O.ZP.get(y.getClusters),t=!1,s=!1;if(e){let r=null==e?void 0:e.find(e=>(0,A.Ym)(e.cluster)),a=r?r.status:"NOT_FOUND";"STOPPED"===a&&(t=!0),"LAUNCHING"===a&&(s=!0)}r===eW.current&&(e_(!!t),eP(!!s))}catch(e){console.error("Error fetching clusters:",e)}}catch(e){console.error("Error fetching data:",e),r===eW.current&&(eK([]),eY(0),eX(0),ev({}),e_(!1),el(!1))}finally{r===eW.current&&(er(!1),s(!1))}},[s,l,ec,em,e1,e2,e5,eZ,eF]);a.useEffect(()=>{n&&(n.current=e8)},[n,e8]);let e7=a.useRef(e8);a.useEffect(()=>{e7.current=e8},[e8]);let e9=a.useRef(!0);a.useEffect(()=>{e9.current&&eO&&(e8({includeStatus:!0}),e9.current=!1)},[eO]),a.useEffect(()=>{if(!e9.current)return;let e=setTimeout(()=>{e9.current&&(eU("all"),eH(!0))},3e3);return()=>clearTimeout(e)},[]),a.useEffect(()=>{!e9.current&&W&&e8({includeStatus:!1})},[ec,e8,W]),a.useEffect(()=>{!e9.current&&W&&e8({includeStatus:!0})},[l,em,e8,W]),a.useEffect(()=>{!e9.current&&W&&e8({includeStatus:!0})},[eM,ey,eA,e8,W]),a.useEffect(()=>{!e9.current&&W&&e8({includeStatus:!1})},[ee,e8,W]);let te=a.useMemo(()=>eB.some(e=>null!=e.batch_total_batches&&("RUNNING"===e.status||"WINDING_DOWN"===e.status)&&(e.batch_completed_batches||0){if(!W)return;let e=setInterval(()=>{e7.current&&"visible"===window.document.visibilityState&&(te&&b.Z.invalidateCache(),e7.current({includeStatus:!te}))},tt);return()=>{clearInterval(e)}},[tt,te,W]),(0,a.useEffect)(()=>{e9.current||ed(1)},[eM,l,em,ee]),(0,a.useEffect)(()=>{eN([]),eT(!0)},[eM]);let ts=a.useCallback(e=>{a.startTransition(()=>{eU(e),eN([]),eT(!0),ed(1)})},[]);(0,a.useEffect)(()=>{if(!H)return;let e=new Set,t=new Set,s=new Set,r=new Set,a=new Set;eB.forEach(n=>{n.name&&e.add(n.name),n.user&&t.add(n.user),n.workspace&&s.add(n.workspace),n.pool&&r.add(n.pool),Object.entries(n.labels||{}).forEach(e=>{let[t,s]=e;a.add("".concat(t,":").concat(s))})}),I&&Array.isArray(I)&&I.forEach(e=>{if(!e.name)return;let t=e.jobCounts&&Object.keys(e.jobCounts).length>0,s=null!==e.uptime&&void 0!==e.uptime&&e.uptime>0&&e.uptime<86400;(t||s)&&r.add(e.name)}),H({name:Array.from(e).sort(),user:Array.from(t).sort(),workspace:Array.from(s).sort(),pool:Array.from(r).sort(),labels:Array.from(a).sort()}),Promise.all([O.ZP.get(w.Rf,[]),O.ZP.get(N.getWorkspaces,[])]).then(e=>{let[t,s]=e;H(e=>({...e,user:t?[...new Set(t.map(e=>e.username).filter(Boolean))].sort():e.user,workspace:s?Object.keys(s).sort():e.workspace}))})},[eB,I,H]);let tr=a.useCallback(e=>{let t="ascending";ee.key===e&&"ascending"===ee.direction&&(t="descending"),et({key:e,direction:t})},[ee]),ta=a.useCallback(e=>ee.key===e?"ascending"===ee.direction?" ↑":" ↓":"",[ee]);a.useMemo(()=>{let e=eB||[];return{active:e.filter(e=>V.active.includes(e.status)).length,finished:e.filter(e=>V.finished.includes(e.status)).length}},[eB]);let tn=a.useMemo(()=>ey.filter(e=>!Y.includes(e)),[ey]),tl=a.useMemo(()=>$.reduce((e,t)=>{var s;return e+(null!==(s=ew[t])&&void 0!==s?s:0)},0),[ew]),ti=e=>ey.length>0?ey.includes(e):"all"===eM||V[eM].includes(e),tc=a.useMemo(()=>{let e=eB,t=null==l?void 0:l.find(e=>"labels"===(e.property||"").toLowerCase());return t&&t.value&&(e=e.filter(e=>(0,q.mu)(e,t))),e},[eB,l]),to=a.useMemo(()=>ee.key?[...tc].sort((e,t)=>e[ee.key]t[ee.key]?"ascending"===ee.direction?1:-1:0):tc,[tc,ee]),td=(ec-1)*em,tu=eV>0?Math.ceil(eV/em):0,th=a.useMemo(()=>{let e=new Map;return to.forEach(t=>{let s=t.id;e.has(s)||e.set(s,[]),e.get(s).push(t)}),e},[to]),tm=a.useMemo(()=>{let e=new Map;return th.forEach((t,s)=>{if(t.length>1){let r=t.some(e=>!1===e.is_primary_in_job_group),a=Q(t),n=r?"Task statuses:\n".concat(t.map((e,t)=>{let s=!0===e.is_primary_in_job_group;return"Task ".concat(t).concat(s?" ★":"",": ").concat(e.status)}).join("\n"),"\n\n★ = Primary task"):"Task statuses:\n".concat(t.map((e,t)=>"Task ".concat(t,": ").concat(e.status)).join("\n")),l=t.map(e=>e.requested_resources||e.resources_str).filter(Boolean),i=[...new Set(l)],c=0===l.length?"-":1===i.length?i[0]:"".concat(i[0]," (+").concat(t.length-1," more)"),o=0===l.length?null:"Aggregated from ".concat(t.length," tasks:\n").concat(l.map((e,t)=>"Task ".concat(t,": ").concat(e)).join("\n")),d=t.reduce((e,t)=>e+(t.recoveries||0),0);e.set(s,{aggregatedStatus:a,statusTooltip:n,resourcesDisplay:c,resourcesTooltip:o,totalRecoveries:d})}}),e},[th]),tx=a.useMemo(()=>Array.from(th.values()).some(e=>e.length>1),[th]),tp=e=>{eb(t=>{let s=new Set(t);return s.has(e)?s.delete(e):s.add(e),s})},tj=e=>ef.has(e);(0,a.useEffect)(()=>{let e=!1;return(async()=>{try{let t=await (0,v.w)();if(e)return;t&&t.id&&"local"!==t.id?ez({id:t.id,name:t.name||t.id}):eU("all")}catch(t){e||eU("all")}finally{e||eH(!0)}})(),()=>{e=!0}},[]);let[tg,tf]=(0,a.useState)(null);(0,a.useEffect)(()=>{if("mine"!==eZ||!eF||es||ea||eB.length>0||null!==tg)return;let e=!1;return(async()=>{try{var t,s;let r=await b.Z.getPaginatedJobs({allUsers:!0,page:1,limit:1});if(e)return;tf(null!==(s=null!==(t=null==r?void 0:r.totalNoFilter)&&void 0!==t?t:null==r?void 0:r.total)&&void 0!==s?s:0)}catch(t){e||tf(0)}})(),()=>{e=!0}},[eZ,eF,es,ea,eB.length,tg]);let[tb,ty]=(0,a.useState)(!1);(0,a.useEffect)(()=>{if(!es||ea){ty(!1);return}let e=setTimeout(()=>ty(!0),1e3);return()=>clearTimeout(e)},[es,ea]),(0,a.useEffect)(()=>{if(!ek)return;let e=e=>{eS.current&&!eS.current.contains(e.target)&&eC(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[ek]);let tN=e=>{if(ey.includes(e)){let t=ey.filter(t=>t!==e);0===t.length?(eT(!0),eN([])):(eN(t),eT(!1))}else eN([...ey,e]),eT(!1);ed(1)},tw=a.useMemo(()=>[{id:"id",order:0,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("id"),children:["ID",ta("id")]}),renderCell:(e,t)=>{let{renderMode:s,jobId:a,taskIndex:n,isExpanded:l,toggleJobGroup:c,hasAnyJobGroups:o}=t||{};return"groupParent"===s?(0,r.jsx)(h.pj,{children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("button",{onClick:()=>c(a),className:"p-1 hover:bg-gray-200 rounded mr-1",children:l?(0,r.jsx)(k.Z,{className:"w-4 h-4 text-gray-500"}):(0,r.jsx)(C.Z,{className:"w-4 h-4 text-gray-500"})}),(0,r.jsx)(i(),{href:"/jobs/".concat(a),className:"text-blue-600",children:a})]})}):"groupChild"===s?(0,r.jsxs)(h.pj,{className:"whitespace-nowrap relative",children:[(0,r.jsx)("div",{className:"absolute left-0 top-0 bottom-0 w-0.5 bg-blue-300"}),(0,r.jsx)("span",{className:"text-gray-500 pl-6",children:n})]}):(0,r.jsx)(h.pj,{children:o?(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)("span",{className:"w-6 mr-1","aria-hidden":"true"}),(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})]}):(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.id})})}},{id:"name",order:1,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("name"),children:["Name",ta("name")]}),renderCell:(e,t)=>{let{renderMode:s,jobId:a,tasks:n,taskIndex:l,toggleJobGroup:c}=t||{},o=!0===e.is_batch||null!=e.batch_total_batches;if("groupParent"===s)return(0,r.jsx)(h.pj,{className:"whitespace-nowrap",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(i(),{href:"/jobs/".concat(a),className:"text-blue-600",children:e.name}),o&&(0,r.jsx)(U.J,{className:"ml-2"}),(0,r.jsxs)("button",{onClick:()=>c(a),className:"ml-2 text-xs font-medium bg-gray-200 text-gray-700 hover:bg-gray-300 px-1.5 py-0.5 rounded cursor-pointer whitespace-nowrap",children:["JobGroup: ",n.length," tasks"]})]})});if("groupChild"===s){let t=n.some(e=>!1===e.is_primary_in_job_group);return(0,r.jsxs)(h.pj,{className:"whitespace-nowrap",children:[(0,r.jsx)(i(),{href:"/jobs/".concat(e.id,"/").concat(l),className:"text-blue-600 hover:underline",children:e.task||"Task ".concat(l)}),t&&!0===e.is_primary_in_job_group&&(0,r.jsx)("span",{className:"ml-1.5",children:(0,r.jsx)(Z.N,{})})]})}return(0,r.jsx)(h.pj,{className:"whitespace-nowrap",children:(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(i(),{href:"/jobs/".concat(e.id),className:"text-blue-600",children:e.name}),o&&(0,r.jsx)(U.J,{className:"ml-2"})]})})}},{id:"user",order:2,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("user"),children:["User",ta("user")]}),renderCell:e=>(0,r.jsx)(h.pj,{children:(0,r.jsx)(F.H,{username:e.user,userHash:e.user_hash,onUserClick:E})})},{id:"workspace",order:2.5,conditional:!0,renderHeader:()=>e6?(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("workspace"),children:["Workspace",ta("workspace")]}):null,renderCell:e=>e6?(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/workspaces",className:"text-gray-700 hover:text-blue-600 hover:underline",children:e.workspace||"default"})}):null},{id:"submitted",order:3,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("submitted_at"),children:["Submitted",ta("submitted_at")]}),renderCell:e=>(0,r.jsx)(h.pj,{children:en(e.submitted_at)})},{id:"duration",order:4,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("job_duration"),children:["Duration",ta("job_duration")]}),renderCell:e=>(0,r.jsx)(h.pj,{children:(0,j.LU)(e.job_duration)})},{id:"status",order:5,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("status"),children:["Status",ta("status")]}),renderCell:(e,t)=>{let{renderMode:s,aggregates:a}=t||{};return"groupParent"===s?(0,r.jsx)(h.pj,{children:(0,r.jsx)(j.Md,{content:null==a?void 0:a.statusTooltip,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:(0,r.jsx)(T.OE,{status:null==a?void 0:a.aggregatedStatus})})})}):"RUNNING"===e.status&&null!=e.batch_total_batches?(0,r.jsx)(h.pj,{children:(0,r.jsx)(ei,{completed:e.batch_completed_batches||0,total:e.batch_total_batches})}):(0,r.jsx)(h.pj,{children:(0,r.jsx)(G.j,{name:"jobs.table.status.badge",context:e,fallback:(0,r.jsx)(T.OE,{status:e.status,statusTooltip:e.statusTooltip})})})}},{id:"infra",order:6,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("infra"),children:["Infra",ta("infra")]}),renderCell:(e,t)=>{let{renderMode:s}=t||{};return"groupParent"===s?(0,r.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)("span",{children:e.cloud||e.infra.split("(")[0].trim()}):(0,r.jsx)("span",{children:"-"})}):(0,r.jsx)(h.pj,{children:e.infra&&"-"!==e.infra?(0,r.jsx)(j.Md,{content:e.full_infra||e.infra,className:"text-sm text-muted-foreground",children:(0,r.jsxs)("span",{children:[(0,r.jsx)(i(),{href:"/infra",className:"text-blue-600 hover:underline",children:e.cloud||e.infra.split("(")[0].trim()}),e.infra.includes("(")&&(0,r.jsx)("span",{children:" "+(()=>{let t=g.MO.NAME_TRUNCATE_LENGTH,s=e.infra.substring(e.infra.indexOf("(")),r=s.substring(1,s.length-1);if(r.length<=t)return s;let a="".concat(r.substring(0,Math.floor((t-3)/2)),"...").concat(r.substring(r.length-Math.ceil((t-3)/2)));return"(".concat(a,")")})()})]})}):(0,r.jsx)("span",{children:e.infra||"-"})})}},{id:"requested_resources",order:7,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("cluster"),children:["Requested Resources",ta("cluster")]}),renderCell:(e,t)=>{let{renderMode:s,aggregates:a}=t||{};return"groupParent"===s?(0,r.jsx)(h.pj,{children:(null==a?void 0:a.resourcesTooltip)?(0,r.jsx)(j.Md,{content:a.resourcesTooltip,className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:a.resourcesDisplay})}):(0,r.jsx)("span",{children:null==a?void 0:a.resourcesDisplay})}):(0,r.jsx)(h.pj,{children:(0,r.jsx)(j.Md,{content:e.requested_resources||e.resources_str_full||e.resources_str||"-",className:"text-sm text-muted-foreground",children:(0,r.jsx)("span",{children:e.requested_resources||e.resources_str||"-"})})})}},{id:"recoveries",order:8,renderHeader:()=>(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("recoveries"),children:["Recoveries",ta("recoveries")]}),renderCell:(e,t)=>{let{renderMode:s,aggregates:a}=t||{};return"groupParent"===s?(0,r.jsx)(h.pj,{children:null==a?void 0:a.totalRecoveries}):(0,r.jsx)(h.pj,{children:e.recoveries})}},{id:"pool",order:9.5,conditional:!0,renderHeader:()=>e4?(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>tr("pool"),children:["Pool",ta("pool")]}):null,renderCell:e=>e4?(0,r.jsx)(h.pj,{children:(0,r.jsx)("div",{className:M?"blur-sm transition-all duration-300":"",children:M?"-":(0,j.os)(e.pool,e.pool_hash,I)})}):null},{id:"details",order:10,renderHeader:()=>(0,r.jsx)(h.ss,{children:"Details"}),renderCell:(e,t)=>{let{renderMode:s}=t||{};if("groupParent"===s)return(0,r.jsx)(h.pj,{children:"-"});let a=(null==t?void 0:t.renderMode)==="groupChild"?e.task_job_id:e.id;return(0,r.jsx)(h.pj,{children:e.details?(0,r.jsx)(eh,{text:e.details,rowId:a,expandedRowId:ep,setExpandedRowId:ej}):"-"})}},{id:"logs",order:11,renderHeader:()=>(0,r.jsx)(h.ss,{children:"Logs"}),renderCell:(e,t)=>{let{renderMode:s,jobId:a}=t||{},n="groupParent"===s?a:e.id;return(0,r.jsx)(h.pj,{children:(0,r.jsx)(eo,{jobParent:"/jobs",jobId:n,managed:!0,workspace:e.workspace})})}}],[tr,ta,e6,e4,ep,M,I,E]),tv=a.useCallback(e=>({id:e.id,order:e.header.order,isPlugin:!0,pluginColumn:e,renderHeader:()=>{let t=e.header.sortKey?"sortable whitespace-nowrap":"whitespace-nowrap",s="".concat(t).concat(e.header.className?" "+e.header.className:"");return(0,r.jsxs)(h.ss,{className:s,onClick:e.header.sortKey?()=>tr(e.header.sortKey):void 0,children:[e.header.label,e.header.sortKey?ta(e.header.sortKey):""]})},renderCell:(t,s)=>{let a={item:t,shouldShowWorkspace:e6,shouldShowPool:e4,expandedRowId:ep,setExpandedRowId:ej,expandedRowRef:eg,...s||{}},n=e.cell.render(t,a);return(0,r.jsx)(h.pj,{className:e.cell.className||"",children:n})}}),[tr,ta,e6,e4,ep,ej,eg]),tk=(0,J.V$)("jobs",tw,{shouldShowColumn:e=>"workspace"===e?e6:"pool"!==e||e4},tv),tC=tk.length;return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("div",{className:"flex flex-col space-y-1 mb-1",children:(0,r.jsxs)("div",{className:"flex items-center justify-between text-sm mb-1",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-center min-w-0",children:[(0,r.jsx)("span",{className:"mr-2 text-sm font-medium",children:"Statuses:"}),(0,r.jsxs)("div",{className:"flex flex-wrap gap-2 items-center",children:[!es&&0===e$&&!ea&&(0,r.jsx)("span",{className:"text-gray-500 mr-2",children:"No jobs found"}),Y.map(e=>{var t;let s=null!==(t=ew[e])&&void 0!==t?t:0,a=ti(e)||ey.includes(e);return(0,r.jsxs)("button",{onClick:()=>tN(e),className:"px-3 py-0.5 rounded-full flex items-center space-x-2 ".concat(a?(0,T.Cl)(e):"bg-gray-50 text-gray-600 hover:bg-gray-100"),children:[(0,r.jsx)("span",{children:e}),(0,r.jsx)("span",{className:"text-xs tabular-nums text-center min-w-[1.5rem] ".concat(a?"bg-white/50":"bg-gray-200"," px-1.5 py-0.5 rounded"),children:s})]},e)}),tn.map(e=>{var t;let s=null!==(t=ew[e])&&void 0!==t?t:0;return(0,r.jsxs)("button",{onClick:()=>tN(e),className:"px-3 py-0.5 rounded-full flex items-center space-x-2 ".concat((0,T.Cl)(e)),children:[(0,r.jsx)("span",{children:e}),(0,r.jsx)("span",{className:"text-xs tabular-nums text-center min-w-[1.5rem] bg-white/50 px-1.5 py-0.5 rounded",children:s})]},e)}),(()=>{let e=$.filter(e=>ti(e)).length,t="all"!==eM||ey.length>0;return(0,r.jsxs)("div",{className:"relative",ref:eS,children:[(0,r.jsxs)("button",{onClick:()=>eC(e=>!e),className:"px-3 py-0.5 rounded-full flex items-center space-x-1.5 ".concat(t?"bg-gray-200 text-gray-800":"bg-gray-50 text-gray-600 hover:bg-gray-100"),"aria-haspopup":"true","aria-expanded":ek,children:[(0,r.jsx)("span",{children:"More"}),t?(0,r.jsxs)("span",{className:"text-xs tabular-nums bg-white/70 px-1.5 py-0.5 rounded",children:[(0,r.jsx)("span",{className:"inline-block text-center min-w-[1rem]",children:e})," ","selected"]}):tl>0&&(0,r.jsx)("span",{className:"text-xs tabular-nums text-center min-w-[1.5rem] inline-block bg-gray-200 px-1.5 py-0.5 rounded",children:tl}),(0,r.jsx)(k.Z,{className:"w-3.5 h-3.5 transition-transform ".concat(ek?"rotate-180":"")})]}),ek&&(0,r.jsx)("div",{className:"absolute left-0 z-50 mt-1 w-60 rounded-md border border-gray-200 bg-white shadow-md py-1",children:$.map(e=>{var t;let s=null!==(t=ew[e])&&void 0!==t?t:0,a=ti(e),n=ey.includes(e);return(0,r.jsxs)("button",{onClick:()=>tN(e),className:"w-full px-3 py-1.5 flex items-center justify-between text-sm hover:bg-gray-50 ".concat(n?"bg-gray-50":""),children:[(0,r.jsxs)("span",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)(S.Z,{className:"w-3.5 h-3.5 shrink-0 ".concat(a?"text-sky-blue":"text-transparent")}),(0,r.jsx)("span",{className:"truncate ".concat(a?"font-medium text-gray-900":0===s?"text-gray-400":"text-gray-700"),children:e})]}),(0,r.jsx)("span",{className:"ml-2 text-xs tabular-nums text-right min-w-[2rem] ".concat(0===s?"text-gray-400":"text-gray-500"),children:s})]},e)})})]})})(),(()=>{let e=e=>{a.startTransition(()=>{eD(e),eN([]),eT(!0),ed(1)})},t="active"===eM&&eA,s="all"===eM&&eA;return(0,r.jsxs)("div",{role:"tablist","aria-label":"Filter jobs by activity",className:"inline-flex items-center bg-gray-100 rounded-md p-0.5 shrink-0",children:[(0,r.jsx)("button",{role:"tab","aria-selected":t,onClick:()=>e("active"),className:"px-2.5 py-0.5 rounded text-xs font-medium transition-colors ".concat(t?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"Active"}),(0,r.jsx)("button",{role:"tab","aria-selected":s,onClick:()=>e("all"),className:"px-2.5 py-0.5 rounded text-xs font-medium transition-colors ".concat(s?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"All"})]})})(),(()=>{if(!eF)return null;let e=(l||[]).find(e=>"user"===(e.property||"").toLowerCase()&&e.value),t=e?String(e.value)===eF.id||String(e.value)===eF.name:"mine"===eZ,s=!e&&"all"===eZ;return(0,r.jsxs)("div",{role:"tablist","aria-label":"Filter jobs by owner",className:"inline-flex items-center bg-gray-100 rounded-md p-0.5 shrink-0",children:[(0,r.jsx)("button",{role:"tab","aria-selected":t,onClick:()=>ts("mine"),className:"px-2.5 py-0.5 rounded text-xs font-medium transition-colors ".concat(t?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"My Jobs"}),(0,r.jsx)("button",{role:"tab","aria-selected":s,onClick:()=>ts("all"),className:"px-2.5 py-0.5 rounded text-xs font-medium transition-colors ".concat(s?"bg-white text-gray-900 shadow-sm":"text-gray-600 hover:text-gray-900"),children:"All Jobs"})]})})(),(()=>{let e=(l||[]).find(e=>"user"===(e.property||"").toLowerCase()&&e.value);return"mine"===eZ&&eF&&!e&&!ea&&to.length>0?(0,r.jsxs)("div",{className:"inline-flex items-center gap-2 rounded-full border border-sky-200/70 bg-sky-50 pl-2 pr-2.5 py-0.5 text-xs shrink-0",role:"status","aria-live":"polite",children:[(0,r.jsx)(_,{className:"h-3 w-3 text-sky-600 shrink-0"}),(0,r.jsx)("span",{className:"text-gray-700",children:"Showing your jobs only."}),(0,r.jsx)("button",{type:"button",onClick:()=>ts("all"),className:"font-medium text-sky-700 transition-colors hover:text-sky-800 hover:underline",children:"View all jobs"})]}):null})()]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0 ml-2",children:[es&&(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(o.Z,{size:15,className:"mt-0"}),(0,r.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),!es&&X&&(0,r.jsx)(j.$3,{timestamp:X}),(0,r.jsxs)("button",{onClick:()=>{R&&R()},disabled:es,className:"text-sky-blue hover:text-sky-blue-bright flex items-center text-sm",children:[(0,r.jsx)(L.Z,{className:"h-4 w-4 mr-1.5"}),(0,r.jsx)("span",{children:"Refresh"})]})]})]})}),eq&&eE&&0===to.length&&!es&&!ea&&(0,r.jsx)("div",{className:"mb-4 p-4 bg-gray-50 rounded-lg border",children:(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3",children:[(0,r.jsxs)("p",{className:"text-gray-700 text-center text-sm",children:["Job controller stopped.",(0,r.jsx)("br",{}),"Restart to check status."]}),(0,r.jsx)(d.z,{variant:"outline",size:"sm",onClick:e3,className:"text-sky-blue hover:text-sky-blue-bright",disabled:es||eR,children:eR?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P,{className:"h-4 w-4 mr-2"}),"Restart"]})})]})}),(0,r.jsx)(u.Zb,{className:"overflow-hidden",children:(0,r.jsxs)("div",{className:"overflow-x-auto relative",children:[tb&&(0,r.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center bg-white/70 pointer-events-none transition-opacity","aria-hidden":"true",children:(0,r.jsx)(o.Z,{size:28})}),(0,r.jsxs)(h.iA,{className:"min-w-full border-collapse",children:[(0,r.jsx)(h.xD,{children:(0,r.jsx)(h.SC,{children:tk.map(e=>a.cloneElement(e.renderHeader(),{key:e.id}))})}),(0,r.jsx)(h.RM,{children:(es||"mine"===eZ&&eF&&null===tg)&&0===to.length?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:tC,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(o.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):to.length>0&&!(0,x.KL)()?(0,r.jsx)(r.Fragment,{children:Array.from(th.entries()).map(e=>{let[t,s]=e,n=s.length>1,l=tj(t),i=s[0];if(!n){let e={renderMode:"single",hasAnyJobGroups:tx};return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)(h.SC,{children:tk.map(t=>{let s=t.renderCell(i,e);return s?a.cloneElement(s,{key:t.id}):null})}),ep===i.id&&(0,r.jsx)(eu,{text:i.details,colSpan:tC,innerRef:eg})]},i.task_job_id)}let c=tm.get(t)||{},o={renderMode:"groupParent",jobId:t,tasks:s,aggregates:c,isExpanded:l,toggleJobGroup:tp,hasAnyJobGroups:tx};return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)(h.SC,{className:"hover:bg-gray-50",children:tk.map(e=>{let t=e.renderCell(i,o);return t?a.cloneElement(t,{key:e.id}):null})}),l&&s.map((e,n)=>{let i={renderMode:"groupChild",jobId:t,tasks:s,taskIndex:n,aggregates:c,isExpanded:l,toggleJobGroup:tp,hasAnyJobGroups:tx};return(0,r.jsxs)(a.Fragment,{children:[(0,r.jsx)(h.SC,{className:"bg-gray-50/50",children:tk.map(t=>{let s=t.renderCell(e,i);return s?a.cloneElement(s,{key:t.id}):null})}),ep===e.task_job_id&&(0,r.jsx)(eu,{text:e.details,colSpan:tC,innerRef:eg})]},e.task_job_id)})]},"group-".concat(t))})}):(0,r.jsx)(h.SC,{className:"hover:bg-transparent",children:(0,r.jsx)(h.pj,{colSpan:tC,className:"p-0",children:(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center space-y-4 px-6",style:{minHeight:280},children:[eL&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"The managed job controller is launching. It will be ready shortly."}),(0,r.jsxs)("div",{className:"flex items-center",children:[(0,r.jsx)(o.Z,{size:12,className:"mr-2"}),(0,r.jsx)("span",{className:"text-gray-500",children:"Launching..."})]})]}),!eE&&!eL&&("mine"===eZ&&eF&&"all"===eM&&eA&&tg>0?(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-2 max-w-md",children:[(0,r.jsx)("p",{className:"text-gray-700",children:"You haven't submitted any managed jobs yet."}),(0,r.jsxs)("p",{className:"text-sm text-gray-500",children:[tg.toLocaleString()," job",1===tg?"":"s"," in total — switch to All Jobs to see them."]}),(0,r.jsx)(d.z,{variant:"outline",size:"sm",onClick:()=>{a.startTransition(()=>{eU("all"),eN([]),eT(!0),ed(1)})},className:"text-sky-blue hover:text-sky-blue-bright",children:"View all jobs"})]}):(0,r.jsx)(m.u,{icon:(0,r.jsx)(p.Vp,{className:"w-5 h-5"}),title:"No active jobs",description:"Launch a managed job to run it with automatic recovery",minHeight:0})),!eq&&eE&&(0,r.jsxs)("div",{className:"flex flex-col items-center space-y-3 px-4",children:[(0,r.jsx)("p",{className:"text-gray-700 text-center text-sm sm:text-base max-w-md",children:"The managed job controller has been stopped. Restart to check the latest job status."}),(0,r.jsx)(d.z,{variant:"outline",size:"sm",onClick:e3,className:"text-sky-blue hover:text-sky-blue-bright",disabled:es||eR,children:eR?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{size:12,className:"mr-2"}),"Restarting..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(P,{className:"h-4 w-4 mr-2"}),"Restart Controller"]})})]})]})})})})]})]})}),(0,r.jsx)(c.j,{currentPage:ec,totalPages:tu,totalCount:eV,startIndex:td,endIndex:td+th.size,onPageChange:ed,onPreviousPage:()=>{ed(e=>Math.max(e-1,1))},onNextPage:()=>{tu>0&&ece+1)},isPrevDisabled:1===ec||!to||0===to.length,isNextDisabled:0===tu||ec>=tu||!to||0===to.length,pageSize:em,onPageSizeChange:e=>{let t=parseInt(e.target.value,10);ex(t),(0,x.AW)(K,t),ed(1)},pageSizeOptions:B,itemLabel:"Jobs"}),(0,r.jsx)(D.cV,{isOpen:eG.isOpen,onClose:()=>eJ({...eG,isOpen:!1}),onConfirm:eG.onConfirm,title:eG.title,message:eG.message,confirmClassName:"bg-blue-600 hover:bg-blue-700 text-white"})]})}function eo(e){let{withLabel:t=!1,jobParent:s,jobId:a,managed:l,workspace:i="default"}=e,c=(0,n.useRouter)(),o=(e,t)=>{e.preventDefault(),e.stopPropagation(),(0,W.uw)("view_logs",{jobId:a}),c.push({pathname:"".concat(s,"/").concat(a),query:{tab:t}})},d=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e.preventDefault(),e.stopPropagation(),(0,W.uw)("download_logs",{jobId:a}),l)(0,f.jh)({jobId:parseInt(a),controller:t});else{let e=s.match(/\/clusters\/(.+)/);if(e){let t=e[1];(0,y.GH)({clusterName:t,jobIds:[a],workspace:i})}}};return(0,r.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,r.jsx)(j.WH,{content:"View Job Logs",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>o(e,"logs"),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",children:[(0,r.jsx)(R,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Logs"})]})},"logs"),(0,r.jsx)(j.WH,{content:"Download All Task Logs (zip)",className:"capitalize text-sm text-muted-foreground",children:(0,r.jsxs)("button",{onClick:e=>d(e,!1),className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center h-8",title:"Download logs",children:[(0,r.jsx)(I.Z,{className:"w-4 h-4"}),t&&(0,r.jsx)("span",{className:"ml-1.5",children:"Download"})]})},"downloadlogs")]})}function ed(e){let{clusterName:t,clusterJobData:s,loading:n,refreshClusterJobsOnly:l,userFilter:d=null,nameFilter:m=null,workspace:g="default"}=e,[f,b]=(0,a.useState)(null),[y,N]=(0,a.useState)({key:null,direction:"ascending"}),[w,v]=(0,a.useState)(1),[k,C]=(0,a.useState)(10),S=(0,a.useRef)(null),[E,_]=(0,a.useState)(null);(0,a.useEffect)(()=>{let e=e=>{f&&S.current&&!S.current.contains(e.target)&&b(null)};return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[f]);let P=a.useMemo(()=>{let e=s||[];return d&&"ALL_USERS"!==d&&(e=er(e,d)),m&&(e=et(e,m)),e},[s,d,m]);(0,a.useEffect)(()=>{JSON.stringify(s)!==JSON.stringify(E)&&_(s)},[s,E]);let R=a.useMemo(()=>y.key?[...P].sort((e,t)=>e[y.key]t[y.key]?"ascending"===y.direction?1:-1:0):P,[P,y]),I=e=>{let t="ascending";y.key===e&&"ascending"===y.direction&&(t="descending"),N({key:e,direction:t})},M=e=>y.key===e?"ascending"===y.direction?" ↑":" ↓":"",D=Math.ceil(R.length/k),A=(w-1)*k,Z=A+k,U=R.slice(A,Z);return(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsxs)(u.Zb,{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,r.jsx)("h3",{className:"text-lg font-semibold",children:"Cluster Jobs"}),(0,r.jsx)("div",{className:"flex items-center",children:l&&(0,r.jsxs)("button",{onClick:l,disabled:n,className:"text-sky-blue hover:text-sky-blue-bright font-medium inline-flex items-center text-sm ml-2",children:[(0,r.jsx)(L.Z,{className:"w-4 h-4 mr-1"}),"Refresh Jobs"]})})]}),(0,r.jsxs)(h.iA,{children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("id"),children:["ID",M("id")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("job"),children:["Name",M("job")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("user"),children:["User",M("user")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("submitted_at"),children:["Submitted",M("submitted_at")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("job_duration"),children:["Duration",M("job_duration")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("status"),children:["Status",M("status")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap",onClick:()=>I("resources"),children:["Resources",M("resources")]}),(0,r.jsx)(h.ss,{className:"whitespace-nowrap",children:"Logs"})]})}),(0,r.jsx)(h.RM,{children:n?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:8,className:"text-center py-12 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(o.Z,{size:24,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading cluster jobs..."})]})})}):U.length>0&&!(0,x.KL)()?U.map(e=>(0,r.jsxs)(a.Fragment,{children:[(0,r.jsxs)(h.SC,{className:f===e.id?"selected-row":"",children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:e.id})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/clusters/".concat(t,"/").concat(e.id),className:"text-blue-600",children:(0,r.jsx)(eh,{text:e.job||"Unnamed job",rowId:e.id,expandedRowId:f,setExpandedRowId:b})})}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(F.H,{username:e.user,userHash:e.user_hash})}),(0,r.jsx)(h.pj,{children:en(e.submitted_at)}),(0,r.jsx)(h.pj,{children:(0,j.LU)(e.job_duration)}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(T.OE,{status:e.status})}),(0,r.jsx)(h.pj,{children:e.resources}),(0,r.jsx)(h.pj,{className:"flex content-center items-center",children:(0,r.jsx)(eo,{jobParent:"/clusters/".concat(t),jobId:e.id,managed:!1,workspace:g})})]}),f===e.id&&(0,r.jsx)(eu,{text:e.job||"Unnamed job",colSpan:8,innerRef:S})]},e.id)):(0,r.jsx)(h.Iz,{colSpan:8,icon:(0,r.jsx)(p.Vp,{className:"w-5 h-5"}),title:"No jobs found",description:"Submit a job to run it on this cluster"})})]})]}),R&&R.length>0&&(0,r.jsx)(c.j,{currentPage:w,totalPages:D,totalCount:R.length,startIndex:A,endIndex:Z,onPageChange:v,onPreviousPage:()=>{v(e=>Math.max(e-1,1))},onNextPage:()=>{v(e=>Math.min(e+1,D))},isPrevDisabled:1===w,isNextDisabled:w===D||0===D,pageSize:k,onPageSizeChange:e=>{C(parseInt(e.target.value,10)),v(1)},pageSizeOptions:[5,10,20,50]})]})}function eu(e){let{text:t,colSpan:s,innerRef:a}=e;return(0,r.jsx)(h.SC,{className:"expanded-details",children:(0,r.jsx)(h.pj,{colSpan:s,children:(0,r.jsx)("div",{className:"p-4 bg-gray-50 rounded-md border border-gray-200",ref:a,children:(0,r.jsx)("div",{className:"flex justify-between items-start",children:(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-gray-900",children:"Full Details"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-700",style:{whiteSpace:"pre-wrap"},children:t})]})})})})})}function eh(e){let{text:t,rowId:s,expandedRowId:n,setExpandedRowId:l}=e,i=t||"",c=i.length>50,o=n===s,d=c?"".concat(i.substring(0,50)):i,u=(0,a.useRef)(null);return(0,r.jsxs)("div",{className:"truncated-details relative max-w-full flex items-center",children:[(0,r.jsx)("span",{className:"truncate",children:d}),c&&(0,r.jsx)("button",{ref:u,type:"button",onClick:e=>{e.preventDefault(),e.stopPropagation(),l(o?null:s)},className:"text-blue-600 hover:text-blue-800 font-medium ml-1 flex-shrink-0","data-button-type":"show-more-less",children:o?"... show less":"... show more"})]})}function em(e){let{refreshInterval:t,setLoading:s,refreshDataRef:n}=e,[l,d]=(0,a.useState)([]),[m,p]=(0,a.useState)({key:null,direction:"ascending"}),[g,b]=(0,a.useState)(!1),[y,N]=(0,a.useState)(!0),[w,v]=(0,a.useState)(1),[k,C]=(0,a.useState)(10),S=a.useCallback(async()=>{b(!0),s(!0);try{let{pools:e=[]}=await O.ZP.get(f.vs,[{}])||{};d(e),N(!1)}catch(e){console.error("Error fetching pools data:",e),d([]),N(!1)}finally{b(!1),s(!1)}},[s]);a.useEffect(()=>{n&&(n.current=S)},[n,S]),(0,a.useEffect)(()=>{d([]);let e=!0;S();let s=setInterval(()=>{e&&"visible"===window.document.visibilityState&&S()},t);return()=>{e=!1,clearInterval(s)}},[t,S]);let E=e=>{let t="ascending";m.key===e&&"ascending"===m.direction&&(t="descending"),p({key:e,direction:t})},_=e=>m.key===e?"ascending"===m.direction?" ↑":" ↓":"",L=a.useMemo(()=>m.key?[...l].sort((e,t)=>e[m.key]t[m.key]?"ascending"===m.direction?1:-1:0):l,[l,m]),P=Math.ceil(L.length/k),R=(w-1)*k,I=R+k,D=L.slice(R,I),A=e=>{if(!e||!e.replica_info||0===e.replica_info.length)return"0 (target: 0)";let t=e.replica_info.filter(e=>"READY"===e.status).length,s=e.target_num_replicas||0;return"".concat(t," (target: ").concat(s,")")},Z=e=>{let{jobCounts:t}=e;return(0,r.jsx)(j.x9,{jobCounts:t,getStatusStyle:T.Cl})},U=e=>{let{replicaInfo:t}=e;return(0,r.jsx)(j.Kl,{replicaInfo:t})};return(0,r.jsxs)(u.Zb,{children:[(0,r.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,r.jsxs)(h.iA,{className:"min-w-full table-fixed",children:[(0,r.jsx)(h.xD,{children:(0,r.jsxs)(h.SC,{children:[(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-32",onClick:()=>E("name"),children:["Pool",_("name")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>E("job_counts"),children:["Jobs",_("job_counts")]}),(0,r.jsx)(h.ss,{className:"whitespace-nowrap w-20",children:"Workers"}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-36",onClick:()=>E("requested_resources_str"),children:["Worker Details",_("requested_resources_str")]}),(0,r.jsxs)(h.ss,{className:"sortable whitespace-nowrap w-40",onClick:()=>E("requested_resources_str"),children:["Worker Resources",_("requested_resources_str")]})]})}),(0,r.jsx)(h.RM,{children:g&&y?(0,r.jsx)(h.SC,{children:(0,r.jsx)(h.pj,{colSpan:5,className:"text-center py-6 text-gray-500",children:(0,r.jsxs)("div",{className:"flex justify-center items-center",children:[(0,r.jsx)(o.Z,{size:20,className:"mr-2"}),(0,r.jsx)("span",{children:"Loading..."})]})})}):D.length>0&&!(0,x.KL)()?D.map(e=>(0,r.jsxs)(h.SC,{children:[(0,r.jsx)(h.pj,{children:(0,r.jsx)(i(),{href:"/jobs/pools/".concat(e.name),className:"text-blue-600 hover:text-blue-800",children:e.name})}),(0,r.jsx)(h.pj,{children:(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsx)(Z,{jobCounts:e.jobCounts}),(0,r.jsx)(i(),{href:(0,q.P2)("/jobs","pool",":",e.name),className:"text-blue-600 hover:text-blue-800 text-xs",children:"See all jobs"})]})}),(0,r.jsx)(h.pj,{children:A(e)}),(0,r.jsx)(h.pj,{children:(0,r.jsx)(U,{replicaInfo:e.replica_info})}),(0,r.jsx)(h.pj,{children:e.requested_resources_str||"-"})]},e.name)):(0,r.jsx)(h.Iz,{colSpan:5,icon:(0,r.jsx)(M.Z,{size:20,strokeWidth:1.75}),title:"No pools found",description:"Create a pool to share workers across jobs"})})]})}),D.length>0&&P>1&&(0,r.jsx)(c.j,{currentPage:w,totalPages:P,totalCount:L.length,startIndex:R,endIndex:I,onPageChange:v,onPreviousPage:()=>{v(e=>Math.max(e-1,1))},onNextPage:()=>{v(e=>Math.min(e+1,P))},isPrevDisabled:1===w,isNextDisabled:w===P,pageSize:k,onPageSizeChange:e=>{C(parseInt(e.target.value,10)),v(1)},pageSizeOptions:[5,10,25,50]})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/495.476be8fb9a3add7a.js b/sky/dashboard/out/_next/static/chunks/495.476be8fb9a3add7a.js new file mode 100644 index 000000000..093e33104 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/495.476be8fb9a3add7a.js @@ -0,0 +1,16 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[495],{3626:function(e,t,s){s.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,s(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},8418:function(e,t,s){s.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,s(998).Z)("Trash",[["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"}]])},6122:function(e,t,s){s.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,s(998).Z)("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"}]])},3495:function(e,t,s){s.r(t),s.d(t,{ContextDetails:function(){return W},GPUs:function(){return V},InfrastructureSection:function(){return B}});var a=s(5893),r=s(7294),l=s(5739);s(3872);var n=s(2942),o=s(3850),i=s(6122),c=s(6409),d=s(8418),m=s(3626),u=s(3001),h=s(7853);function x(e){return null==e?"-":Math.round(e).toString()}function g(e,t,s){if(!s||0===e.length)return null;let a=e.reduce((e,s)=>{let a=s[t];return e+(null!=a?a:0)},0);return a>0?a:null}var p=s(17),f=s(3907),y=s(2045);s(3225);var j=s(7324),N=s(3266),b=s(8969);s(7145);var v=s(9326),w=s(1360),S=s(803),C=s(2557),_=s(9749),k=s(9123);function P(e){let{isOpen:t,onClose:s,onSave:n,poolData:o=null,isLoading:i=!1}=e,[c,d]=(0,r.useState)(""),[m,u]=(0,r.useState)(""),[h,x]=(0,r.useState)("ubuntu"),[g,p]=(0,r.useState)(null),[f,y]=(0,r.useState)(""),[j,N]=(0,r.useState)({}),b=null!==o;(0,r.useEffect)(()=>{if(b&&o){var e,t,s;d(o.name||""),u(((null===(e=o.config)||void 0===e?void 0:e.hosts)||[]).join("\n")),x((null===(t=o.config)||void 0===t?void 0:t.user)||"ubuntu"),y((null===(s=o.config)||void 0===s?void 0:s.password)||"")}else d(""),u(""),x("ubuntu"),p(null),y("");N({})},[b,o]);let P=()=>{let e={};return c.trim()||(e.poolName="Pool name is required"),m.trim()||(e.hosts="At least one host is required"),h.trim()||(e.sshUser="SSH user is required"),g||f||(e.auth="Either SSH key file or password is required"),N(e),0===Object.keys(e).length},U=async()=>{if(!P())return;let e={hosts:m.split("\n").map(e=>e.trim()).filter(e=>e.length>0),user:h};try{if(g){let t=g.name;await (0,v.hY)(t,g),e.identity_file="~/.sky/ssh_keys/".concat(t)}f&&(e.password=f),n(c,e)}catch(e){console.error("Failed to upload SSH key:",e),N({...j,keyUpload:"Failed to upload SSH key"})}},D=()=>{i||s()};return(0,a.jsx)(w.Vq,{open:t,onOpenChange:D,children:(0,a.jsxs)(w.cZ,{className:"max-w-2xl max-h-[80vh] overflow-y-auto",children:[(0,a.jsx)(w.fK,{children:(0,a.jsx)(w.$N,{children:b?"Edit SSH Node Pool: ".concat(null==o?void 0:o.name):"Add SSH Node Pool"})}),(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(_._,{htmlFor:"poolName",children:"Pool Name"}),(0,a.jsx)(C.I,{id:"poolName",placeholder:"my-ssh-cluster",value:c,onChange:e=>d(e.target.value),disabled:b,className:"placeholder:text-gray-500 ".concat(j.poolName?"border-red-500":"")}),j.poolName&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:j.poolName})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(_._,{htmlFor:"hosts",children:"Hosts (one per line)"}),(0,a.jsx)(k.g,{id:"hosts",placeholder:"192.168.1.10\n192.168.1.11\nhostname.example.com",value:m,onChange:e=>u(e.target.value),rows:6,className:"placeholder:text-gray-500 ".concat(j.hosts?"border-red-500":"")}),j.hosts&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:j.hosts})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(_._,{htmlFor:"sshUser",children:"SSH User"}),(0,a.jsx)(C.I,{id:"sshUser",placeholder:"ubuntu",value:h,onChange:e=>x(e.target.value),className:"placeholder:text-gray-500 ".concat(j.sshUser?"border-red-500":"")}),j.sshUser&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:j.sshUser})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(_._,{htmlFor:"keyFile",children:"SSH Private Key File"}),(0,a.jsx)(C.I,{id:"keyFile",type:"file",accept:".pem,.key,id_rsa,id_ed25519",onChange:e=>{var t;return p((null===(t=e.target.files)||void 0===t?void 0:t[0])||null)},className:"border-0 bg-transparent p-0 shadow-none focus:ring-0 file:mr-2 file:text-sm file:py-1 file:px-3 file:border file:border-gray-300 file:rounded file:bg-gray-50 hover:file:bg-gray-100 file:cursor-pointer"}),j.keyUpload&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:j.keyUpload})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(_._,{htmlFor:"password",children:"Password (optional, if sudo requires a password)"}),(0,a.jsx)(C.I,{id:"password",type:"password",placeholder:"Leave empty if using passwordless sudo",value:f,onChange:e=>y(e.target.value),className:"placeholder:text-gray-500"})]}),j.auth&&(0,a.jsx)("p",{className:"text-sm text-red-500",children:j.auth})]}),(0,a.jsxs)(w.cN,{children:[(0,a.jsx)(S.z,{variant:"outline",onClick:D,disabled:i,children:"Cancel"}),(0,a.jsx)(S.z,{onClick:U,disabled:i,className:"bg-blue-600 hover:bg-blue-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:i?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"Saving..."]}):b?"Update Pool":"Create Pool"})]})]})})}var U=s(6378),D=s(1428),E=s(6856),M=s(1214),I=s(1163),F=s(1664),L=s.n(F),A=s(5988),H=s(864),R=s(3800),Z=s(470);s(7673);var O=s(2935);let G=M.nb.REFRESH_INTERVAL,q=M.MO.NAME_TRUNCATE_LENGTH,z=e=>{let{gpu:t,heightClass:s="h-4",wrapperClassName:r=""}=e,l=(null==t?void 0:t.gpu_total)||0,n=(null==t?void 0:t.gpu_not_ready)||0,o=(null==t?void 0:t.gpu_free)||0,i=Math.max(0,l-o-n),c="".concat(n," not ready"),d="".concat(i," used"),m="".concat(o," free"),u=l>0?e=>e/l*100:()=>0,h=u(n),x=u(i),g=u(o);return(0,a.jsxs)("div",{className:"bg-gray-100 rounded-md flex overflow-hidden shadow-sm ".concat(s," ").concat(r).trim(),children:[h>0&&(0,a.jsx)("div",{style:{width:"".concat(h,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:c,className:"bg-gray-400 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:h>15&&c}),x>0&&(0,a.jsx)("div",{style:{width:"".concat(x,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:d,className:"bg-yellow-500 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:x>15&&d}),g>0&&(0,a.jsx)("div",{style:{width:"".concat(g,"%"),fontSize:"clamp(8px, 1.2vw, 12px)"},title:m,className:"bg-green-700 h-full flex items-center justify-center text-white font-medium overflow-hidden whitespace-nowrap px-1",children:g>15&&m})]})},T=()=>(0,a.jsx)("span",{className:"px-2 py-0.5 bg-muted rounded text-xs font-medium inline-flex items-center",children:(0,a.jsx)("span",{className:"infra-skeleton-text",style:{width:"20px",height:"12px"}})});function B(e){let{title:t,isLoading:s,isDataLoaded:r,contexts:n,gpus:o,groupedPerContextGPUs:c,groupedPerNodeGPUs:d,handleContextClick:m,contextStats:u={},jobsData:h={},isJobsDataLoading:y=!0,isClusterDataLoading:j=!0,isSSH:N=!1,isSlurm:b=!1,actionButton:v=null,contextWorkspaceMap:w={},contextErrors:S={},gpuMetricsRefreshTrigger:C=0,loadedContexts:_=new Set,isInitialLoad:k=!0,statusByKey:P=null}=e,U=n||[];if(r&&0===U.length)return(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:t}),v]}),(0,a.jsxs)("p",{className:"text-sm text-gray-500",children:["No ",t," found or ",t," is not configured."]})]})});if(k&&s&&!r&&0===U.length)return(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:t}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(l.Z,{size:24,className:"mr-3"}),(0,a.jsxs)("span",{className:"text-gray-500",children:["Loading ",t,"..."]})]})]})});let D=!k&&(s||!(b||N)&&U.length>0&&!U.every(e=>_.has(e)));return U.length>0?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:t}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[U.length," ",1===U.length?N?"pool":b?"cluster":"context":N?"pools":b?"clusters":"contexts"]})]}),v]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border shadow-sm bg-card ".concat(D?"infra-table-refreshing":""," ").concat(U.length>5?"max-h-[300px] overflow-y-auto":""),children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50 sticky top-0 z-10",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Name"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"Nodes"}),!b&&(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"CPU"}),!b&&(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/6",children:"Memory"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/6",children:"GPU Types"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/8",children:"GPUs"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600 w-12"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:U.map(e=>{var t;let r=c[e]||[],l=d[e]||[],n=r.reduce((e,t)=>e+(t.gpu_total||0),0),o=(0,p.G)(e,{isSSH:N,isSlurm:b}),v=u[o]||{clusters:0,jobs:0},C=b||N?!s:_.has(e),U=b||N?!s:_.has(e),D=0===r.length?null:Object.keys(r.reduce((e,t)=>{let s=(0,f.yh)(t.gpu_name);return e[s]=(e[s]||0)+(t.gpu_total||0),e},{})).join(", "),E=g(l,"cpu_count",!0),M=g(l,"memory_gb",!0),I=N?e.replace(/^ssh-/,""):e,F=N?"ssh":b?"slurm":"k8s",L=w[e]||[],H=L.length>1?" (workspaces: ".concat(L.join(", "),")"):"";return(0,a.jsxs)("tr",{className:"hover:bg-muted/50 ".concat(C||k?"":"infra-loading-row"),children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(A.j,{name:"infra.row.namePrefix",context:{id:I,kind:F,status:null==P?void 0:P.get("".concat(F,":").concat(I))}}),(0,a.jsx)(Z.Md,{content:"".concat(I).concat(H),className:"text-sm text-muted-foreground",children:(0,a.jsxs)("span",{className:"text-blue-600 hover:underline cursor-pointer",onClick:()=>m(e),children:[I.length>q?"".concat(I.substring(0,Math.floor((q-3)/2)),"...").concat(I.substring(I.length-Math.ceil((q-3)/2))):I,H&&(0,a.jsx)("span",{className:"text-xs text-gray-500 ml-1",children:H})]})}),S[e]&&!P&&(0,a.jsx)(Z.Md,{content:"Context unreachable: ".concat(S[e]),className:"text-sm text-muted-foreground",children:(0,a.jsx)(i.Z,{className:"w-4 h-4 text-yellow-500 flex-shrink-0"})})]})}),(0,a.jsx)("td",{className:"p-3",children:j?(0,a.jsx)(T,{}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:v.clusters})}),(0,a.jsx)("td",{className:"p-3",children:y?(0,a.jsx)(T,{}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:(null===(t=h[o])||void 0===t?void 0:t.jobs)||0})}),(0,a.jsx)("td",{className:"p-3",children:U?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:l.length}):(0,a.jsx)(T,{})}),!b&&(0,a.jsx)("td",{className:"p-3",children:U?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:x(E)}):(0,a.jsx)(T,{})}),!b&&(0,a.jsx)("td",{className:"p-3",children:U?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:null==M?"-":"".concat(Math.round(M)," GB")}):(0,a.jsx)(T,{})}),(0,a.jsx)("td",{className:"p-3",children:C?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:D||"-"}):(0,a.jsx)(T,{})}),(0,a.jsx)("td",{className:"p-3",children:C?(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:n}):(0,a.jsx)(T,{})}),(0,a.jsx)("td",{className:"p-3 text-right",children:(0,a.jsx)(A.j,{name:"infra.row.actions",context:{id:I,kind:F}})})]},e)})})]})})}),o&&o.length>0&&(0,a.jsx)("div",{children:(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border shadow-sm bg-card ".concat(D?"infra-table-refreshing":""," ").concat(o.length>5?"max-h-[300px] overflow-y-auto":""),children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50 sticky top-0 z-10",children:(0,a.jsxs)("tr",{children:[(0,a.jsxs)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4 whitespace-nowrap",children:["GPU",(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-green-100 text-green-800 rounded-full text-xs font-medium whitespace-nowrap",children:[o.reduce((e,t)=>e+t.gpu_free,0)," ","of"," ",o.reduce((e,t)=>e+t.gpu_total,0)," ","free"]})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/4",children:"Requestable"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-1/2",children:(0,a.jsx)("div",{className:"flex items-center",children:(0,a.jsx)("span",{children:"Utilization"})})})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:o.map(e=>{let t=c?Object.values(c).flat().filter(t=>{if((0,f.yh)(t.gpu_name)!==e.gpu_name)return!1;if(b)return!0;let s=t.context||t.cluster;return!!s&&(N?s.startsWith("ssh-"):!s.startsWith("ssh-"))}).map(e=>e.gpu_requestable_qty_per_node).filter((e,t,s)=>s.indexOf(e)===t).join(", "):"-";return(0,a.jsxs)("tr",{children:[(0,a.jsx)("td",{className:"p-3 font-medium w-24 whitespace-nowrap",children:(0,f.yh)(e.gpu_name)}),(0,a.jsxs)("td",{className:"p-3 text-xs text-gray-600",children:[t||"-"," / node"]}),(0,a.jsx)("td",{className:"p-3 w-2/3",children:(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsx)(z,{gpu:e,heightClass:"h-5",wrapperClassName:"flex-1 min-w-[100px] w-full"})})})]},e.gpu_name)})})]})})})]})]})}):null}function W(e){let{contextName:t,gpusInContext:s,nodesInContext:i,gpuMetricsRefreshTrigger:c=0,isSlurm:d=!1}=e,m=t.startsWith("ssh-"),[u,g]=(0,r.useState)([]),[p,y]=(0,r.useState)("$__all"),[j,N]=(0,r.useState)({from:"now-1h",to:"now"}),[b,v]=(0,r.useState)(!1),[w,S]=(0,r.useState)(!1);(0,r.useEffect)(()=>{(async()=>{S(await (0,h.TO)())})()},[]);let C=(0,r.useCallback)(async()=>{if(w){v(!0);try{let e=(0,h.ki)(),s="in-cluster"===t?"^$":t,a="query="+encodeURIComponent('group by (node) (DCGM_FI_DEV_GPU_TEMP{cluster=~"'.concat(s,'"} or label_replace(amd_gpu_gfx_activity{cluster=~"').concat(s,'"}, "node", "$1", "hostname", "(.*)"))')),r="/api/datasources/proxy/1/api/v1/query?".concat(a);try{let t=await fetch("".concat(e).concat(r),{method:"GET",credentials:"include",headers:{Accept:"application/json"}});if(t.ok){let e=await t.json();if(e.data&&e.data.result&&e.data.result.length>0){let t=e.data.result.map(e=>e.metric.node).filter(Boolean).sort();g(t),console.log("Successfully fetched hosts for cluster ".concat(s||"in-cluster",":"),t)}else console.log("No nodes found for this cluster"),g([])}else console.log("HTTP ".concat(t.status," from ").concat(r,": ").concat(t.statusText)),g([])}catch(e){console.log("Failed to fetch from ".concat(r,":"),e),g([])}}catch(e){console.error("Error fetching available hosts:",e),g([])}finally{v(!1)}}},[w,t]);(0,r.useEffect)(()=>{w&&i&&i.length>0&&C()},[i,w,C]);let _=e=>{let s=(0,h.ki)(),a="in-cluster"===t?"^$":t;return"".concat(s,"/d-solo/skypilot-dcgm-cluster-dashboard/skypilot-dcgm-kubernetes-cluster-dashboard?orgId=1&timezone=browser&var-datasource=prometheus&var-host=").concat(encodeURIComponent(p),"&var-gpu=$__all&var-cluster=").concat(encodeURIComponent(a),"&refresh=5s&theme=light&from=").concat(encodeURIComponent(j.from),"&to=").concat(encodeURIComponent(j.to),"&panelId=").concat(e,"&__feature.dashboardSceneSolo")},k=e=>{(0,D.JS)("time_range_change",{range:e}),N({"15m":{from:"now-15m",to:"now"},"1h":{from:"now-1h",to:"now"},"6h":{from:"now-6h",to:"now"},"24h":{from:"now-24h",to:"now"},"7d":{from:"now-7d",to:"now"}}[e])};return(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)(A.j,{name:"infra.contextDetail.statusPanel",context:{contextName:t,isSlurm:d}}),(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm h-full",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("div",{className:"flex items-center justify-between mb-4",children:(0,a.jsx)("h4",{className:"text-lg font-semibold",children:"Nodes"})}),s.length>0&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("h4",{className:"text-base font-semibold mb-3",children:"Available GPUs"}),(0,a.jsx)("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:s.map(e=>(0,a.jsxs)("div",{className:"p-3 bg-gray-50 rounded-md border border-gray-200 shadow-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between items-center mb-1.5 flex-wrap",children:[(0,a.jsxs)("div",{className:"font-medium text-gray-800 text-sm",children:[(0,f.yh)(e.gpu_name),(0,a.jsxs)("span",{className:"text-xs text-gray-500 ml-2",children:["(Requestable: ",e.gpu_requestable_qty_per_node," / node)"]})]}),(0,a.jsxs)("span",{className:"text-xs font-medium",children:[e.gpu_free," free / ",e.gpu_total," total"]})]}),(0,a.jsx)("div",{className:"w-full",children:(0,a.jsx)(z,{gpu:e,heightClass:"h-4",wrapperClassName:"w-full"})})]},e.gpu_name))})]}),0===i.length&&(0,a.jsx)("div",{className:"rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)(n.u,{icon:(0,a.jsx)(o.QT,{className:"w-5 h-5"}),title:"No nodes found",description:"No nodes are available in this context"})}),i.length>0&&(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border border-gray-200 shadow-sm",children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-100",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node"}),!d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"IP Address"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"vCPU"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Memory (GB)"})]}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"GPU Utilization"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600",children:"Node Status"})]})}),(0,a.jsx)("tbody",{className:"bg-white divide-y divide-gray-200",children:i.map((e,t)=>{let s="-";if(null!==e.cpu_count&&void 0!==e.cpu_count){let t=x(e.cpu_count);if(null!==e.cpu_free&&void 0!==e.cpu_free){let a=x(e.cpu_free);s="".concat(a," of ").concat(t," free")}else s=t}let r="-";if(null!==e.memory_gb&&void 0!==e.memory_gb){let t=e.memory_gb.toFixed(1);if(null!==e.memory_free_gb&&void 0!==e.memory_free_gb){let s=e.memory_free_gb.toFixed(1);r="".concat(s," of ").concat(t," free")}else r=t}let l="".concat(e.gpu_free," of ").concat(e.gpu_total," free"),n=[];!1===e.is_ready&&n.push("NotReady"),!0===e.is_cordoned&&n.push("Cordoned");let o=(e.taints||[]).filter(e=>e&&!0!==e.tolerated),i=null;if(o.length>0){let e={};for(let t of o){let s=t.effect,a=t.key;e[s]||(e[s]=[]),e[s].push(a)}let t=Object.entries(e).map(e=>{let[t,s]=e;return"".concat(t," Taint [").concat(s.join(", "),"]")});t.length>0&&(i=t.join(", "))}let c=n.length>0||i?n.join(", "):"Healthy",m=0===n.length&&!i;return(0,a.jsxs)("tr",{className:"hover:bg-gray-50",children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.node_name}),!d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:e.ip_address||"-"}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:s}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:r})]}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:(0,f.yh)(e.gpu_name)}),(0,a.jsx)("td",{className:"p-3 whitespace-nowrap text-gray-700",children:l}),(0,a.jsx)("td",{className:"p-3 max-w-xs",children:(0,a.jsxs)("div",{className:"flex flex-col gap-1.5",children:[c&&(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium w-fit ".concat(m?"bg-emerald-50 text-emerald-700 ring-1 ring-inset ring-emerald-600/20":"bg-amber-50 text-amber-700 ring-1 ring-inset ring-amber-600/20"),children:c}),i&&(0,a.jsx)("span",{className:"inline-flex items-center px-2.5 py-1 rounded-md text-xs font-medium w-fit bg-gray-50 text-gray-700 ring-1 ring-inset ring-gray-600/20",children:i})]})})]},"".concat(e.node_name,"-").concat(t))})})]})}),w&&s&&s.length>0&&!m&&!d&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("h4",{className:"text-lg font-semibold mb-4 mt-6",children:"GPU Metrics"}),(0,a.jsxs)("div",{className:"mb-4 p-4 bg-gray-50 rounded-md border border-gray-200",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center",children:[i&&i.length>0&&(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:"host-select",className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Node:"}),(0,a.jsxs)("select",{id:"host-select",value:p,onChange:e=>{y(e.target.value)},disabled:b,className:"px-3 py-1 border border-gray-300 rounded-md text-sm focus:outline-none focus:ring-2 focus:ring-sky-blue focus:border-transparent",children:[(0,a.jsx)("option",{value:"$__all",children:"All Nodes"}),u.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]}),b&&(0,a.jsx)("div",{className:"ml-2",children:(0,a.jsx)(l.Z,{size:16})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 whitespace-nowrap",children:"Time Range:"}),(0,a.jsx)("div",{className:"flex gap-1",children:[{label:"15m",value:"15m"},{label:"1h",value:"1h"},{label:"6h",value:"6h"},{label:"24h",value:"24h"},{label:"7d",value:"7d"}].map(e=>(0,a.jsx)("button",{onClick:()=>k(e.value),className:"px-2 py-1 text-xs font-medium rounded border transition-colors ".concat(j.from==="now-".concat(e.value)&&"now"===j.to?"bg-sky-blue text-white border-sky-blue":"bg-white text-gray-600 border-gray-300 hover:bg-gray-50"),children:e.label},e.value))})]})]}),(0,a.jsx)("div",{className:"mt-2 text-xs text-gray-500",children:i&&i.length>0?(0,a.jsxs)(a.Fragment,{children:["Showing:"," ","$__all"===p?"All nodes":p," ","• Time: ",j.from," to ",j.to,u.length>0&&(0,a.jsxs)("span",{children:[" ","• ",u.length," nodes available"]})]}):(0,a.jsxs)(a.Fragment,{children:["Cluster:"," ",m?t.replace(/^ssh-/,""):t," ","• Time: ",j.from," to ",j.to," • Showing metrics for all nodes in cluster"]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4",children:[(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("6"),width:"100%",height:"400",frameBorder:"0",title:"GPU Utilization",className:"rounded"},"gpu-util-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("18"),width:"100%",height:"400",frameBorder:"0",title:"GPU Memory",className:"rounded"},"gpu-memory-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("10"),width:"100%",height:"400",frameBorder:"0",title:"GPU Power Consumption",className:"rounded"},"gpu-power-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("12"),width:"100%",height:"400",frameBorder:"0",title:"GPU Temperature",className:"rounded"},"gpu-temp-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("22"),width:"100%",height:"400",frameBorder:"0",title:"CPU Utilization",className:"rounded"},"cpu-util-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})}),(0,a.jsx)("div",{className:"bg-white rounded-md border border-gray-200 shadow-sm",children:(0,a.jsx)("div",{className:"p-2",children:(0,a.jsx)("iframe",{src:_("21"),width:"100%",height:"400",frameBorder:"0",title:"Memory Utilization",className:"rounded"},"memory-util-".concat(p,"-").concat(j.from,"-").concat(j.to,"-").concat(c||0))})})]})]})]})})]})}function K(e){var t;let{poolName:s,gpusInContext:n,nodesInContext:o,handleDeploySSHPool:i,handleEditSSHPool:m,handleDeleteSSHPool:u,poolConfig:h}=e,[x,g]=(0,r.useState)(null),[p,f]=(0,r.useState)(!0),[y,j]=(0,r.useState)({isOpen:!1,action:null,loading:!1}),[N,b]=(0,r.useState)({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});(0,r.useEffect)(()=>{(async()=>{try{f(!0);let e=await (0,v.IS)(s);g(e)}catch(e){console.error("Failed to fetch SSH Node Pool status:",e),g({pool_name:s,status:"Error",reason:"Failed to fetch status"})}finally{f(!1)}})()},[s]);let{deployDisabled:C}=(()=>{if(!x)return{deployDisabled:!0};let e=x.status;return"Ready"===e?{deployDisabled:!0}:"Error"===e?{deployDisabled:!0}:{deployDisabled:!1}})(),_=async()=>{j({...y,loading:!0});try{if("deploy"===y.action){j({isOpen:!1,action:null,loading:!1}),b({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await i(s)).request_id;b(t=>({...t,requestId:e}));let t=new AbortController;await (0,v.wJ)({requestId:e,signal:t.signal,onNewLog:e=>{b(t=>({...t,logs:t.logs+e}))}}),b(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0})),setTimeout(async()=>{(async()=>{try{let e=await (0,v.IS)(s);g(e)}catch(e){console.error("Failed to fetch SSH Node Pool status after deployment:",e)}})()},1e3)}catch(e){console.error("Deployment failed:",e),b(t=>({...t,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:t.logs+"\nDeployment failed: ".concat(e.message)}))}}else if("delete"===y.action){j({isOpen:!1,action:null,loading:!1}),b({isOpen:!0,logs:"",isStreaming:!0,deploymentComplete:!1,deploymentSuccess:!1,requestId:null});try{let e=(await (0,v.ez)(s)).request_id;b(t=>({...t,requestId:e})),e&&await (0,v.mF)({requestId:e,signal:null,onNewLog:e=>{b(t=>({...t,logs:t.logs+e}))},operationType:"down"}),await u(s),b(e=>({...e,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!0,logs:e.logs+"\nSSH Node Pool teardown completed successfully."}))}catch(e){console.error("Down operation failed:",e),b(t=>({...t,isStreaming:!1,deploymentComplete:!0,deploymentSuccess:!1,logs:t.logs+"\nTeardown failed: ".concat(e.message)}))}}}catch(e){console.error("Action failed:",e),j({...y,loading:!1})}},k=()=>{j({isOpen:!1,action:null,loading:!1})},P=()=>{b({isOpen:!1,logs:"",isStreaming:!1,deploymentComplete:!1,deploymentSuccess:!1,requestId:null}),N.deploymentComplete&&setTimeout(()=>{(async()=>{try{let e=await (0,v.IS)(s);g(e)}catch(e){console.error("Failed to refresh status:",e)}})()},1e3)},U="deploy"===y.action?{title:"Deploy SSH Node Pool",description:'Are you sure you want to deploy SSH Node Pool "'.concat(s,'"?'),details:["• Set up SkyPilot runtime on the configured SSH hosts","• Install required components and dependencies","• Make the node pool available for workloads","","This process may take a few minutes to complete."]}:{title:"Delete SSH Node Pool",description:'Are you sure you want to delete SSH Node Pool "'.concat(s,'"?'),details:["• Clean up any deployed resources","• Remove the SSH Node Pool configuration"]};return(0,a.jsxs)("div",{children:[(0,a.jsx)(A.j,{name:"infra.sshDetail.statusPanel",context:{poolName:s}}),(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-4 pt-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"SSH Node Pool Details"}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border rounded flex items-center ".concat(C?"border-gray-300 bg-gray-100 text-gray-400 cursor-not-allowed":"border-green-300 bg-green-50 text-green-700 hover:bg-green-100"),onClick:C?void 0:()=>{j({isOpen:!0,action:"deploy",loading:!1})},disabled:C,children:[(0,a.jsx)(c.Z,{className:"w-4 h-4 mr-2"}),"Deploy"]}),(0,a.jsxs)("button",{className:"px-3 py-1 text-sm border border-gray-300 rounded hover:bg-gray-50 flex items-center text-red-600 hover:text-red-700",onClick:()=>{j({isOpen:!0,action:"delete",loading:!1})},children:[(0,a.jsx)(d.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})]})]}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Pool Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:s})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Nodes"}),(0,a.jsx)("div",{className:"text-base mt-1",children:o?o.length:0})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Status"}),(0,a.jsx)("div",{className:"text-base mt-1",children:p?(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."})]}):x?(0,a.jsx)(e=>{let{status:t,reason:s}=e,r="Ready"===t,l="Not Ready"===t?"Click Deploy to set up this node pool":s;return(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)("span",{className:"px-2 py-0.5 rounded text-xs font-medium ".concat(r?"bg-green-100":"bg-red-100"," ").concat(r?"text-green-800":"text-red-800"),children:t}),!r&&l&&(0,a.jsxs)("span",{className:"text-sm text-gray-600",children:["(",l,")"]})]})},{status:x.status,reason:x.reason}):(0,a.jsx)("span",{className:"text-gray-500",children:"Unknown"})})]})]})})]})}),(0,a.jsx)(W,{contextName:"ssh-".concat(s),gpusInContext:n,nodesInContext:o}),(0,a.jsx)(w.Vq,{open:y.isOpen,onOpenChange:k,children:(0,a.jsxs)(w.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(w.fK,{className:"",children:[(0,a.jsx)(w.$N,{className:"",children:U.title}),(0,a.jsx)(w.Be,{className:"",children:U.description})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"text-sm text-gray-600 space-y-1",children:[(0,a.jsx)("p",{className:"font-medium mb-2",children:"This will:"}),U.details.map((e,t)=>(0,a.jsx)("p",{className:""===e?"pt-2":"",children:e},t))]})}),(0,a.jsxs)(w.cN,{className:"",children:[(0,a.jsx)(S.z,{variant:"outline",onClick:k,disabled:y.loading,className:"",children:"Cancel"}),(0,a.jsx)(S.z,{onClick:_,disabled:y.loading,className:"deploy"===y.action?"bg-green-600 hover:bg-green-700 text-white":"bg-red-600 hover:bg-red-700 text-white",children:y.loading?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"deploy"===y.action?"Deploying...":"Deleting..."]}):"deploy"===y.action?"Deploy":"Delete"})]})]})}),(0,a.jsx)(w.Vq,{open:N.isOpen,onOpenChange:N.isStreaming?void 0:P,children:(0,a.jsxs)(w.cZ,{className:"sm:max-w-4xl max-h-[80vh]",children:[(0,a.jsxs)(w.fK,{className:"",children:[(0,a.jsxs)(w.$N,{className:"",children:["Deploying SSH Node Pool: ",s]}),(0,a.jsx)(w.Be,{className:"",children:N.isStreaming?"Deployment in progress. Do not close this dialog.":N.deploymentSuccess?"Deployment completed successfully!":"Deployment completed with errors."})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"bg-black text-green-400 p-4 rounded-md font-mono text-sm max-h-96 overflow-y-auto",children:[(0,a.jsx)("pre",{className:"whitespace-pre-wrap",children:(t=N.logs)?t.split("\n").map(e=>(e=e.replace(/\x1b\[[0-9;]*m/g,"")).match(/^D \d{2}-\d{2} \d{2}:\d{2}:\d{2}/)?null:e=(e=e.replace(/├──/g,"├─")).replace(/└──/g,"└─")).filter(e=>null!==e&&""!==e.trim()).join("\n"):""}),N.isStreaming&&(0,a.jsxs)("div",{className:"flex items-center mt-2",children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2 text-green-400"}),(0,a.jsx)("span",{className:"text-green-400",children:"Streaming logs..."})]})]})}),(0,a.jsx)(w.cN,{className:"",children:(0,a.jsx)(S.z,{onClick:P,disabled:N.isStreaming,className:N.deploymentSuccess?"bg-green-600 hover:bg-green-700 text-white":N.deploymentComplete&&!N.deploymentSuccess?"bg-red-600 hover:bg-red-700 text-white":"bg-gray-600 hover:bg-gray-700 text-white",children:N.isStreaming?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"Deploying..."]}):"Close"})})]})})]})}function J(){return(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsx)("div",{className:"p-5",children:(0,a.jsx)("div",{className:"flex items-start",children:(0,a.jsxs)("div",{className:"ml-3 flex-1",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-gray-900 mb-2",children:"No Infrastructure Enabled"}),(0,a.jsx)("p",{className:"text-sm text-gray-600 mb-4",children:"No cloud providers, Kubernetes contexts, SSH node pools, or Slurm clusters are currently enabled or configured."}),(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsx)("p",{className:"text-sm text-gray-600",children:"To check enabled infrastructures, you can:"}),(0,a.jsxs)("ul",{className:"list-disc list-inside text-sm text-gray-600 space-y-1 ml-2",children:[(0,a.jsxs)("li",{children:["Click ",(0,a.jsx)("strong",{children:'"Refresh"'}),"."]}),(0,a.jsxs)("li",{children:["Run"," ",(0,a.jsx)("code",{className:"bg-gray-100 px-1.5 py-0.5 rounded",children:"sky check"})," ","in your CLI."]})]})]})]})})})})}function V(){let e=(0,R.fp)(),t=r.useMemo(()=>e.filter(e=>{var t;return null===(t=e.hooks)||void 0===t?void 0:t.useExtraInfraRows}),[e]),[s,n]=(0,r.useState)({}),o=r.useCallback((e,t)=>{n(s=>s[e]===t?s:{...s,[e]:t})},[]),i=t.length>0,c=r.useMemo(()=>Object.values(s),[s]),d=r.useMemo(()=>c.flatMap(e=>{var t;return null!==(t=null==e?void 0:e.rows)&&void 0!==t?t:[]}),[c]),h=r.useMemo(()=>{let e=new Map;for(let t of c)if(null==t?void 0:t.statusByKey)for(let[s,a]of t.statusByKey)e.set(s,a);return e},[c]),x=i&&(c.lengthnull==e?void 0:e.loading)),g=r.useCallback(()=>Promise.all(c.map(e=>{var t;return null==e?void 0:null===(t=e.refresh)||void 0===t?void 0:t.call(e,!0)}).filter(Boolean)),[c]),[p,w]=(0,r.useState)(!0),[S,C]=(0,r.useState)(!0),[_,k]=(0,r.useState)(!0),M=r.useRef(null),F=(0,u.X)(),[q,z]=(0,r.useState)(!1),[V,Q]=(0,r.useState)(!1),X=(0,I.useRouter)(),[Y,ee]=(0,r.useState)([]),[et,es]=(0,r.useState)([]),[ea,er]=(0,r.useState)([]),[el,en]=(0,r.useState)([]),[eo,ei]=(0,r.useState)(new Set),[ec,ed]=(0,r.useState)([]),[em,eu]=(0,r.useState)([]),[eh,ex]=(0,r.useState)([]),[eg,ep]=(0,r.useState)([]),[ef,ey]=(0,r.useState)(0),[ej,eN]=(0,r.useState)({}),[eb,ev]=(0,r.useState)({}),[ew,eS]=(0,r.useState)({}),[eC,e_]=(0,r.useState)({}),[ek,eP]=(0,r.useState)({}),[eU,eD]=(0,r.useState)({}),[eE,eM]=(0,r.useState)("all"),[eI,eF]=(0,r.useState)([]),[eL,eA]=(0,r.useState)({}),[eH,eR]=(0,r.useState)(!1),[eZ,eO]=(0,r.useState)(null),[eG,eq]=(0,r.useState)(!1),[ez,eT]=(0,r.useState)(!0),[eB,eW]=(0,r.useState)(!1),[eK,eJ]=(0,r.useState)(!0),[eV,e$]=(0,r.useState)({}),[eQ,eX]=(0,r.useState)(!0),[eY,e0]=(0,r.useState)(null),[e1,e2]=(0,r.useState)(0),e5=r.useRef(!0),[e3,e6]=(0,r.useState)(!1),e4=r.useRef(0),e7=r.useRef(!1),[e8,e9]=(0,r.useState)(null),te=r.useCallback(async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showLoadingIndicators:!0},{showLoadingIndicators:t=!0,forceRefresh:s=!1}=e;e6(!0),e7.current=!1,t&&(w(!0),C(!0),eq(!0),eT(!0),eJ(!0),eX(!0));try{let e=s?(0,j.LD)().catch(e=>{console.error("Error during sky check refresh:",e)}):Promise.resolve();await Promise.all([e,tt(s,t),tn(s),tl(s),ts(),ta(),tr()]),e7.current=!0,0===e4.current&&e6(!1)}catch(e){console.error("Error in fetchData:",e),eD({}),ee([]),es([]),er([]),en([]),eS({}),e_({}),eP({}),eF([]),z(!0),w(!1),eX(!1),ep([]),ey(0),eN({}),ev({}),Q(!0),eA({}),eq(!1),eT(!1),ed([]),eu([]),ex([]),e$({}),eJ(!1),e7.current=!0,0===e4.current&&e6(!1)}finally{t&&(w(!1),C(!1),eq(!1),eT(!1),eJ(!1),eX(!1)),_&&t&&k(!1)}},[_]),tt=async function(e){let t=!(arguments.length>1)||void 0===arguments[1]||arguments[1];try{let s=e?await (0,y.CI)():await U.ZP.get(y.CI);if(!s){eD({}),ee([]),es([]),er([]),en([]),e_({}),eP({}),eF([]),z(!0),w(!1);return}let{workspaces:a,allContextNames:r,contextWorkspaceMap:l}=s;eD(a||{}),ee(r||[]),e_(l||{});let n=Object.keys(a||{});eF(n.sort()),z(!0),w(!1);let o=(r||[]).filter(e=>e&&"string"==typeof e);if(0===o.length){t&&(es([]),er([]),en([]),eP({}),ei(new Set));return}t&&(ei(new Set),eP({})),e4.current=o.length,o.forEach(t=>{(e?(0,y.UU)(t):U.ZP.get(y.UU,[t])).then(e=>{ei(e=>new Set([...e,t])),er(s=>[...s.filter(e=>e.context!==t),...e.perContextGPUs]),en(s=>[...s.filter(e=>e.context!==t),...e.perNodeGPUs]),e.error&&eP(s=>({...s,[t]:e.error}))}).catch(e=>{ei(e=>new Set([...e,t])),eP(s=>({...s,[t]:e.message||"Failed to load GPU data"}))}).finally(()=>{e4.current--,0===e4.current&&e7.current&&e6(!1)})})}catch(e){console.error("Error in fetchKubernetesData:",e),eD({}),ee([]),es([]),er([]),en([]),e_({}),eP({}),eF([]),z(!0),w(!1)}},ts=async()=>{try{let e=await U.ZP.get(b.getManagedJobs,[{allUsers:!0,skipFinished:!0}]),t=(null==e?void 0:e.jobs)||[];e$(await (0,y.R8)(t));let s={};t.forEach(e=>{e.cloud&&(s[e.cloud]=(s[e.cloud]||0)+1)}),ev(s),eJ(!1)}catch(e){console.error("Error in fetchManagedJobsData:",e),e$({}),ev({}),eJ(!1)}},ta=async()=>{try{let e=await U.ZP.get(N.getClusters)||[],t=await (0,y.F5)(e);eS(t);let s={};e.forEach(e=>{e.cloud&&(s[e.cloud]=(s[e.cloud]||0)+1)}),eN(s),eX(!1)}catch(e){console.error("Error in fetchClusterStatsData:",e),eS({}),eN({}),eX(!1)}},tr=async()=>{try{let e=await U.ZP.get(y.Ve);e&&(ed(e.allSlurmGPUs||[]),eu(e.perClusterSlurmGPUs||[]),ex(e.perNodeSlurmGPUs||[])),eW(!0),eT(!1)}catch(e){console.error("Error in fetchSlurmData:",e),ed([]),eu([]),ex([]),eW(!0),eT(!1)}},tl=async e=>{try{let t=e?await (0,y.oD)():await U.ZP.get(y.oD);t?(ep(t.clouds||[]),ey(t.totalClouds||0),Q(!0)):null===t&&(ep([]),ey(0),Q(!0)),C(!1)}catch(e){console.error("Error in fetchCloudData:",e),ep([]),ey(0),Q(!0),C(!1)}},tn=async e=>{try{let t=e?await (0,v.It)():await U.ZP.get(v.It);eA(t),eq(!1)}catch(e){console.error("Failed to fetch SSH Node Pools:",e),eA({}),eq(!1)}},to=(e,t)=>{eO({name:e,config:t}),eR(!0)},ti=async e=>{try{await (0,v.MV)(e),await tn(),e9(null),X.push("/infra")}catch(e){throw console.error("Failed to delete SSH Node Pool:",e),e}},tc=async e=>{try{await (0,v._x)(e)}catch(e){throw console.error("Failed to deploy SSH Node Pool:",e),e}},td=async(e,t)=>{eq(!0);try{let s={...eL};s[e]=t,await (0,v.Ri)(s),await tn(),eR(!1)}catch(e){console.error("Failed to save SSH Node Pool:",e),alert("Failed to save SSH Node Pool. Please try again.")}finally{eq(!1)}};(0,r.useEffect)(()=>{M.current=te},[te]),(0,r.useEffect)(()=>{let e={};ea.forEach(t=>{let s=(0,f.yh)(t.gpu_name);s in e?(e[s].gpu_total+=t.gpu_total||0,e[s].gpu_free+=t.gpu_free||0,e[s].gpu_not_ready+=t.gpu_not_ready||0):e[s]={gpu_name:s,gpu_total:t.gpu_total||0,gpu_free:t.gpu_free||0,gpu_not_ready:t.gpu_not_ready||0}}),es(Object.values(e))},[ea]),(0,r.useEffect)(()=>{(async()=>{await E.ZP.preloadForPage("infra"),await te({showLoadingIndicators:!0})})()},[]),(0,r.useEffect)(()=>{let e=!0,t=setInterval(()=>{e&&M.current&&"visible"===window.document.visibilityState&&M.current({showLoadingIndicators:!1})},G);return()=>{e=!1,clearInterval(t)}},[]),(0,r.useEffect)(()=>()=>{z(!1),Q(!1),eq(!1),eT(!1),eW(!1),k(!0),eJ(!1),eX(!1)},[]);let tm=r.useCallback(async()=>{(0,D.JS)("refresh"),U.ZP.invalidate(N.getClusters),U.ZP.invalidate(b.getManagedJobs,[{allUsers:!0,skipFinished:!0}]),U.ZP.invalidate(y.CI),U.ZP.invalidate(y.Xg),U.ZP.invalidate(y.oD),U.ZP.invalidateFunction(j.getEnabledCloudsBatch),U.ZP.invalidate(y.ef,[!1]),U.ZP.invalidate(v.It),U.ZP.invalidate(y.Ve),e2(e=>e+1),await Promise.all([M.current?M.current({showLoadingIndicators:!0,forceRefresh:!0}):Promise.resolve(),g()])},[g]);(0,r.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"r"===e.key&&(e.preventDefault(),tm())};return window.addEventListener("keydown",e),()=>{window.removeEventListener("keydown",e)}},[tm]),(0,r.useEffect)(()=>{let e=()=>tm();return window.addEventListener("skydashboard:infra:refresh",e),()=>{window.removeEventListener("skydashboard:infra:refresh",e)}},[tm]),(et||[]).length,(et||[]).reduce((e,t)=>e+t.gpu_total,0),(et||[]).reduce((e,t)=>e+t.gpu_free,0);let tu=r.useMemo(()=>ea?ea.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[ea]),th=r.useCallback(e=>"all"===eE?e:e.filter(e=>(eC[e]||[]).includes(eE)),[eE,eC]),tx=r.useMemo(()=>{if(p&&0===Object.keys(eU).length)return null;if("all"===eE){let e=new Set;return Object.values(eU).forEach(t=>{t.clouds&&Array.isArray(t.clouds)&&t.clouds.forEach(t=>{let s=t.toLowerCase().split("/")[0];e.add(s)})}),Array.from(e)}{let e=eU[eE];if(!e||!e.clouds||!Array.isArray(e.clouds))return[];let t=new Set;return e.clouds.forEach(e=>{let s=e.toLowerCase().split("/")[0];t.add(s)}),Array.from(t)}},[eE,eU,p]),tg=r.useMemo(()=>{let e=eg&&0!==eg.length?null===tx?eg:eg.filter(e=>tx.includes(e.name.toLowerCase())):[],t=new Set(e.map(e=>(e.id||e.name||"").toLowerCase()));return[...e,...d.filter(e=>"cloud"===e.kind).filter(e=>!t.has((e.id||"").toLowerCase())).map(e=>({id:e.id,name:e.name||e.id,clusters:0,jobs:0,storageOnly:!0===e.storageOnly}))]},[eg,tx,d]),tp=r.useMemo(()=>tg.length,[tg]),tf=r.useMemo(()=>Y&&Array.isArray(Y)?th(Y.filter(e=>e.startsWith("ssh-"))):[],[Y,th]),ty=r.useMemo(()=>Y&&Array.isArray(Y)?th(Y.filter(e=>!e.startsWith("ssh-"))):[],[Y,th]),tj=r.useMemo(()=>{if(!ea||!et)return[];let e=new Set;return ea.forEach(t=>{t.context.startsWith("ssh-")&&e.add((0,f.yh)(t.gpu_name))}),et.filter(t=>e.has(t.gpu_name))},[et,ea]),tN=r.useMemo(()=>{if(!ea||!et)return[];let e=new Set;return ea.forEach(t=>{t.context.startsWith("ssh-")||e.add((0,f.yh)(t.gpu_name))}),et.filter(t=>e.has(t.gpu_name))},[et,ea]),tb=r.useMemo(()=>em&&Array.isArray(em)?[...new Set(em.map(e=>e.cluster))].sort():[],[em]),tv=r.useMemo(()=>em?em.reduce((e,t)=>{let{cluster:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[em]),tw=r.useMemo(()=>eh?eh.reduce((e,t)=>{let{cluster:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[eh]),tS=r.useMemo(()=>el?el.reduce((e,t)=>{let{context:s}=t;return e[s]||(e[s]=[]),e[s].push(t),e},{}):{},[el]),tC=(()=>{if(!V||!q||!eB||p||S||ez||x)return!1;let e=0===tp,t=0===tf.length,s=0===ty.length,a=0===tb.length;return e&&t&&s&&a})();(0,r.useEffect)(()=>{X.isReady&&X.query.context&&e9(decodeURIComponent(Array.isArray(X.query.context)?X.query.context.join("/"):X.query.context))},[X.isReady,X.query.context]);let t_=e=>{(0,D.JS)("view_context");let t="/infra/".concat(encodeURIComponent(e));X.asPath!==t&&X.push(t)},tk=e=>{let t=tb.includes(e),s=t?tv[e]||[]:tu[e]||[],r=t?tw[e]||[]:tS[e]||[];if(e.startsWith("ssh-")){let t=e.replace(/^ssh-/,"");return(0,a.jsx)(K,{poolName:t,gpusInContext:s,nodesInContext:r,handleDeploySSHPool:tc,handleEditSSHPool:to,handleDeleteSSHPool:ti,poolConfig:eL[t]})}return(0,a.jsx)(W,{contextName:e,gpusInContext:s,nodesInContext:r,gpuMetricsRefreshTrigger:e1,isSlurm:t})},tP=(0,R.dL)("infra.cloudRow.link").length>0,tU=()=>_&&S&&(!eg||0===eg.length)?(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold mb-4",children:"Cloud"}),(0,a.jsxs)("div",{className:"flex items-center justify-center py-6",children:[(0,a.jsx)(l.Z,{size:24,className:"mr-3"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading Cloud..."})]})]})}):(0,a.jsx)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm mb-6",children:(0,a.jsxs)("div",{className:"p-5",children:[(0,a.jsxs)("div",{className:"flex items-center mb-4",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Cloud"}),(0,a.jsxs)("span",{className:"ml-2 px-2 py-0.5 bg-blue-100 text-blue-800 rounded-full text-xs font-medium",children:[tp," of ",ef," enabled"]})]}),tg&&0!==tg.length?(0,a.jsx)("div",{className:"overflow-x-auto rounded-md border shadow-sm bg-card ".concat(!_&&(eQ||eK)?"infra-table-refreshing":""),children:(0,a.jsxs)("table",{className:"min-w-full text-sm",children:[(0,a.jsx)("thead",{className:"bg-gray-50",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-32",children:"Cloud"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Clusters"}),(0,a.jsx)("th",{className:"p-3 text-left font-medium text-gray-600 w-24",children:"Jobs"}),(0,a.jsx)("th",{className:"p-3 text-right font-medium text-gray-600 w-12"})]})}),(0,a.jsx)("tbody",{className:"bg-card divide-y divide-gray-200",children:tg.map(e=>{var t,s;let r=null!==(t=ej[e.name])&&void 0!==t?t:e.clusters,l=null!==(s=eb[e.name])&&void 0!==s?s:e.jobs,n=(e.id||e.name||"").toLowerCase(),o=(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("td",{className:"p-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(A.j,{name:"infra.row.namePrefix",context:{id:n,kind:"cloud",status:null==h?void 0:h.get("cloud:".concat(n))}}),(0,a.jsx)("span",{className:tP?"text-blue-600 hover:underline cursor-pointer font-medium":"font-medium text-gray-700",children:e.name})]})}),(0,a.jsx)("td",{className:"p-3",children:e.storageOnly?(0,a.jsx)(Z.Md,{content:"Storage-only infrastructure does not run clusters",children:(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-gray-400 text-xs font-medium cursor-help",children:"—"})}):eQ?(0,a.jsx)(T,{}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:null!=r?r:0})}),(0,a.jsx)("td",{className:"p-3",children:e.storageOnly?(0,a.jsx)(Z.Md,{content:"Storage-only infrastructure does not run managed jobs",children:(0,a.jsx)("span",{className:"px-1.5 py-0.5 text-gray-400 text-xs font-medium cursor-help",children:"—"})}):eK?(0,a.jsx)(T,{}):(0,a.jsx)("span",{className:"px-2 py-0.5 bg-gray-100 text-gray-500 rounded text-xs font-medium",children:null!=l?l:0})}),(0,a.jsx)("td",{className:"p-3 text-right",children:(0,a.jsx)(A.j,{name:"infra.row.actions",context:{id:n,kind:"cloud"}})})]});return(0,a.jsx)(H.l,{name:"infra.cloudRow.link",context:{id:n},children:(0,a.jsx)("tr",{className:"hover:bg-muted/50",children:o})},e.name)})})]})}):S&&!V||i&&x?(0,a.jsxs)("div",{className:"flex items-center py-2 text-sm text-gray-500",children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"Loading..."]}):(0,a.jsx)("p",{className:"text-sm text-gray-500",children:"all"===eE?"No enabled clouds available.":'No enabled clouds for workspace "'.concat(eE,'".')})]})}),tD=()=>(0,a.jsx)(B,{title:"SSH Node Pool",isLoading:p,isDataLoaded:q,contexts:tf,gpus:tj,groupedPerContextGPUs:tu,groupedPerNodeGPUs:tS,handleContextClick:t_,contextStats:ew,jobsData:eV,isJobsDataLoading:eK,isClusterDataLoading:eQ,isSSH:!0,contextWorkspaceMap:eC,contextErrors:ek,gpuMetricsRefreshTrigger:e1,loadedContexts:eo,isInitialLoad:_,statusByKey:h,actionButton:null}),tE=()=>(0,a.jsx)(B,{title:"Kubernetes",isLoading:p,isDataLoaded:q,contexts:ty,gpus:tN,groupedPerContextGPUs:tu,groupedPerNodeGPUs:tS,handleContextClick:t_,contextStats:ew,jobsData:eV,isJobsDataLoading:eK,isClusterDataLoading:eQ,isSSH:!1,contextWorkspaceMap:eC,contextErrors:ek,gpuMetricsRefreshTrigger:e1,loadedContexts:eo,isInitialLoad:_,statusByKey:h}),tM=()=>(0,a.jsx)(B,{title:"Slurm",isLoading:ez,isDataLoaded:eB,contexts:tb,gpus:ec,groupedPerContextGPUs:tv,groupedPerNodeGPUs:tw,handleContextClick:t_,contextStats:ew,jobsData:eV,isJobsDataLoading:eK,isClusterDataLoading:eQ,isSSH:!1,isSlurm:!0,contextWorkspaceMap:{},isInitialLoad:_,statusByKey:h}),tI=Y.length>0&&eo.size{e5.current&&!tF&&e0(new Date),e5.current=tF},[tF]),(0,a.jsxs)(a.Fragment,{children:[t.map(e=>(0,a.jsx)($,{providerId:e.id,useHook:e.hooks.useExtraInfraRows,onResult:o},e.id)),e8&&(0,a.jsx)("div",{className:"mb-2",children:(0,a.jsx)(L(),{href:"/infra",className:"inline-flex items-center gap-1 text-sm text-gray-500 hover:text-gray-700 cursor-pointer",children:"← Infrastructure"})}),!e8&&(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4 h-5",children:[(0,a.jsx)("div",{className:"text-base flex items-center",children:(0,a.jsx)(L(),{href:"/infra",className:"text-sky-blue cursor-default",children:"Infrastructure"})}),(0,a.jsxs)("div",{className:"flex items-center",children:[eI.length>0&&(0,a.jsxs)("div",{className:"flex items-center mr-4",children:[(0,a.jsx)("label",{className:"text-sm font-medium text-gray-700 mr-2",children:"Workspace:"}),(0,a.jsxs)(O.Ph,{value:eE,onValueChange:eM,children:[(0,a.jsx)(O.i4,{className:"w-40 h-8 text-sm",children:(0,a.jsx)(O.ki,{})}),(0,a.jsxs)(O.Bw,{children:[(0,a.jsx)(O.Ql,{value:"all",children:"All Workspaces"}),eI.map(e=>(0,a.jsx)(O.Ql,{value:e,children:e},e))]})]})]}),tF&&(0,a.jsxs)("div",{className:"flex items-center mr-2",children:[(0,a.jsx)(l.Z,{size:15,className:"mt-0"}),(0,a.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}),!tF&&eY&&(0,a.jsx)(Z.$3,{timestamp:eY,className:"mr-2"}),(0,a.jsxs)("button",{onClick:tm,disabled:tF,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(m.Z,{className:"h-4 w-4 mr-1.5"}),!F&&"Refresh"]}),(0,a.jsx)(A.j,{name:"infra.headerActions",wrapperClassName:"ml-3"})]})]}),(0,a.jsx)(A.j,{name:"infra.attentionBanner"}),e8&&(0,a.jsxs)("div",{className:"flex items-center justify-between gap-3 mb-5",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-gray-900 leading-tight tracking-tight ".concat(e8.startsWith("ssh-")||tb.includes(e8)?"":"font-mono"),children:e8.startsWith("ssh-")?e8.replace(/^ssh-/,""):e8}),(0,a.jsx)(A.j,{name:"infra.contextDetail.headerActions",context:{contextName:e8.startsWith("ssh-")?e8.replace(/^ssh-/,""):e8,isSlurm:tb.includes(e8),isSsh:e8.startsWith("ssh-")},wrapperClassName:"flex items-center gap-2"})]}),(()=>{if(e8)return tk(e8);let e=[];if(tC)e.push({name:"Infrastructure Hint",render:()=>(0,a.jsx)(A.j,{name:"infra.emptyState",fallback:(0,a.jsx)(J,{})}),hasActivity:!1,priority:0});else{let t=ty.length>0;e.push({name:"Kubernetes",render:tE,hasActivity:t,priority:1});let s=tb.length>0;e.push({name:"Slurm",render:tM,hasActivity:s,priority:2}),e.push({name:"Cloud",render:tU,hasActivity:tp>0,priority:3});let a=tf.length>0;e.push({name:"SSH Node Pool",render:tD,hasActivity:a,priority:4})}let t=e.sort((e,t)=>e.hasActivity!==t.hasActivity?e.hasActivity?-1:1:e.priority-t.priority);return(0,a.jsx)(a.Fragment,{children:t.map((e,t)=>(0,a.jsx)(r.Fragment,{children:e.render()},t))})})(),(0,a.jsx)(P,{isOpen:eH,onClose:()=>eR(!1),onSave:td,poolData:eZ,isLoading:eG})]})}function $(e){let{providerId:t,useHook:s,onResult:a}=e,l=s();return r.useEffect(()=>{a(t,l)},[t,l,a]),null}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/542-a506bfa12fc1edfb.js b/sky/dashboard/out/_next/static/chunks/542-a506bfa12fc1edfb.js new file mode 100644 index 000000000..fe52bdcf0 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/542-a506bfa12fc1edfb.js @@ -0,0 +1,31 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[542],{3359:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},8507:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},6021:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]])},8586:function(e,t,r){r.d(t,{Z:function(){return s}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,r(998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},9071:function(e,t,r){r.d(t,{Hn:function(){return C},Du:function(){return S},Ap:function(){return M}});var s=r(5893),a=r(7294),n=r(5675),l=r.n(n),c=r(1163),i=r(1664),o=r.n(i),d=r(3850),h=r(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let x=(0,h.Z)("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);var m=r(3359);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let u=(0,h.Z)("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"}]]),p=(0,h.Z)("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"}]]);var f=r(6021),g=r(3225),b=r(470),j=r(3001),y=r(1623),v=r(3800),N=r(5988);let k={key:d._m,shield:d.b7,server:d.QT,briefcase:d.Vp,chip:d.PC,book:d.E9,users:d.oy,volume:d.eU,clock:x,filecode:m.Z,repeat:d.ny,piechart:d.ng,activity:u},w=(0,a.createContext)(null);function C(e){let{children:t}=e,[r,n]=(0,a.useState)(!0),[l,c]=(0,a.useState)(!1),[i,o]=(0,a.useState)(null),[d,h]=(0,a.useState)(null),[x,m]=(0,a.useState)(!1),u=window.location.origin,p="".concat(u).concat(g.f4);return(0,a.useEffect)(()=>{fetch("".concat(p,"/api/health")).then(e=>e.json()).then(e=>{m(!!e.restrict_config_to_admins),e.user&&e.user.name?(o(e.user.name),(async()=>{try{let e=await fetch("".concat(p,"/users/role"));if(e.ok){let t=await e.json();h(t.role||"user")}else h("user")}catch(e){console.log("Could not fetch user role:",e),h("user")}})()):h("user")}).catch(e=>{console.error("Error fetching user data:",e),h("user")})},[p]),(0,s.jsx)(w.Provider,{value:{isSidebarOpen:r,toggleSidebar:()=>{n(e=>!e)},isMobileSidebarOpen:l,toggleMobileSidebar:()=>{c(e=>!e)},userEmail:i,userRole:d,restrictConfigToAdmins:x},children:t})}function M(){let e=(0,a.useContext)(w);if(!e)throw Error("useSidebar must be used within a SidebarProvider");return e}function S(){let e,t;let r=(0,c.useRouter)(),n=(0,j.X)(),{userEmail:i,userRole:h,restrictConfigToAdmins:x,isMobileSidebarOpen:u,toggleMobileSidebar:w}=M(),C="admin"===h||"user"===h&&!x,[S,E]=(0,a.useState)(!1),[Z,_]=(0,a.useState)(null),{ungrouped:z,groups:H}=(0,v.d7)(),W=(0,v.x1)(),U=(0,a.useRef)(null),L=(0,a.useRef)(null),V=(0,a.useRef)(null);(0,a.useEffect)(()=>{function e(e){U.current&&!U.current.contains(e.target)&&E(!1),L.current&&!L.current.contains(e.target)&&!e.target.closest(".mobile-menu-button")&&u&&w(),V.current&&!V.current.contains(e.target)&&_(null)}return document.addEventListener("mousedown",e),()=>{document.removeEventListener("mousedown",e)}},[U,u,w]);let F=e=>"/workspaces"===e?r.pathname.startsWith("/workspaces")||r.pathname.startsWith("/workspace"):r.pathname.startsWith(e),R=e=>{let t=F(e);return"inline-flex items-center border-b-2 ".concat(t?"border-transparent text-blue-600":"border-transparent hover:text-blue-600"," ").concat(n?"px-2 py-1":"px-1 pt-1 space-x-2")},D=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=!t&&F(e);return"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(r?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600")},P=(e,t)=>{if(a.isValidElement(e)){var r;return a.cloneElement(e,{className:[null===(r=e.props)||void 0===r?void 0:r.className,t].filter(Boolean).join(" ")})}let s=k[e];return s?a.createElement(s,{className:t}):e},A=e=>(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-1","aria-hidden":"true",children:P(e.icon,"w-4 h-4")}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]}),q=e=>{if("string"!=typeof e)return e;let t=W.find(t=>t.path===e);if(!t||!t.path.startsWith("/plugins"))return e;let r=t.path.replace(/^\/+/,"").split("/").slice(1).filter(Boolean);return{pathname:"/plugins/[...slug]",query:r.length?{slug:r}:{}}},B=e=>e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:"inline-flex items-center border-b-2 border-transparent px-1 pt-1 space-x-2 text-gray-700 hover:text-blue-600",children:A(e)},e.id):(0,s.jsx)(o(),{href:q(e.href),className:R(e.href),prefetch:!1,children:A(e)},e.id),G=e=>{let t=(0,s.jsxs)(s.Fragment,{children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none mr-2","aria-hidden":"true",children:P(e.icon,"w-5 h-5")}),(0,s.jsxs)("span",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{children:e.label}),e.badge&&(0,s.jsx)("span",{className:"text-[10px] uppercase tracking-wide bg-blue-100 text-blue-700 px-1.5 py-0.5 rounded-full",children:e.badge})]})]});return e.external?(0,s.jsx)("a",{href:e.href,target:e.target,rel:e.rel,className:D(e.href,!0),onClick:w,children:t},e.id):(0,s.jsx)(o(),{href:q(e.href),className:D(e.href),onClick:w,prefetch:!1,children:t},e.id)},T=(e,t)=>{let r=Z===e;return(0,s.jsxs)("div",{className:"relative",ref:V,children:[(0,s.jsxs)("button",{onClick:()=>_(r?null:e),className:"inline-flex items-center align-middle border-b-2 px-1 pt-1 space-x-1 ".concat(r?"text-blue-600 border-blue-600":"border-transparent text-gray-700 hover:text-blue-600"),children:[(0,s.jsx)("span",{children:e}),(0,s.jsx)("svg",{className:"w-4 h-4 transition-transform ".concat(r?"rotate-180":""),fill:"currentColor",viewBox:"0 0 20 20",children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z",clipRule:"evenodd"})})]}),r&&(0,s.jsx)("div",{className:"absolute top-full left-0 mt-1 min-w-[8rem] bg-white rounded-md shadow-lg border border-gray-200 z-50",children:(0,s.jsx)("div",{className:"py-1",children:t.map(e=>(0,s.jsx)(o(),{href:q(e.href),className:"block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 transition-colors",onClick:()=>_(null),prefetch:!1,children:(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[e.icon&&(0,s.jsx)("span",{className:"text-base leading-none",children:P(e.icon,"w-4 h-4")}),(0,s.jsx)("span",{children:e.label})]})},e.id))})})]},e)};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed top-0 left-0 right-0 bg-white z-30 h-14 px-4 border-b border-gray-200 shadow-sm",children:(0,s.jsxs)("div",{className:"flex items-center justify-between h-full",children:[(0,s.jsxs)("div",{className:"flex items-center space-x-4 mr-4 md:mr-6",children:[n&&(0,s.jsx)("button",{onClick:w,className:"mobile-menu-button p-2 rounded-md text-gray-600 hover:text-blue-600 hover:bg-gray-100 transition-colors","aria-label":"Toggle mobile menu",children:(0,s.jsx)("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:u?"M6 18L18 6M6 6l12 12":"M4 6h16M4 12h16M4 18h16"})})}),(0,s.jsx)(o(),{href:"/",className:"flex items-center px-1 pt-1 h-full",prefetch:!1,children:(0,s.jsx)("div",{className:"h-20 w-20 flex items-center justify-center",children:(0,s.jsx)(l(),{src:"".concat(g.GW,"/skypilot.svg"),alt:"SkyPilot Logo",width:80,height:80,priority:!0,className:"w-full h-full object-contain"})})})]}),!n&&(0,s.jsxs)("div",{className:"flex items-center space-x-2 md:space-x-4 mr-6",children:[(0,s.jsxs)(o(),{href:"/clusters",className:R("/clusters"),prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Clusters"})]}),(0,s.jsxs)(o(),{href:"/jobs",className:R("/jobs"),prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Jobs"})]}),(0,s.jsxs)(o(),{href:"/volumes",className:R("/volumes"),prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Volumes"})]}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6 mx-1"}),(0,s.jsxs)(o(),{href:"/recipes",className:R("/recipes"),prefetch:!1,children:[(0,s.jsx)(m.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Recipes"})]}),(0,s.jsxs)(o(),{href:"/infra",className:R("/infra"),prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Infra"})]}),(0,s.jsxs)(o(),{href:"/workspaces",className:R("/workspaces"),prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Workspaces"})]}),(0,s.jsxs)(o(),{href:"/users",className:R("/users"),prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Users"})]})]}),(0,s.jsxs)("div",{className:"flex items-center space-x-1 ml-auto",children:[!n&&(0,s.jsxs)(s.Fragment,{children:[z.map(e=>B(e)),Object.entries(H).map(e=>{let[t,r]=e;return T(t,r)}),(0,s.jsx)(b.WH,{content:"Documentation",className:"text-sm text-muted-foreground",children:(0,s.jsxs)("a",{href:"https://docs.skypilot.co/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center align-middle border-b-2 border-transparent px-1 pt-1 space-x-1 text-gray-600 hover:text-blue-600 transition-colors duration-150 cursor-pointer",title:"Docs",children:[(0,s.jsx)("span",{className:"leading-none",children:"Docs"}),(0,s.jsx)(d.h0,{className:"w-3.5 h-3.5"})]})}),(0,s.jsx)(b.WH,{content:"GitHub Repository",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"GitHub",children:(0,s.jsx)(d.fy,{className:"w-5 h-5"})})}),(0,s.jsx)(b.WH,{content:"Join Slack",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Slack",children:(0,s.jsx)(d.mU,{className:"w-5 h-5"})})}),(0,s.jsx)(b.WH,{content:"Leave Feedback",className:"text-sm text-muted-foreground",children:(0,s.jsx)("a",{href:"https://github.com/skypilot-org/skypilot/issues/new",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center justify-center align-middle p-2 rounded-full text-gray-600 hover:bg-gray-100 transition-colors duration-150 cursor-pointer",title:"Leave Feedback",children:(0,s.jsx)(d.aD,{className:"w-5 h-5"})})}),(0,s.jsx)("div",{className:"border-l border-gray-200 h-6"}),(0,s.jsx)(y.on,{}),C&&(0,s.jsx)(b.WH,{content:"Configuration",className:"text-sm text-muted-foreground",children:(0,s.jsx)(o(),{href:"/settings",className:"inline-flex items-center justify-center p-2 rounded-full transition-colors duration-150 cursor-pointer ".concat(F("/settings")?"text-blue-600 hover:bg-gray-100":"text-gray-600 hover:bg-gray-100"),title:"Configuration",prefetch:!1,children:(0,s.jsx)(p,{className:"w-5 h-5"})})})]}),i&&(0,s.jsxs)("div",{className:"relative",ref:U,children:[(0,s.jsx)("button",{onClick:()=>E(!S),className:"inline-flex items-center justify-center rounded-full transition-colors duration-150 cursor-pointer hover:ring-2 hover:ring-blue-200",title:"User Profile",children:(0,s.jsx)("div",{className:"".concat(n?"w-6 h-6 text-xs":"w-7 h-7 text-sm"," bg-blue-600 text-white rounded-full flex items-center justify-center font-medium hover:bg-blue-700 transition-colors"),children:i?i.includes("@")?i.split("@")[0].charAt(0).toUpperCase():i.charAt(0).toUpperCase():"?"})}),S&&(0,s.jsxs)("div",{className:"absolute right-0 mt-2 w-48 bg-white rounded-md shadow-lg z-50 border border-gray-200",children:[(e=i,t=null,i&&i.includes("@")&&(e=i.split("@")[0],t=i),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"px-4 pt-2 pb-1 text-sm font-medium text-gray-900",children:e}),t&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-1 text-xs text-gray-500",children:t}),h&&(0,s.jsx)("div",{className:"px-4 pt-0 pb-2 text-xs",children:"admin"===h?(0,s.jsxs)("span",{className:"inline-flex items-center text-blue-600",children:[(0,s.jsx)(d.r7,{className:"w-3 h-3 mr-1"}),"Admin"]}):(0,s.jsxs)("span",{className:"inline-flex items-center text-gray-600",children:[(0,s.jsx)(f.Z,{className:"w-3 h-3 mr-1"}),"User"]})})]})),(0,s.jsx)(N.j,{name:"user-menu",wrapperClassName:"contents",context:{closeDropdown:()=>E(!1)},prefix:(0,s.jsx)("div",{className:"border-t border-gray-200 mx-1 my-1"})})]})]})]})]})}),n&&(0,s.jsxs)(s.Fragment,{children:[u&&(0,s.jsx)("div",{className:"fixed top-14 left-0 right-0 bottom-0 bg-black bg-opacity-50 z-40",onClick:w}),(0,s.jsx)("div",{ref:L,className:"fixed top-14 left-0 h-[calc(100vh-56px)] w-64 bg-white border-r border-gray-200 shadow-lg z-50 transform transition-transform duration-300 ease-in-out ".concat(u?"translate-x-0":"-translate-x-full"),children:(0,s.jsx)("nav",{className:"flex-1 overflow-y-auto py-6",children:(0,s.jsxs)("div",{className:"px-4 space-y-1",children:[(0,s.jsxs)(o(),{href:"/clusters",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/clusters")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.QT,{className:"w-5 h-5 mr-3"}),"Clusters"]}),(0,s.jsxs)(o(),{href:"/jobs",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/jobs")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.Vp,{className:"w-5 h-5 mr-3"}),"Jobs"]}),(0,s.jsxs)(o(),{href:"/volumes",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/volumes")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.eU,{className:"w-5 h-5 mr-3"}),"Volumes"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)(o(),{href:"/recipes",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/recipes")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(m.Z,{className:"w-5 h-5 mr-3"}),"Recipes"]}),(0,s.jsxs)(o(),{href:"/infra",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/infra")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.PC,{className:"w-5 h-5 mr-3"}),"Infra"]}),(0,s.jsxs)(o(),{href:"/workspaces",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/workspaces")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.E9,{className:"w-5 h-5 mr-3"}),"Workspaces"]}),(0,s.jsxs)(o(),{href:"/users",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/users")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(d.oy,{className:"w-5 h-5 mr-3"}),"Users"]}),(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),z.map(e=>G(e)),Object.entries(H).map(e=>{let[t,r]=e;return(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"px-4 py-2 text-xs font-semibold text-gray-500 uppercase tracking-wider",children:t}),r.map(e=>G(e))]},t)}),(z.length>0||Object.keys(H).length>0)&&(0,s.jsx)("div",{className:"border-t border-gray-200 my-4"}),(0,s.jsxs)("a",{href:"https://docs.skypilot.co/en/latest/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:w,children:[(0,s.jsx)(d.h0,{className:"w-5 h-5 mr-3"}),"Documentation"]}),(0,s.jsxs)("a",{href:"https://github.com/skypilot-org/skypilot",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:w,children:[(0,s.jsx)(d.fy,{className:"w-5 h-5 mr-3"}),"GitHub"]}),(0,s.jsxs)("a",{href:"https://slack.skypilot.co/",target:"_blank",rel:"noopener noreferrer",className:"flex items-center px-4 py-3 text-sm font-medium text-gray-700 hover:bg-gray-100 hover:text-blue-600 rounded-md transition-colors",onClick:w,children:[(0,s.jsx)(d.mU,{className:"w-5 h-5 mr-3"}),"Slack"]}),C&&(0,s.jsxs)(o(),{href:"/settings",className:"flex items-center px-4 py-3 text-sm font-medium rounded-md transition-colors ".concat(F("/settings")?"bg-blue-50 text-blue-600":"text-gray-700 hover:bg-gray-100 hover:text-blue-600"),onClick:w,prefetch:!1,children:[(0,s.jsx)(p,{className:"w-5 h-5 mr-3"}),"Configuration"]})]})})})]})]})}},3001:function(e,t,r){r.d(t,{X:function(){return a}});var s=r(7294);function a(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[t,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{let t=()=>{r(window.innerWidth{window.removeEventListener("resize",t)}},[e]),t}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/583.846bef62e026e4d9.js b/sky/dashboard/out/_next/static/chunks/583.846bef62e026e4d9.js new file mode 100644 index 000000000..7fee2e6c1 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/583.846bef62e026e4d9.js @@ -0,0 +1,11 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[583],{8507:function(e,n,t){t.d(n,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]])},8586:function(e,n,t){t.d(n,{Z:function(){return r}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let r=(0,t(998).Z)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},3001:function(e,n,t){t.d(n,{X:function(){return i}});var r=t(7294);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[n,t]=(0,r.useState)(!1);return(0,r.useEffect)(()=>{let n=()=>{t(window.innerWidth{window.removeEventListener("resize",n)}},[e]),n}},5988:function(e,n,t){t.d(n,{j:function(){return u}});var r=t(5893);t(7294);var i=t(3800);function u(e){let{name:n,context:t={},fallback:u=null,wrapperClassName:a="",prefix:c=null}=e,d=(0,i.dL)(n);return 0===d.length?u:(0,r.jsxs)("div",{className:a||void 0,children:[c,d.map(e=>{let n=e.component;return(0,r.jsx)(n,{...t},e.id)})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/699.132d4816f55d9991.js b/sky/dashboard/out/_next/static/chunks/699.132d4816f55d9991.js new file mode 100644 index 000000000..d69e474c3 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/699.132d4816f55d9991.js @@ -0,0 +1,6 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[699],{9333:function(e,s,r){r.d(s,{Z:function(){return n}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(998).Z)("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]])},699:function(e,s,r){r.r(s),r.d(s,{Config:function(){return b}});var n=r(5893),l=r(7294),t=r(803),a=r(7673),i=r(7324),c=r(1812),o=r(5739),d=r(9333),u=r(1272),m=r(1623),x=r(7145),f=r(7853),h=r(1428),g=r(5988),j=r(9071),v=r(5089),p=r(3454);function b(){let{userRole:e,restrictConfigToAdmins:s}=(0,j.Ap)(),r="admin"===e||"user"===e&&!s,[b,y]=(0,l.useState)(""),[N,w]=(0,l.useState)(!0),[k,L]=(0,l.useState)(!1),[A,C]=(0,l.useState)(null),[E,S]=(0,l.useState)(!1),[z,M]=(0,l.useState)(!1),P=(0,l.useRef)(null),R=(0,l.useCallback)(async()=>{w(!0),C(null);try{let e=await (0,i.iE)();0===Object.keys(e).length?y(""):y(u.ZP.dump(e,{indent:2}))}catch(e){console.error("Error loading config:",e),C(e)}finally{w(!1)}},[]);(0,l.useEffect)(()=>{if(!r){w(!1);return}R(),(async()=>{M(await (0,f.TO)())})()},[r,R]),(0,l.useEffect)(()=>()=>{P.current&&clearTimeout(P.current)},[]);let Z=async()=>{(0,h.U$)("save"),L(!0),C(null),P.current&&(clearTimeout(P.current),P.current=null);try{let e=await x.x.get("/users/role");if(!e.ok){let s=await e.json();throw Error(s.detail||"Failed to get user role")}let s=await e.json(),r=s.role;if("admin"!=r){C(Error("".concat(s.name," is logged in as non-admin and cannot edit config"))),L(!1);return}let n=u.ZP.load(b);if(null==n&&(n={}),"object"!=typeof n||Array.isArray(n)){let e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.";Array.isArray(n),e="Invalid config structure: Configuration must be a mapping (key-value pairs) in YAML format.",C(Error(e)),L(!1);return}await (0,i.rF)(n),S(!0),P.current=setTimeout(()=>{S(!1),P.current=null},5e3)}catch(e){console.error("Error saving config:",e),C(e)}finally{L(!1)}};return null===e?(0,n.jsxs)("div",{className:"flex items-center justify-center py-16",children:[(0,n.jsx)(o.Z,{size:20}),(0,n.jsx)("span",{className:"ml-2 text-gray-500",children:"Loading..."})]}):r?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 h-8",children:[(0,n.jsx)("div",{className:"text-base flex items-center",children:(0,n.jsx)("span",{className:"text-sky-blue leading-none",children:"SkyPilot API Server"})}),(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"text-sm flex items-center",children:(N||k)&&(0,n.jsxs)("div",{className:"flex items-center mr-4",children:[(0,n.jsx)(o.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500",children:k?"Applying...":"Loading..."})]})}),z&&(0,n.jsxs)("button",{onClick:()=>{let e=(0,f.ki)(),s=p.env.SKYPILOT_RELEASE_NAME||"skypilot";window.open("".concat(e,"/d/skypilot-apiserver-overview/skypilot-api-server?orgId=1&from=now-1h&to=now&timezone=browser&var-app=").concat("".concat(s,"-api")),"_blank")},className:"inline-flex items-center h-8 px-3 text-sm font-medium text-white bg-sky-blue-bright border border-transparent rounded-md shadow-sm hover:bg-sky-blue focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-sky-blue mr-4",children:[(0,n.jsx)("svg",{className:"w-4 h-4 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"})}),"View API Server Metrics"]}),(0,n.jsx)(m.$h,{}),(0,n.jsx)(g.j,{name:"settings.version-display",fallback:(0,n.jsx)(m.Bx,{})})]})]}),(0,n.jsxs)(a.Zb,{className:"w-full",children:[(0,n.jsx)(a.Ol,{children:(0,n.jsx)(a.ll,{className:"text-base font-normal flex items-center justify-between",children:(0,n.jsx)("span",{children:"Edit SkyPilot API Server Configuration"})})}),(0,n.jsxs)(a.aY,{className:"space-y-4",children:[(0,n.jsxs)("p",{className:"text-sm text-gray-600 mb-3",children:["Refer to the"," ",(0,n.jsx)("a",{href:"https://docs.skypilot.co/en/latest/reference/config.html",target:"_blank",rel:"noopener noreferrer",className:"text-blue-600 hover:underline",children:"SkyPilot Docs"})," ","for details. The configuration should be in YAML format."]}),E&&(0,n.jsx)("div",{className:"bg-green-50 border border-green-200 rounded p-4 mb-6",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsx)("svg",{className:"h-5 w-5 text-green-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z",clipRule:"evenodd"})})}),(0,n.jsx)("div",{className:"ml-3",children:(0,n.jsx)("p",{className:"text-sm font-medium text-green-800",children:"Configuration saved successfully!"})})]}),(0,n.jsx)("div",{className:"ml-auto pl-3",children:(0,n.jsx)("div",{className:"-mx-1.5 -my-1.5",children:(0,n.jsxs)("button",{type:"button",onClick:()=>{S(!1),P.current&&(clearTimeout(P.current),P.current=null)},className:"inline-flex rounded-md bg-green-50 p-1.5 text-green-500 hover:bg-green-100 focus:outline-none focus:ring-2 focus:ring-green-600 focus:ring-offset-2 focus:ring-offset-green-50",children:[(0,n.jsx)("span",{className:"sr-only",children:"Dismiss"}),(0,n.jsx)("svg",{className:"h-5 w-5",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})]})})})]})}),A&&(0,n.jsx)("div",{className:"mb-6",children:(0,n.jsx)(c.X,{error:A,title:"Failed to apply new configuration",onDismiss:()=>C(null)})}),(0,n.jsx)("div",{className:"w-full",children:(0,n.jsx)(v.Xx,{value:b,onChange:e=>y(e),minHeight:"384px",maxHeight:"600px",disabled:N||k})}),(0,n.jsx)("div",{className:"flex justify-end space-x-3 pt-3",children:(0,n.jsx)(t.z,{onClick:Z,disabled:N||k,className:"inline-flex items-center bg-sky-600 hover:bg-sky-700 text-white",children:k?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.Z,{size:16,className:"mr-2"}),"Applying..."]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(d.Z,{className:"w-4 h-4 mr-1.5"}),"Apply"]})})})]})]})]}):(0,n.jsxs)(a.Zb,{className:"w-full",children:[(0,n.jsx)(a.Ol,{children:(0,n.jsx)(a.ll,{className:"text-base font-normal",children:"API Server Configuration"})}),(0,n.jsx)(a.aY,{children:(0,n.jsx)("p",{className:"text-sm text-gray-600",children:"You must be an admin to view the API server configuration."})})]})}},1812:function(e,s,r){r.d(s,{X:function(){return a}});var n=r(5893),l=r(7294);let t=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},a=e=>{let{error:s,title:r="Error",onDismiss:a}=e,[i,c]=(0,l.useState)(!1);if((0,l.useEffect)(()=>{s&&c(!1)},[s]),!s||i)return null;let o="string"==typeof s?s:t(s);return(0,n.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsx)("div",{className:"ml-3",children:(0,n.jsxs)("div",{className:"text-sm text-red-800 whitespace-pre-wrap",children:[(0,n.jsxs)("strong",{children:[r,":"]})," ",o]})})]}),(0,n.jsx)("button",{onClick:()=>{c(!0),a&&a()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,n.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/725.12953dd9757fcf0b.js b/sky/dashboard/out/_next/static/chunks/725.12953dd9757fcf0b.js new file mode 100644 index 000000000..618f8cb73 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/725.12953dd9757fcf0b.js @@ -0,0 +1,16 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[725],{3626:function(e,s,r){r.d(s,{Z:function(){return n}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(998).Z)("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]])},7603:function(e,s,r){r.d(s,{Z:function(){return n}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(998).Z)("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"}]])},6122:function(e,s,r){r.d(s,{Z:function(){return n}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(998).Z)("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"}]])},1812:function(e,s,r){r.d(s,{X:function(){return l}});var n=r(5893),t=r(7294);let a=e=>{if(!(null==e?void 0:e.message))return"An unexpected error occurred.";let s=e.message;return s.includes("failed:")&&(s=s.split("failed:")[1].trim()),s},l=e=>{let{error:s,title:r="Error",onDismiss:l}=e,[c,i]=(0,t.useState)(!1);if((0,t.useEffect)(()=>{s&&i(!1)},[s]),!s||c)return null;let o="string"==typeof s?s:a(s);return(0,n.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-md p-3 mb-4",children:(0,n.jsxs)("div",{className:"flex items-center justify-between",children:[(0,n.jsxs)("div",{className:"flex",children:[(0,n.jsx)("div",{className:"flex-shrink-0",children:(0,n.jsx)("svg",{className:"h-5 w-5 text-red-400",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})})}),(0,n.jsx)("div",{className:"ml-3",children:(0,n.jsxs)("div",{className:"text-sm text-red-800 whitespace-pre-wrap",children:[(0,n.jsxs)("strong",{children:[r,":"]})," ",o]})})]}),(0,n.jsx)("button",{onClick:()=>{i(!0),l&&l()},className:"flex-shrink-0 ml-4 text-red-400 hover:text-red-600 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-offset-2 focus:ring-offset-red-50 rounded","aria-label":"Dismiss error",children:(0,n.jsx)("svg",{className:"h-4 w-4",viewBox:"0 0 20 20",fill:"currentColor",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]})})}},9307:function(e,s,r){r.d(s,{Cl:function(){return c},OE:function(){return d}});var n=r(5893);r(7294);var t=r(5739),a=r(470),l=r(3850);let c=e=>{switch(e){case"LAUNCHING":return"bg-blue-100 text-sky-blue";case"UNHEALTHY":case"FAILED":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":return"bg-red-50 text-red-700";case"RUNNING":case"IN_USE":case"READY":return"bg-green-50 text-green-700";case"STOPPED":return"bg-yellow-100 text-yellow-800";case"AUTOSTOPPING":return"bg-purple-100 text-purple-800";case"TERMINATED":case"PENDING":case"UNKNOWN":default:return"bg-gray-100 text-gray-800";case"SUCCEEDED":case"PROVISIONING":case"CONTROLLER_INIT":case"REPLICA_INIT":return"bg-blue-50 text-blue-700";case"CANCELLED":case"CANCELLING":case"NOT_READY":return"bg-yellow-50 text-yellow-700";case"RECOVERING":case"SHUTTING_DOWN":return"bg-orange-50 text-orange-700";case"WINDING_DOWN":case"PREEMPTED":case"NO_REPLICA":return"bg-purple-50 text-purple-700";case"SUBMITTED":return"bg-indigo-50 text-indigo-700";case"STARTING":return"bg-cyan-50 text-cyan-700";case"FAILED_SETUP":return"bg-pink-50 text-pink-700"}},i=e=>{switch(e){case"LAUNCHING":case"STARTING":case"AUTOSTOPPING":case"WINDING_DOWN":case"PROVISIONING":case"SHUTTING_DOWN":return(0,n.jsx)(t.Z,{size:12,className:"w-3 h-3 mr-1"});case"RUNNING":case"IN_USE":case"UNHEALTHY":default:return(0,n.jsx)(l.W2,{className:"w-3 h-3 mr-1"});case"STOPPED":case"PREEMPTED":return(0,n.jsx)(l.fp,{className:"w-3 h-3 mr-1"});case"TERMINATED":case"FAILED":case"CANCELLED":case"FAILED_INITIAL_DELAY":case"FAILED_PROBING":case"FAILED_PROVISION":case"FAILED_CLEANUP":case"CONTROLLER_FAILED":case"UNKNOWN":return(0,n.jsx)(l.Ps,{className:"w-3 h-3 mr-1"});case"SUCCEEDED":return(0,n.jsx)(l.Ye,{className:"w-3 h-3 mr-1"});case"PENDING":case"RECOVERING":case"SUBMITTED":case"CANCELLING":case"FAILED_SETUP":case"FAILED_PRECHECKS":case"FAILED_NO_RESOURCE":case"FAILED_CONTROLLER":case"READY":case"NOT_READY":case"CONTROLLER_INIT":case"REPLICA_INIT":case"NO_REPLICA":return(0,n.jsx)(l.J$,{className:"w-3 h-3 mr-1"})}},o=e=>{let s=c(e),r=i(e);return(0,n.jsxs)("span",{className:"".concat("inline-flex items-center px-2 py-1 rounded-full text-sm"," ").concat(s),children:[r,e]})},d=e=>{let{status:s,statusTooltip:r}=e,t=r||s;return(0,n.jsx)(a.Md,{content:t,children:(0,n.jsx)("span",{children:o(s)})})}},4725:function(e,s,r){r.r(s),r.d(s,{Volumes:function(){return P}});var n=r(5893),t=r(7294),a=r(5697),l=r.n(a),c=r(5739),i=r(5168),o=r(803),d=r(8764),u=r(6990),m=r(9238),h=r(1214),x=r(4545),p=r(3626),j=r(6122),g=r(7603),N=r(3850),v=r(3001),f=r(7673),y=r(1360),b=r(1812),E=r(1664),C=r.n(E),w=r(1163),I=r(470),k=r(9307),L=r(5988),R=r(3800),D=r(6378),A=r(6856),_=r(1428);let S=h.nb.REFRESH_INTERVAL,T=[10,30,50,100,200],O="skypilot-volumes-page-size";function P(){var e;let s=(0,w.useRouter)(),[r,a]=(0,t.useState)(!1),l=(0,t.useRef)(null),i=(0,v.X)(),[d,u]=(0,t.useState)(!1),[h,x]=(0,t.useState)(null),[g,N]=(0,t.useState)(null),[f,E]=(0,t.useState)(!1),[k,T]=(0,t.useState)(!1),[O,P]=(0,t.useState)(!1),[U,z]=(0,t.useState)(!1),[M,G]=(0,t.useState)(!1),[H,Z]=(0,t.useState)(null),[V,W]=(0,t.useState)("volumes"),[q,B]=(0,t.useState)([]),K=(0,R.dL)("volumes.tabs"),Y=(0,t.useCallback)(e=>{W(e);let r="volumes"===e?{}:{tab:e};s.replace({pathname:s.pathname,query:r},void 0,{shallow:!0})},[s]);(0,t.useEffect)(()=>{s.isReady&&s.query.tab&&W(s.query.tab)},[s.isReady,s.query.tab]);let X=()=>{(0,_.qD)("refresh"),D.ZP.invalidate(m.C),G(!1),A.ZP.preloadForPage("volumes",{force:!0}).then(()=>{G(!0),Z(new Date),l.current&&l.current()})},$=async()=>{if(h){E(!0),N(null);try{let e=await (0,m.w)(h.name);if(!e.success)throw Error(e.msg);u(!1),x(null),T(!1),P(!1),X()}catch(e){N(e)}finally{E(!1)}}},J=async()=>{if(h){z(!0),N(null);try{let e=await (0,m.w)(h.name,{purge:!0});if(!e.success)throw Error(e.msg);u(!1),x(null),T(!1),P(!1),X()}catch(e){N(e)}finally{z(!1)}}},Q=()=>{u(!1),x(null),N(null),T(!1),P(!1)};(0,t.useEffect)(()=>{(async()=>{try{await A.ZP.preloadForPage("volumes")}catch(e){console.error("Error preloading volumes data:",e)}finally{G(!0),Z(new Date)}})()},[]);let ee=K.length>0;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"flex items-center justify-between mb-4 min-h-[20px]",children:[(0,n.jsx)("div",{className:"text-base flex items-center",children:ee?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("button",{className:"leading-none mr-6 pb-2 px-1 border-b-2 ".concat("volumes"===V?"text-sky-blue border-sky-500":"text-gray-500 hover:text-gray-700 border-transparent"),onClick:()=>Y("volumes"),children:"Volumes"}),(0,n.jsx)(L.j,{name:"volumes.tabs",context:{activeTab:V,onTabChange:Y},wrapperClassName:"contents"})]}):(0,n.jsx)(C(),{href:"/volumes",className:"text-sky-blue hover:underline leading-none",children:"Volumes"})}),"volumes"===V&&(0,n.jsxs)("div",{className:"flex items-center gap-3",children:[r&&(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)(c.Z,{size:15,className:"mt-0"}),(0,n.jsx)("span",{className:"ml-2 text-gray-500 text-sm",children:"Loading..."})]}),!r&&H&&(0,n.jsx)(I.$3,{timestamp:H}),(0,n.jsxs)("button",{onClick:X,disabled:r,className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,n.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),!i&&(0,n.jsx)("span",{children:"Refresh"})]}),(0,n.jsx)(L.j,{name:"volumes.header-actions",context:{onVolumeChange:X,volumes:q},wrapperClassName:"contents"})]})]}),"volumes"===V?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(F,{refreshInterval:S,setLoading:a,refreshDataRef:l,onDeleteVolume:e=>{(0,_.qD)("delete"),x(e),u(!0),N(null),T(!1),P(!1)},onDataChange:B,preloadingComplete:M},"volumes"),(0,n.jsx)(y.Vq,{open:d,onOpenChange:Q,children:(0,n.jsxs)(y.cZ,{className:"sm:max-w-md",children:[(0,n.jsxs)(y.fK,{children:[(0,n.jsx)(y.$N,{children:k?"Force remove volume":"Delete Volume"}),(0,n.jsx)(y.Be,{children:k?(0,n.jsxs)(n.Fragment,{children:['Remove "',(null==h?void 0:h.name)||"this volume",'" from SkyPilot records. The underlying volume will not be deleted.']}):(0,n.jsxs)(n.Fragment,{children:['Are you sure you want to delete volume "',(null==h?void 0:h.name)||"this volume",'"? This action cannot be undone.']})})]}),!k&&(null==h?void 0:null===(e=h.config)||void 0===e?void 0:e.use_existing)&&(0,n.jsxs)("div",{className:"bg-sky-50 border border-sky-200 rounded-md p-3 my-3 flex items-start gap-2",children:[(0,n.jsx)(j.Z,{className:"w-4 h-4 text-sky-600 mt-0.5 flex-shrink-0"}),(0,n.jsxs)("div",{className:"text-sm text-sky-900",children:["This volume was imported from an existing"," ",(null==h?void 0:h.type)==="k8s-pvc"?"PVC":"resource",". Deleting it only removes it from SkyPilot",(null==h?void 0:h.type)==="k8s-pvc"&&(null==h?void 0:h.name_on_cloud)?(0,n.jsxs)(n.Fragment,{children:["; the underlying PVC"," ",(0,n.jsx)("code",{className:"bg-sky-100 px-1 rounded",children:h.name_on_cloud}),h.namespace&&"-"!==h.namespace&&(0,n.jsxs)(n.Fragment,{children:[" ","in namespace"," ",(0,n.jsx)("code",{className:"bg-sky-100 px-1 rounded",children:h.namespace})]})," ","will be left intact."]}):(0,n.jsx)(n.Fragment,{children:"; the underlying resource will be left intact."})]})]}),!k&&(0,n.jsx)(b.X,{error:g,title:"Deletion Failed",onDismiss:()=>N(null)}),k&&(0,n.jsxs)("div",{className:"bg-amber-50 border border-amber-200 rounded-md p-3 my-3 flex items-start gap-2",children:[(0,n.jsx)(j.Z,{className:"w-4 h-4 text-amber-600 mt-0.5 flex-shrink-0"}),(0,n.jsxs)("div",{className:"text-sm text-amber-800 space-y-2",children:[(0,n.jsxs)("p",{className:"m-0",children:["Removing the SkyPilot entry means this volume will no longer appear here, but"," ",(null==h?void 0:h.type)==="k8s-pvc"&&(null==h?void 0:h.name_on_cloud)?(0,n.jsxs)(n.Fragment,{children:["the Kubernetes PVC"," ",(0,n.jsx)("code",{className:"bg-amber-100 px-1 rounded",children:h.name_on_cloud}),h.namespace&&"-"!==h.namespace&&(0,n.jsxs)(n.Fragment,{children:[" ","in namespace"," ",(0,n.jsx)("code",{className:"bg-amber-100 px-1 rounded",children:h.namespace})]})," ","may still exist and continue consuming resources. Delete it manually with"," ",(0,n.jsxs)("code",{className:"bg-amber-100 px-1 rounded",children:["kubectl delete pvc",h.namespace&&"-"!==h.namespace?" -n ".concat(h.namespace):""," ",h.name_on_cloud]})," ","once it's no longer in use."]}):(0,n.jsx)(n.Fragment,{children:"the underlying cloud resource may still exist and continue consuming resources. Clean it up manually once it's no longer in use."})]}),(0,n.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,n.jsx)("input",{type:"checkbox",checked:O,onChange:e=>P(e.target.checked),disabled:U,className:"cursor-pointer"}),(0,n.jsx)("span",{children:"I understand force removal may not delete the underlying volume"})]})]})]}),(0,n.jsxs)(y.cN,{children:[!k&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.z,{variant:"outline",onClick:Q,disabled:f,children:"Cancel"}),(0,n.jsx)(o.z,{variant:"destructive",onClick:$,disabled:f,children:f?"Deleting...":g?"Retry Delete":"Delete"}),g&&(0,n.jsx)(o.z,{variant:"outline",onClick:()=>T(!0),disabled:f,className:"border-amber-600 text-amber-700 hover:bg-amber-50 hover:text-amber-800",children:"Force remove"})]}),k&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.z,{variant:"outline",onClick:()=>{T(!1),P(!1)},disabled:U,children:"Back"}),(0,n.jsx)(o.z,{onClick:J,disabled:!O||U,className:"bg-amber-600 hover:bg-amber-700 text-white",children:U?"Removing...":"Force Remove"})]})]})]})})]}):(0,n.jsx)(L.j,{name:"volumes.tab-content",context:{activeTab:V,onTabChange:Y}})]})}function F(e){let{refreshInterval:s,setLoading:r,refreshDataRef:a,onDeleteVolume:l,onDataChange:i,preloadingComplete:h}=e,[p,j]=(0,t.useState)([]),[v,y]=(0,t.useState)({key:null,direction:"ascending"}),[b,E]=(0,t.useState)(!1),[w,L]=(0,t.useState)(!0),[A,_]=(0,t.useState)(1),[S,P]=(0,t.useState)(()=>(0,u.dp)(O,T,10)),F=(0,t.useCallback)(async()=>{r(!0),E(!0);try{let e=await D.ZP.get(m.C);j(e),i&&i(e)}catch(e){console.error("Failed to fetch volumes:",e),j([]),i&&i([])}finally{r(!1),E(!1),L(!1)}},[r,i]),z=(0,t.useMemo)(()=>(0,x.R0)(p,v.key,v.direction),[p,v]);(0,t.useEffect)(()=>{a&&(a.current=F)},[a,F]),(0,t.useEffect)(()=>{j([]);let e=!0;if(h){F();let r=setInterval(()=>{e&&"visible"===window.document.visibilityState&&F()},s);return()=>{e=!1,clearInterval(r)}}return()=>{e=!1}},[s,F,h]),(0,t.useEffect)(()=>{_(1)},[p.length]);let M=e=>{let s="ascending";v.key===e&&"ascending"===v.direction&&(s="descending"),y({key:e,direction:s})},G=e=>v.key===e?"ascending"===v.direction?" ↑":" ↓":"",H=Math.ceil(z.length/S),Z=(A-1)*S,V=Z+S,W=z.slice(Z,V),q=e=>null==e?"-":e>=1024?"".concat(+(e/1024).toFixed(1),"Ti"):"".concat(e,"Gi"),B=e=>{if(!e)return"N/A";try{let s=new Date(1e3*e);return(0,n.jsx)(I.Zg,{date:s})}catch(e){return"Invalid Date"}},K=(0,R._q)("volumes"),Y=(e,s)=>(0,n.jsxs)(d.ss,{className:"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50",onClick:()=>M(s),children:[e,G(s)]}),X=[{id:"name",order:0,renderHeader:()=>Y("Name","name"),renderCell:e=>(0,n.jsx)(d.pj,{children:(0,n.jsx)(C(),{href:"/volumes/".concat(encodeURIComponent(e.name)),className:"text-blue-600",children:e.name})})},{id:"infra",order:10,renderHeader:()=>Y("Infra","infra"),renderCell:e=>(0,n.jsx)(d.pj,{children:e.infra||"N/A"})},{id:"status",order:20,renderHeader:()=>Y("Status","status"),renderCell:e=>(0,n.jsx)(d.pj,{children:(0,n.jsx)(k.OE,{status:e.status,statusTooltip:e.error_message||e.status})})},{id:"size",order:30,renderHeader:()=>Y("Size","size"),renderCell:e=>(0,n.jsx)(d.pj,{children:q(e.size)})},{id:"user_name",order:40,renderHeader:()=>Y("User","user_name"),renderCell:e=>(0,n.jsx)(d.pj,{children:e.user_name||"N/A"})},{id:"last_attached_at",order:50,renderHeader:()=>Y("Last Use","last_attached_at"),renderCell:e=>(0,n.jsx)(d.pj,{children:B(e.last_attached_at)})},{id:"type",order:60,renderHeader:()=>Y("Type","type"),renderCell:e=>(0,n.jsx)(d.pj,{children:e.type||"N/A"})},{id:"usedby_clusters",order:70,renderHeader:()=>Y("Used By","usedby_clusters"),renderCell:e=>(0,n.jsx)(d.pj,{children:(0,n.jsx)(U,{clusters:e.usedby_clusters,pods:e.usedby_pods})})},{id:"actions",order:1e3,renderHeader:()=>(0,n.jsx)(d.ss,{children:"Actions"}),renderCell:e=>(0,n.jsx)(d.pj,{children:(0,n.jsx)(o.z,{variant:"ghost",size:"sm",onClick:()=>l(e),className:"text-red-600 hover:text-red-700 hover:bg-red-50",title:"Delete volume",children:(0,n.jsx)(g.Z,{className:"w-4 h-4"})})})},...K.map(e=>({id:e.id,order:e.header.order,isPlugin:!0,renderHeader:()=>{let s=e.header.sortKey?"sortable whitespace-nowrap cursor-pointer hover:bg-gray-50":"whitespace-nowrap",r="".concat(s).concat(e.header.className?" "+e.header.className:"");return(0,n.jsxs)(d.ss,{className:r,onClick:e.header.sortKey?()=>M(e.header.sortKey):void 0,children:[e.header.label,e.header.sortKey?G(e.header.sortKey):""]})},renderCell:s=>{let r=e.cell.render(s,{item:s});return(0,n.jsx)(d.pj,{className:e.cell.className||"",children:r})}}))].sort((e,s)=>e.order-s.order),$=X.length;return(0,n.jsxs)("div",{children:[(0,n.jsx)(f.Zb,{children:(0,n.jsx)("div",{className:"overflow-x-auto rounded-lg",children:(0,n.jsxs)(d.iA,{className:"min-w-full",children:[(0,n.jsx)(d.xD,{children:(0,n.jsx)(d.SC,{children:X.map(e=>t.cloneElement(e.renderHeader(),{key:e.id}))})}),(0,n.jsx)(d.RM,{children:b||!h?(0,n.jsx)(d.SC,{children:(0,n.jsx)(d.pj,{colSpan:$,className:"text-center py-6 text-gray-500",children:(0,n.jsxs)("div",{className:"flex justify-center items-center",children:[(0,n.jsx)(c.Z,{size:20,className:"mr-2"}),(0,n.jsx)("span",{children:"Loading..."})]})})}):W.length>0&&!(0,u.KL)()?W.map(e=>(0,n.jsx)(d.SC,{children:X.map(s=>t.cloneElement(s.renderCell(e),{key:s.id}))},e.name)):(0,n.jsx)(d.Iz,{colSpan:$,icon:(0,n.jsx)(N.eU,{className:"w-5 h-5"}),title:"No volumes found",description:"Create a volume to mount storage in your clusters and jobs"})})]})})}),p.length>0&&(0,n.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,n.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("span",{className:"mr-2",children:"Rows per page:"}),(0,n.jsxs)("div",{className:"relative inline-block",children:[(0,n.jsxs)("select",{value:S,onChange:e=>{let s=parseInt(e.target.value,10);P(s),(0,u.AW)(O,s),_(1)},className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:[(0,n.jsx)("option",{value:10,children:"10"}),(0,n.jsx)("option",{value:30,children:"30"}),(0,n.jsx)("option",{value:50,children:"50"}),(0,n.jsx)("option",{value:100,children:"100"}),(0,n.jsx)("option",{value:200,children:"200"})]}),(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,n.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),(0,n.jsxs)("div",{children:[Z+1," – ",Math.min(V,p.length)," of"," ",p.length]}),(0,n.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{_(e=>Math.max(e-1,1))},disabled:1===A,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-left",children:(0,n.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,n.jsx)(o.z,{variant:"ghost",size:"icon",onClick:()=>{_(e=>Math.min(e+1,H))},disabled:A===H||0===H,className:"text-gray-500 h-8 w-8 p-0",children:(0,n.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"chevron-right",children:(0,n.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})]})}function U(e){let{clusters:s,pods:r}=e,[a,l]=(0,t.useState)(null),c=Array.isArray(s)&&s.length>0?s:Array.isArray(r)&&r.length>0?r:[],o=Array.isArray(s)&&s.length>0;if(!c||0===c.length)return"N/A";let d=c.slice(0,2),u=c.slice(2);return(0,n.jsxs)(n.Fragment,{children:[d.map((e,s)=>(0,n.jsxs)("span",{children:[o?(0,n.jsx)(C(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,n.jsx)("span",{children:e}),s0&&(0,n.jsxs)(n.Fragment,{children:[","," ",(0,n.jsxs)("span",{className:"text-sky-blue cursor-pointer underline",onClick:e=>{l(e.currentTarget)},style:{userSelect:"none"},children:["+",u.length," more"]}),(0,n.jsx)(i.ZP,{open:!!a,anchorEl:a,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},transformOrigin:{vertical:"top",horizontal:"left"},children:(0,n.jsx)("div",{style:{padding:12,maxWidth:300},children:u.map(e=>(0,n.jsx)("div",{style:{marginBottom:4},children:o?(0,n.jsx)(C(),{href:"/clusters/".concat(encodeURIComponent(e)),className:"text-sky-blue hover:underline",children:e}):(0,n.jsx)("span",{children:e})},e))})})]})]})}F.propTypes={refreshInterval:l().number.isRequired,setLoading:l().func.isRequired,refreshDataRef:l().shape({current:l().func}).isRequired,onDeleteVolume:l().func.isRequired,onDataChange:l().func,preloadingComplete:l().bool.isRequired}},3001:function(e,s,r){r.d(s,{X:function(){return t}});var n=r(7294);function t(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:768,[s,r]=(0,n.useState)(!1);return(0,n.useEffect)(()=>{let s=()=>{r(window.innerWidth{window.removeEventListener("resize",s)}},[e]),s}},5988:function(e,s,r){r.d(s,{j:function(){return a}});var n=r(5893);r(7294);var t=r(3800);function a(e){let{name:s,context:r={},fallback:a=null,wrapperClassName:l="",prefix:c=null}=e,i=(0,t.dL)(s);return 0===i.length?a:(0,n.jsxs)("div",{className:l||void 0,children:[c,i.map(e=>{let s=e.component;return(0,n.jsx)(s,{...r},e.id)})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/739-e8580e965e4977a9.js b/sky/dashboard/out/_next/static/chunks/739-e8580e965e4977a9.js new file mode 100644 index 000000000..279a4e83b --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/739-e8580e965e4977a9.js @@ -0,0 +1,8 @@ +(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[739],{917:function(e,t,r){"use strict";r.d(t,{F4:function(){return d},iv:function(){return p},xB:function(){return f}});var n,o,i=r(1941),a=r(7294),l=r(444),s=r(7278),u=r(5662);r(8711),r(8679);var c=function(e,t){var r=arguments;if(null==t||!i.h.call(t,"css"))return a.createElement.apply(void 0,r);var n=r.length,o=Array(n);o[0]=i.E,o[1]=(0,i.c)(e,t);for(var l=2;le.charCodeAt(2)}),d=function(e){return"theme"!==e},m=function(e){return"string"==typeof e&&e.charCodeAt(0)>96?p:d},y=function(e,t,r){var n;if(t){var o=t.shouldForwardProp;n=e.__emotion_forwardProp&&o?function(t){return e.__emotion_forwardProp(t)&&o(t)}:o}return"function"!=typeof n&&r&&(n=e.__emotion_forwardProp),n},h=function(e){var t=e.cache,r=e.serialized,n=e.isStringTag;return(0,s.hC)(t,r,n),(0,l.L)(function(){return(0,s.My)(t,r,n)}),null},g=(function e(t,r){var n,l,c=t.__emotion_real===t,f=c&&t.__emotion_base||t;void 0!==r&&(n=r.label,l=r.target);var p=y(t,r,c),d=p||m(f),g=!d("as");return function(){var b=arguments,v=c&&void 0!==t.__emotion_styles?t.__emotion_styles.slice(0):[];if(void 0!==n&&v.push("label:"+n+";"),null==b[0]||void 0===b[0].raw)v.push.apply(v,b);else{var x=b[0];v.push(x[0]);for(var k=b.length,S=1;St(null==e||0===Object.keys(e).length?r:e):t;return(0,x.jsx)(b.xB,{styles:n})}function P(e,t){return g(e,t)}"object"==typeof document&&(n=(0,v.Z)({key:"css",prepend:!0}));let Z=(e,t)=>{Array.isArray(e.__emotion_styles)&&(e.__emotion_styles=t(e.__emotion_styles))}},2101:function(e,t,r){"use strict";var n=r(4836);t.Fq=function(e,t){return e=l(e),t=a(t),("rgb"===e.type||"hsl"===e.type)&&(e.type+="a"),"color"===e.type?e.values[3]=`/${t}`:e.values[3]=t,s(e)},t._j=function(e,t){if(e=l(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]*=1-t;else if(-1!==e.type.indexOf("rgb")||-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]*=1-t;return s(e)},t.mi=function(e,t){let r=u(e),n=u(t);return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)},t.$n=function(e,t){if(e=l(e),t=a(t),-1!==e.type.indexOf("hsl"))e.values[2]+=(100-e.values[2])*t;else if(-1!==e.type.indexOf("rgb"))for(let r=0;r<3;r+=1)e.values[r]+=(255-e.values[r])*t;else if(-1!==e.type.indexOf("color"))for(let r=0;r<3;r+=1)e.values[r]+=(1-e.values[r])*t;return s(e)};var o=n(r(5480)),i=n(r(2340));function a(e,t=0,r=1){return(0,i.default)(e,t,r)}function l(e){let t;if(e.type)return e;if("#"===e.charAt(0))return l(function(e){e=e.slice(1);let t=RegExp(`.{1,${e.length>=6?2:1}}`,"g"),r=e.match(t);return r&&1===r[0].length&&(r=r.map(e=>e+e)),r?`rgb${4===r.length?"a":""}(${r.map((e,t)=>t<3?parseInt(e,16):Math.round(parseInt(e,16)/255*1e3)/1e3).join(", ")})`:""}(e));let r=e.indexOf("("),n=e.substring(0,r);if(-1===["rgb","rgba","hsl","hsla","color"].indexOf(n))throw Error((0,o.default)(9,e));let i=e.substring(r+1,e.length-1);if("color"===n){if(t=(i=i.split(" ")).shift(),4===i.length&&"/"===i[3].charAt(0)&&(i[3]=i[3].slice(1)),-1===["srgb","display-p3","a98-rgb","prophoto-rgb","rec-2020"].indexOf(t))throw Error((0,o.default)(10,t))}else i=i.split(",");return{type:n,values:i=i.map(e=>parseFloat(e)),colorSpace:t}}function s(e){let{type:t,colorSpace:r}=e,{values:n}=e;return -1!==t.indexOf("rgb")?n=n.map((e,t)=>t<3?parseInt(e,10):e):-1!==t.indexOf("hsl")&&(n[1]=`${n[1]}%`,n[2]=`${n[2]}%`),n=-1!==t.indexOf("color")?`${r} ${n.join(" ")}`:`${n.join(", ")}`,`${t}(${n})`}function u(e){let t="hsl"===(e=l(e)).type||"hsla"===e.type?l(function(e){let{values:t}=e=l(e),r=t[0],n=t[1]/100,o=t[2]/100,i=n*Math.min(o,1-o),a=(e,t=(e+r/30)%12)=>o-i*Math.max(Math.min(t-3,9-t,1),-1),u="rgb",c=[Math.round(255*a(0)),Math.round(255*a(8)),Math.round(255*a(4))];return"hsla"===e.type&&(u+="a",c.push(t[3])),s({type:u,values:c})}(e)).values:e.values;return Number((.2126*(t=t.map(t=>("color"!==e.type&&(t/=255),t<=.03928?t/12.92:((t+.055)/1.055)**2.4)))[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}},8128:function(e,t,r){"use strict";var n=r(4836);t.ZP=function(e={}){let{themeId:t,defaultTheme:r=y,rootShouldForwardProp:n=m,slotShouldForwardProp:s=m}=e,c=e=>(0,u.default)((0,o.default)({},e,{theme:g((0,o.default)({},e,{defaultTheme:r,themeId:t}))}));return c.__mui_systemSx=!0,(e,u={})=>{var f;let d;(0,a.internal_processStyles)(e,e=>e.filter(e=>!(null!=e&&e.__mui_systemSx)));let{name:y,slot:v,skipVariantsResolver:x,skipSx:k,overridesResolver:S=(f=h(v))?(e,t)=>t[f]:null}=u,P=(0,i.default)(u,p),Z=void 0!==x?x:v&&"Root"!==v&&"root"!==v||!1,w=k||!1,O=m;"Root"===v||"root"===v?O=n:v?O=s:"string"==typeof e&&e.charCodeAt(0)>96&&(O=void 0);let A=(0,a.default)(e,(0,o.default)({shouldForwardProp:O,label:d},P)),_=e=>"function"==typeof e&&e.__emotion_real!==e||(0,l.isPlainObject)(e)?n=>b(e,(0,o.default)({},n,{theme:g({theme:n.theme,defaultTheme:r,themeId:t})})):e,C=(n,...i)=>{let a=_(n),l=i?i.map(_):[];y&&S&&l.push(e=>{let n=g((0,o.default)({},e,{defaultTheme:r,themeId:t}));if(!n.components||!n.components[y]||!n.components[y].styleOverrides)return null;let i=n.components[y].styleOverrides,a={};return Object.entries(i).forEach(([t,r])=>{a[t]=b(r,(0,o.default)({},e,{theme:n}))}),S(e,a)}),y&&!Z&&l.push(e=>{var n;let i=g((0,o.default)({},e,{defaultTheme:r,themeId:t}));return b({variants:null==i||null==(n=i.components)||null==(n=n[y])?void 0:n.variants},(0,o.default)({},e,{theme:i}))}),w||l.push(c);let s=l.length-i.length;if(Array.isArray(n)&&s>0){let e=Array(s).fill("");(a=[...n,...e]).raw=[...n.raw,...e]}let u=A(a,...l);return e.muiName&&(u.muiName=e.muiName),u};return A.withConfig&&(C.withConfig=A.withConfig),C}};var o=n(r(434)),i=n(r(7071)),a=function(e,t){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var r=d(void 0);if(r&&r.has(e))return r.get(e);var n={__proto__:null},o=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var a=o?Object.getOwnPropertyDescriptor(e,i):null;a&&(a.get||a.set)?Object.defineProperty(n,i,a):n[i]=e[i]}return n.default=e,r&&r.set(e,n),n}(r(3534)),l=r(8524);n(r(7641)),n(r(2125));var s=n(r(9926)),u=n(r(9633));let c=["ownerState"],f=["variants"],p=["name","slot","skipVariantsResolver","skipSx","overridesResolver"];function d(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(d=function(e){return e?r:t})(e)}function m(e){return"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e}let y=(0,s.default)(),h=e=>e?e.charAt(0).toLowerCase()+e.slice(1):e;function g({defaultTheme:e,theme:t,themeId:r}){return 0===Object.keys(t).length?e:t[r]||t}function b(e,t){let{ownerState:r}=t,n=(0,i.default)(t,c),a="function"==typeof e?e((0,o.default)({ownerState:r},n)):e;if(Array.isArray(a))return a.flatMap(e=>b(e,(0,o.default)({ownerState:r},n)));if(a&&"object"==typeof a&&Array.isArray(a.variants)){let{variants:e=[]}=a,t=(0,i.default)(a,f);return e.forEach(e=>{let i=!0;"function"==typeof e.props?i=e.props((0,o.default)({ownerState:r},n,r)):Object.keys(e.props).forEach(t=>{(null==r?void 0:r[t])!==e.props[t]&&n[t]!==e.props[t]&&(i=!1)}),i&&(Array.isArray(t)||(t=[t]),t.push("function"==typeof e.style?e.style((0,o.default)({ownerState:r},n,r)):e.style))}),t}return a}},5408:function(e,t,r){"use strict";r.d(t,{L7:function(){return l},VO:function(){return n},W8:function(){return a},k9:function(){return i}});let n={xs:0,sm:600,md:900,lg:1200,xl:1536},o={keys:["xs","sm","md","lg","xl"],up:e=>`@media (min-width:${n[e]}px)`};function i(e,t,r){let i=e.theme||{};if(Array.isArray(t)){let e=i.breakpoints||o;return t.reduce((n,o,i)=>(n[e.up(e.keys[i])]=r(t[i]),n),{})}if("object"==typeof t){let e=i.breakpoints||o;return Object.keys(t).reduce((o,i)=>(-1!==Object.keys(e.values||n).indexOf(i)?o[e.up(i)]=r(t[i],i):o[i]=t[i],o),{})}return r(t)}function a(e={}){var t;return(null==(t=e.keys)?void 0:t.reduce((t,r)=>(t[e.up(r)]={},t),{}))||{}}function l(e,t){return e.reduce((e,t)=>{let r=e[t];return r&&0!==Object.keys(r).length||delete e[t],e},t)}},7064:function(e,t,r){"use strict";function n(e,t){return this.vars&&"function"==typeof this.getColorSchemeSelector?{[this.getColorSchemeSelector(e).replace(/(\[[^\]]+\])/,"*:where($1)")]:t}:this.palette.mode===e?t:{}}r.d(t,{Z:function(){return n}})},1512:function(e,t,r){"use strict";r.d(t,{Z:function(){return l}});var n=r(3366),o=r(7462);let i=["values","unit","step"],a=e=>{let t=Object.keys(e).map(t=>({key:t,val:e[t]}))||[];return t.sort((e,t)=>e.val-t.val),t.reduce((e,t)=>(0,o.Z)({},e,{[t.key]:t.val}),{})};function l(e){let{values:t={xs:0,sm:600,md:900,lg:1200,xl:1536},unit:r="px",step:l=5}=e,s=(0,n.Z)(e,i),u=a(t),c=Object.keys(u);function f(e){let n="number"==typeof t[e]?t[e]:e;return`@media (min-width:${n}${r})`}function p(e){let n="number"==typeof t[e]?t[e]:e;return`@media (max-width:${n-l/100}${r})`}function d(e,n){let o=c.indexOf(n);return`@media (min-width:${"number"==typeof t[e]?t[e]:e}${r}) and (max-width:${(-1!==o&&"number"==typeof t[c[o]]?t[c[o]]:n)-l/100}${r})`}return(0,o.Z)({keys:c,values:u,up:f,down:p,between:d,only:function(e){return c.indexOf(e)+1(0===e.length?[1]:e).map(e=>{let r=t(e);return"number"==typeof r?`${r}px`:r}).join(" ");return r.mui=!0,r}(m),v=(0,i.Z)({breakpoints:g,direction:"ltr",components:{},palette:(0,n.Z)({mode:"light"},d),spacing:b,shape:(0,n.Z)({},l,y)},h);return v.applyStyles=f.Z,(v=t.reduce((e,t)=>(0,i.Z)(e,t),v)).unstable_sxConfig=(0,n.Z)({},c.Z,null==h?void 0:h.unstable_sxConfig),v.unstable_sx=function(e){return(0,u.Z)({sx:e,theme:this})},v}},9926:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return n.Z},private_createBreakpoints:function(){return o.Z},unstable_applyStyles:function(){return i.Z}});var n=r(7172),o=r(1512),i=r(7064)},7730:function(e,t,r){"use strict";var n=r(4953);t.Z=function(e,t){return t?(0,n.Z)(e,t,{clone:!1}):e}},8700:function(e,t,r){"use strict";r.d(t,{hB:function(){return m},eI:function(){return d},NA:function(){return y},e6:function(){return g},o3:function(){return b}});var n=r(5408),o=r(4844),i=r(7730);let a={m:"margin",p:"padding"},l={t:"Top",r:"Right",b:"Bottom",l:"Left",x:["Left","Right"],y:["Top","Bottom"]},s={marginX:"mx",marginY:"my",paddingX:"px",paddingY:"py"},u=function(e){let t={};return r=>(void 0===t[r]&&(t[r]=e(r)),t[r])}(e=>{if(e.length>2){if(!s[e])return[e];e=s[e]}let[t,r]=e.split(""),n=a[t],o=l[r]||"";return Array.isArray(o)?o.map(e=>n+e):[n+o]}),c=["m","mt","mr","mb","ml","mx","my","margin","marginTop","marginRight","marginBottom","marginLeft","marginX","marginY","marginInline","marginInlineStart","marginInlineEnd","marginBlock","marginBlockStart","marginBlockEnd"],f=["p","pt","pr","pb","pl","px","py","padding","paddingTop","paddingRight","paddingBottom","paddingLeft","paddingX","paddingY","paddingInline","paddingInlineStart","paddingInlineEnd","paddingBlock","paddingBlockStart","paddingBlockEnd"],p=[...c,...f];function d(e,t,r,n){var i;let a=null!=(i=(0,o.DW)(e,t,!1))?i:r;return"number"==typeof a?e=>"string"==typeof e?e:a*e:Array.isArray(a)?e=>"string"==typeof e?e:a[e]:"function"==typeof a?a:()=>void 0}function m(e){return d(e,"spacing",8,"spacing")}function y(e,t){if("string"==typeof t||null==t)return t;let r=e(Math.abs(t));return t>=0?r:"number"==typeof r?-r:`-${r}`}function h(e,t){let r=m(e.theme);return Object.keys(e).map(o=>(function(e,t,r,o){var i;if(-1===t.indexOf(r))return null;let a=(i=u(r),e=>i.reduce((t,r)=>(t[r]=y(o,e),t),{})),l=e[r];return(0,n.k9)(e,l,a)})(e,t,o,r)).reduce(i.Z,{})}function g(e){return h(e,c)}function b(e){return h(e,f)}function v(e){return h(e,p)}g.propTypes={},g.filterProps=c,b.propTypes={},b.filterProps=f,v.propTypes={},v.filterProps=p},4844:function(e,t,r){"use strict";r.d(t,{DW:function(){return i},Jq:function(){return a}});var n=r(4142),o=r(5408);function i(e,t,r=!0){if(!t||"string"!=typeof t)return null;if(e&&e.vars&&r){let r=`vars.${t}`.split(".").reduce((e,t)=>e&&e[t]?e[t]:null,e);if(null!=r)return r}return t.split(".").reduce((e,t)=>e&&null!=e[t]?e[t]:null,e)}function a(e,t,r,n=r){let o;return o="function"==typeof e?e(r):Array.isArray(e)?e[r]||n:i(e,r)||n,t&&(o=t(o,n,e)),o}t.ZP=function(e){let{prop:t,cssProperty:r=e.prop,themeKey:l,transform:s}=e,u=e=>{if(null==e[t])return null;let u=e[t],c=i(e.theme,l)||{};return(0,o.k9)(e,u,e=>{let o=a(c,s,e);return(e===o&&"string"==typeof e&&(o=a(c,s,`${t}${"default"===e?"":(0,n.Z)(e)}`,e)),!1===r)?o:{[r]:o}})};return u.propTypes={},u.filterProps=[t],u}},4920:function(e,t,r){"use strict";r.d(t,{Z:function(){return z}});var n=r(8700),o=r(4844),i=r(7730),a=function(...e){let t=e.reduce((e,t)=>(t.filterProps.forEach(r=>{e[r]=t}),e),{}),r=e=>Object.keys(e).reduce((r,n)=>t[n]?(0,i.Z)(r,t[n](e)):r,{});return r.propTypes={},r.filterProps=e.reduce((e,t)=>e.concat(t.filterProps),[]),r},l=r(5408);function s(e){return"number"!=typeof e?e:`${e}px solid`}function u(e,t){return(0,o.ZP)({prop:e,themeKey:"borders",transform:t})}let c=u("border",s),f=u("borderTop",s),p=u("borderRight",s),d=u("borderBottom",s),m=u("borderLeft",s),y=u("borderColor"),h=u("borderTopColor"),g=u("borderRightColor"),b=u("borderBottomColor"),v=u("borderLeftColor"),x=u("outline",s),k=u("outlineColor"),S=e=>{if(void 0!==e.borderRadius&&null!==e.borderRadius){let t=(0,n.eI)(e.theme,"shape.borderRadius",4,"borderRadius");return(0,l.k9)(e,e.borderRadius,e=>({borderRadius:(0,n.NA)(t,e)}))}return null};S.propTypes={},S.filterProps=["borderRadius"],a(c,f,p,d,m,y,h,g,b,v,S,x,k);let P=e=>{if(void 0!==e.gap&&null!==e.gap){let t=(0,n.eI)(e.theme,"spacing",8,"gap");return(0,l.k9)(e,e.gap,e=>({gap:(0,n.NA)(t,e)}))}return null};P.propTypes={},P.filterProps=["gap"];let Z=e=>{if(void 0!==e.columnGap&&null!==e.columnGap){let t=(0,n.eI)(e.theme,"spacing",8,"columnGap");return(0,l.k9)(e,e.columnGap,e=>({columnGap:(0,n.NA)(t,e)}))}return null};Z.propTypes={},Z.filterProps=["columnGap"];let w=e=>{if(void 0!==e.rowGap&&null!==e.rowGap){let t=(0,n.eI)(e.theme,"spacing",8,"rowGap");return(0,l.k9)(e,e.rowGap,e=>({rowGap:(0,n.NA)(t,e)}))}return null};w.propTypes={},w.filterProps=["rowGap"];let O=(0,o.ZP)({prop:"gridColumn"}),A=(0,o.ZP)({prop:"gridRow"}),_=(0,o.ZP)({prop:"gridAutoFlow"}),C=(0,o.ZP)({prop:"gridAutoColumns"}),j=(0,o.ZP)({prop:"gridAutoRows"}),$=(0,o.ZP)({prop:"gridTemplateColumns"});function T(e,t){return"grey"===t?t:e}function M(e){return e<=1&&0!==e?`${100*e}%`:e}a(P,Z,w,O,A,_,C,j,$,(0,o.ZP)({prop:"gridTemplateRows"}),(0,o.ZP)({prop:"gridTemplateAreas"}),(0,o.ZP)({prop:"gridArea"})),a((0,o.ZP)({prop:"color",themeKey:"palette",transform:T}),(0,o.ZP)({prop:"bgcolor",cssProperty:"backgroundColor",themeKey:"palette",transform:T}),(0,o.ZP)({prop:"backgroundColor",themeKey:"palette",transform:T}));let R=(0,o.ZP)({prop:"width",transform:M}),E=e=>void 0!==e.maxWidth&&null!==e.maxWidth?(0,l.k9)(e,e.maxWidth,t=>{var r,n;let o=(null==(r=e.theme)||null==(r=r.breakpoints)||null==(r=r.values)?void 0:r[t])||l.VO[t];return o?(null==(n=e.theme)||null==(n=n.breakpoints)?void 0:n.unit)!=="px"?{maxWidth:`${o}${e.theme.breakpoints.unit}`}:{maxWidth:o}:{maxWidth:M(t)}}):null;E.filterProps=["maxWidth"];let I=(0,o.ZP)({prop:"minWidth",transform:M}),B=(0,o.ZP)({prop:"height",transform:M}),F=(0,o.ZP)({prop:"maxHeight",transform:M}),N=(0,o.ZP)({prop:"minHeight",transform:M});(0,o.ZP)({prop:"size",cssProperty:"width",transform:M}),(0,o.ZP)({prop:"size",cssProperty:"height",transform:M}),a(R,E,I,B,F,N,(0,o.ZP)({prop:"boxSizing"}));var z={border:{themeKey:"borders",transform:s},borderTop:{themeKey:"borders",transform:s},borderRight:{themeKey:"borders",transform:s},borderBottom:{themeKey:"borders",transform:s},borderLeft:{themeKey:"borders",transform:s},borderColor:{themeKey:"palette"},borderTopColor:{themeKey:"palette"},borderRightColor:{themeKey:"palette"},borderBottomColor:{themeKey:"palette"},borderLeftColor:{themeKey:"palette"},outline:{themeKey:"borders",transform:s},outlineColor:{themeKey:"palette"},borderRadius:{themeKey:"shape.borderRadius",style:S},color:{themeKey:"palette",transform:T},bgcolor:{themeKey:"palette",cssProperty:"backgroundColor",transform:T},backgroundColor:{themeKey:"palette",transform:T},p:{style:n.o3},pt:{style:n.o3},pr:{style:n.o3},pb:{style:n.o3},pl:{style:n.o3},px:{style:n.o3},py:{style:n.o3},padding:{style:n.o3},paddingTop:{style:n.o3},paddingRight:{style:n.o3},paddingBottom:{style:n.o3},paddingLeft:{style:n.o3},paddingX:{style:n.o3},paddingY:{style:n.o3},paddingInline:{style:n.o3},paddingInlineStart:{style:n.o3},paddingInlineEnd:{style:n.o3},paddingBlock:{style:n.o3},paddingBlockStart:{style:n.o3},paddingBlockEnd:{style:n.o3},m:{style:n.e6},mt:{style:n.e6},mr:{style:n.e6},mb:{style:n.e6},ml:{style:n.e6},mx:{style:n.e6},my:{style:n.e6},margin:{style:n.e6},marginTop:{style:n.e6},marginRight:{style:n.e6},marginBottom:{style:n.e6},marginLeft:{style:n.e6},marginX:{style:n.e6},marginY:{style:n.e6},marginInline:{style:n.e6},marginInlineStart:{style:n.e6},marginInlineEnd:{style:n.e6},marginBlock:{style:n.e6},marginBlockStart:{style:n.e6},marginBlockEnd:{style:n.e6},displayPrint:{cssProperty:!1,transform:e=>({"@media print":{display:e}})},display:{},overflow:{},textOverflow:{},visibility:{},whiteSpace:{},flexBasis:{},flexDirection:{},flexWrap:{},justifyContent:{},alignItems:{},alignContent:{},order:{},flex:{},flexGrow:{},flexShrink:{},alignSelf:{},justifyItems:{},justifySelf:{},gap:{style:P},rowGap:{style:w},columnGap:{style:Z},gridColumn:{},gridRow:{},gridAutoFlow:{},gridAutoColumns:{},gridAutoRows:{},gridTemplateColumns:{},gridTemplateRows:{},gridTemplateAreas:{},gridArea:{},position:{},zIndex:{themeKey:"zIndex"},top:{},right:{},bottom:{},left:{},boxShadow:{themeKey:"shadows"},width:{transform:M},maxWidth:{style:E},minWidth:{transform:M},height:{transform:M},maxHeight:{transform:M},minHeight:{transform:M},boxSizing:{},fontFamily:{themeKey:"typography"},fontSize:{themeKey:"typography"},fontStyle:{themeKey:"typography"},fontWeight:{themeKey:"typography"},letterSpacing:{},textTransform:{},lineHeight:{},textAlign:{},typography:{cssProperty:!1,themeKey:"typography"}}},9633:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return n.Z},extendSxProp:function(){return c},unstable_createStyleFunctionSx:function(){return n.n},unstable_defaultSxConfig:function(){return l.Z}});var n=r(6523),o=r(7462),i=r(3366),a=r(4953),l=r(4920);let s=["sx"],u=e=>{var t,r;let n={systemProps:{},otherProps:{}},o=null!=(t=null==e||null==(r=e.theme)?void 0:r.unstable_sxConfig)?t:l.Z;return Object.keys(e).forEach(t=>{o[t]?n.systemProps[t]=e[t]:n.otherProps[t]=e[t]}),n};function c(e){let t;let{sx:r}=e,{systemProps:n,otherProps:l}=u((0,i.Z)(e,s));return t=Array.isArray(r)?[n,...r]:"function"==typeof r?(...e)=>{let t=r(...e);return(0,a.P)(t)?(0,o.Z)({},n,t):n}:(0,o.Z)({},n,r),(0,o.Z)({},l,{sx:t})}},6523:function(e,t,r){"use strict";r.d(t,{n:function(){return s}});var n=r(4142),o=r(7730),i=r(4844),a=r(5408),l=r(4920);function s(){function e(e,t,r,o){let l={[e]:t,theme:r},s=o[e];if(!s)return{[e]:t};let{cssProperty:u=e,themeKey:c,transform:f,style:p}=s;if(null==t)return null;if("typography"===c&&"inherit"===t)return{[e]:t};let d=(0,i.DW)(r,c)||{};return p?p(l):(0,a.k9)(l,t,t=>{let r=(0,i.Jq)(d,f,t);return(t===r&&"string"==typeof t&&(r=(0,i.Jq)(d,f,`${e}${"default"===t?"":(0,n.Z)(t)}`,t)),!1===u)?r:{[u]:r}})}return function t(r){var n;let{sx:i,theme:s={}}=r||{};if(!i)return null;let u=null!=(n=s.unstable_sxConfig)?n:l.Z;function c(r){let n=r;if("function"==typeof r)n=r(s);else if("object"!=typeof r)return r;if(!n)return null;let i=(0,a.W8)(s.breakpoints),l=Object.keys(i),c=i;return Object.keys(n).forEach(r=>{var i;let l="function"==typeof(i=n[r])?i(s):i;if(null!=l){if("object"==typeof l){if(u[r])c=(0,o.Z)(c,e(r,l,s,u));else{let e=(0,a.k9)({theme:s},l,e=>({[r]:e}));(function(...e){let t=new Set(e.reduce((e,t)=>e.concat(Object.keys(t)),[]));return e.every(e=>t.size===Object.keys(e).length)})(e,l)?c[r]=t({sx:l,theme:s}):c=(0,o.Z)(c,e)}}else c=(0,o.Z)(c,e(r,l,s,u))}}),(0,a.L7)(l,c)}return Array.isArray(i)?i.map(c):c(i)}}let u=s();u.filterProps=["sx"],t.Z=u},4142:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(6535);function o(e){if("string"!=typeof e)throw Error((0,n.Z)(7));return e.charAt(0).toUpperCase()+e.slice(1)}},7641:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return n.Z}});var n=r(4142)},2340:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return n}});var n=function(e,t=Number.MIN_SAFE_INTEGER,r=Number.MAX_SAFE_INTEGER){return Math.max(t,Math.min(e,r))}},4780:function(e,t,r){"use strict";function n(e,t,r){let n={};return Object.keys(e).forEach(o=>{n[o]=e[o].reduce((e,n)=>{if(n){let o=t(n);""!==o&&e.push(o),r&&r[n]&&e.push(r[n])}return e},[]).join(" ")}),n}r.d(t,{Z:function(){return n}})},4953:function(e,t,r){"use strict";r.d(t,{P:function(){return i},Z:function(){return function e(t,r,a={clone:!0}){let l=a.clone?(0,n.Z)({},t):t;return i(t)&&i(r)&&Object.keys(r).forEach(n=>{o.isValidElement(r[n])?l[n]=r[n]:i(r[n])&&Object.prototype.hasOwnProperty.call(t,n)&&i(t[n])?l[n]=e(t[n],r[n],a):a.clone?l[n]=i(r[n])?function e(t){if(o.isValidElement(t)||!i(t))return t;let r={};return Object.keys(t).forEach(n=>{r[n]=e(t[n])}),r}(r[n]):r[n]:l[n]=r[n]}),l}}});var n=r(7462),o=r(7294);function i(e){if("object"!=typeof e||null===e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}},8524:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return n.Z},isPlainObject:function(){return n.P}});var n=r(4953)},6535:function(e,t,r){"use strict";function n(e){let t="https://mui.com/production-error/?code="+e;for(let e=1;ee,i=(n=o,{configure(e){n=e},generate:e=>n(e),reset(){n=o}}),a={active:"active",checked:"checked",completed:"completed",disabled:"disabled",error:"error",expanded:"expanded",focused:"focused",focusVisible:"focusVisible",open:"open",readOnly:"readOnly",required:"required",selected:"selected"};function l(e,t,r="Mui"){let n=a[t];return n?`${r}-${n}`:`${i.generate(e)}-${t}`}},1588:function(e,t,r){"use strict";r.d(t,{Z:function(){return o}});var n=r(7621);function o(e,t,r="Mui"){let o={};return t.forEach(t=>{o[t]=(0,n.ZP)(e,t,r)}),o}},2125:function(e,t,r){"use strict";r.r(t),r.d(t,{default:function(){return s},getFunctionName:function(){return i}});var n=r(9593);let o=/^\s*function(?:\s|\s*\/\*.*\*\/\s*)+([^(\s/]*)\s*/;function i(e){let t=`${e}`.match(o);return t&&t[1]||""}function a(e,t=""){return e.displayName||e.name||i(e)||t}function l(e,t,r){let n=a(t);return e.displayName||(""!==n?`${r}(${n})`:r)}function s(e){if(null!=e){if("string"==typeof e)return e;if("function"==typeof e)return a(e,"Component");if("object"==typeof e)switch(e.$$typeof){case n.A4:return l(e,e.render,"ForwardRef");case n._Y:return l(e,e.type,"memo")}}}},8679:function(e,t,r){"use strict";var n=r(1296),o={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},i={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},a={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return n.isMemo(e)?a:l[e.$$typeof]||o}l[n.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[n.Memo]=a;var u=Object.defineProperty,c=Object.getOwnPropertyNames,f=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,d=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,r,n){if("string"!=typeof r){if(m){var o=d(r);o&&o!==m&&e(t,o,n)}var a=c(r);f&&(a=a.concat(f(r)));for(var l=s(t),y=s(r),h=0;he,P,Z,w,O,A=(0,u.F4)(P||(P=S(g()))),_=(0,u.F4)(Z||(Z=S(b()))),C=e=>{let{classes:t,variant:r,color:n,disableShrink:o}=e,i={root:["root",r,"color".concat(c(n))],svg:["svg"],circle:["circle","circle".concat(c(r)),o&&"circleDisableShrink"]};return(0,s.Z)(i,y,t)},j=(0,p.ZP)("span",{name:"MuiCircularProgress",slot:"Root",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.root,t[r.variant],t["color".concat(c(r.color))]]}})(e=>{let{ownerState:t,theme:r}=e;return(0,i.Z)({display:"inline-block"},"determinate"===t.variant&&{transition:r.transitions.create("transform")},"inherit"!==t.color&&{color:(r.vars||r).palette[t.color].main})},e=>{let{ownerState:t}=e;return"indeterminate"===t.variant&&(0,u.iv)(w||(w=S(v(),0)),A)}),$=(0,p.ZP)("svg",{name:"MuiCircularProgress",slot:"Svg",overridesResolver:(e,t)=>t.svg})({display:"block"}),T=(0,p.ZP)("circle",{name:"MuiCircularProgress",slot:"Circle",overridesResolver:(e,t)=>{let{ownerState:r}=e;return[t.circle,t["circle".concat(c(r.variant))],r.disableShrink&&t.circleDisableShrink]}})(e=>{let{ownerState:t,theme:r}=e;return(0,i.Z)({stroke:"currentColor"},"determinate"===t.variant&&{transition:r.transitions.create("stroke-dashoffset")},"indeterminate"===t.variant&&{strokeDasharray:"80px, 200px",strokeDashoffset:0})},e=>{let{ownerState:t}=e;return"indeterminate"===t.variant&&!t.disableShrink&&(0,u.iv)(O||(O=S(x(),0)),_)});var M=a.forwardRef(function(e,t){let r=(0,f.i)({props:e,name:"MuiCircularProgress"}),{className:n,color:a="primary",disableShrink:s=!1,size:u=40,style:c,thickness:p=3.6,value:d=0,variant:m="indeterminate"}=r,y=(0,o.Z)(r,k),g=(0,i.Z)({},r,{color:a,disableShrink:s,size:u,thickness:p,value:d,variant:m}),b=C(g),v={},x={},S={};if("determinate"===m){let e=2*Math.PI*((44-p)/2);v.strokeDasharray=e.toFixed(3),S["aria-valuenow"]=Math.round(d),v.strokeDashoffset="".concat(((100-d)/100*e).toFixed(3),"px"),x.transform="rotate(-90deg)"}return(0,h.jsx)(j,(0,i.Z)({className:(0,l.Z)(b.root,n),style:(0,i.Z)({width:u,height:u},x,c),ownerState:g,ref:t,role:"progressbar"},S,y,{children:(0,h.jsx)($,{className:b.svg,ownerState:g,viewBox:"".concat(22," ").concat(22," ").concat(44," ").concat(44),children:(0,h.jsx)(T,{className:b.circle,style:v,ownerState:g,cx:44,cy:44,r:(44-p)/2,fill:"none",strokeWidth:p})})}))})},9733:function(e,t,r){"use strict";r.d(t,{i:function(){return l}});var n=r(7294),o=r(7462);function i(e,t){let r=(0,o.Z)({},t);return Object.keys(e).forEach(n=>{if(n.toString().match(/^(components|slots)$/))r[n]=(0,o.Z)({},e[n],r[n]);else if(n.toString().match(/^(componentsProps|slotProps)$/)){let a=e[n]||{},l=t[n];r[n]={},l&&Object.keys(l)?a&&Object.keys(a)?(r[n]=(0,o.Z)({},l),Object.keys(a).forEach(e=>{r[n][e]=i(a[e],l[e])})):r[n]=l:r[n]=a}else void 0===r[n]&&(r[n]=e[n])}),r}r(5893);let a=n.createContext(void 0);function l(e){return function({props:e,name:t}){return function(e){let{theme:t,name:r,props:n}=e;if(!t||!t.components||!t.components[r])return n;let o=t.components[r];return o.defaultProps?i(o.defaultProps,n):o.styleOverrides||o.variants?n:i(o,n)}({props:e,name:t,theme:{components:n.useContext(a)}})}(e)}},2418:function(e,t,r){"use strict";r.d(t,{Z:function(){return E}});var n=r(7462),o=r(3366),i=r(6535),a=r(4953),l=r(4920),s=r(6523),u=r(7172),c=r(2101),f={black:"#000",white:"#fff"},p={50:"#fafafa",100:"#f5f5f5",200:"#eeeeee",300:"#e0e0e0",400:"#bdbdbd",500:"#9e9e9e",600:"#757575",700:"#616161",800:"#424242",900:"#212121",A100:"#f5f5f5",A200:"#eeeeee",A400:"#bdbdbd",A700:"#616161"},d={50:"#f3e5f5",100:"#e1bee7",200:"#ce93d8",300:"#ba68c8",400:"#ab47bc",500:"#9c27b0",600:"#8e24aa",700:"#7b1fa2",800:"#6a1b9a",900:"#4a148c",A100:"#ea80fc",A200:"#e040fb",A400:"#d500f9",A700:"#aa00ff"},m={50:"#ffebee",100:"#ffcdd2",200:"#ef9a9a",300:"#e57373",400:"#ef5350",500:"#f44336",600:"#e53935",700:"#d32f2f",800:"#c62828",900:"#b71c1c",A100:"#ff8a80",A200:"#ff5252",A400:"#ff1744",A700:"#d50000"},y={50:"#fff3e0",100:"#ffe0b2",200:"#ffcc80",300:"#ffb74d",400:"#ffa726",500:"#ff9800",600:"#fb8c00",700:"#f57c00",800:"#ef6c00",900:"#e65100",A100:"#ffd180",A200:"#ffab40",A400:"#ff9100",A700:"#ff6d00"},h={50:"#e3f2fd",100:"#bbdefb",200:"#90caf9",300:"#64b5f6",400:"#42a5f5",500:"#2196f3",600:"#1e88e5",700:"#1976d2",800:"#1565c0",900:"#0d47a1",A100:"#82b1ff",A200:"#448aff",A400:"#2979ff",A700:"#2962ff"},g={50:"#e1f5fe",100:"#b3e5fc",200:"#81d4fa",300:"#4fc3f7",400:"#29b6f6",500:"#03a9f4",600:"#039be5",700:"#0288d1",800:"#0277bd",900:"#01579b",A100:"#80d8ff",A200:"#40c4ff",A400:"#00b0ff",A700:"#0091ea"},b={50:"#e8f5e9",100:"#c8e6c9",200:"#a5d6a7",300:"#81c784",400:"#66bb6a",500:"#4caf50",600:"#43a047",700:"#388e3c",800:"#2e7d32",900:"#1b5e20",A100:"#b9f6ca",A200:"#69f0ae",A400:"#00e676",A700:"#00c853"};let v=["mode","contrastThreshold","tonalOffset"],x={text:{primary:"rgba(0, 0, 0, 0.87)",secondary:"rgba(0, 0, 0, 0.6)",disabled:"rgba(0, 0, 0, 0.38)"},divider:"rgba(0, 0, 0, 0.12)",background:{paper:f.white,default:f.white},action:{active:"rgba(0, 0, 0, 0.54)",hover:"rgba(0, 0, 0, 0.04)",hoverOpacity:.04,selected:"rgba(0, 0, 0, 0.08)",selectedOpacity:.08,disabled:"rgba(0, 0, 0, 0.26)",disabledBackground:"rgba(0, 0, 0, 0.12)",disabledOpacity:.38,focus:"rgba(0, 0, 0, 0.12)",focusOpacity:.12,activatedOpacity:.12}},k={text:{primary:f.white,secondary:"rgba(255, 255, 255, 0.7)",disabled:"rgba(255, 255, 255, 0.5)",icon:"rgba(255, 255, 255, 0.5)"},divider:"rgba(255, 255, 255, 0.12)",background:{paper:"#121212",default:"#121212"},action:{active:f.white,hover:"rgba(255, 255, 255, 0.08)",hoverOpacity:.08,selected:"rgba(255, 255, 255, 0.16)",selectedOpacity:.16,disabled:"rgba(255, 255, 255, 0.3)",disabledBackground:"rgba(255, 255, 255, 0.12)",disabledOpacity:.38,focus:"rgba(255, 255, 255, 0.12)",focusOpacity:.12,activatedOpacity:.24}};function S(e,t,r,n){let o=n.light||n,i=n.dark||1.5*n;e[t]||(e.hasOwnProperty(r)?e[t]=e[r]:"light"===t?e.light=(0,c.$n)(e.main,o):"dark"===t&&(e.dark=(0,c._j)(e.main,i)))}let P=["fontFamily","fontSize","fontWeightLight","fontWeightRegular","fontWeightMedium","fontWeightBold","htmlFontSize","allVariants","pxToRem"],Z={textTransform:"uppercase"},w='"Roboto", "Helvetica", "Arial", sans-serif';function O(){for(var e=arguments.length,t=Array(e),r=0;r0&&void 0!==arguments[0]?arguments[0]:{};for(var t,r=arguments.length,O=Array(r>1?r-1:0),E=1;E0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:h[200],light:h[50],dark:h[400]}:{main:h[700],light:h[400],dark:h[800]}}(t),P=e.secondary||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:d[200],light:d[50],dark:d[400]}:{main:d[500],light:d[300],dark:d[700]}}(t),Z=e.error||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:m[500],light:m[300],dark:m[700]}:{main:m[700],light:m[400],dark:m[800]}}(t),w=e.info||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:g[400],light:g[300],dark:g[700]}:{main:g[700],light:g[500],dark:g[900]}}(t),O=e.success||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:b[400],light:b[300],dark:b[700]}:{main:b[800],light:b[500],dark:b[900]}}(t),A=e.warning||function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"light";return"dark"===e?{main:y[400],light:y[300],dark:y[700]}:{main:"#ed6c02",light:y[500],dark:y[900]}}(t);function _(e){return(0,c.mi)(e,k.text.primary)>=r?k.text.primary:x.text.primary}let C=e=>{let{color:t,name:r,mainShade:o=500,lightShade:a=300,darkShade:s=700}=e;if(!(t=(0,n.Z)({},t)).main&&t[o]&&(t.main=t[o]),!t.hasOwnProperty("main"))throw Error((0,i.Z)(11,r?" (".concat(r,")"):"",o));if("string"!=typeof t.main)throw Error((0,i.Z)(12,r?" (".concat(r,")"):"",JSON.stringify(t.main)));return S(t,"light",a,l),S(t,"dark",s,l),t.contrastText||(t.contrastText=_(t.main)),t};return(0,a.Z)((0,n.Z)({common:(0,n.Z)({},f),mode:t,primary:C({color:u,name:"primary"}),secondary:C({color:P,name:"secondary",mainShade:"A400",lightShade:"A200",darkShade:"A700"}),error:C({color:Z,name:"error"}),warning:C({color:A,name:"warning"}),info:C({color:w,name:"info"}),success:C({color:O,name:"success"}),grey:p,contrastThreshold:r,getContrastText:_,augmentColor:C,tonalOffset:l},{dark:k,light:x}[t]),s)}(B),W=(0,u.Z)(e),K=(0,a.Z)(W,{mixins:(t=W.breakpoints,(0,n.Z)({toolbar:{minHeight:56,[t.up("xs")]:{"@media (orientation: landscape)":{minHeight:48}},[t.up("sm")]:{minHeight:64}}},I)),palette:L,shadows:A.slice(),typography:function(e,t){let r="function"==typeof t?t(e):t,{fontFamily:i=w,fontSize:l=14,fontWeightLight:s=300,fontWeightRegular:u=400,fontWeightMedium:c=500,fontWeightBold:f=700,htmlFontSize:p=16,allVariants:d,pxToRem:m}=r,y=(0,o.Z)(r,P),h=l/14,g=m||(e=>"".concat(e/p*h,"rem")),b=(e,t,r,o,a)=>(0,n.Z)({fontFamily:i,fontWeight:e,fontSize:g(t),lineHeight:r},i===w?{letterSpacing:"".concat(Math.round(o/t*1e5)/1e5,"em")}:{},a,d),v={h1:b(s,96,1.167,-1.5),h2:b(s,60,1.2,-.5),h3:b(u,48,1.167,0),h4:b(u,34,1.235,.25),h5:b(u,24,1.334,0),h6:b(c,20,1.6,.15),subtitle1:b(u,16,1.75,.15),subtitle2:b(c,14,1.57,.1),body1:b(u,16,1.5,.15),body2:b(u,14,1.43,.15),button:b(c,14,1.75,.4,Z),caption:b(u,12,1.66,.4),overline:b(u,12,2.66,1,Z),inherit:{fontFamily:"inherit",fontWeight:"inherit",fontSize:"inherit",lineHeight:"inherit",letterSpacing:"inherit"}};return(0,a.Z)((0,n.Z)({htmlFontSize:p,pxToRem:g,fontFamily:i,fontSize:l,fontWeightLight:s,fontWeightRegular:u,fontWeightMedium:c,fontWeightBold:f},v),y,{clone:!1})}(L,N),transitions:function(e){let t=(0,n.Z)({},C,e.easing),r=(0,n.Z)({},j,e.duration);return(0,n.Z)({getAutoHeightDuration:T,create:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:["all"],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{duration:i=r.standard,easing:a=t.easeInOut,delay:l=0}=n;return(0,o.Z)(n,_),(Array.isArray(e)?e:[e]).map(e=>"".concat(e," ").concat("string"==typeof i?i:$(i)," ").concat(a," ").concat("string"==typeof l?l:$(l))).join(",")}},e,{easing:t,duration:r})}(F),zIndex:(0,n.Z)({},M)});return K=(0,a.Z)(K,z),(K=O.reduce((e,t)=>(0,a.Z)(e,t),K)).unstable_sxConfig=(0,n.Z)({},l.Z,null==z?void 0:z.unstable_sxConfig),K.unstable_sx=function(e){return(0,s.Z)({sx:e,theme:this})},K}()},2453:function(e,t){"use strict";t.Z="$$material"},957:function(e,t,r){"use strict";r.d(t,{ZP:function(){return a}});var n=r(8128),o=r(2418),i=r(2453),a=(0,n.ZP)({themeId:i.Z,defaultTheme:o.Z,rootShouldForwardProp:e=>"ownerState"!==e&&"theme"!==e&&"sx"!==e&&"as"!==e&&"classes"!==e})},9593:function(e,t){"use strict";Symbol.for("react.transitional.element"),Symbol.for("react.portal"),Symbol.for("react.fragment"),Symbol.for("react.strict_mode"),Symbol.for("react.profiler"),Symbol.for("react.provider"),Symbol.for("react.consumer"),Symbol.for("react.context");var r=Symbol.for("react.forward_ref"),n=(Symbol.for("react.suspense"),Symbol.for("react.suspense_list"),Symbol.for("react.memo"));Symbol.for("react.lazy"),Symbol.for("react.view_transition"),Symbol.for("react.client.reference"),t.A4=r,t._Y=n},434:function(e){function t(){return e.exports=t=Object.assign?Object.assign.bind():function(e){for(var t=1;tPromise.all([a.e(739),a.e(798),a.e(850),a.e(542),a.e(45),a.e(872),a.e(824),a.e(464),a.e(195)]).then(a.bind(a,3195)).then(e=>e.WorkspaceEditor),{loadableGenerated:{webpack:()=>[3195]},ssr:!1});function p(){(0,c.useRouter)();let[e,s]=(0,r.useState)(""),[a,l]=(0,r.useState)(!1),[i,o]=(0,r.useState)({}),[p,w]=(0,r.useState)(!0);(0,r.useEffect)(()=>{N()},[]);let N=async()=>{try{let e=await (0,m.getWorkspaces)();o(e)}catch(e){console.error("Failed to fetch existing workspaces:",e)}finally{w(!1)}},b=()=>{e.trim()&&!f&&l(!0)},f=e.trim()&&i.hasOwnProperty(e.trim()),j=e.trim()&&!f;return a?(0,t.jsx)(k,{workspaceName:e,isNewWorkspace:!0}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"flex items-center justify-between mb-4 h-5",children:(0,t.jsxs)("div",{className:"text-base flex items-center",children:[(0,t.jsx)(n(),{href:"/workspaces",className:"text-sky-blue hover:underline",children:"Workspaces"}),(0,t.jsx)("span",{className:"mx-2 text-gray-500",children:"›"}),(0,t.jsx)("span",{className:"text-sky-blue",children:"New Workspace"})]})}),(0,t.jsxs)(u.Zb,{className:"max-w-md",children:[(0,t.jsx)(u.Ol,{children:(0,t.jsx)(u.ll,{className:"text-base font-normal",children:"Create New Workspace"})}),(0,t.jsxs)(u.aY,{className:"space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(h._,{htmlFor:"workspace-name",className:"text-sm font-normal",children:"Workspace name"}),(0,t.jsx)(x.I,{id:"workspace-name",value:e,onChange:e=>s(e.target.value),placeholder:"Enter workspace name",autoFocus:!0,onKeyPress:e=>{"Enter"===e.key&&j&&b()}}),f?(0,t.jsxs)("p",{className:"text-sm text-gray-500 mt-1",children:['Workspace "',e,'" already exists.'," ",(0,t.jsx)(n(),{href:"/workspaces/".concat(e),className:"text-blue-600 hover:underline",children:"View the workspace"})]}):(0,t.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:"Choose a unique name for your workspace"})]}),(0,t.jsx)(d.z,{onClick:b,disabled:!j||p,className:"w-full bg-sky-600 hover:bg-sky-700 text-white disabled:bg-gray-300 disabled:text-gray-500",children:p?"Loading...":"Next: Configure Workspace"})]})]})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/798-c0525dc3f21e488d.js b/sky/dashboard/out/_next/static/chunks/798-c0525dc3f21e488d.js new file mode 100644 index 000000000..92fb7afbe --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/798-c0525dc3f21e488d.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[798],{1272:function(e,t,n){var i={isNothing:/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function(e){return null==e},isObject:function(e){return"object"==typeof e&&null!==e},repeat:function(e,t){var n,i="";for(n=0;nl&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return i.repeat(" ",t-e.length)+e}o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,o.prototype.toString=function(e){return this.name+": "+r(this,e)};var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null;t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2);for(var n=/\r?\n|\r|\0/g,r=[0],o=[],c=-1;s=n.exec(e.buffer);)o.push(s.index),r.push(s.index+s[0].length),e.position<=s.index&&c<0&&(c=r.length-2);c<0&&(c=r.length-1);var s,u,p,f="",d=Math.min(e.line+t.linesAfter,o.length).toString().length,h=t.maxLength-(t.indent+d+3);for(u=1;u<=t.linesBefore&&!(c-u<0);u++)p=a(e.buffer,r[c-u],o[c-u],e.position-(r[c]-r[c-u]),h),f=i.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f;for(p=a(e.buffer,r[c],o[c],e.position,h),f+=i.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n"+i.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(c+u>=o.length);u++)p=a(e.buffer,r[c+u],o[c+u],e.position-(r[c]-r[c+u]),h),f+=i.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n";return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"],p=function(e,t){var n,i;if(Object.keys(t=t||{}).forEach(function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')}),this.options=t,this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=(n=t.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(e){n[e].forEach(function(t){i[String(t)]=e})}),i),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')};function f(e,t){var n=[];return e[t].forEach(function(e){var t=n.length;n.forEach(function(n,i){n.tag===e.tag&&n.kind===e.kind&&n.multi===e.multi&&(t=i)}),n[t]=e}),n}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[];if(e instanceof p)n.push(e);else if(Array.isArray(e))n=n.concat(e);else if(e&&(Array.isArray(e.implicit)||Array.isArray(e.explicit)))e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit));else throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })");t.forEach(function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.");if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.");if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")}),n.forEach(function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")});var i=Object.create(d.prototype);return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit"),i.compiledExplicit=f(i,"explicit"),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}};function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),k=RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$"),w=/^[-+]?[0-9]+e/,C=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return!!(null!==e&&k.test(e)&&"_"!==e[e.length-1])},construct:function(e){var t,n;return(n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t)?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),w.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"}),x=y.extend({implicit:[b,A,v,C]}),I=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),O=RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$"),S=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==I.exec(e)||null!==O.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null;if(null===(t=I.exec(e))&&(t=O.exec(e)),null===t)throw Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0";s=+s}return t[9]&&(u=(60*+t[10]+ +(t[11]||0))*6e4,"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}}),j=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),T="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r",N=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length;for(n=0;n64)){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=0,a=[];for(t=0;t>16&255),a.push(o>>8&255),a.push(255&o)),o=o<<6|T.indexOf(i.charAt(t));return 0==(n=r%4*6)?(a.push(o>>16&255),a.push(o>>8&255),a.push(255&o)):18===n?(a.push(o>>10&255),a.push(o>>2&255)):12===n&&a.push(o>>4&255),new Uint8Array(a)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length;for(t=0;t>18&63]+T[r>>12&63]+T[r>>6&63]+T[63&r]),r=(r<<8)+e[t];return 0==(n=o%3)?i+=T[r>>18&63]+T[r>>12&63]+T[r>>6&63]+T[63&r]:2===n?i+=T[r>>10&63]+T[r>>4&63]+T[r<<2&63]+T[64]:1===n&&(i+=T[r>>2&63]+T[r<<4&63]+T[64]+T[64]),i}}),F=Object.prototype.hasOwnProperty,E=Object.prototype.toString,M=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[];for(t=0,n=e.length;t1&&(e.result+=i.repeat("\n",t-1))}function ef(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1;if(-1!==e.firstTabInLine)return!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,en(e,"tab characters must not be used in indentation")),45===i&&V(e.input.charCodeAt(e.position+1)));){if(l=!0,e.position++,es(e,!0,-1)&&e.lineIndent<=t){a.push(null),i=e.input.charCodeAt(e.position);continue}if(n=e.line,ed(e,t,3,!1,!0),a.push(e.result),es(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)en(e,"bad indentation of a sequence entry");else if(e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt?g=1:e.lineIndent===t?g=0:e.lineIndentt)&&(y&&(a=e.line,l=e.lineStart,c=e.position),ed(e,t,4,!0,r)&&(y?g=e.result:m=e.result),y||(el(e,f,d,h,g,m,a,l,c),h=g=m=null),es(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)en(e,"bad indentation of a mapping entry");else if(e.lineIndent=0)0===a?en(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?en(e,"repeat of an indentation width identifier"):(p=t+a-1,u=!0);else break;if(Z(l)){do l=e.input.charCodeAt(++e.position);while(Z(l));if(35===l)do l=e.input.charCodeAt(++e.position);while(!G(l)&&0!==l)}for(;0!==l;){for(ec(e),e.lineIndent=0,l=e.input.charCodeAt(e.position);(!u||e.lineIndentp&&(p=e.lineIndent),G(l)){f++;continue}if(e.lineIndent0){for(r=a,o=0;r>0;r--)(a=function(e){var t;return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:en(e,"expected hexadecimal character");e.result+=(s=o)<=65535?String.fromCharCode(s):String.fromCharCode((s-65536>>10)+55296,(s-65536&1023)+56320),e.position++}else en(e,"unknown escape sequence");n=i=e.position}else G(l)?(eo(e,n,i,!0),ep(e,es(e,!1,t)),n=i=e.position):e.position===e.lineStart&&eu(e)?en(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}en(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!V(i)&&!H(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&en(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),Y.call(e.anchorMap,n)||en(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],es(e,!0,-1),!0}(e)?(y=!0,(null!==e.tag||null!==e.anchor)&&en(e,"alias node should not have any properties")):function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result;if(V(u=e.input.charCodeAt(e.position))||H(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u||(63===u||45===u)&&(V(i=e.input.charCodeAt(e.position+1))||n&&H(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(V(i=e.input.charCodeAt(e.position+1))||n&&H(i))break}else if(35===u){if(V(e.input.charCodeAt(e.position-1)))break}else if(e.position===e.lineStart&&eu(e)||n&&H(u))break;else if(G(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,es(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position);continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s;break}a&&(eo(e,r,o,!1),ep(e,e.line-l),r=o=e.position,a=!1),Z(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return eo(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===n)&&(y=!0,null===e.tag&&(e.tag="?")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===g&&(y=c&&ef(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&en(e,'unacceptable node kind for ! tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s"),null!==e.result&&f.kind!==e.kind&&en(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):en(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function eh(e,t){e=String(e),t=t||{},0!==e.length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new ee(e,t),i=e.indexOf("\0");for(-1!==i&&(n.position=i,en(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position0)&&37===r);){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!V(r);)r=e.input.charCodeAt(++e.position);for(n=e.input.slice(t,e.position),i=[],n.length<1&&en(e,"directive name must not be less than one character in length");0!==r;){for(;Z(r);)r=e.input.charCodeAt(++e.position);if(35===r){do r=e.input.charCodeAt(++e.position);while(0!==r&&!G(r));break}if(G(r))break;for(t=e.position;0!==r&&!V(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&ec(e),Y.call(er,n)?er[n](e,n,i):ei(e,'unknown document directive "'+n+'"')}if(es(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,es(e,!0,-1)):a&&en(e,"directives end mark is expected"),ed(e,e.lineIndent-1,4,!1,!0),es(e,!0,-1),e.checkLineBreaks&&B.test(e.input.slice(o,e.position))&&ei(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&eu(e)){46===e.input.charCodeAt(e.position)&&(e.position+=3,es(e,!0,-1));return}e.position=55296&&i<=56319&&t+1=56320&&n<=57343?(i-55296)*1024+n-56320+65536:i}function ej(e){return/^\n* /.test(e)}function eT(e,t){var n=ej(e)?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function eN(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function eF(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l;return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function eE(e,t,n,i){var r,o,a,l="",c=e.tag;for(r=0,o=n.length;r tag resolver accepts not "'+s+'" style');e.dump=i}return!0}return!1}function eL(e,t,n,r,a,l,c){e.tag=null,e.dump=n,eM(e,n,!1)||eM(e,n,!0);var s,u=eg.call(e.dump),p=r;r&&(r=e.flowLevel<0||e.flowLevel>t);var f,d,h,g="[object Object]"===u||"[object Array]"===u;if(g&&(h=-1!==(d=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||h||2!==e.indent&&t>0)&&(a=!1),h&&e.usedDuplicates[d])e.dump="*ref_"+d;else{if(g&&h&&!e.usedDuplicates[d]&&(e.usedDuplicates[d]=!0),"[object Object]"===u)r&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n);if(!0===e.sortKeys)d.sort();else if("function"==typeof e.sortKeys)d.sort(e.sortKeys);else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function");for(r=0,a=d.length;r1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=ew(e,t)),eL(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",u+=e.dump,p+=u));e.tag=f,e.dump=p||"{}"}(e,t,e.dump,a),h&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n);for(i=0,r=u.length;i1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),eL(e,t,a,!1,!1)&&(l+=e.dump,c+=l));e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),h&&(e.dump="&ref_"+d+" "+e.dump));else if("[object Array]"===u)r&&0!==e.dump.length?(e.noArrayIndent&&!c&&t>0?eE(e,t-1,e.dump,a):eE(e,t,e.dump,a),h&&(e.dump="&ref_"+d+e.dump)):(!function(e,t,n){var i,r,o,a="",l=e.tag;for(i=0,r=n.length;i=65536?u+=2:u++){if(!ex(p=eS(e,u)))return 5;y=y&&eO(p,f,l),f=p}else{for(u=0;u=65536?u+=2:u++){if(10===(p=eS(e,u)))d=!0,g&&(h=h||u-m-1>i&&" "!==e[m+1],m=u);else if(!ex(p))return 5;y=y&&eO(p,f,l),f=p}h=h||g&&u-m-1>i&&" "!==e[m+1]}return d||h?n>9&&ej(e)?5:a?2===o?5:2:h?4:3:!y||a||r(e)?2===o?5:2:1}(s,l||e.flowLevel>-1&&t>=e.flowLevel,e.indent,r,function(t){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n"+eT(s,e.indent)+eN(ek(function(e,t){for(var n,i,r,o=/(\n+)([^\n]*)/g,a=(n=-1!==(n=e.indexOf("\n"))?n:e.length,o.lastIndex=n,eF(e.slice(0,n),t)),l="\n"===e[0]||" "===e[0];r=o.exec(e);){var c=r[1],s=r[2];i=" "===s[0],a+=c+(l||i||""===s?"":"\n")+eF(s,t),l=i}return a}(s,r),n));case 5:return'"'+function(e){for(var t,n="",r=0,a=0;a=65536?a+=2:a++)!(t=ey[r=eS(e,a)])&&ex(r)?(n+=e[a],r>=65536&&(n+=e[a+1])):n+=t||function(e){var t,n,r;if(t=e.toString(16).toUpperCase(),e<=255)n="x",r=2;else if(e<=65535)n="u",r=4;else if(e<=4294967295)n="U",r=8;else throw new o("code point within a string may not be greater than 0xFFFFFFFF");return"\\"+n+i.repeat("0",r-t.length)+t}(r);return n}(s)+'"';default:throw new o("impossible error: invalid scalar style")}}());else{if("[object Undefined]"===u||e.skipInvalid)return!1;throw new o("unacceptable kind of an object to dump "+u)}null!==e.tag&&"?"!==e.tag&&(f=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),f="!"===e.tag[0]?"!"+f:"tag:yaml.org,2002:"===f.slice(0,18)?"!!"+f.slice(18):"!<"+f+">",e.dump=f+" "+e.dump)}return!0}function e_(e,t){return function(){throw Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var eD=e_("safeLoad","load"),eq=e_("safeLoadAll","loadAll"),eU=e_("safeDump","dump");t.ZP={Type:p,Schema:d,FAILSAFE_SCHEMA:y,JSON_SCHEMA:x,CORE_SCHEMA:x,DEFAULT_SCHEMA:U,load:function(e,t){var n=eh(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new o("expected a single document in the stream, but found more")}},loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null);var i=eh(e,n);if("function"!=typeof t)return i;for(var r=0,o=i.length;r0?"".concat(l+1," – ").concat(Math.min(i,c)," of ").concat(c):"0 – 0 of 0";return(0,t.jsx)("div",{className:"flex justify-end items-center py-2 px-4 text-sm text-gray-700",children:(0,t.jsxs)("div",{className:"flex items-center space-x-4",children:[(0,t.jsxs)("div",{className:"flex items-center",children:[(0,t.jsxs)("span",{className:"mr-2",children:[f," per page:"]}),(0,t.jsxs)("div",{className:"relative inline-block",children:[(0,t.jsx)("select",{value:u,onChange:p,className:"py-1 pl-2 pr-6 appearance-none outline-none cursor-pointer border-none bg-transparent",style:{minWidth:"40px"},children:j.map(e=>(0,t.jsx)("option",{value:e,children:e},e))}),(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 text-gray-500 absolute right-0 top-1/2 transform -translate-y-1/2 pointer-events-none",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,t.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})]}),N?(0,t.jsxs)("form",{ref:y,onSubmit:e=>{e.preventDefault();let s=parseInt(v,10);s>=1&&s<=n&&o(s),w(!1),g("")},className:"flex items-center space-x-1",children:[(0,t.jsx)("input",{type:"number",min:1,max:n,value:v,onChange:e=>g(e.target.value),onBlur:e=>{var s;(null===(s=y.current)||void 0===s?void 0:s.contains(e.relatedTarget))||(w(!1),g(""))},onKeyDown:e=>{"Escape"===e.key&&(w(!1),g(""))},autoFocus:!0,className:"w-16 px-2 py-1 border border-gray-300 rounded text-sm text-center",placeholder:"1-".concat(n)}),(0,t.jsxs)("span",{className:"text-gray-400",children:["of ",n]})]}):(0,t.jsx)("div",{className:"cursor-pointer select-none hover:text-blue-600",onClick:()=>{n>1&&(w(!0),g(String(s)))},title:n>1?"Click to jump to a page":void 0,children:b}),(0,t.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,t.jsx)(a.z,{variant:"ghost",size:"icon",onClick:d,disabled:m,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M15 18l-6-6 6-6"})})}),(0,t.jsx)(a.z,{variant:"ghost",size:"icon",onClick:h,disabled:x,className:"text-gray-500 h-8 w-8 p-0",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,t.jsx)("path",{d:"M9 18l6-6-6-6"})})})]})]})})}},546:function(e,s,n){n.d(s,{H:function(){return d}});var t=n(5893);n(7294);var r=n(1664),a=n.n(r),c=n(5697),l=n.n(c);function i(e){return!!e&&"string"==typeof e&&e.toLowerCase().startsWith("sa-")}let o=()=>(0,t.jsx)("span",{className:"px-2 py-0.5 text-xs bg-blue-100 text-blue-700 rounded font-medium ml-1",children:"SA"}),d=e=>{let{username:s,userHash:n,className:r="flex items-center gap-1",linkClassName:c="text-gray-700 hover:text-blue-600 hover:underline",showBadge:l=!0,onUserClick:d=null}=e,h=i(n),m=i(n)?"/users?tab=service-accounts":"/users";return(0,t.jsxs)("div",{className:r,children:[d?(0,t.jsx)("button",{type:"button",onClick:e=>{e.stopPropagation(),d(s,n)},className:c,title:"Filter by ".concat(s),children:s}):(0,t.jsx)(a(),{href:m,className:c,children:s}),l&&h&&(0,t.jsx)(o,{})]})};d.propTypes={username:l().string.isRequired,userHash:l().string,className:l().string,linkClassName:l().string,showBadge:l().bool,onUserClick:l().func}},9284:function(e,s,n){n.d(s,{Oh:function(){return m},_R:function(){return x},cV:function(){return u}});var t=n(5893),r=n(7294),a=n(1360),c=n(803),l=n(7673),i=n(8671),o=n(470),d=n(3225),h=n(3001);function m(e){let{isOpen:s,onClose:n,cluster:d}=e,[h,m]=r.useState(!1),x=e=>{navigator.clipboard.writeText(e),m(!0),setTimeout(()=>m(!1),2e3)},u=["sky status ".concat(d),"ssh ".concat(d)],p=u.join("\n");return(0,t.jsx)(a.Vq,{open:s,onOpenChange:n,children:(0,t.jsxs)(a.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(a.fK,{children:[(0,t.jsxs)(a.$N,{children:["Connect to: ",(0,t.jsx)("span",{className:"font-light",children:d})]}),(0,t.jsx)(a.Be,{children:"Use these instructions to connect to your cluster via SSH."})]}),(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-medium mb-2",children:"SSH Command"}),(0,t.jsx)(l.Zb,{className:"p-3 bg-gray-50",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("pre",{className:"text-sm w-full whitespace-pre-wrap",children:u.map((e,s)=>(0,t.jsx)("code",{className:"block",children:e},s))}),(0,t.jsx)(o.WH,{content:h?"Copied!":"Copy command",children:(0,t.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>x(p),className:"h-8 w-8 rounded-full",children:(0,t.jsx)(i.Z,{className:"h-4 w-4"})})})]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-medium mb-2",children:"Additional Information"}),(0,t.jsxs)("p",{className:"text-sm text-secondary-foreground",children:["Make sure to run"," ",(0,t.jsxs)("code",{className:"text-sm",children:["sky status ",d]})," first to have SkyPilot set up the SSH access."]})]})]})]})})}function x(e){let{isOpen:s,onClose:n,cluster:r}=e,m=(0,h.X)();return(0,t.jsx)(a.Vq,{open:s,onOpenChange:n,children:(0,t.jsx)(a.cZ,{className:"sm:max-w-3xl",children:(0,t.jsxs)(a.fK,{children:[(0,t.jsxs)(a.$N,{children:["Connect to: ",(0,t.jsx)("span",{className:"font-light",children:r})]}),(0,t.jsx)(a.Be,{children:(0,t.jsxs)("div",{className:"flex flex-col space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Setup SSH access"}),(0,t.jsx)(l.Zb,{className:"p-3 bg-gray-50",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("pre",{className:"text-sm",children:(0,t.jsxs)("code",{children:["sky status ",r]})}),(0,t.jsx)(o.WH,{content:"Copy command",children:(0,t.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("sky status ".concat(r)),className:"h-8 w-8 rounded-full",children:(0,t.jsx)(i.Z,{className:"h-4 w-4"})})})]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-medium mb-2 my-2",children:"Connect with VSCode/Cursor"}),(0,t.jsx)(l.Zb,{className:"p-3 bg-gray-50",children:(0,t.jsxs)("div",{className:"flex items-center justify-between",children:[(0,t.jsx)("pre",{className:"text-sm",children:(0,t.jsxs)("code",{children:["code --remote ssh-remote+",r,' "/home"']})}),(0,t.jsx)(o.WH,{content:"Copy command",children:(0,t.jsx)(c.z,{variant:"ghost",size:"icon",onClick:()=>navigator.clipboard.writeText("code --remote ssh-remote+".concat(r,' "/home"')),className:"h-8 w-8 rounded-full",children:(0,t.jsx)(i.Z,{className:"h-4 w-4"})})})]})})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-medium",children:"Or use the GUI to connect"}),(0,t.jsx)("div",{className:"relative ".concat(m?"-mt-5":"-mt-10"),style:{paddingBottom:"70%"},children:(0,t.jsxs)("video",{className:"absolute top-0 left-0 w-full h-full rounded-lg",controls:!0,autoPlay:!0,muted:!0,preload:"metadata",children:[(0,t.jsx)("source",{src:"".concat(d.GW,"/videos/cursor-small.mp4"),type:"video/mp4"}),"Your browser does not support the video tag."]})})]})]})})]})})})}function u(e){let{isOpen:s,onClose:n,onConfirm:r,title:l,message:i,confirmText:o="Confirm",confirmVariant:d="destructive",confirmClassName:h=null}=e;return(0,t.jsx)(a.Vq,{open:s,onOpenChange:n,children:(0,t.jsxs)(a.cZ,{className:"sm:max-w-md",children:[(0,t.jsxs)(a.fK,{children:[(0,t.jsx)(a.$N,{children:l}),(0,t.jsx)(a.Be,{children:i})]}),(0,t.jsxs)(a.cN,{className:"flex justify-end gap-2 pt-4",children:[(0,t.jsx)(c.z,{variant:"outline",onClick:n,children:"Cancel"}),(0,t.jsx)(c.z,{variant:h?void 0:d,className:h,onClick:()=>{r(),n()},children:o})]})]})})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/850-1fe11f1330a693e3.js b/sky/dashboard/out/_next/static/chunks/850-1fe11f1330a693e3.js new file mode 100644 index 000000000..dd48c44dc --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/850-1fe11f1330a693e3.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[850],{3850:function(r,n,t){t.d(n,{E9:function(){return p},J$:function(){return x},PC:function(){return g},Ps:function(){return s},QT:function(){return w},Vp:function(){return d},W2:function(){return h},Ye:function(){return u},_m:function(){return L},aD:function(){return f},b7:function(){return m},eU:function(){return c},fp:function(){return l},fy:function(){return v},h0:function(){return j},mU:function(){return k},ng:function(){return C},ny:function(){return M},oy:function(){return y},r7:function(){return a}});var e=t(5893);t(7294);var o=t(8507),i=t(8586);function s(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"})})}function h(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function x(r){return(0,e.jsx)("svg",{...r,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",children:(0,e.jsx)("circle",{cx:"10",cy:"10",r:"8"})})}function u(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"5",strokeLinecap:"round",strokeLinejoin:"round",children:(0,e.jsx)("path",{d:"M6 12l4 4 8-8"})})}function l(r){return(0,e.jsxs)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor",strokeWidth:"0",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,e.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1"}),(0,e.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1"})]})}function c(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("ellipse",{cx:"12",cy:"4",rx:"8",ry:"2"}),(0,e.jsx)("ellipse",{cx:"12",cy:"20",rx:"8",ry:"2"}),(0,e.jsx)("path",{d:"M4 4v16"}),(0,e.jsx)("path",{d:"M20 4v16"}),(0,e.jsx)("path",{d:"M9 9h6"}),(0,e.jsx)("path",{d:"M9 12h6"}),(0,e.jsx)("path",{d:"M9 15h6"})]})}function w(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2"}),(0,e.jsx)("rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2"}),(0,e.jsx)("line",{x1:"6",x2:"6.01",y1:"6",y2:"6"}),(0,e.jsx)("line",{x1:"6",x2:"6.01",y1:"18",y2:"18"})]})}function d(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16"}),(0,e.jsx)("rect",{width:"20",height:"14",x:"2",y:"6",rx:"2"})]})}function g(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",ry:"2"}),(0,e.jsx)("rect",{x:"9",y:"9",width:"6",height:"6"}),(0,e.jsx)("line",{x1:"9",y1:"1",x2:"9",y2:"4"}),(0,e.jsx)("line",{x1:"15",y1:"1",x2:"15",y2:"4"}),(0,e.jsx)("line",{x1:"9",y1:"20",x2:"9",y2:"23"}),(0,e.jsx)("line",{x1:"15",y1:"20",x2:"15",y2:"23"}),(0,e.jsx)("line",{x1:"20",y1:"9",x2:"23",y2:"9"}),(0,e.jsx)("line",{x1:"20",y1:"14",x2:"23",y2:"14"}),(0,e.jsx)("line",{x1:"1",y1:"9",x2:"4",y2:"9"}),(0,e.jsx)("line",{x1:"1",y1:"14",x2:"4",y2:"14"})]})}function j(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"}),(0,e.jsx)("polyline",{points:"15 3 21 3 21 9"}),(0,e.jsx)("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})}function v(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}function a(r){return(0,e.jsx)("svg",{...r,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",children:(0,e.jsx)("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})})}function k(r){return(0,e.jsx)("svg",{...r,xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:(0,e.jsx)("path",{transform:"scale(0.85) translate(1.8, 1.8)",d:"M5.042 15.165a2.528 2.528 0 0 1-2.52 2.523A2.528 2.528 0 0 1 0 15.165a2.527 2.527 0 0 1 2.522-2.52h2.52v2.52zM6.313 15.165a2.527 2.527 0 0 1 2.521-2.52 2.527 2.527 0 0 1 2.521 2.52v6.313A2.528 2.528 0 0 1 8.834 24a2.528 2.528 0 0 1-2.521-2.522v-6.313zM8.834 5.042a2.528 2.528 0 0 1-2.521-2.52A2.528 2.528 0 0 1 8.834 0a2.528 2.528 0 0 1 2.521 2.522v2.52H8.834zM8.834 6.313a2.528 2.528 0 0 1 2.521 2.521 2.528 2.528 0 0 1-2.521 2.521H2.522A2.528 2.528 0 0 1 0 8.834a2.528 2.528 0 0 1 2.522-2.521h6.312zM18.956 8.834a2.528 2.528 0 0 1 2.522-2.521A2.528 2.528 0 0 1 24 8.834a2.528 2.528 0 0 1-2.522 2.521h-2.522V8.834zM17.688 8.834a2.528 2.528 0 0 1-2.523 2.521 2.527 2.527 0 0 1-2.52-2.521V2.522A2.527 2.527 0 0 1 15.165 0a2.528 2.528 0 0 1 2.523 2.522v6.312zM15.165 18.956a2.528 2.528 0 0 1 2.523 2.522A2.528 2.528 0 0 1 15.165 24a2.527 2.527 0 0 1-2.52-2.522v-2.522h2.52zM15.165 17.688a2.527 2.527 0 0 1-2.52-2.523 2.526 2.526 0 0 1 2.52-2.52h6.313A2.527 2.527 0 0 1 24 15.165a2.528 2.528 0 0 1-2.522 2.523h-6.313z"})})}function p(r){return(0,e.jsx)("svg",{...r,stroke:"currentColor",fill:"currentColor",strokeWidth:"0",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,e.jsxs)("g",{children:[(0,e.jsx)("path",{fill:"none",d:"M0 0h24v24H0z"}),(0,e.jsx)("path",{d:"M3 18.5V5a3 3 0 0 1 3-3h14a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5A3.5 3.5 0 0 1 3 18.5zM19 20v-3H6.5a1.5 1.5 0 0 0 0 3H19zM10 4H6a1 1 0 0 0-1 1v10.337A3.486 3.486 0 0 1 6.5 15H19V4h-2v8l-3.5-2-3.5 2V4z"})]})})}let f=o.Z,y=i.Z;function L(r){return(0,e.jsx)("svg",{...r,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",children:(0,e.jsx)("path",{d:"m21 2-2 2m-7.61 7.61a5.5 5.5 0 1 1-7.778 7.778 5.5 5.5 0 0 1 7.777-7.777zm0 0L15.5 7.5m0 0 3 3L22 7l-3-3m-3.5 3.5L19 4"})})}function m(r){return(0,e.jsx)("svg",{...r,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",children:(0,e.jsx)("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"})})}function C(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83"}),(0,e.jsx)("path",{d:"M22 12A10 10 0 0 0 12 2v10z"})]})}function M(r){return(0,e.jsxs)("svg",{...r,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",children:[(0,e.jsx)("polyline",{points:"1 4 1 10 7 10"}),(0,e.jsx)("polyline",{points:"23 20 23 14 17 14"}),(0,e.jsx)("path",{d:"M20.49 9A9 9 0 0 0 5.64 5.64L1 10m22 4l-4.64 4.36A9 9 0 0 1 3.51 15"})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/872-34e0443f37403e69.js b/sky/dashboard/out/_next/static/chunks/872-34e0443f37403e69.js new file mode 100644 index 000000000..1011f58c2 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/872-34e0443f37403e69.js @@ -0,0 +1,16 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[872],{6409:function(e,t,r){r.d(t,{Z:function(){return n}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let n=(0,r(998).Z)("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]])},3872:function(e,t,r){r.r(t),r.d(t,{Layout:function(){return M}});var n=r(5893),s=r(7294),a=r(9071),i=r(3001),l=r(3767),o=r(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let c=(0,o.Z)("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"}]]);var d=r(6409),u=r(4849),x=r(6556);function m(){let{startTour:e}=(0,u.r)(),{shouldShowTourPrompt:t,markTourCompleted:r}=(0,x.n)(),[a,i]=(0,s.useState)(!1),[o,m]=(0,s.useState)(!1);(0,s.useEffect)(()=>{if(m(!0),t){let e=setTimeout(()=>{i(!0)},2e3);return()=>clearTimeout(e)}},[t]);let h=()=>{i(!1),r()};return o&&t&&a?(0,n.jsx)("div",{className:"fixed top-20 right-6 z-50 max-w-sm",children:(0,n.jsxs)("div",{className:"bg-white rounded-md shadow-lg border border-gray-200 p-4 transform transition-all duration-300 ease-out",children:[(0,n.jsx)("button",{onClick:h,className:"absolute top-3 right-3 text-gray-400 hover:text-gray-600 hover:bg-gray-100 rounded-full p-1 transition-all duration-150","aria-label":"Dismiss notification",children:(0,n.jsx)(l.Z,{className:"w-3 h-3"})}),(0,n.jsxs)("div",{className:"pr-6",children:[(0,n.jsxs)("div",{className:"flex items-start mb-3",children:[(0,n.jsx)("div",{className:"flex items-center justify-center w-7 h-7 bg-blue-50 rounded-full mr-3 mt-0.5",children:(0,n.jsx)(c,{className:"w-3.5 h-3.5 text-blue-600"})}),(0,n.jsxs)("div",{children:[(0,n.jsx)("h3",{className:"text-sm font-medium text-gray-900 mb-1",children:"Welcome to SkyPilot!"}),(0,n.jsx)("p",{className:"text-sm text-gray-600 leading-relaxed",children:"New to the dashboard? Take a quick guided tour to discover all the features."})]})]}),(0,n.jsxs)("div",{className:"flex space-x-2 ml-10",children:[(0,n.jsxs)("button",{onClick:()=>{i(!1),e()},className:"flex items-center px-3 py-1.5 bg-blue-600 text-white text-sm font-medium rounded hover:bg-blue-700 transition-colors duration-150",children:[(0,n.jsx)(d.Z,{className:"w-3 h-3 mr-1.5"}),"Start Tour"]}),(0,n.jsx)("button",{onClick:h,className:"px-3 py-1.5 text-sm font-medium text-gray-600 hover:text-gray-800 hover:bg-gray-100 rounded transition-colors duration-150",children:"Maybe Later"})]})]})]})}):null}/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let h=(0,o.Z)("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"}]]);function f(e){let{children:t,text:r}=e,[a,i]=(0,s.useState)(!1);return(0,n.jsxs)("div",{className:"relative",onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:[t,a&&(0,n.jsx)("div",{className:"absolute top-0 right-0 transform -translate-y-full -translate-x-2 mb-2 px-2 py-1 bg-gray-700 text-white text-xs rounded-md shadow-lg whitespace-nowrap z-50",children:r})]})}function p(){let{startTour:e}=(0,u.r)();return(0,n.jsx)(f,{text:"Start a tour",children:(0,n.jsx)("button",{onClick:e,className:"fixed bottom-4 right-4 bg-transparent text-gray-400 p-2 rounded-full hover:text-gray-500 focus:outline-none","aria-label":"Start Tour",children:(0,n.jsx)(h,{className:"h-5 w-5"})})})}let g=(0,s.createContext)(void 0);function y(e){let{children:t}=e,[r,a]=(0,s.useState)(!1),i=(0,s.useCallback)(()=>{a(!0)},[]),l=(0,s.useCallback)(()=>{a(!1)},[]);return(0,n.jsx)(g.Provider,{value:{isUpgrading:r,reportUpgrade:i,clearUpgrade:l},children:t})}function w(){let e=(0,s.useContext)(g);if(!e)throw Error("useUpgradeDetection must be used within UpgradeDetectionProvider");return e}function j(){let{isUpgrading:e}=w();return e?(0,n.jsx)("div",{className:"fixed top-0 left-0 right-0 z-[60] bg-yellow-50 border-b border-yellow-200",children:(0,n.jsx)("div",{className:"max-w-7xl mx-auto py-3 px-4 sm:px-6 lg:px-8",children:(0,n.jsx)("div",{className:"flex items-center justify-center",children:(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsxs)("svg",{className:"h-5 w-5 text-yellow-600 mr-2 animate-spin",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",children:[(0,n.jsx)("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),(0,n.jsx)("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"})]}),(0,n.jsx)("span",{className:"text-sm font-medium text-yellow-800",children:"Your SkyPilot deployment is undergoing upgrades. Refresh in a few moments."})]})})})}):null}function v(e){let t;try{t="string"==typeof e?e:e.url}catch(e){return!1}return["/_next/static/","/_next/image",".js",".mjs",".css",".woff",".woff2",".ttf",".eot",".svg",".png",".jpg",".jpeg",".gif",".webp",".ico"].some(e=>t.includes(e))}var b=r(5988),N=r(3225);function k(e){let{children:t}=e;return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{className:"fixed top-0 left-0 right-0 z-50 shadow-sm",children:(0,n.jsx)(a.Du,{})}),(0,n.jsx)("div",{className:"transition-all duration-200 ease-in-out min-h-screen",style:{paddingTop:"56px"},children:(0,n.jsx)("main",{className:"p-6",children:t})})]})}let E="__skydashboardPluginsSettled";function C(e){let{children:t,highlighted:r}=e,a=(0,i.X)(),{reportUpgrade:l,clearUpgrade:o}=w(),[c,d]=(0,s.useState)(()=>!0===window[E]);return((0,s.useEffect)(()=>{window.__upgradeInterceptorInstalled||(window.fetch=function(e,t){let r=window.fetch;return async function(n,s){let a;try{a=await r(n,s)}catch(t){try{let r="undefined"!=typeof document&&"hidden"===document.visibilityState;t&&("AbortError"===t.name||"undefined"!=typeof DOMException&&t instanceof DOMException&&t.code===DOMException.ABORT_ERR)||v(n)||r||e()}catch(e){console.error("Error in upgrade detection interceptor:",e)}throw t}try{if(v(n))return a;503===a.status?e():(a.ok||a.status>=200&&a.status<300)&&t()}catch(e){console.error("Error in upgrade detection interceptor:",e)}return a}}(l,o),window.__upgradeInterceptorInstalled=!0)},[l,o]),(0,s.useEffect)(()=>{if(c)return;let e=()=>{window[E]=!0,d(!0)},t=setTimeout(e,1e3),r=()=>{clearTimeout(t),e()};return window.addEventListener(N.gs,r,{once:!0}),window.addEventListener(N.Pn,r,{once:!0}),()=>{clearTimeout(t),window.removeEventListener(N.gs,r),window.removeEventListener(N.Pn,r)}},[c]),c)?(0,n.jsxs)("div",{className:"min-h-screen bg-gray-50",children:[(0,n.jsx)(j,{}),(0,n.jsx)(b.j,{name:"layout.navigation",context:{children:t,isMobile:a},fallback:(0,n.jsx)(k,{children:t})}),(0,n.jsx)(m,{}),(0,n.jsx)(p,{})]}):(0,n.jsx)("div",{className:"min-h-screen bg-gray-50"})}function M(e){return(0,n.jsx)(y,{children:(0,n.jsx)(a.Hn,{children:(0,n.jsx)(C,{...e})})})}},5988:function(e,t,r){r.d(t,{j:function(){return a}});var n=r(5893);r(7294);var s=r(3800);function a(e){let{name:t,context:r={},fallback:a=null,wrapperClassName:i="",prefix:l=null}=e,o=(0,s.dL)(t);return 0===o.length?a:(0,n.jsxs)("div",{className:i||void 0,children:[l,o.map(e=>{let t=e.component;return(0,n.jsx)(t,{...r},e.id)})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/937.72796f7afe54075b.js b/sky/dashboard/out/_next/static/chunks/937.72796f7afe54075b.js new file mode 100644 index 000000000..7480c1110 --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/937.72796f7afe54075b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[937],{3937:function(t,e,i){let n;i.r(e),i.d(e,{default:function(){return i2}});var s=i(2445),r=i(9432);function a(t,e,i){let n=t.getProps();return(0,r.o)(n,e,void 0!==i?i:n.custom,t)}function o(t,e){return t?.[e]??t?.default??t}let l=t=>t,{schedule:u,cancel:h,state:d,steps:p}=(0,i(3674).Z)("undefined"!=typeof requestAnimationFrame?requestAnimationFrame:l,!0);var c=i(9354);let m=new Set(["width","height","top","left","right","bottom",...c._]);class f{constructor(){this.subscriptions=[]}add(t){var e;return -1===(e=this.subscriptions).indexOf(t)&&e.push(t),()=>(function(t,e){let i=t.indexOf(e);i>-1&&t.splice(i,1)})(this.subscriptions,t)}notify(t,e,i){let n=this.subscriptions.length;if(n){if(1===n)this.subscriptions[0](t,e,i);else for(let s=0;s(void 0===n&&g.set(d.isProcessing||v.c.useManualTiming?d.timestamp:performance.now()),n),set:t=>{n=t,queueMicrotask(y)}},b=t=>!isNaN(parseFloat(t)),w={current:void 0};class T{constructor(t,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=(t,e=!0)=>{let i=g.now();if(this.updatedAt!==i&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(t),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(let t of this.dependents)t.dirty();e&&this.events.renderRequest?.notify(this.current)},this.hasAnimated=!1,this.setCurrent(t),this.owner=e.owner}setCurrent(t){this.current=t,this.updatedAt=g.now(),null===this.canTrackVelocity&&void 0!==t&&(this.canTrackVelocity=b(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,e){this.events[t]||(this.events[t]=new f);let i=this.events[t].add(e);return"change"===t?()=>{i(),u.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(let t in this.events)this.events[t].clear()}attach(t,e){this.passiveEffect=t,this.stopPassiveEffect=e}set(t,e=!0){e&&this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t,e)}setWithVelocity(t,e,i){this.set(e),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-i}jump(t,e=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return w.current&&w.current.push(this),this.current}getPrevious(){return this.prev}getVelocity(){var t;let e=g.now();if(!this.canTrackVelocity||void 0===this.prevFrameValue||e-this.updatedAt>30)return 0;let i=Math.min(this.updatedAt-this.prevUpdatedAt,30);return t=parseFloat(this.current)-parseFloat(this.prevFrameValue),i?1e3/i*t:0}start(t){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=t(e),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function S(t,e){return new T(t,e)}let A=t=>Array.isArray(t);var M=i(2558),V=i(8588);let x=(t,e)=>i=>e(t(i)),C=(...t)=>t.reduce(x);var k=i(488);let F=t=>1e3*t,P=t=>t/1e3,E={mainThread:0,waapi:0},D=()=>{},O=()=>{};var I=i(1219),N=i(7958);let R=t=>Math.round(1e5*t)/1e5,L=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu,j=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,B=(t,e)=>i=>!!("string"==typeof i&&j.test(i)&&i.startsWith(t)||e&&null!=i&&Object.prototype.hasOwnProperty.call(i,e)),$=(t,e,i)=>n=>{if("string"!=typeof n)return n;let[s,r,a,o]=n.match(L);return{[t]:parseFloat(s),[e]:parseFloat(r),[i]:parseFloat(a),alpha:void 0!==o?parseFloat(o):1}},K=t=>(0,k.u)(0,255,t),q={...N.Rx,transform:t=>Math.round(K(t))},U={test:B("rgb","red"),parse:$("red","green","blue"),transform:({red:t,green:e,blue:i,alpha:n=1})=>"rgba("+q.transform(t)+", "+q.transform(e)+", "+q.transform(i)+", "+R(N.Fq.transform(n))+")"},W={test:B("#"),parse:function(t){let e="",i="",n="",s="";return t.length>5?(e=t.substring(1,3),i=t.substring(3,5),n=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),i=t.substring(2,3),n=t.substring(3,4),s=t.substring(4,5),e+=e,i+=i,n+=n,s+=s),{red:parseInt(e,16),green:parseInt(i,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}},transform:U.transform};var _=i(7259);let Y={test:B("hsl","hue"),parse:$("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:i,alpha:n=1})=>"hsla("+Math.round(t)+", "+_.aQ.transform(R(e))+", "+_.aQ.transform(R(i))+", "+R(N.Fq.transform(n))+")"},z={test:t=>U.test(t)||W.test(t)||Y.test(t),parse:t=>U.test(t)?U.parse(t):Y.test(t)?Y.parse(t):W.parse(t),transform:t=>"string"==typeof t?t:t.hasOwnProperty("red")?U.transform(t):Y.transform(t),getAnimatableNone:t=>{let e=z.parse(t);return e.alpha=0,z.transform(e)}},G=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu,H="number",X="color",Z=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Q(t){let e=t.toString(),i=[],n={color:[],number:[],var:[]},s=[],r=0,a=e.replace(Z,t=>(z.test(t)?(n.color.push(r),s.push(X),i.push(z.parse(t))):t.startsWith("var(")?(n.var.push(r),s.push("var"),i.push(t)):(n.number.push(r),s.push(H),i.push(parseFloat(t))),++r,"${}")).split("${}");return{values:i,split:a,indexes:n,types:s}}function J(t){return Q(t).values}function tt(t){let{split:e,types:i}=Q(t),n=e.length;return t=>{let s="";for(let r=0;r"number"==typeof t?0:z.test(t)?z.getAnimatableNone(t):t,ti={test:function(t){return isNaN(t)&&"string"==typeof t&&(t.match(L)?.length||0)+(t.match(G)?.length||0)>0},parse:J,createTransformer:tt,getAnimatableNone:function(t){let e=J(t);return tt(t)(e.map(te))}};function tn(t,e,i){return(i<0&&(i+=1),i>1&&(i-=1),i<1/6)?t+(e-t)*6*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t}function ts(t,e){return i=>i>0?e:t}let tr=(t,e,i)=>t+(e-t)*i,ta=(t,e,i)=>{let n=t*t,s=i*(e*e-n)+n;return s<0?0:Math.sqrt(s)},to=[W,U,Y],tl=t=>to.find(e=>e.test(t));function tu(t){let e=tl(t);if(D(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`),!e)return!1;let i=e.parse(t);return e===Y&&(i=function({hue:t,saturation:e,lightness:i,alpha:n}){t/=360,i/=100;let s=0,r=0,a=0;if(e/=100){let n=i<.5?i*(1+e):i+e-i*e,o=2*i-n;s=tn(o,n,t+1/3),r=tn(o,n,t),a=tn(o,n,t-1/3)}else s=r=a=i;return{red:Math.round(255*s),green:Math.round(255*r),blue:Math.round(255*a),alpha:n}}(i)),i}let th=(t,e)=>{let i=tu(t),n=tu(e);if(!i||!n)return ts(t,e);let s={...i};return t=>(s.red=ta(i.red,n.red,t),s.green=ta(i.green,n.green,t),s.blue=ta(i.blue,n.blue,t),s.alpha=tr(i.alpha,n.alpha,t),U.transform(s))},td=new Set(["none","hidden"]);function tp(t,e){return i=>tr(t,e,i)}function tc(t){return"number"==typeof t?tp:"string"==typeof t?(0,I.t)(t)?ts:z.test(t)?th:tv:Array.isArray(t)?tm:"object"==typeof t?z.test(t)?th:tf:ts}function tm(t,e){let i=[...t],n=i.length,s=t.map((t,i)=>tc(t)(t,e[i]));return t=>{for(let e=0;e{for(let e in n)i[e]=n[e](t);return i}}let tv=(t,e)=>{let i=ti.createTransformer(e),n=Q(t),s=Q(e);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?td.has(t)&&!s.values.length||td.has(e)&&!n.values.length?td.has(t)?i=>i<=0?t:e:i=>i>=1?e:t:C(tm(function(t,e){let i=[],n={color:0,var:0,number:0};for(let s=0;s{let e=({timestamp:e})=>t(e);return{start:(t=!0)=>u.update(e,t),stop:()=>h(e),now:()=>d.isProcessing?d.timestamp:g.now()}},tb=(t,e,i=10)=>{let n="",s=Math.max(Math.round(e/i),2);for(let e=0;e=2e4?1/0:e}function tT(t,e,i){var n,s;let r=Math.max(e-5,0);return n=i-t(r),(s=e-r)?1e3/s*n:0}let tS={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1};function tA(t,e){return t*Math.sqrt(1-e*e)}let tM=["duration","bounce"],tV=["stiffness","damping","mass"];function tx(t,e){return e.some(e=>void 0!==t[e])}function tC(t=tS.visualDuration,e=tS.bounce){let i;let n="object"!=typeof t?{visualDuration:t,keyframes:[0,1],bounce:e}:t,{restSpeed:s,restDelta:r}=n,a=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:a},{stiffness:u,damping:h,mass:d,duration:p,velocity:c,isResolvedFromDuration:m}=function(t){let e={velocity:tS.velocity,stiffness:tS.stiffness,damping:tS.damping,mass:tS.mass,isResolvedFromDuration:!1,...t};if(!tx(t,tV)&&tx(t,tM)){if(t.visualDuration){let i=2*Math.PI/(1.2*t.visualDuration),n=i*i,s=2*(0,k.u)(.05,1,1-(t.bounce||0))*Math.sqrt(n);e={...e,mass:tS.mass,stiffness:n,damping:s}}else{let i=function({duration:t=tS.duration,bounce:e=tS.bounce,velocity:i=tS.velocity,mass:n=tS.mass}){let s,r;D(t<=F(tS.maxDuration),"Spring duration must be 10 seconds or less");let a=1-e;a=(0,k.u)(tS.minDamping,tS.maxDamping,a),t=(0,k.u)(tS.minDuration,tS.maxDuration,P(t)),a<1?(s=e=>{let n=e*a,s=n*t;return .001-(n-i)/tA(e,a)*Math.exp(-s)},r=e=>{let n=e*a*t,r=Math.pow(a,2)*Math.pow(e,2)*t,o=tA(Math.pow(e,2),a);return(n*i+i-r)*Math.exp(-n)*(-s(e)+.001>0?-1:1)/o}):(s=e=>-.001+Math.exp(-e*t)*((e-i)*t+1),r=e=>t*t*(i-e)*Math.exp(-e*t));let o=function(t,e,i){let n=i;for(let i=1;i<12;i++)n-=t(n)/e(n);return n}(s,r,5/t);if(t=F(t),isNaN(o))return{stiffness:tS.stiffness,damping:tS.damping,duration:t};{let e=Math.pow(o,2)*n;return{stiffness:e,damping:2*a*Math.sqrt(n*e),duration:t}}}(t);(e={...e,...i,mass:tS.mass}).isResolvedFromDuration=!0}}return e}({...n,velocity:-P(n.velocity||0)}),f=c||0,v=h/(2*Math.sqrt(u*d)),y=o-a,g=P(Math.sqrt(u/d)),b=5>Math.abs(y);if(s||(s=b?tS.restSpeed.granular:tS.restSpeed.default),r||(r=b?tS.restDelta.granular:tS.restDelta.default),v<1){let t=tA(g,v);i=e=>o-Math.exp(-v*g*e)*((f+v*g*y)/t*Math.sin(t*e)+y*Math.cos(t*e))}else if(1===v)i=t=>o-Math.exp(-g*t)*(y+(f+g*y)*t);else{let t=g*Math.sqrt(v*v-1);i=e=>{let i=Math.exp(-v*g*e),n=Math.min(t*e,300);return o-i*((f+v*g*y)*Math.sinh(n)+t*y*Math.cosh(n))/t}}let w={calculatedDuration:m&&p||null,next:t=>{let e=i(t);if(m)l.done=t>=p;else{let n=0===t?f:0;v<1&&(n=0===t?F(f):tT(i,t,e));let a=Math.abs(n)<=s,u=Math.abs(o-e)<=r;l.done=a&&u}return l.value=l.done?o:e,l},toString:()=>{let t=Math.min(tw(w),2e4),e=tb(e=>w.next(t*e).value,t,30);return t+"ms "+e},toTransition:()=>{}};return w}function tk({keyframes:t,velocity:e=0,power:i=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:r=500,modifyTarget:a,min:o,max:l,restDelta:u=.5,restSpeed:h}){let d,p;let c=t[0],m={done:!1,value:c},f=t=>void 0!==o&&tl,v=t=>void 0===o?l:void 0===l?o:Math.abs(o-t)-y*Math.exp(-t/n),T=t=>b+w(t),S=t=>{let e=w(t),i=T(t);m.done=Math.abs(e)<=u,m.value=m.done?b:i},A=t=>{f(m.value)&&(d=t,p=tC({keyframes:[m.value,v(m.value)],velocity:tT(T,t,m.value),damping:s,stiffness:r,restDelta:u,restSpeed:h}))};return A(0),{calculatedDuration:null,next:t=>{let e=!1;return(p||void 0!==d||(e=!0,S(t),A(t)),void 0!==d&&t>=d)?p.next(t-d):(e||S(t),m)}}}tC.applyToOptions=t=>{let e=function(t,e=100,i){let n=i({...t,keyframes:[0,e]}),s=Math.min(tw(n),2e4);return{type:"keyframes",ease:t=>n.next(s*t).value/e,duration:P(s)}}(t,100,tC);return t.ease=e.ease,t.duration=F(e.duration),t.type="keyframes",t};let tF=(t,e,i)=>(((1-3*i+3*e)*t+(3*i-6*e))*t+3*e)*t;function tP(t,e,i,n){if(t===e&&i===n)return l;let s=e=>(function(t,e,i,n,s){let r,a;let o=0;do(r=tF(a=e+(i-e)/2,n,s)-t)>0?i=a:e=a;while(Math.abs(r)>1e-7&&++o<12);return a})(e,0,1,t,i);return t=>0===t||1===t?t:tF(s(t),e,n)}let tE=tP(.42,0,1,1),tD=tP(0,0,.58,1),tO=tP(.42,0,.58,1),tI=t=>Array.isArray(t)&&"number"!=typeof t[0],tN=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,tR=t=>e=>1-t(1-e),tL=tP(.33,1.53,.69,.99),tj=tR(tL),tB=tN(tj),t$=t=>(t*=2)<1?.5*tj(t):.5*(2-Math.pow(2,-10*(t-1))),tK=t=>1-Math.sin(Math.acos(t)),tq=tR(tK),tU=tN(tK),tW=t=>Array.isArray(t)&&"number"==typeof t[0],t_={linear:l,easeIn:tE,easeInOut:tO,easeOut:tD,circIn:tK,circInOut:tU,circOut:tq,backIn:tj,backInOut:tB,backOut:tL,anticipate:t$},tY=t=>"string"==typeof t,tz=t=>{if(tW(t)){O(4===t.length,"Cubic bezier arrays must contain four numerical values.");let[e,i,n,s]=t;return tP(e,i,n,s)}return tY(t)?(O(void 0!==t_[t],`Invalid easing type '${t}'`),t_[t]):t},tG=(t,e,i)=>{let n=e-t;return 0===n?1:(i-t)/n};function tH({duration:t=300,keyframes:e,times:i,ease:n="easeInOut"}){let s=tI(n)?n.map(tz):tz(n),r={done:!1,value:e[0]},a=function(t,e,{clamp:i=!0,ease:n,mixer:s}={}){let r=t.length;if(O(r===e.length,"Both input and output ranges must be the same length"),1===r)return()=>e[0];if(2===r&&e[0]===e[1])return()=>e[1];let a=t[0]===t[1];t[0]>t[r-1]&&(t=[...t].reverse(),e=[...e].reverse());let o=function(t,e,i){let n=[],s=i||v.c.mix||ty,r=t.length-1;for(let i=0;i{if(a&&i1)for(;nh((0,k.u)(t[0],t[r-1],e)):h}((i&&i.length===e.length?i:function(t){let e=[0];return function(t,e){let i=t[t.length-1];for(let n=1;n<=e;n++){let s=tG(0,e,n);t.push(tr(i,1,s))}}(e,t.length-1),e}(e)).map(e=>e*t),e,{ease:Array.isArray(s)?s:e.map(()=>s||tO).splice(0,e.length-1)});return{calculatedDuration:t,next:e=>(r.value=a(e),r.done=e>=t,r)}}let tX=t=>null!==t;function tZ(t,{repeat:e,repeatType:i="loop"},n,s=1){let r=t.filter(tX),a=s<0||e&&"loop"!==i&&e%2==1?0:r.length-1;return a&&void 0!==n?n:r[a]}let tQ={decay:tk,inertia:tk,tween:tH,keyframes:tH,spring:tC};function tJ(t){"string"==typeof t.type&&(t.type=tQ[t.type])}class t0{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,e){return this.finished.then(t,e)}}let t1=t=>t/100;class t2 extends t0{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{let{motionValue:t}=this.options;t&&t.updatedAt!==g.now()&&this.tick(g.now()),this.isStopped=!0,"idle"!==this.state&&(this.teardown(),this.options.onStop?.())},E.mainThread++,this.options=t,this.initAnimation(),this.play(),!1===t.autoplay&&this.pause()}initAnimation(){let{options:t}=this;tJ(t);let{type:e=tH,repeat:i=0,repeatDelay:n=0,repeatType:s,velocity:r=0}=t,{keyframes:a}=t,o=e||tH;o!==tH&&"number"!=typeof a[0]&&(this.mixKeyframes=C(t1,ty(a[0],a[1])),a=[0,100]);let l=o({...t,keyframes:a});"mirror"===s&&(this.mirroredGenerator=o({...t,keyframes:[...a].reverse(),velocity:-r})),null===l.calculatedDuration&&(l.calculatedDuration=tw(l));let{calculatedDuration:u}=l;this.calculatedDuration=u,this.resolvedDuration=u+n,this.totalDuration=this.resolvedDuration*(i+1)-n,this.generator=l}updateTime(t){let e=Math.round(t-this.startTime)*this.playbackSpeed;null!==this.holdTime?this.currentTime=this.holdTime:this.currentTime=e}tick(t,e=!1){let{generator:i,totalDuration:n,mixKeyframes:s,mirroredGenerator:r,resolvedDuration:a,calculatedDuration:o}=this;if(null===this.startTime)return i.next(0);let{delay:l=0,keyframes:u,repeat:h,repeatType:d,repeatDelay:p,type:c,onUpdate:m,finalKeyframe:f}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-n/this.speed,this.startTime)),e?this.currentTime=t:this.updateTime(t);let v=this.currentTime-l*(this.playbackSpeed>=0?1:-1),y=this.playbackSpeed>=0?v<0:v>n;this.currentTime=Math.max(v,0),"finished"===this.state&&null===this.holdTime&&(this.currentTime=n);let g=this.currentTime,b=i;if(h){let t=Math.min(this.currentTime,n)/a,e=Math.floor(t),i=t%1;!i&&t>=1&&(i=1),1===i&&e--,(e=Math.min(e,h+1))%2&&("reverse"===d?(i=1-i,p&&(i-=p/a)):"mirror"===d&&(b=r)),g=(0,k.u)(0,1,i)*a}let w=y?{done:!1,value:u[0]}:b.next(g);s&&(w.value=s(w.value));let{done:T}=w;y||null===o||(T=this.playbackSpeed>=0?this.currentTime>=n:this.currentTime<=0);let S=null===this.holdTime&&("finished"===this.state||"running"===this.state&&T);return S&&c!==tk&&(w.value=tZ(u,this.options,f,this.speed)),m&&m(w.value),S&&this.finish(),w}then(t,e){return this.finished.then(t,e)}get duration(){return P(this.calculatedDuration)}get time(){return P(this.currentTime)}set time(t){t=F(t),this.currentTime=t,null===this.startTime||null!==this.holdTime||0===this.playbackSpeed?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(g.now());let e=this.playbackSpeed!==t;this.playbackSpeed=t,e&&(this.time=P(this.currentTime))}play(){if(this.isStopped)return;let{driver:t=tg,startTime:e}=this.options;this.driver||(this.driver=t(t=>this.tick(t))),this.options.onPlay?.();let i=this.driver.now();"finished"===this.state?(this.updateFinished(),this.startTime=i):null!==this.holdTime?this.startTime=i-this.holdTime:this.startTime||(this.startTime=e??i),"finished"===this.state&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(g.now()),this.holdTime=this.currentTime}complete(){"running"!==this.state&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null,E.mainThread--}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),t.observe(this)}}let t5=t=>180*t/Math.PI,t3=t=>t6(t5(Math.atan2(t[1],t[0]))),t4={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:t3,rotateZ:t3,skewX:t=>t5(Math.atan(t[1])),skewY:t=>t5(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},t6=t=>((t%=360)<0&&(t+=360),t),t9=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),t8=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),t7={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:t9,scaleY:t8,scale:t=>(t9(t)+t8(t))/2,rotateX:t=>t6(t5(Math.atan2(t[6],t[5]))),rotateY:t=>t6(t5(Math.atan2(-t[2],t[0]))),rotateZ:t3,rotate:t3,skewX:t=>t5(Math.atan(t[4])),skewY:t=>t5(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function et(t){return t.includes("scale")?1:0}function ee(t,e){let i,n;if(!t||"none"===t)return et(e);let s=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);if(s)i=t7,n=s;else{let e=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=t4,n=e}if(!n)return et(e);let r=i[e],a=n[1].split(",").map(en);return"function"==typeof r?r(a):a[r]}let ei=(t,e)=>{let{transform:i="none"}=getComputedStyle(t);return ee(i,e)};function en(t){return parseFloat(t.trim())}let es=t=>t===N.Rx||t===_.px,er=new Set(["x","y","z"]),ea=c._.filter(t=>!er.has(t)),eo={width:({x:t},{paddingLeft:e="0",paddingRight:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),height:({y:t},{paddingTop:e="0",paddingBottom:i="0"})=>t.max-t.min-parseFloat(e)-parseFloat(i),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>ee(e,"x"),y:(t,{transform:e})=>ee(e,"y")};eo.translateX=eo.x,eo.translateY=eo.y;let el=new Set,eu=!1,eh=!1,ed=!1;function ep(){if(eh){let t=Array.from(el).filter(t=>t.needsMeasurement),e=new Set(t.map(t=>t.element)),i=new Map;e.forEach(t=>{let e=function(t){let e=[];return ea.forEach(i=>{let n=t.getValue(i);void 0!==n&&(e.push([i,n.get()]),n.set(i.startsWith("scale")?1:0))}),e}(t);e.length&&(i.set(t,e),t.render())}),t.forEach(t=>t.measureInitialState()),e.forEach(t=>{t.render();let e=i.get(t);e&&e.forEach(([e,i])=>{t.getValue(e)?.set(i)})}),t.forEach(t=>t.measureEndState()),t.forEach(t=>{void 0!==t.suspendedScrollY&&window.scrollTo(0,t.suspendedScrollY)})}eh=!1,eu=!1,el.forEach(t=>t.complete(ed)),el.clear()}function ec(){el.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(eh=!0)})}class em{constructor(t,e,i,n,s,r=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=e,this.name=i,this.motionValue=n,this.element=s,this.isAsync=r}scheduleResolve(){this.state="scheduled",this.isAsync?(el.add(this),eu||(eu=!0,u.read(ec),u.resolveKeyframes(ep))):(this.readKeyframes(),this.complete())}readKeyframes(){let{unresolvedKeyframes:t,name:e,element:i,motionValue:n}=this;if(null===t[0]){let s=n?.get(),r=t[t.length-1];if(void 0!==s)t[0]=s;else if(i&&e){let n=i.readValue(e,r);null!=n&&(t[0]=n)}void 0===t[0]&&(t[0]=r),n&&void 0===s&&n.set(t[0])}!function(t){for(let e=1;et.startsWith("--");function ev(t){let e;return()=>(void 0===e&&(e=t()),e)}let ey=ev(()=>void 0!==window.ScrollTimeline);var eg=i(7275);let eb={},ew=function(t,e){let i=ev(t);return()=>eb[e]??i()}(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch(t){return!1}return!0},"linearEasing"),eT=([t,e,i,n])=>`cubic-bezier(${t}, ${e}, ${i}, ${n})`,eS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:eT([0,.65,.55,1]),circOut:eT([.55,0,1,.45]),backIn:eT([.31,.01,.66,-.59]),backOut:eT([.33,1.53,.69,.99])};function eA(t){return"function"==typeof t&&"applyToOptions"in t}class eM extends t0{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;let{element:e,name:i,keyframes:n,pseudoElement:s,allowFlatten:r=!1,finalKeyframe:a,onComplete:o}=t;this.isPseudoElement=!!s,this.allowFlatten=r,this.options=t,O("string"!=typeof t.type,'animateMini doesn\'t support "type" as a string. Did you mean to import { spring } from "motion"?');let l=function({type:t,...e}){return eA(t)&&ew()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}(t);this.animation=function(t,e,i,{delay:n=0,duration:s=300,repeat:r=0,repeatType:a="loop",ease:o="easeOut",times:l}={},u){let h={[e]:i};l&&(h.offset=l);let d=function t(e,i){if(e)return"function"==typeof e?ew()?tb(e,i):"ease-out":tW(e)?eT(e):Array.isArray(e)?e.map(e=>t(e,i)||eS.easeOut):eS[e]}(o,s);Array.isArray(d)&&(h.easing=d),eg.f.value&&E.waapi++;let p={delay:n,duration:s,easing:Array.isArray(d)?"linear":d,fill:"both",iterations:r+1,direction:"reverse"===a?"alternate":"normal"};u&&(p.pseudoElement=u);let c=t.animate(h,p);return eg.f.value&&c.finished.finally(()=>{E.waapi--}),c}(e,i,n,l,s),!1===l.autoplay&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!s){let t=tZ(n,this.options,a,this.speed);this.updateMotionValue?this.updateMotionValue(t):ef(i)?e.style.setProperty(i,t):e.style[i]=t,this.animation.cancel()}o?.(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),"finished"===this.state&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch(t){}}stop(){if(this.isStopped)return;this.isStopped=!0;let{state:t}=this;"idle"!==t&&"finished"!==t&&(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){return P(Number(this.animation.effect?.getComputedTiming?.().duration||0))}get time(){return P(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=F(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return null!==this.finishedTime?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:e}){return(this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,t&&ey())?(this.animation.timeline=t,l):e(this)}}let eV={anticipate:t$,backInOut:tB,circInOut:tU};class ex extends eM{constructor(t){"string"==typeof t.ease&&t.ease in eV&&(t.ease=eV[t.ease]),tJ(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){let{motionValue:e,onUpdate:i,onComplete:n,element:s,...r}=this.options;if(!e)return;if(void 0!==t){e.set(t);return}let a=new t2({...r,autoplay:!1}),o=F(this.finishedTime??this.time);e.setWithVelocity(a.sample(o-10).value,a.sample(o).value,10),a.stop()}}let eC=(t,e)=>"zIndex"!==e&&!!("number"==typeof t||Array.isArray(t)||"string"==typeof t&&(ti.test(t)||"0"===t)&&!t.startsWith("url("));var ek=i(7596);let eF=new Set(["opacity","clipPath","filter","transform"]),eP=ev(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));class eE extends t0{constructor({autoplay:t=!0,delay:e=0,type:i="keyframes",repeat:n=0,repeatDelay:s=0,repeatType:r="loop",keyframes:a,name:o,motionValue:l,element:u,...h}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=g.now();let d={autoplay:t,delay:e,type:i,repeat:n,repeatDelay:s,repeatType:r,name:o,motionValue:l,element:u,...h},p=u?.KeyframeResolver||em;this.keyframeResolver=new p(a,(t,e,i)=>this.onKeyframesResolved(t,e,d,!i),o,l,u),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(t,e,i,n){this.keyframeResolver=void 0;let{name:s,type:r,velocity:a,delay:o,isHandoff:u,onUpdate:h}=i;this.resolvedAt=g.now(),!function(t,e,i,n){let s=t[0];if(null===s)return!1;if("display"===e||"visibility"===e)return!0;let r=t[t.length-1],a=eC(s,e),o=eC(r,e);return D(a===o,`You are trying to animate ${e} from "${s}" to "${r}". ${s} is not an animatable value - to enable this animation set ${s} to a value animatable to ${r} via the \`style\` property.`),!!a&&!!o&&(function(t){let e=t[0];if(1===t.length)return!0;for(let i=0;i40?this.resolvedAt:this.createdAt:void 0,finalKeyframe:e,...i,keyframes:t},p=!u&&function(t){let{motionValue:e,name:i,repeatDelay:n,repeatType:s,damping:r,type:a}=t;if(!(0,ek.R)(e?.owner?.current))return!1;let{onUpdate:o,transformTemplate:l}=e.owner.getProps();return eP()&&i&&eF.has(i)&&("transform"!==i||!l)&&!o&&!n&&"mirror"!==s&&0!==r&&"inertia"!==a}(d)?new ex({...d,element:d.motionValue.owner.current}):new t2(d);p.finished.then(()=>this.notifyFinished()).catch(l),this.pendingTimeline&&(this.stopTimeline=p.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=p}get finished(){return this._animation?this.animation.finished:this._finished}then(t,e){return this.finished.finally(t).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),ed=!0,ec(),ep(),ed=!1),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}let eD=t=>null!==t,eO={type:"spring",stiffness:500,damping:25,restSpeed:10},eI=t=>({type:"spring",stiffness:550,damping:0===t?2*Math.sqrt(550):30,restSpeed:10}),eN={type:"keyframes",duration:.8},eR={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},eL=(t,{keyframes:e})=>e.length>2?eN:c.G.has(t)?t.startsWith("scale")?eI(e[1]):eO:eR,ej=(t,e,i,n={},s,r)=>a=>{let l=o(n,t)||{},h=l.delay||n.delay||0,{elapsed:d=0}=n;d-=F(h);let p={keyframes:Array.isArray(i)?i:[null,i],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:t=>{e.set(t),l.onUpdate&&l.onUpdate(t)},onComplete:()=>{a(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:r?void 0:s};!function({when:t,delay:e,delayChildren:i,staggerChildren:n,staggerDirection:s,repeat:r,repeatType:a,repeatDelay:o,from:l,elapsed:u,...h}){return!!Object.keys(h).length}(l)&&Object.assign(p,eL(t,p)),p.duration&&(p.duration=F(p.duration)),p.repeatDelay&&(p.repeatDelay=F(p.repeatDelay)),void 0!==p.from&&(p.keyframes[0]=p.from);let c=!1;if(!1!==p.type&&(0!==p.duration||p.repeatDelay)||(p.duration=0,0!==p.delay||(c=!0)),(v.c.instantAnimations||v.c.skipAnimations)&&(c=!0,p.duration=0,p.delay=0),p.allowFlatten=!l.type&&!l.ease,c&&!r&&void 0!==e.get()){let t=function(t,{repeat:e,repeatType:i="loop"},n){let s=t.filter(eD),r=e&&"loop"!==i&&e%2==1?0:s.length-1;return s[r]}(p.keyframes,l);if(void 0!==t){u.update(()=>{p.onUpdate(t),p.onComplete()});return}}return l.isSync?new t2(p):new eE(p)};function eB(t,e,{delay:i=0,transitionOverride:n,type:s}={}){let{transition:r=t.getDefaultTransition(),transitionEnd:l,...h}=e;n&&(r=n);let d=[],p=s&&t.animationState&&t.animationState.getState()[s];for(let e in h){let n=t.getValue(e,t.latestValues[e]??null),s=h[e];if(void 0===s||p&&function({protectedKeys:t,needsAnimating:e},i){let n=t.hasOwnProperty(i)&&!0!==e[i];return e[i]=!1,n}(p,e))continue;let a={delay:i,...o(r||{},e)},l=n.get();if(void 0!==l&&!n.isAnimating&&!Array.isArray(s)&&s===l&&!a.velocity)continue;let c=!1;if(window.MotionHandoffAnimation){let i=t.props[V.M];if(i){let t=window.MotionHandoffAnimation(i,e,u);null!==t&&(a.startTime=t,c=!0)}}!function(t,e){let i=t.getValue("willChange");if((0,M.i)(i)&&i.add)return i.add(e);if(!i&&v.c.WillChange){let i=new v.c.WillChange("auto");t.addValue("willChange",i),i.add(e)}}(t,e),n.start(ej(e,n,s,t.shouldReduceMotion&&m.has(e)?{type:!1}:a,t,c));let f=n.animation;f&&d.push(f)}return l&&Promise.all(d).then(()=>{u.update(()=>{l&&function(t,e){let{transitionEnd:i={},transition:n={},...s}=a(t,e)||{};for(let e in s={...s,...i}){var r;let i=A(r=s[e])?r[r.length-1]||0:r;t.hasValue(e)?t.getValue(e).set(i):t.addValue(e,S(i))}}(t,l)})}),d}function e$(t,e,i={}){let n=a(t,e,"exit"===i.type?t.presenceContext?.custom:void 0),{transition:s=t.getDefaultTransition()||{}}=n||{};i.transitionOverride&&(s=i.transitionOverride);let r=n?()=>Promise.all(eB(t,n,i)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(n=0)=>{let{delayChildren:r=0,staggerChildren:a,staggerDirection:o}=s;return function(t,e,i=0,n=0,s=1,r){let a=[],o=(t.variantChildren.size-1)*n,l=1===s?(t=0)=>t*n:(t=0)=>o-t*n;return Array.from(t.variantChildren).sort(eK).forEach((t,n)=>{t.notify("AnimationStart",e),a.push(e$(t,e,{...r,delay:i+l(n)}).then(()=>t.notify("AnimationComplete",e)))}),Promise.all(a)}(t,e,r+n,a,o,i)}:()=>Promise.resolve(),{when:l}=s;if(!l)return Promise.all([r(),o(i.delay)]);{let[t,e]="beforeChildren"===l?[r,o]:[o,r];return t().then(()=>e())}}function eK(t,e){return t.sortNodePosition(e)}function eq(t,e){if(!Array.isArray(e))return!1;let i=e.length;if(i!==t.length)return!1;for(let n=0;nPromise.all(e.map(({animation:e,options:i})=>(function(t,e,i={}){let n;if(t.notify("AnimationStart",e),Array.isArray(e))n=Promise.all(e.map(e=>e$(t,e,i)));else if("string"==typeof e)n=e$(t,e,i);else{let s="function"==typeof e?a(t,e,i.custom):e;n=Promise.all(eB(t,s,i))}return n.then(()=>{t.notify("AnimationComplete",e)})})(t,e,i))),i=eH(),n=!0,r=e=>(i,n)=>{let s=a(t,n,"exit"===e?t.presenceContext?.custom:void 0);if(s){let{transition:t,transitionEnd:e,...n}=s;i={...i,...n,...e}}return i};function o(o){let{props:l}=t,u=function t(e){if(!e)return;if(!e.isControllingVariants){let i=e.parent&&t(e.parent)||{};return void 0!==e.props.initial&&(i.initial=e.props.initial),i}let i={};for(let t=0;tc&&y,S=!1,M=Array.isArray(v)?v:[v],V=M.reduce(r(a),{});!1===g&&(V={});let{prevResolvedValues:x={}}=f,C={...x,...V},k=e=>{T=!0,d.has(e)&&(S=!0,d.delete(e)),f.needsAnimating[e]=!0;let i=t.getValue(e);i&&(i.liveStyle=!1)};for(let t in C){let e=V[t],i=x[t];if(!p.hasOwnProperty(t))(A(e)&&A(i)?eq(e,i):e===i)?void 0!==e&&d.has(t)?k(t):f.protectedKeys[t]=!0:null!=e?k(t):d.add(t)}f.prevProp=v,f.prevResolvedValues=V,f.isActive&&(p={...p,...V}),n&&t.blockInitialAnimation&&(T=!1);let F=!(b&&w)||S;T&&F&&h.push(...M.map(t=>({animation:t,options:{type:a}})))}if(d.size){let e={};if("boolean"!=typeof l.initial){let i=a(t,Array.isArray(l.initial)?l.initial[0]:l.initial);i&&i.transition&&(e.transition=i.transition)}d.forEach(i=>{let n=t.getBaseTarget(i),s=t.getValue(i);s&&(s.liveStyle=!0),e[i]=n??null}),h.push({animation:e})}let f=!!h.length;return n&&(!1===l.initial||l.initial===l.animate)&&!t.manuallyAnimateOnMount&&(f=!1),n=!1,f?e(h):Promise.resolve()}return{animateChanges:o,setActive:function(e,n){if(i[e].isActive===n)return Promise.resolve();t.variantChildren?.forEach(t=>t.animationState?.setActive(e,n)),i[e].isActive=n;let s=o(e);for(let t in i)i[t].protectedKeys={};return s},setAnimateFunction:function(i){e=i(t)},getState:()=>i,reset:()=>{i=eH(),n=!0}}}(t))}updateAnimationControlsSubscription(){let{animate:t}=this.node.getProps();(0,s.H)(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){let{animate:t}=this.node.getProps(),{animate:e}=this.node.prevProps||{};t!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let eQ=0;class eJ extends eX{constructor(){super(...arguments),this.id=eQ++}update(){if(!this.node.presenceContext)return;let{isPresent:t,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===i)return;let n=this.node.animationState.setActive("exit",!t);e&&!t&&n.then(()=>{e(this.id)})}mount(){let{register:t,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),t&&(this.unmount=t(this.id))}unmount(){}}let e0={x:!1,y:!1};function e1(t,e){let i=function(t,e,i){if(t instanceof EventTarget)return[t];if("string"==typeof t){let e=document,i=(void 0)??e.querySelectorAll(t);return i?Array.from(i):[]}return Array.from(t)}(t),n=new AbortController;return[i,{passive:!0,...e,signal:n.signal},()=>n.abort()]}function e2(t){return!("touch"===t.pointerType||e0.x||e0.y)}function e5(t){return{point:{x:t.pageX,y:t.pageY}}}function e3(t,e,i){let{props:n}=t;t.animationState&&n.whileHover&&t.animationState.setActive("whileHover","Start"===i);let s=n["onHover"+i];s&&u.postRender(()=>s(e,e5(e)))}class e4 extends eX{mount(){let{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){let[n,s,r]=e1(t,i),a=t=>{if(!e2(t))return;let{target:i}=t,n=e(i,t);if("function"!=typeof n||!i)return;let r=t=>{e2(t)&&(n(t),i.removeEventListener("pointerleave",r))};i.addEventListener("pointerleave",r,s)};return n.forEach(t=>{t.addEventListener("pointerenter",a,s)}),r}(t,(t,e)=>(e3(this.node,e,"Start"),t=>e3(this.node,t,"End"))))}unmount(){}}function e6(t,e,i,n={passive:!0}){return t.addEventListener(e,i,n),()=>t.removeEventListener(e,i)}class e9 extends eX{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch(e){t=!0}t&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){this.isActive&&this.node.animationState&&(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=C(e6(this.node.current,"focus",()=>this.onFocus()),e6(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}let e8=(t,e)=>!!e&&(t===e||e8(t,e.parentElement)),e7=t=>"mouse"===t.pointerType?"number"!=typeof t.button||t.button<=0:!1!==t.isPrimary,it=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]),ie=new WeakSet;function ii(t){return e=>{"Enter"===e.key&&t(e)}}function is(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}let ir=(t,e)=>{let i=t.currentTarget;if(!i)return;let n=ii(()=>{if(ie.has(i))return;is(i,"down");let t=ii(()=>{is(i,"up")});i.addEventListener("keyup",t,e),i.addEventListener("blur",()=>is(i,"cancel"),e)});i.addEventListener("keydown",n,e),i.addEventListener("blur",()=>i.removeEventListener("keydown",n),e)};function ia(t){return e7(t)&&!(e0.x||e0.y)}function io(t,e,i){let{props:n}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&n.whileTap&&t.animationState.setActive("whileTap","Start"===i);let s=n["onTap"+("End"===i?"":i)];s&&u.postRender(()=>s(e,e5(e)))}class il extends eX{mount(){let{current:t}=this.node;t&&(this.unmount=function(t,e,i={}){let[n,s,r]=e1(t,i),a=t=>{let n=t.currentTarget;if(!ia(t))return;ie.add(n);let r=e(n,t),a=(t,e)=>{window.removeEventListener("pointerup",o),window.removeEventListener("pointercancel",l),ie.has(n)&&ie.delete(n),ia(t)&&"function"==typeof r&&r(t,{success:e})},o=t=>{a(t,n===window||n===document||i.useGlobalTarget||e8(n,t.target))},l=t=>{a(t,!1)};window.addEventListener("pointerup",o,s),window.addEventListener("pointercancel",l,s)};return n.forEach(t=>{(i.useGlobalTarget?window:t).addEventListener("pointerdown",a,s),(0,ek.R)(t)&&(t.addEventListener("focus",t=>ir(t,s)),it.has(t.tagName)||-1!==t.tabIndex||t.hasAttribute("tabindex")||(t.tabIndex=0))}),r}(t,(t,e)=>(io(this.node,e,"Start"),(t,{success:e})=>io(this.node,t,e?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}let iu=new WeakMap,ih=new WeakMap,id=t=>{let e=iu.get(t.target);e&&e(t)},ip=t=>{t.forEach(id)},ic={some:0,all:1};class im extends eX{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();let{viewport:t={}}=this.node.getProps(),{root:e,margin:i,amount:n="some",once:s}=t,r={root:e?e.current:void 0,rootMargin:i,threshold:"number"==typeof n?n:ic[n]};return function(t,e,i){let n=function({root:t,...e}){let i=t||document;ih.has(i)||ih.set(i,{});let n=ih.get(i),s=JSON.stringify(e);return n[s]||(n[s]=new IntersectionObserver(ip,{root:t,...e})),n[s]}(e);return iu.set(t,i),n.observe(t),()=>{iu.delete(t),n.unobserve(t)}}(this.node.current,r,t=>{let{isIntersecting:e}=t;if(this.isInView===e||(this.isInView=e,s&&!e&&this.hasEnteredView))return;e&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",e);let{onViewportEnter:i,onViewportLeave:n}=this.node.getProps(),r=e?i:n;r&&r(t)})}mount(){this.startObserver()}update(){if("undefined"==typeof IntersectionObserver)return;let{props:t,prevProps:e}=this.node;["amount","margin","root"].some(function({viewport:t={}},{viewport:e={}}={}){return i=>t[i]!==e[i]}(t,e))&&this.startObserver()}unmount(){}}var iv=i(7294);let iy=t=>e=>e.test(t),ig=[N.Rx,_.px,_.aQ,_.RW,_.vw,_.vh,{test:t=>"auto"===t,parse:t=>t}],ib=t=>ig.find(iy(t)),iw=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t),iT=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u,iS=t=>/^0[^.\s]+$/u.test(t),iA=new Set(["brightness","contrast","saturate","opacity"]);function iM(t){let[e,i]=t.slice(0,-1).split("(");if("drop-shadow"===e)return t;let[n]=i.match(L)||[];if(!n)return t;let s=i.replace(n,""),r=iA.has(e)?1:0;return n!==i&&(r*=100),e+"("+r+s+")"}let iV=/\b([a-z-]*)\(.*?\)/gu,ix={...ti,getAnimatableNone:t=>{let e=t.match(iV);return e?e.map(iM).join(" "):t}},iC={...i(354).j,color:z,backgroundColor:z,outlineColor:z,fill:z,stroke:z,borderColor:z,borderTopColor:z,borderRightColor:z,borderBottomColor:z,borderLeftColor:z,filter:ix,WebkitFilter:ix},ik=t=>iC[t];function iF(t,e){let i=ik(t);return i!==ix&&(i=ti),i.getAnimatableNone?i.getAnimatableNone(e):void 0}let iP=new Set(["auto","none","0"]);class iE extends em{constructor(t,e,i,n,s){super(t,e,i,n,s,!0)}readKeyframes(){let{unresolvedKeyframes:t,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let i=0;i{t.getValue(e).set(i)}),this.resolveNoneKeyframes()}}let iD=[...ig,z,ti],iO=t=>iD.find(iy(t));var iI=i(9442);let iN=()=>({min:0,max:0}),iR=()=>({x:iN(),y:iN()});var iL=i(1741);let ij={current:null},iB={current:!1},i$=new WeakMap;var iK=i(7504);let iq=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class iU{scrapeMotionValuesFromProps(t,e,i){return{}}constructor({parent:t,props:e,presenceContext:i,reducedMotionConfig:n,blockInitialAnimation:s,visualState:r},a={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=em,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{let t=g.now();this.renderScheduledAtthis.bindToMotionValue(e,t)),iB.current||function(){if(iB.current=!0,iL.j){if(window.matchMedia){let t=window.matchMedia("(prefers-reduced-motion)"),e=()=>ij.current=t.matches;t.addListener(e),e()}else ij.current=!1}}(),this.shouldReduceMotion="never"!==this.reducedMotionConfig&&("always"===this.reducedMotionConfig||ij.current),this.parent&&this.parent.children.add(this),this.update(this.props,this.presenceContext)}unmount(){for(let t in this.projection&&this.projection.unmount(),h(this.notifyUpdate),h(this.render),this.valueSubscriptions.forEach(t=>t()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent&&this.parent.children.delete(this),this.events)this.events[t].clear();for(let t in this.features){let e=this.features[t];e&&(e.unmount(),e.isMounted=!1)}this.current=null}bindToMotionValue(t,e){let i;this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();let n=c.G.has(t);n&&this.onBindTransform&&this.onBindTransform();let s=e.on("change",e=>{this.latestValues[t]=e,this.props.onUpdate&&u.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0)}),r=e.on("renderRequest",this.scheduleRender);window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,t,e)),this.valueSubscriptions.set(t,()=>{s(),r(),i&&i(),e.owner&&e.stop()})}sortNodePosition(t){return this.current&&this.sortInstanceNodePosition&&this.type===t.type?this.sortInstanceNodePosition(this.current,t.current):0}updateFeatures(){let t="animation";for(t in iI.featureDefinitions){let e=iI.featureDefinitions[t];if(!e)continue;let{isEnabled:i,Feature:n}=e;if(!this.features[t]&&n&&i(this.props)&&(this.features[t]=new n(this)),this.features[t]){let e=this.features[t];e.isMounted?e.update():(e.mount(),e.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):iR()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,e){this.latestValues[t]=e}update(t,e){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let e=0;ee.variantChildren.delete(t)}addValue(t,e){let i=this.values.get(t);e!==i&&(i&&this.removeValue(t),this.bindToMotionValue(t,e),this.values.set(t,e),this.latestValues[t]=e.get())}removeValue(t){this.values.delete(t);let e=this.valueSubscriptions.get(t);e&&(e(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,e){if(this.props.values&&this.props.values[t])return this.props.values[t];let i=this.values.get(t);return void 0===i&&void 0!==e&&(i=S(null===e?void 0:e,{owner:this}),this.addValue(t,i)),i}readValue(t,e){let i=void 0===this.latestValues[t]&&this.current?this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options):this.latestValues[t];return null!=i&&("string"==typeof i&&(iw(i)||iS(i))?i=parseFloat(i):!iO(i)&&ti.test(e)&&(i=iF(t,e)),this.setBaseTarget(t,(0,M.i)(i)?i.get():i)),(0,M.i)(i)?i.get():i}setBaseTarget(t,e){this.baseTarget[t]=e}getBaseTarget(t){let e;let{initial:i}=this.props;if("string"==typeof i||"object"==typeof i){let n=(0,r.o)(this.props,i,this.presenceContext?.custom);n&&(e=n[t])}if(i&&void 0!==e)return e;let n=this.getBaseTargetFromProps(this.props,t);return void 0===n||(0,M.i)(n)?void 0!==this.initialValues[t]&&void 0===e?void 0:this.baseTarget[t]:n}on(t,e){return this.events[t]||(this.events[t]=new f),this.events[t].add(e)}notify(t,...e){this.events[t]&&this.events[t].notify(...e)}}class iW extends iU{constructor(){super(...arguments),this.KeyframeResolver=iE}sortInstanceNodePosition(t,e){return 2&t.compareDocumentPosition(e)?1:-1}getBaseTargetFromProps(t,e){return t.style?t.style[e]:void 0}removeValueFromRenderState(t,{vars:e,style:i}){delete e[t],delete i[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);let{children:t}=this.props;(0,M.i)(t)&&(this.childSubscription=t.on("change",t=>{this.current&&(this.current.textContent=`${t}`)}))}}var i_=i(1069);function iY(t,{style:e,vars:i},n,s){for(let r in Object.assign(t.style,e,s&&s.getProjectionStyles(n)),i)t.style.setProperty(r,i[r])}var iz=i(189);class iG extends iW{constructor(){super(...arguments),this.type="html",this.renderInstance=iY}readValueFromInstance(t,e){if(c.G.has(e))return this.projection?.isProjecting?et(e):ei(t,e);{let i=window.getComputedStyle(t),n=((0,I.f)(e)?i.getPropertyValue(e):i[e])||0;return"string"==typeof n?n.trim():n}}measureInstanceViewportBox(t,{transformPagePoint:e}){return function({top:t,left:e,right:i,bottom:n}){return{x:{min:e,max:i},y:{min:t,max:n}}}(function(t,e){if(!e)return t;let i=e({x:t.left,y:t.top}),n=e({x:t.right,y:t.bottom});return{top:i.y,left:i.x,bottom:n.y,right:n.x}}(t.getBoundingClientRect(),e))}build(t,e,i){(0,i_.r)(t,e,i.transformTemplate)}scrapeMotionValuesFromProps(t,e,i){return(0,iz.U)(t,e,i)}}var iH=i(3193),iX=i(2617);let iZ=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]);var iQ=i(9854),iJ=i(6832);class i0 extends iW{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=iR}getBaseTargetFromProps(t,e){return t[e]}readValueFromInstance(t,e){if(c.G.has(e)){let t=ik(e);return t&&t.default||0}return e=iZ.has(e)?e:(0,iH.D)(e),t.getAttribute(e)}scrapeMotionValuesFromProps(t,e,i){return(0,iJ.U)(t,e,i)}build(t,e,i){(0,iX.i)(t,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(t,e,i,n){!function(t,e,i,n){for(let i in iY(t,e,void 0,n),e.attrs)t.setAttribute(iZ.has(i)?i:(0,iH.D)(i),e.attrs[i])}(t,e,0,n)}mount(t){this.isSVGTag=(0,iQ.a)(t.tagName),super.mount(t)}}var i1=i(2627),i2={renderer:(t,e)=>(0,i1.q)(t)?new i0(e):new iG(e,{allowProjection:t!==iv.Fragment}),animation:{Feature:eZ},exit:{Feature:eJ},inView:{Feature:im},tap:{Feature:il},focus:{Feature:e9},hover:{Feature:e4}}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/940.e8189d1486fccb3d.js b/sky/dashboard/out/_next/static/chunks/940.e8189d1486fccb3d.js new file mode 100644 index 000000000..7ada66eee --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/940.e8189d1486fccb3d.js @@ -0,0 +1,56 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[940],{8671:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("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"}]])},3359:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]])},172:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]])},1021:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]])},4544:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]])},5134:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]])},7603:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("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"}]])},6122:function(e,t,n){n.d(t,{Z:function(){return a}});/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let a=(0,n(998).Z)("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"}]])},940:function(e,t,n){n.r(t),n.d(t,{RecipeDetail:function(){return R}});var a=n(5893),s=n(7294),r=n(1163),i=n(1664),c=n.n(i),l=n(5739),o=n(1272),d=n(6122),u=n(7603),x=n(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let h=(0,x.Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);var p=n(4544),m=n(282);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let y=(0,x.Z)("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);var f=n(1021),b=n(8671),j=n(5134);n(7673);var g=n(803),v=n(1360),k=n(2557),N=n(9749);n(9123);var w=n(5089);n(2935);var C=n(7086),Z=n(5821),_=n(7719),L=n(2344),M=n(3800),S=n(470),O=n(5988);function z(e){let{isOpen:t,onClose:n,template:r,onSave:i}=e,[c,u]=(0,s.useState)(""),[x,h]=(0,s.useState)(""),[p,m]=(0,s.useState)(!1),[y,f]=(0,s.useState)(null);(0,s.useEffect)(()=>{r&&t&&(u(r.description||""),h(r.content||""),f(null))},[r,t]);let b=async e=>{e.preventDefault(),m(!0),f(null);try{o.ZP.load(x)}catch(e){f("Invalid YAML: ".concat(e.message)),m(!1);return}try{await i({description:c||null,content:x}),n()}catch(e){f(e.message)}finally{m(!1)}};return r?(0,a.jsx)(v.Vq,{open:t,onOpenChange:n,children:(0,a.jsxs)(v.cZ,{className:"sm:max-w-2xl max-h-[90vh] overflow-y-auto px-8",children:[(0,a.jsxs)(v.fK,{children:[(0,a.jsxs)(v.$N,{className:"text-xl text-gray-900",children:["Edit Recipe: ",r.name]}),(0,a.jsx)(v.Be,{children:"Update your recipe description and content."})]}),(0,a.jsxs)("form",{onSubmit:b,className:"space-y-4 mt-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(N._,{htmlFor:"description",children:"Description"}),(0,a.jsx)(k.I,{id:"description",value:c,onChange:e=>u(e.target.value),placeholder:"Optional description...",className:"placeholder:text-gray-500"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(N._,{htmlFor:"content",children:"YAML Content *"}),(0,a.jsx)(w.Xx,{value:x,onChange:e=>{h(e),f(null)},maxHeight:"400px"})]}),y&&(0,a.jsxs)("div",{className:"rounded-md border border-red-200 bg-red-50 p-3 flex items-start gap-2",children:[(0,a.jsx)(d.Z,{className:"w-4 h-4 text-red-600 mt-0.5 flex-shrink-0"}),(0,a.jsx)("p",{className:"text-sm text-red-800",children:y})]}),(0,a.jsxs)(v.cN,{children:[(0,a.jsx)(g.z,{type:"button",variant:"outline",onClick:n,disabled:p,children:"Cancel"}),(0,a.jsx)(g.z,{type:"submit",disabled:p,className:"bg-sky-600 hover:bg-sky-700 text-white",children:p?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"Saving..."]}):"Save Changes"})]})]})]})}):null}function U(e){let{isOpen:t,onClose:n,template:r,onDelete:i}=e,[c,o]=(0,s.useState)(!1),d=async()=>{o(!0);try{await i(),n()}catch(e){(0,Z.C)("Delete failed: ".concat(e.message),"error")}finally{o(!1)}};return r?(0,a.jsx)(v.Vq,{open:t,onOpenChange:n,children:(0,a.jsxs)(v.cZ,{className:"sm:max-w-md",children:[(0,a.jsxs)(v.fK,{children:[(0,a.jsx)(v.$N,{className:"text-xl text-red-600",children:"Delete Recipe"}),(0,a.jsxs)(v.Be,{children:['Are you sure you want to delete "',r.name,'"? This action cannot be undone.']})]}),(0,a.jsxs)(v.cN,{className:"mt-4",children:[(0,a.jsx)(g.z,{variant:"outline",onClick:n,disabled:c,children:"Cancel"}),(0,a.jsx)(g.z,{onClick:d,disabled:c,className:"bg-red-600 hover:bg-red-700 text-white",children:c?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(l.Z,{size:16,className:"mr-2"}),"Deleting..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(u.Z,{className:"w-4 h-4 mr-2"}),"Delete"]})})]})]})}):null}function R(){let e=(0,r.useRouter)(),{recipe:t}=e.query,n=(0,M.uX)(),[i,o]=(0,s.useState)(null),[d,x]=(0,s.useState)(!0),[v,k]=(0,s.useState)(null),[N,w]=(0,s.useState)(!1),[R,E]=(0,s.useState)(!1),[V,A]=(0,s.useState)(!1),[D,q]=(0,s.useState)(!1),[F,T]=(0,s.useState)(!1),P=(0,s.useCallback)(async()=>{if(!e.isReady||!t)return;let n=t||null;if(!n){k("Invalid template URL"),x(!1);return}x(!0),k(null);try{let e=await (0,_.G3)(n);e?o(e):k("Recipe not found")}catch(e){k(e.message||"Failed to load recipe")}finally{x(!1)}},[e.isReady,t]);(0,s.useEffect)(()=>{P()},[P]);let H=async e=>{let t=await (0,_.DI)(i.name,e);if(t)o(t),(0,Z.C)("Recipe updated successfully!","success");else throw Error("Failed to update recipe")},B=async()=>{if(await (0,_.eI)(i.name))(0,Z.C)("Recipe deleted successfully!","success"),e.push("/recipes");else throw Error("Failed to delete recipe")},I=async()=>{try{let e=await (0,_.Uu)(i.name,!i.pinned);e&&(o(e),(0,Z.C)(e.pinned?"Recipe pinned!":"Recipe unpinned!","success"))}catch(e){(0,Z.C)("Recipe pin operation failed: ".concat(e.message),"error")}},J=async(e,t,n)=>{try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(e);else{let t=document.createElement("textarea");t.value=e,t.style.position="fixed",t.style.left="-999999px",t.style.top="-999999px",document.body.appendChild(t),t.focus(),t.select(),document.execCommand("copy"),t.remove()}n(!0),(0,Z.C)(t,"success"),setTimeout(()=>n(!1),2e3)}catch(e){(0,Z.C)("Failed to copy to clipboard","error")}};if(d)return(0,a.jsxs)("div",{className:"flex justify-center items-center h-64",children:[(0,a.jsx)(l.Z,{size:20,className:"mr-2"}),(0,a.jsx)("span",{className:"text-gray-500",children:"Loading..."})]});if(v)return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64",children:[(0,a.jsx)("div",{className:"text-red-500 mb-4",children:v}),(0,a.jsx)(c(),{href:"/recipes",children:(0,a.jsxs)(g.z,{variant:"outline",children:[(0,a.jsx)(h,{className:"w-4 h-4 mr-2"}),"Back to Hub"]})})]});if(!i)return null;let Y=(0,L.NL)(i.recipe_type,n),K=Y.icon;return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)(c(),{href:"/recipes",className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(h,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Back"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)(K,{className:"w-5 h-5 ".concat("sky"===Y.color?"text-sky-600":"purple"===Y.color?"text-purple-600":"green"===Y.color?"text-green-600":"orange"===Y.color?"text-orange-600":"text-gray-600")}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("h1",{className:"text-base text-sky-blue leading-none",children:i.name}),i.pinned&&(0,a.jsx)(p.Z,{className:"w-4 h-4 text-amber-500"})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 text-sm text-gray-500",children:(0,a.jsx)("span",{children:Y.fullLabel})})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(O.j,{name:"recipes.detail.actions",context:{recipe:i},wrapperClassName:"contents"}),(0,a.jsxs)("button",{onClick:()=>{J(window.location.href,"Link copied to clipboard!",w)},className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[N?(0,a.jsx)(m.Z,{className:"h-4 w-4 mr-1.5 text-green-600"}):(0,a.jsx)(y,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:N?"Copied!":"Share"})]}),(0,a.jsx)("button",{onClick:!1!==i.is_pinnable?I:void 0,className:"flex items-center ".concat(!1===i.is_pinnable?"text-gray-400 cursor-not-allowed":"text-sky-blue hover:text-sky-blue-bright"),title:!1===i.is_pinnable?"Default recipes cannot be pinned/unpinned":"",disabled:!1===i.is_pinnable,children:i.pinned?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(f.Z,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Unpin"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(p.Z,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Pin"})]})}),(0,a.jsxs)("button",{onClick:()=>{let t={name:"".concat(i.name,"-copied"),description:i.description,content:i.content,recipe_type:i.recipe_type};e.push({pathname:"/recipes",query:{copy:JSON.stringify(t)}})},className:"text-sky-blue hover:text-sky-blue-bright flex items-center",children:[(0,a.jsx)(b.Z,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Copy to New"})]}),(0,a.jsxs)("button",{onClick:!1!==i.is_editable?()=>q(!0):void 0,className:"flex items-center ".concat(!1===i.is_editable?"text-gray-400 cursor-not-allowed":"text-sky-blue hover:text-sky-blue-bright"),title:!1===i.is_editable?"Default recipes cannot be edited":"",disabled:!1===i.is_editable,children:[(0,a.jsx)(j.Z,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Edit"})]}),(0,a.jsxs)("button",{onClick:!1!==i.is_editable?()=>T(!0):void 0,className:"flex items-center ".concat(!1===i.is_editable?"text-gray-400 cursor-not-allowed":"text-red-600 hover:text-red-700"),title:!1===i.is_editable?"Default recipes cannot be deleted":"",disabled:!1===i.is_editable,children:[(0,a.jsx)(u.Z,{className:"h-4 w-4 mr-1.5"}),(0,a.jsx)("span",{children:"Delete"})]})]})]}),(0,a.jsxs)("div",{className:"rounded-lg border bg-card text-card-foreground shadow-sm",children:[(0,a.jsx)("div",{className:"flex items-center justify-between px-4 pt-4",children:(0,a.jsx)("h3",{className:"text-lg font-semibold",children:"Details"})}),(0,a.jsxs)("div",{className:"p-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6 mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Name"}),(0,a.jsx)("div",{className:"text-base mt-1",children:i.name})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Type"}),(0,a.jsx)("div",{className:"text-base mt-1",children:Y.fullLabel})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Authored by"}),(0,a.jsx)("div",{className:"text-base mt-1",children:i.user_name||i.user_id||"Unknown"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Updated"}),(0,a.jsxs)("div",{className:"text-base mt-1",children:[(0,a.jsx)(S.Zg,{date:i.updated_at?new Date(1e3*i.updated_at):null})," ","by ",i.updated_by_name||i.user_name||"Unknown"]})]})]}),i.description&&(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base mb-1",children:"Description"}),(0,a.jsx)("p",{className:"text-base text-gray-700",children:i.description})]}),(0,L.UU)(i.recipe_type,i.name)?(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"Launch Command"}),(0,a.jsx)("button",{onClick:()=>{i&&J((0,L.UU)(i.recipe_type,i.name),"Command copied to clipboard!",E)},className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",title:R?"Copied!":"Copy command",children:R?(0,a.jsx)(m.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(b.Z,{className:"w-4 h-4"})})]}),(0,a.jsx)("div",{className:"bg-gray-50 border border-gray-200 rounded-md p-3 mt-2",children:(0,a.jsx)("code",{className:"text-sm text-gray-800 font-mono break-all",children:(0,L.UU)(i.recipe_type,i.name)})})]}):(0,a.jsx)("div",{className:"mb-6",children:(0,a.jsx)(O.j,{name:"recipes.detail.".concat(i.recipe_type,"-launcher"),context:{recipeContent:i.content,recipeName:i.name},fallback:(0,a.jsx)("div",{className:"text-sm text-gray-500 italic",children:"A plugin is required to launch this recipe type."})})}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center",children:[(0,a.jsx)("div",{className:"text-gray-600 font-medium text-base",children:"YAML Content"}),(0,a.jsx)("button",{onClick:()=>{i&&J(i.content,"YAML copied to clipboard!",A)},className:"flex items-center text-gray-500 hover:text-gray-700 transition-colors duration-200 p-1 ml-2",title:V?"Copied!":"Copy YAML",children:V?(0,a.jsx)(m.Z,{className:"w-4 h-4 text-green-600"}):(0,a.jsx)(b.Z,{className:"w-4 h-4"})})]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(C.K,{value:i.content,readOnly:!0})})]})]})]}),(0,a.jsx)(z,{isOpen:D,onClose:()=>q(!1),template:i,onSave:H}),(0,a.jsx)(U,{isOpen:F,onClose:()=>T(!1),template:i,onDelete:B})]})}},7086:function(e,t,n){n.d(t,{K:function(){return x}});var a=n(5893);n(7294);var s=n(9094),r=n(5533),i=n(7205),c=n(3464),l=n(9119),o=n(7918),d=n(5089);let u=r.tk.theme({".cm-cursor, .cm-cursor-primary":{display:"none !important"}});function x(e){let{value:t,onChange:n,height:x,maxHeight:h="400px",readOnly:p=!1,className:m}=e,y=!!x;return(0,a.jsx)("div",{className:"rounded-md border border-gray-200 overflow-hidden ".concat(y?"flex flex-col":""," ").concat(m||""),style:{height:y?x:void 0,maxHeight:y?void 0:h,width:"100%",minWidth:0},children:(0,a.jsx)(s.ZP,{value:t,onChange:n,extensions:[(0,c.rV)(),d.xX,...p?[u]:[d.Kb],i.Wl.highest((0,l.nF)(d.SS)),...(0,o.V)()?[r.tk.cspNonce.of((0,o.V)())]:[]],readOnly:p,height:y?"100%":void 0,maxHeight:y?void 0:h,basicSetup:{lineNumbers:!0,foldGutter:!1,highlightActiveLineGutter:!1,highlightActiveLine:!1,indentOnInput:!0,bracketMatching:!0,autocompletion:!1},style:{fontSize:"13px",...y?{flex:1,minHeight:0}:{}},theme:"light"})})}},7719:function(e,t,n){n.d(t,{DI:function(){return c},G3:function(){return r},Uu:function(){return o},eI:function(){return l},iM:function(){return s},kW:function(){return i}});var a=n(7145);async function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};try{let t={pinned_only:e.pinnedOnly||!1,my_recipes_only:e.myRecipesOnly||!1,recipe_type:e.recipeType||null};return await a.x.fetch("/recipes/list",t,"POST")||[]}catch(e){throw console.error("Error fetching YAML templates:",e),e}}async function r(e){try{return await a.x.fetch("/recipes/get",{recipe_name:e})}catch(e){throw console.error("Error fetching Recipe:",e),e}}async function i(e){try{return await a.x.fetch("/recipes/create",{name:e.name,content:e.content,recipe_type:e.recipeType,description:e.description||null,owner_name:e.ownerName||null})}catch(e){throw console.error("Error creating Recipe:",e),e}}async function c(e,t){try{return await a.x.fetch("/recipes/update",{recipe_name:e,description:t.description,content:t.content})}catch(e){throw console.error("Error updating Recipe:",e),e}}async function l(e){try{return await a.x.fetch("/recipes/delete",{recipe_name:e})}catch(e){throw console.error("Error deleting Recipe:",e),e}}async function o(e,t){try{return await a.x.fetch("/recipes/pin",{recipe_name:e,pinned:t})}catch(e){throw console.error("Error toggling Recipe pin status:",e),e}}},2344:function(e,t,n){n.d(t,{lz:function(){return d},nT:function(){return o},UU:function(){return m},NL:function(){return p},B1:function(){return u}});var a=n(998);/** + * @license lucide-react v0.407.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */let s=(0,a.Z)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]),r=(0,a.Z)("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]),i=(0,a.Z)("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"}]]);var c=n(172),l=n(3359);let o=Object.freeze({CLUSTER:"cluster",JOB:"job",POOL:"pool",VOLUME:"volume"}),d=Object.freeze(Object.values(o));function u(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return[...d,...e.map(e=>e.id)]}function x(e){return e?e.split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" "):""}let h={sky:"text-sky-600",purple:"text-purple-600",green:"text-green-600",orange:"text-orange-600",gray:"text-gray-600"};function p(e){let t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];switch(e){case o.CLUSTER:t={icon:s,color:"sky",label:"Cluster",fullLabel:"Cluster"};break;case o.JOB:t={icon:r,color:"purple",label:"Job",fullLabel:"Managed Job"};break;case o.VOLUME:t={icon:i,color:"green",label:"Volume",fullLabel:"Volume"};break;case o.POOL:t={icon:c.Z,color:"orange",label:"Pool",fullLabel:"Job Pool"};break;default:{let a=n.find(t=>t.id===e);if(a){t={icon:a.icon||l.Z,color:a.color||"gray",label:a.label,fullLabel:a.fullLabel||a.label};break}t={icon:l.Z,color:"gray",label:x(e),fullLabel:x(e)}}}return t.colorClass=h[t.color]||"text-gray-600",t}function m(e,t){switch(e){case o.CLUSTER:return"sky launch recipes:".concat(t);case o.JOB:return"sky jobs launch recipes:".concat(t);case o.VOLUME:return"sky volumes apply recipes:".concat(t);case o.POOL:return"sky jobs pool apply recipes:".concat(t);default:return null}}},5988:function(e,t,n){n.d(t,{j:function(){return r}});var a=n(5893);n(7294);var s=n(3800);function r(e){let{name:t,context:n={},fallback:r=null,wrapperClassName:i="",prefix:c=null}=e,l=(0,s.dL)(t);return 0===l.length?r:(0,a.jsxs)("div",{className:i||void 0,children:[c,l.map(e=>{let t=e.component;return(0,a.jsx)(t,{...n},e.id)})]})}}}]); \ No newline at end of file diff --git a/sky/dashboard/out/_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js b/sky/dashboard/out/_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js new file mode 100644 index 000000000..fa8340dba --- /dev/null +++ b/sky/dashboard/out/_next/static/chunks/fd9d1056-2821b0f0cabcd8bd.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[971],{4417:function(e,t,n){var r,l=n(2265),a=n(5689),o={usingClientEntryPoint:!1,Events:null,Dispatcher:{current:null}};function i(e){var t="https://react.dev/errors/"+e;if(1p||(e.current=d[p],d[p]=null,p--)}function g(e,t){d[++p]=e.current,e.current=t}var y=Symbol.for("react.element"),v=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),w=Symbol.for("react.profiler"),S=Symbol.for("react.provider"),C=Symbol.for("react.consumer"),E=Symbol.for("react.context"),x=Symbol.for("react.forward_ref"),z=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),L=Symbol.for("react.scope");Symbol.for("react.debug_trace_mode");var T=Symbol.for("react.offscreen"),F=Symbol.for("react.legacy_hidden"),M=Symbol.for("react.cache");Symbol.for("react.tracing_marker");var O=Symbol.iterator;function R(e){return null===e||"object"!=typeof e?null:"function"==typeof(e=O&&e[O]||e["@@iterator"])?e:null}var D=m(null),A=m(null),I=m(null),U=m(null),B={$$typeof:E,_currentValue:null,_currentValue2:null,_threadCount:0,Provider:null,Consumer:null};function V(e,t){switch(g(I,t),g(A,e),g(D,null),e=t.nodeType){case 9:case 11:t=(t=t.documentElement)&&(t=t.namespaceURI)?s2(t):0;break;default:if(t=(e=8===e?t.parentNode:t).tagName,e=e.namespaceURI)t=s3(e=s2(e),t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}h(D),g(D,t)}function Q(){h(D),h(A),h(I)}function $(e){null!==e.memoizedState&&g(U,e);var t=D.current,n=s3(t,e.type);t!==n&&(g(A,e),g(D,n))}function j(e){A.current===e&&(h(D),h(A)),U.current===e&&(h(U),B._currentValue=null)}var W=a.unstable_scheduleCallback,H=a.unstable_cancelCallback,q=a.unstable_shouldYield,K=a.unstable_requestPaint,Y=a.unstable_now,X=a.unstable_getCurrentPriorityLevel,G=a.unstable_ImmediatePriority,Z=a.unstable_UserBlockingPriority,J=a.unstable_NormalPriority,ee=a.unstable_LowPriority,et=a.unstable_IdlePriority,en=a.log,er=a.unstable_setDisableYieldValue,el=null,ea=null;function eo(e){if("function"==typeof en&&er(e),ea&&"function"==typeof ea.setStrictMode)try{ea.setStrictMode(el,e)}catch(e){}}var ei=Math.clz32?Math.clz32:function(e){return 0==(e>>>=0)?32:31-(eu(e)/es|0)|0},eu=Math.log,es=Math.LN2,ec=128,ef=4194304;function ed(e){var t=42&e;if(0!==t)return t;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:return 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 4194176&e;case 4194304:case 8388608:case 16777216:case 33554432:return 62914560&e;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function ep(e,t){var n=e.pendingLanes;if(0===n)return 0;var r=0,l=e.suspendedLanes;e=e.pingedLanes;var a=134217727&n;return 0!==a?0!=(n=a&~l)?r=ed(n):0!=(e&=a)&&(r=ed(e)):0!=(n&=~l)?r=ed(n):0!==e&&(r=ed(e)),0===r?0:0!==t&&t!==r&&0==(t&l)&&((l=r&-r)>=(e=t&-t)||32===l&&0!=(4194176&e))?t:r}function em(e,t){return e.errorRecoveryDisabledLanes&t?0:0!=(e=-536870913&e.pendingLanes)?e:536870912&e?536870912:0}function eh(){var e=ec;return 0==(4194176&(ec<<=1))&&(ec=128),e}function eg(){var e=ef;return 0==(62914560&(ef<<=1))&&(ef=4194304),e}function ey(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function ev(e,t,n){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-ei(t);e.entangledLanes|=t,e.entanglements[r]=1073741824|e.entanglements[r]|4194218&n}function eb(e,t){var n=e.entangledLanes|=t;for(e=e.entanglements;n;){var r=31-ei(n),l=1<l||u[r]!==s[l]){var c="\n"+u[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=l);break}}}finally{eG=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?eX(n):""}function eJ(e){try{var t="";do t+=function(e){switch(e.tag){case 26:case 27:case 5:return eX(e.type);case 16:return eX("Lazy");case 13:return eX("Suspense");case 19:return eX("SuspenseList");case 0:case 2:case 15:return e=eZ(e.type,!1);case 11:return e=eZ(e.type.render,!1);case 1:return e=eZ(e.type,!0);default:return""}}(e),e=e.return;while(e);return t}catch(e){return"\nError generating stack: "+e.message+"\n"+e.stack}}var e0=Symbol.for("react.client.reference");function e1(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":case"object":return e;default:return""}}function e2(e){var t=e.type;return(e=e.nodeName)&&"input"===e.toLowerCase()&&("checkbox"===t||"radio"===t)}function e3(e){e._valueTracker||(e._valueTracker=function(e){var t=e2(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),r=""+e[t];if(!e.hasOwnProperty(t)&&void 0!==n&&"function"==typeof n.get&&"function"==typeof n.set){var l=n.get,a=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return l.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]}}}}(e))}function e4(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),r="";return e&&(r=e2(e)?e.checked?"true":"false":e.value),(e=r)!==n&&(t.setValue(e),!0)}function e6(e){if(void 0===(e=e||("undefined"!=typeof document?document:void 0)))return null;try{return e.activeElement||e.body}catch(t){return e.body}}var e8=/[\n"\\]/g;function e5(e){return e.replace(e8,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function e7(e,t,n,r,l,a,o,i){e.name="",null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o?e.type=o:e.removeAttribute("type"),null!=t?"number"===o?(0===t&&""===e.value||e.value!=t)&&(e.value=""+e1(t)):e.value!==""+e1(t)&&(e.value=""+e1(t)):"submit"!==o&&"reset"!==o||e.removeAttribute("value"),null!=t?te(e,o,e1(t)):null!=n?te(e,o,e1(n)):null!=r&&e.removeAttribute("value"),null==l&&null!=a&&(e.defaultChecked=!!a),null!=l&&(e.checked=l&&"function"!=typeof l&&"symbol"!=typeof l),null!=i&&"function"!=typeof i&&"symbol"!=typeof i&&"boolean"!=typeof i?e.name=""+e1(i):e.removeAttribute("name")}function e9(e,t,n,r,l,a,o,i){if(null!=a&&"function"!=typeof a&&"symbol"!=typeof a&&"boolean"!=typeof a&&(e.type=a),null!=t||null!=n){if(!("submit"!==a&&"reset"!==a||null!=t))return;n=null!=n?""+e1(n):"",t=null!=t?""+e1(t):n,i||t===e.value||(e.value=t),e.defaultValue=t}r="function"!=typeof(r=null!=r?r:l)&&"symbol"!=typeof r&&!!r,e.checked=i?e.checked:!!r,e.defaultChecked=!!r,null!=o&&"function"!=typeof o&&"symbol"!=typeof o&&"boolean"!=typeof o&&(e.name=o)}function te(e,t,n){"number"===t&&e6(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}var tt=Array.isArray;function tn(e,t,n,r){if(e=e.options,t){t={};for(var l=0;l"+t.valueOf().toString()+"",t=iX.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}}var to=ta;"undefined"!=typeof MSApp&&MSApp.execUnsafeLocalFunction&&(to=function(e,t){return MSApp.execUnsafeLocalFunction(function(){return ta(e,t)})});var ti=to;function tu(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&3===n.nodeType){n.nodeValue=t;return}}e.textContent=t}var ts=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function tc(e,t,n){var r=0===t.indexOf("--");null==n||"boolean"==typeof n||""===n?r?e.setProperty(t,""):"float"===t?e.cssFloat="":e[t]="":r?e.setProperty(t,n):"number"!=typeof n||0===n||ts.has(t)?"float"===t?e.cssFloat=n:e[t]=(""+n).trim():e[t]=n+"px"}function tf(e,t,n){if(null!=t&&"object"!=typeof t)throw Error(i(62));if(e=e.style,null!=n){for(var r in n)!n.hasOwnProperty(r)||null!=t&&t.hasOwnProperty(r)||(0===r.indexOf("--")?e.setProperty(r,""):"float"===r?e.cssFloat="":e[r]="");for(var l in t)r=t[l],t.hasOwnProperty(l)&&n[l]!==r&&tc(e,l,r)}else for(var a in t)t.hasOwnProperty(a)&&tc(e,a,t[a])}function td(e){if(-1===e.indexOf("-"))return!1;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 tp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),tm=null;function th(e){return(e=e.target||e.srcElement||window).correspondingUseElement&&(e=e.correspondingUseElement),3===e.nodeType?e.parentNode:e}var tg=null,ty=null;function tv(e){var t=eO(e);if(t&&(e=t.stateNode)){var n=eD(e);switch(e=t.stateNode,t.type){case"input":if(e7(e,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),t=n.name,"radio"===n.type&&null!=t){for(n=e;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+e5(""+t)+'"][type="radio"]'),t=0;t>=o,l-=o,tj=1<<32-ei(t)+l|n<h?(g=f,f=null):g=f.sibling;var y=p(l,f,i[h],u);if(null===y){null===f&&(f=g);break}e&&f&&null===y.alternate&&t(l,f),o=a(y,o,h),null===c?s=y:c.sibling=y,c=y,f=g}if(h===i.length)return n(l,f),tZ&&tH(l,h),s;if(null===f){for(;hg?(y=h,h=null):y=h.sibling;var b=p(l,h,v.value,s);if(null===b){null===h&&(h=y);break}e&&h&&null===b.alternate&&t(l,h),o=a(b,o,g),null===f?c=b:f.sibling=b,f=b,h=y}if(v.done)return n(l,h),tZ&&tH(l,g),c;if(null===h){for(;!v.done;g++,v=u.next())null!==(v=d(l,v.value,s))&&(o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return tZ&&tH(l,g),c}for(h=r(l,h);!v.done;g++,v=u.next())null!==(v=m(h,l,g,v.value,s))&&(e&&null!==v.alternate&&h.delete(null===v.key?g:v.key),o=a(v,o,g),null===f?c=v:f.sibling=v,f=v);return e&&h.forEach(function(e){return t(l,e)}),tZ&&tH(l,g),c}(s,c,f,h);if("function"==typeof f.then)return u(s,c,nJ(f),h);if(f.$$typeof===E)return u(s,c,ai(s,f,h),h);n1(s,f)}return"string"==typeof f&&""!==f||"number"==typeof f?(f=""+f,null!==c&&6===c.tag?(n(s,c.sibling),(c=l(c,f)).return=s):(n(s,c),(c=i_(f,s.mode,h)).return=s),o(s=c)):n(s,c)}(u,s,c,f),nG=null,u}}var n4=n3(!0),n6=n3(!1),n8=m(null),n5=m(0);function n7(e,t){g(n5,e=oz),g(n8,t),oz=e|t.baseLanes}function n9(){g(n5,oz),g(n8,n8.current)}function re(){oz=n5.current,h(n8),h(n5)}var rt=m(null),rn=null;function rr(e){var t=e.alternate;g(ri,1&ri.current),g(rt,e),null===rn&&(null===t||null!==n8.current?rn=e:null!==t.memoizedState&&(rn=e))}function rl(e){if(22===e.tag){if(g(ri,ri.current),g(rt,e),null===rn){var t=e.alternate;null!==t&&null!==t.memoizedState&&(rn=e)}}else ra(e)}function ra(){g(ri,ri.current),g(rt,rt.current)}function ro(e){h(rt),rn===e&&(rn=null),h(ri)}var ri=m(0);function ru(e){for(var t=e;null!==t;){if(13===t.tag){var n=t.memoizedState;if(null!==n&&(null===(n=n.dehydrated)||"$?"===n.data||"$!"===n.data))return t}else if(19===t.tag&&void 0!==t.memoizedProps.revealOrder){if(0!=(128&t.flags))return t}else if(null!==t.child){t.child.return=t,t=t.child;continue}if(t===e)break;for(;null===t.sibling;){if(null===t.return||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var rs=s.ReactCurrentDispatcher,rc=s.ReactCurrentBatchConfig,rf=0,rd=null,rp=null,rm=null,rh=!1,rg=!1,ry=!1,rv=0,rb=0,rk=null,rw=0;function rS(){throw Error(i(321))}function rC(e,t){if(null===t)return!1;for(var n=0;na?a:8;var o=rc.transition,i={_callbacks:new Set};rc.transition=i,lf(e,!1,t,n);try{var u=l();if(null!==u&&"object"==typeof u&&"function"==typeof u.then){av(i,u);var s,c,f=(s=[],c={status:"pending",value:null,reason:null,then:function(e){s.push(e)}},u.then(function(){c.status="fulfilled",c.value=r;for(var e=0;e title"))),sG(l,n,r),l[eE]=e,eI(l),n=l;break e;case"link":var a=cE("link","href",t).get(n+(r.href||""));if(a){for(var o=0;o",e=e.removeChild(e.firstChild);break;case"select":e="string"==typeof r.is?l.createElement("select",{is:r.is}):l.createElement("select"),r.multiple?e.multiple=!0:r.size&&(e.size=r.size);break;default:e="string"==typeof r.is?l.createElement(n,{is:r.is}):l.createElement(n)}}e[eE]=t,e[ex]=r;e:for(l=t.child;null!==l;){if(5===l.tag||6===l.tag)e.appendChild(l.stateNode);else if(4!==l.tag&&27!==l.tag&&null!==l.child){l.child.return=l,l=l.child;continue}if(l===t)break;for(;null===l.sibling;){if(null===l.return||l.return===t)break e;l=l.return}l.sibling.return=l.return,l=l.sibling}switch(t.stateNode=e,sG(e,n,r),n){case"button":case"input":case"select":case"textarea":e=!!r.autoFocus;break;case"img":e=!0;break;default:e=!1}e&&aC(t)}}return aP(t),t.flags&=-16777217,null;case 6:if(e&&null!=t.stateNode)e.memoizedProps!==r&&aC(t);else{if("string"!=typeof r&&null===t.stateNode)throw Error(i(166));if(e=I.current,t9(t)){e:{if(e=t.stateNode,n=t.memoizedProps,e[eE]=t,(r=e.nodeValue!==n)&&null!==(l=tX))switch(l.tag){case 3:if(l=0!=(1&l.mode),sq(e.nodeValue,n,l),l){e=!1;break e}break;case 27:case 5:var a=0!=(1&l.mode);if(!0!==l.memoizedProps.suppressHydrationWarning&&sq(e.nodeValue,n,a),a){e=!1;break e}}e=r}e&&aC(t)}else(e=s1(e).createTextNode(r))[eE]=t,t.stateNode=e}return aP(t),null;case 13:if(ro(t),r=t.memoizedState,null===e||null!==e.memoizedState&&null!==e.memoizedState.dehydrated){if(tZ&&null!==tG&&0!=(1&t.mode)&&0==(128&t.flags))ne(),nt(),t.flags|=384,l=!1;else if(l=t9(t),null!==r&&null!==r.dehydrated){if(null===e){if(!l)throw Error(i(318));if(!(l=null!==(l=t.memoizedState)?l.dehydrated:null))throw Error(i(317));l[eE]=t}else nt(),0==(128&t.flags)&&(t.memoizedState=null),t.flags|=4;aP(t),l=!1}else null!==tJ&&(o0(tJ),tJ=null),l=!0;if(!l)return 256&t.flags?t:null}if(0!=(128&t.flags))return t.lanes=n,t;return n=null!==r,e=null!==e&&null!==e.memoizedState,n&&(r=t.child,l=null,null!==r.alternate&&null!==r.alternate.memoizedState&&null!==r.alternate.memoizedState.cachePool&&(l=r.alternate.memoizedState.cachePool.pool),a=null,null!==r.memoizedState&&null!==r.memoizedState.cachePool&&(a=r.memoizedState.cachePool.pool),a!==l&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),ax(t,t.updateQueue),aP(t),null;case 4:return Q(),null===e&&sA(t.stateNode.containerInfo),aP(t),null;case 10:return an(t.type._context),aP(t),null;case 19:if(h(ri),null===(l=t.memoizedState))return aP(t),null;if(r=0!=(128&t.flags),null===(a=l.rendering)){if(r)az(l,!1);else{if(0!==oP||null!==e&&0!=(128&e.flags))for(e=t.child;null!==e;){if(null!==(a=ru(e))){for(t.flags|=128,az(l,!1),e=a.updateQueue,t.updateQueue=e,ax(t,e),t.subtreeFlags=0,e=n,n=t.child;null!==n;)ix(n,e),n=n.sibling;return g(ri,1&ri.current|2),t.child}e=e.sibling}null!==l.tail&&Y()>oI&&(t.flags|=128,r=!0,az(l,!1),t.lanes=4194304)}}else{if(!r){if(null!==(e=ru(a))){if(t.flags|=128,r=!0,e=e.updateQueue,t.updateQueue=e,ax(t,e),az(l,!0),null===l.tail&&"hidden"===l.tailMode&&!a.alternate&&!tZ)return aP(t),null}else 2*Y()-l.renderingStartTime>oI&&536870912!==n&&(t.flags|=128,r=!0,az(l,!1),t.lanes=4194304)}l.isBackwards?(a.sibling=t.child,t.child=a):(null!==(e=l.last)?e.sibling=a:t.child=a,l.last=a)}if(null!==l.tail)return t=l.tail,l.rendering=t,l.tail=t.sibling,l.renderingStartTime=Y(),t.sibling=null,e=ri.current,g(ri,r?1&e|2:1&e),t;return aP(t),null;case 22:case 23:return ro(t),re(),r=null!==t.memoizedState,null!==e?null!==e.memoizedState!==r&&(t.flags|=8192):r&&(t.flags|=8192),r&&0!=(1&t.mode)?0!=(536870912&n)&&0==(128&t.flags)&&(aP(t),6&t.subtreeFlags&&(t.flags|=8192)):aP(t),null!==(n=t.updateQueue)&&ax(t,n.retryQueue),n=null,null!==e&&null!==e.memoizedState&&null!==e.memoizedState.cachePool&&(n=e.memoizedState.cachePool.pool),r=null,null!==t.memoizedState&&null!==t.memoizedState.cachePool&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),null!==e&&h(ab),null;case 24:return n=null,null!==e&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),an(ad),aP(t),null;case 25:return null}throw Error(i(156,t.tag))}(t.alternate,t,oz);if(null!==n){ow=n;return}if(null!==(t=t.sibling)){ow=t;return}ow=t=e}while(null!==t);0===oP&&(oP=5)}function is(e,t,n,r,l){var a=ek,o=ov.transition;try{ov.transition=null,ek=2,function(e,t,n,r,l,a){do id();while(null!==oj);if(0!=(6&ob))throw Error(i(327));var o,u=e.finishedWork,s=e.finishedLanes;if(null!==u){if(e.finishedWork=null,e.finishedLanes=0,u===e.current)throw Error(i(177));e.callbackNode=null,e.callbackPriority=0,e.cancelPendingCommit=null;var c=u.lanes|u.childLanes;if(function(e,t,n){var r=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.entangledLanes&=t,e.errorRecoveryDisabledLanes&=t,e.shellSuspendCounter=0,t=e.entanglements;for(var l=e.expirationTimes,a=e.hiddenUpdates;0r&&(l=r,r=a,a=l),l=si(n,a);var o=si(n,r);l&&o&&(1!==e.rangeCount||e.anchorNode!==l.node||e.anchorOffset!==l.offset||e.focusNode!==o.node||e.focusOffset!==o.offset)&&((t=t.createRange()).setStart(l.node,l.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;)1===e.nodeType&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for("function"==typeof n.focus&&n.focus(),n=0;nn?32:n;n=ov.transition;var l=ek;try{if(ov.transition=null,ek=r,null===oj)var a=!1;else{r=oq,oq=null;var o=oj,u=oW;if(oj=null,oW=0,0!=(6&ob))throw Error(i(331));var s=ob;if(ob|=4,of(o.current),ol(o,o.current,u,r),ob=s,nb(!1),ea&&"function"==typeof ea.onPostCommitFiberRoot)try{ea.onPostCommitFiberRoot(el,o)}catch(e){}a=!0}return a}finally{ek=l,ov.transition=n,ic(e,t)}}return!1}function ip(e,t,n){t=lL(e,t=lP(n,t),2),null!==(e=nO(e,t,2))&&(o2(e,2),nv(e))}function im(e,t,n){if(3===e.tag)ip(e,e,n);else for(;null!==t;){if(3===t.tag){ip(t,e,n);break}if(1===t.tag){var r=t.stateNode;if("function"==typeof t.type.getDerivedStateFromError||"function"==typeof r.componentDidCatch&&(null===oQ||!oQ.has(r))){e=lT(t,e=lP(n,e),2),null!==(t=nO(t,e,2))&&(o2(t,2),nv(t));break}}t=t.return}}function ih(e,t,n){var r=e.pingCache;if(null===r){r=e.pingCache=new om;var l=new Set;r.set(t,l)}else void 0===(l=r.get(t))&&(l=new Set,r.set(t,l));l.has(n)||(ox=!0,l.add(n),e=ig.bind(null,e,t,n),t.then(e,e))}function ig(e,t,n){var r=e.pingCache;null!==r&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,2&ob?oR=!0:4&ob&&(oD=!0),ik(),ok===e&&(oS&n)===n&&(4===oP||3===oP&&(62914560&oS)===oS&&300>Y()-oA?0==(2&ob)&&o5(e,0):oT|=n),nv(e)}function iy(e,t){0===t&&(t=0==(1&e.mode)?2:eg()),null!==(e=ns(e,t))&&(o2(e,t),nv(e))}function iv(e){var t=e.memoizedState,n=0;null!==t&&(n=t.retryLane),iy(e,n)}function ib(e,t){var n=0;switch(e.tag){case 13:var r=e.stateNode,l=e.memoizedState;null!==l&&(n=l.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(i(314))}null!==r&&r.delete(t),iy(e,n)}function ik(){if(50=uH),uY=!1;function uX(e,t){switch(e){case"keyup":return -1!==uj.indexOf(t.keyCode);case"keydown":return 229!==t.keyCode;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function uG(e){return"object"==typeof(e=e.detail)&&"data"in e?e.data:null}var uZ=!1,uJ={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function u0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return"input"===t?!!uJ[e.type]:"textarea"===t}function u1(e,t,n,r){tb(r),0<(t=sV(t,"onChange")).length&&(n=new i3("onChange","change",null,n,r),e.push({event:n,listeners:t}))}var u2=null,u3=null;function u4(e){sM(e,0)}function u6(e){if(e4(eR(e)))return e}function u8(e,t){if("change"===e)return t}var u5=!1;if(e$){if(e$){var u7="oninput"in document;if(!u7){var u9=document.createElement("div");u9.setAttribute("oninput","return;"),u7="function"==typeof u9.oninput}r=u7}else r=!1;u5=r&&(!document.documentMode||9=t)return{node:r,offset:t-e};e=n}e:{for(;r;){if(r.nextSibling){r=r.nextSibling;break e}r=r.parentNode}r=void 0}r=so(r)}}function su(){for(var e=window,t=e6();t instanceof e.HTMLIFrameElement;){try{var n="string"==typeof t.contentWindow.location.href}catch(e){n=!1}if(n)e=t.contentWindow;else break;t=e6(e.document)}return t}function ss(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&("input"===t&&("text"===e.type||"search"===e.type||"tel"===e.type||"url"===e.type||"password"===e.type)||"textarea"===t||"true"===e.contentEditable)}var sc=e$&&"documentMode"in document&&11>=document.documentMode,sf=null,sd=null,sp=null,sm=!1;function sh(e,t,n){var r=n.window===n?n.document:9===n.nodeType?n:n.ownerDocument;sm||null==sf||sf!==e6(r)||(r="selectionStart"in(r=sf)&&ss(r)?{start:r.selectionStart,end:r.selectionEnd}:{anchorNode:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection()).anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset},sp&&nQ(sp,r)||(sp=r,0<(r=sV(sd,"onSelect")).length&&(t=new i3("onSelect","select",null,t,n),e.push({event:t,listeners:r}),t.target=sf)))}function sg(e,t){var n={};return n[e.toLowerCase()]=t.toLowerCase(),n["Webkit"+e]="webkit"+t,n["Moz"+e]="moz"+t,n}var sy={animationend:sg("Animation","AnimationEnd"),animationiteration:sg("Animation","AnimationIteration"),animationstart:sg("Animation","AnimationStart"),transitionend:sg("Transition","TransitionEnd")},sv={},sb={};function sk(e){if(sv[e])return sv[e];if(!sy[e])return e;var t,n=sy[e];for(t in n)if(n.hasOwnProperty(t)&&t in sb)return sv[e]=n[t];return e}e$&&(sb=document.createElement("div").style,"AnimationEvent"in window||(delete sy.animationend.animation,delete sy.animationiteration.animation,delete sy.animationstart.animation),"TransitionEvent"in window||delete sy.transitionend.transition);var sw=sk("animationend"),sS=sk("animationiteration"),sC=sk("animationstart"),sE=sk("transitionend"),sx=new Map,sz="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll scrollEnd toggle touchMove waiting wheel".split(" ");function sP(e,t){sx.set(e,t),eV(t,[e])}for(var sN=0;sN title"):null)}var cz=null;function cP(){}function cN(){if(this.count--,0===this.count){if(this.stylesheets)cL(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var c_=null;function cL(e,t){e.stylesheets=null,null!==e.unsuspend&&(e.count++,c_=new Map,t.forEach(cT,e),c_=null,cN.call(e))}function cT(e,t){if(!(4&t.state.loading)){var n=c_.get(e);if(n)var r=n.get(null);else{n=new Map,c_.set(e,n);for(var l=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a