chainlit 2.0rc0__py3-none-any.whl → 2.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of chainlit might be problematic. Click here for more details.

Files changed (76) hide show
  1. chainlit/__init__.py +49 -54
  2. chainlit/action.py +12 -10
  3. chainlit/{auth.py → auth/__init__.py} +20 -34
  4. chainlit/auth/cookie.py +123 -0
  5. chainlit/auth/jwt.py +37 -0
  6. chainlit/callbacks.py +29 -1
  7. chainlit/chat_context.py +2 -2
  8. chainlit/chat_settings.py +3 -1
  9. chainlit/cli/__init__.py +14 -1
  10. chainlit/config.py +21 -59
  11. chainlit/context.py +3 -2
  12. chainlit/copilot/dist/index.js +8319 -1019
  13. chainlit/data/__init__.py +98 -17
  14. chainlit/data/acl.py +3 -2
  15. chainlit/data/base.py +1 -1
  16. chainlit/data/chainlit_data_layer.py +584 -0
  17. chainlit/data/dynamodb.py +5 -3
  18. chainlit/data/literalai.py +4 -6
  19. chainlit/data/sql_alchemy.py +8 -7
  20. chainlit/data/storage_clients/azure.py +1 -0
  21. chainlit/data/storage_clients/azure_blob.py +80 -0
  22. chainlit/data/storage_clients/base.py +6 -0
  23. chainlit/data/storage_clients/gcs.py +78 -0
  24. chainlit/data/storage_clients/s3.py +16 -3
  25. chainlit/discord/app.py +2 -1
  26. chainlit/element.py +13 -9
  27. chainlit/emitter.py +17 -21
  28. chainlit/frontend/dist/assets/{DailyMotion-CleI-8Dh.js → DailyMotion-B8XgmoRm.js} +1 -1
  29. chainlit/frontend/dist/assets/Dataframe-VU4lXMbv.js +22 -0
  30. chainlit/frontend/dist/assets/{Facebook-C4PuTowX.js → Facebook-fVIMi9h_.js} +1 -1
  31. chainlit/frontend/dist/assets/{FilePlayer-D49YToZz.js → FilePlayer-DlXvvaZa.js} +1 -1
  32. chainlit/frontend/dist/assets/{Kaltura-BkZcQEIs.js → Kaltura-C48Ui_4V.js} +1 -1
  33. chainlit/frontend/dist/assets/{Mixcloud-DzvBFYsm.js → Mixcloud-Dmjz7RrS.js} +1 -1
  34. chainlit/frontend/dist/assets/{Mux-UXPyWWYv.js → Mux-Bqaa3ZzG.js} +1 -1
  35. chainlit/frontend/dist/assets/{Preview-0YXzpiVm.js → Preview-B2d1Ugq4.js} +1 -1
  36. chainlit/frontend/dist/assets/{SoundCloud-CS54COex.js → SoundCloud-BGuk87T3.js} +1 -1
  37. chainlit/frontend/dist/assets/{Streamable-DYYShO6Q.js → Streamable-DOe4rXrG.js} +1 -1
  38. chainlit/frontend/dist/assets/{Twitch-DG7403Hm.js → Twitch-TA7I2UEi.js} +1 -1
  39. chainlit/frontend/dist/assets/{Vidyard-C5JbOHIQ.js → Vidyard-B5F6Dk_y.js} +1 -1
  40. chainlit/frontend/dist/assets/{Vimeo-dFLZbhqH.js → Vimeo-DP_Y98tQ.js} +1 -1
  41. chainlit/frontend/dist/assets/Wistia-DB26BTg8.js +1 -0
  42. chainlit/frontend/dist/assets/{YouTube-Dct4gpfH.js → YouTube-CMwwf2TN.js} +1 -1
  43. chainlit/frontend/dist/assets/index-88S3ZtD5.css +1 -0
  44. chainlit/frontend/dist/assets/index-D7lZEN9m.js +8665 -0
  45. chainlit/frontend/dist/assets/{react-plotly-CFHBSMgg.js → react-plotly-28_xImPF.js} +1 -1
  46. chainlit/frontend/dist/index.html +2 -2
  47. chainlit/haystack/callbacks.py +5 -4
  48. chainlit/input_widget.py +6 -4
  49. chainlit/langchain/callbacks.py +56 -47
  50. chainlit/langflow/__init__.py +1 -0
  51. chainlit/llama_index/callbacks.py +7 -7
  52. chainlit/message.py +6 -7
  53. chainlit/mistralai/__init__.py +3 -2
  54. chainlit/oauth_providers.py +70 -3
  55. chainlit/openai/__init__.py +3 -2
  56. chainlit/secret.py +1 -1
  57. chainlit/server.py +483 -199
  58. chainlit/session.py +7 -5
  59. chainlit/slack/app.py +3 -2
  60. chainlit/socket.py +79 -106
  61. chainlit/step.py +11 -11
  62. chainlit/sync.py +2 -1
  63. chainlit/teams/app.py +1 -0
  64. chainlit/translations/en-US.json +1 -1
  65. chainlit/translations/nl-NL.json +229 -0
  66. chainlit/types.py +20 -4
  67. chainlit/user.py +2 -1
  68. chainlit/utils.py +3 -2
  69. {chainlit-2.0rc0.dist-info → chainlit-2.0.1.dist-info}/METADATA +3 -34
  70. chainlit-2.0.1.dist-info/RECORD +106 -0
  71. chainlit/frontend/dist/assets/Wistia-143Q9V9c.js +0 -1
  72. chainlit/frontend/dist/assets/index-2yAiK0R5.js +0 -1091
  73. chainlit/frontend/dist/assets/index-CwmincdQ.css +0 -1
  74. chainlit-2.0rc0.dist-info/RECORD +0 -99
  75. {chainlit-2.0rc0.dist-info → chainlit-2.0.1.dist-info}/WHEEL +0 -0
  76. {chainlit-2.0rc0.dist-info → chainlit-2.0.1.dist-info}/entry_points.txt +0 -0
@@ -7,6 +7,11 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
7
7
 
8
8
  import aiofiles
9
9
  import aiohttp
10
+ from sqlalchemy import text
11
+ from sqlalchemy.exc import SQLAlchemyError
12
+ from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine
13
+ from sqlalchemy.orm import sessionmaker
14
+
10
15
  from chainlit.data.base import BaseDataLayer
11
16
  from chainlit.data.storage_clients.base import BaseStorageClient
12
17
  from chainlit.data.utils import queue_until_user_message
@@ -23,10 +28,6 @@ from chainlit.types import (
23
28
  ThreadFilter,
24
29
  )
25
30
  from chainlit.user import PersistedUser, User
26
- from sqlalchemy import text
27
- from sqlalchemy.exc import SQLAlchemyError
28
- from sqlalchemy.ext.asyncio import AsyncEngine, AsyncSession, create_async_engine
29
- from sqlalchemy.orm import sessionmaker
30
31
 
31
32
  if TYPE_CHECKING:
32
33
  from chainlit.element import Element, ElementDict
@@ -167,7 +168,7 @@ class SQLAlchemyDataLayer(BaseDataLayer):
167
168
  async def create_user(self, user: User) -> Optional[PersistedUser]:
168
169
  if self.show_logger:
169
170
  logger.info(f"SQLAlchemy: create_user, user_identifier={user.identifier}")
170
- existing_user: Optional["PersistedUser"] = await self.get_user(user.identifier)
171
+ existing_user: Optional[PersistedUser] = await self.get_user(user.identifier)
171
172
  user_dict: Dict[str, Any] = {
172
173
  "identifier": str(user.identifier),
173
174
  "metadata": json.dumps(user.metadata) or {},
@@ -438,6 +439,7 @@ class SQLAlchemyDataLayer(BaseDataLayer):
438
439
  url=element_dict.get("url"),
439
440
  objectKey=element_dict.get("objectKey"),
440
441
  name=element_dict["name"],
442
+ props=element_dict.get("props"),
441
443
  display=element_dict["display"],
442
444
  size=element_dict.get("size"),
443
445
  language=element_dict.get("language"),
@@ -576,7 +578,6 @@ class SQLAlchemyDataLayer(BaseDataLayer):
576
578
  s."generation" AS step_generation,
577
579
  s."showInput" AS step_showinput,
578
580
  s."language" AS step_language,
579
- s."indent" AS step_indent,
580
581
  f."value" AS feedback_value,
581
582
  f."comment" AS feedback_comment,
582
583
  f."id" AS feedback_id
@@ -664,7 +665,6 @@ class SQLAlchemyDataLayer(BaseDataLayer):
664
665
  generation=step_feedback.get("step_generation"),
665
666
  showInput=step_feedback.get("step_showinput"),
666
667
  language=step_feedback.get("step_language"),
667
- indent=step_feedback.get("step_indent"),
668
668
  feedback=feedback,
669
669
  )
670
670
  # Append the step to the steps list of the corresponding ThreadDict
@@ -688,6 +688,7 @@ class SQLAlchemyDataLayer(BaseDataLayer):
688
688
  autoPlay=element.get("element_autoPlay"),
689
689
  playerConfig=element.get("element_playerconfig"),
690
690
  page=element.get("element_page"),
691
+ props=element.get("element_props"),
691
692
  forId=element.get("element_forid"),
692
693
  mime=element.get("element_mime"),
693
694
  )
@@ -6,6 +6,7 @@ from azure.storage.filedatalake import (
6
6
  DataLakeServiceClient,
7
7
  FileSystemClient,
8
8
  )
9
+
9
10
  from chainlit.data.storage_clients.base import BaseStorageClient
10
11
  from chainlit.logger import logger
11
12
 
@@ -0,0 +1,80 @@
1
+ from datetime import datetime, timedelta
2
+ from typing import Any, Dict, Union
3
+
4
+ from azure.storage.blob import BlobSasPermissions, ContentSettings, generate_blob_sas
5
+ from azure.storage.blob.aio import BlobServiceClient as AsyncBlobServiceClient
6
+
7
+ from chainlit.data.storage_clients.base import EXPIRY_TIME, BaseStorageClient
8
+ from chainlit.logger import logger
9
+
10
+
11
+ class AzureBlobStorageClient(BaseStorageClient):
12
+ def __init__(self, container_name: str, storage_account: str, storage_key: str):
13
+ self.container_name = container_name
14
+ self.storage_account = storage_account
15
+ self.storage_key = storage_key
16
+ connection_string = (
17
+ f"DefaultEndpointsProtocol=https;"
18
+ f"AccountName={storage_account};"
19
+ f"AccountKey={storage_key};"
20
+ f"EndpointSuffix=core.windows.net"
21
+ )
22
+ self.service_client = AsyncBlobServiceClient.from_connection_string(
23
+ connection_string
24
+ )
25
+ logger.info("AzureBlobStorageClient initialized")
26
+
27
+ async def get_read_url(self, object_key: str) -> str:
28
+ if not self.storage_key:
29
+ raise Exception("Not using Azure Storage")
30
+
31
+ sas_permissions = BlobSasPermissions(read=True)
32
+ start_time = datetime.now()
33
+ expiry_time = start_time + timedelta(seconds=EXPIRY_TIME)
34
+
35
+ sas_token = generate_blob_sas(
36
+ account_name=self.storage_account,
37
+ container_name=self.container_name,
38
+ blob_name=object_key,
39
+ account_key=self.storage_key,
40
+ permission=sas_permissions,
41
+ start=start_time,
42
+ expiry=expiry_time,
43
+ )
44
+
45
+ return f"https://{self.storage_account}.blob.core.windows.net/{self.container_name}/{object_key}?{sas_token}"
46
+
47
+ async def upload_file(
48
+ self,
49
+ object_key: str,
50
+ data: Union[bytes, str],
51
+ mime: str = "application/octet-stream",
52
+ overwrite: bool = True,
53
+ ) -> Dict[str, Any]:
54
+ try:
55
+ container_client = self.service_client.get_container_client(
56
+ self.container_name
57
+ )
58
+ blob_client = container_client.get_blob_client(object_key)
59
+
60
+ if isinstance(data, str):
61
+ data = data.encode("utf-8")
62
+
63
+ content_settings = ContentSettings(content_type=mime)
64
+
65
+ await blob_client.upload_blob(
66
+ data, overwrite=overwrite, content_settings=content_settings
67
+ )
68
+
69
+ properties = await blob_client.get_blob_properties()
70
+
71
+ return {
72
+ "path": object_key,
73
+ "size": properties.size,
74
+ "last_modified": properties.last_modified,
75
+ "etag": properties.etag,
76
+ "content_type": properties.content_settings.content_type,
77
+ }
78
+
79
+ except Exception as e:
80
+ raise Exception(f"Failed to upload file to Azure Blob Storage: {e!s}")
@@ -1,6 +1,8 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from typing import Any, Dict, Union
3
3
 
4
+ EXPIRY_TIME = 3600
5
+
4
6
 
5
7
  class BaseStorageClient(ABC):
6
8
  """Base class for non-text data persistence like Azure Data Lake, S3, Google Storage, etc."""
@@ -14,3 +16,7 @@ class BaseStorageClient(ABC):
14
16
  overwrite: bool = True,
15
17
  ) -> Dict[str, Any]:
16
18
  pass
19
+
20
+ @abstractmethod
21
+ async def get_read_url(self, object_key: str) -> str:
22
+ pass
@@ -0,0 +1,78 @@
1
+ import base64
2
+ from typing import Any, Dict, Union
3
+
4
+ from google.cloud import storage # type: ignore
5
+ from google.oauth2 import service_account
6
+
7
+ from chainlit import make_async
8
+ from chainlit.data.storage_clients.base import EXPIRY_TIME, BaseStorageClient
9
+ from chainlit.logger import logger
10
+
11
+
12
+ class GCSStorageClient(BaseStorageClient):
13
+ def __init__(
14
+ self, project_id: str, client_email: str, private_key: str, bucket_name: str
15
+ ):
16
+ private_key = base64.b64decode(private_key).decode("utf-8")
17
+
18
+ credentials = service_account.Credentials.from_service_account_info(
19
+ {
20
+ "type": "service_account",
21
+ "project_id": project_id,
22
+ "private_key": private_key,
23
+ "client_email": client_email,
24
+ "token_uri": "https://oauth2.googleapis.com/token",
25
+ }
26
+ )
27
+
28
+ self.client = storage.Client(project=project_id, credentials=credentials)
29
+ self.bucket_name = bucket_name
30
+ self.bucket = self.client.bucket(bucket_name)
31
+ logger.info("GCSStorageClient initialized")
32
+
33
+ def sync_get_read_url(self, object_key: str) -> str:
34
+ return self.bucket.blob(object_key).generate_signed_url(
35
+ version="v4", expiration=EXPIRY_TIME, method="GET"
36
+ )
37
+
38
+ async def get_read_url(self, object_key: str) -> str:
39
+ return await make_async(self.sync_get_read_url)(object_key)
40
+
41
+ def sync_upload_file(
42
+ self,
43
+ object_key: str,
44
+ data: Union[bytes, str],
45
+ mime: str = "application/octet-stream",
46
+ overwrite: bool = True,
47
+ ) -> Dict[str, Any]:
48
+ try:
49
+ blob = self.bucket.blob(object_key)
50
+
51
+ if not overwrite and blob.exists():
52
+ raise Exception(
53
+ f"File {object_key} already exists and overwrite is False"
54
+ )
55
+
56
+ if isinstance(data, str):
57
+ data = data.encode("utf-8")
58
+
59
+ blob.upload_from_string(data, content_type=mime)
60
+
61
+ return {
62
+ "object_key": object_key,
63
+ "url": f"gs://{self.bucket_name}/{object_key}",
64
+ }
65
+
66
+ except Exception as e:
67
+ raise Exception(f"Failed to upload file to GCS: {e!s}")
68
+
69
+ async def upload_file(
70
+ self,
71
+ object_key: str,
72
+ data: Union[bytes, str],
73
+ mime: str = "application/octet-stream",
74
+ overwrite: bool = True,
75
+ ) -> Dict[str, Any]:
76
+ return await make_async(self.sync_upload_file)(
77
+ object_key, data, mime, overwrite
78
+ )
@@ -1,7 +1,8 @@
1
1
  from typing import Any, Dict, Union
2
2
 
3
3
  import boto3 # type: ignore
4
- from chainlit.data.storage_clients.base import BaseStorageClient
4
+
5
+ from chainlit.data.storage_clients.base import EXPIRY_TIME, BaseStorageClient
5
6
  from chainlit.logger import logger
6
7
 
7
8
 
@@ -10,14 +11,26 @@ class S3StorageClient(BaseStorageClient):
10
11
  Class to enable Amazon S3 storage provider
11
12
  """
12
13
 
13
- def __init__(self, bucket: str):
14
+ def __init__(self, bucket: str, **kwargs: Any):
14
15
  try:
15
16
  self.bucket = bucket
16
- self.client = boto3.client("s3")
17
+ self.client = boto3.client("s3", **kwargs)
17
18
  logger.info("S3StorageClient initialized")
18
19
  except Exception as e:
19
20
  logger.warn(f"S3StorageClient initialization error: {e}")
20
21
 
22
+ async def get_read_url(self, object_key: str) -> str:
23
+ try:
24
+ url = self.client.generate_presigned_url(
25
+ "get_object",
26
+ Params={"Bucket": self.bucket, "Key": object_key},
27
+ ExpiresIn=EXPIRY_TIME,
28
+ )
29
+ return url
30
+ except Exception as e:
31
+ logger.warn(f"S3StorageClient, get_read_url error: {e}")
32
+ return object_key
33
+
21
34
  async def upload_file(
22
35
  self,
23
36
  object_key: str,
chainlit/discord/app.py CHANGED
@@ -12,6 +12,8 @@ if TYPE_CHECKING:
12
12
  import discord
13
13
  import filetype
14
14
  import httpx
15
+ from discord.ui import Button, View
16
+
15
17
  from chainlit.config import config
16
18
  from chainlit.context import ChainlitContext, HTTPSession, context, context_var
17
19
  from chainlit.data import get_data_layer
@@ -23,7 +25,6 @@ from chainlit.telemetry import trace
23
25
  from chainlit.types import Feedback
24
26
  from chainlit.user import PersistedUser, User
25
27
  from chainlit.user_session import user_session
26
- from discord.ui import Button, View
27
28
 
28
29
 
29
30
  class FeedbackView(View):
chainlit/element.py CHANGED
@@ -16,13 +16,15 @@ from typing import (
16
16
  )
17
17
 
18
18
  import filetype
19
+ from pydantic import Field
20
+ from pydantic.dataclasses import dataclass
21
+ from syncer import asyncio
22
+
19
23
  from chainlit.context import context
20
24
  from chainlit.data import get_data_layer
21
25
  from chainlit.logger import logger
22
26
  from chainlit.telemetry import trace_event
23
27
  from chainlit.types import FileDict
24
- from pydantic.dataclasses import Field, dataclass
25
- from syncer import asyncio
26
28
 
27
29
  mime_types = {
28
30
  "text": "text/plain",
@@ -40,7 +42,7 @@ ElementType = Literal[
40
42
  "file",
41
43
  "plotly",
42
44
  "dataframe",
43
- "component",
45
+ "custom",
44
46
  ]
45
47
  ElementDisplay = Literal["inline", "side", "page"]
46
48
  ElementSize = Literal["small", "medium", "large"]
@@ -58,6 +60,7 @@ class ElementDict(TypedDict):
58
60
  size: Optional[ElementSize]
59
61
  language: Optional[str]
60
62
  page: Optional[int]
63
+ props: Optional[Dict]
61
64
  autoPlay: Optional[bool]
62
65
  playerConfig: Optional[dict]
63
66
  forId: Optional[str]
@@ -115,6 +118,7 @@ class Element:
115
118
  "display": self.display,
116
119
  "objectKey": getattr(self, "object_key", None),
117
120
  "size": getattr(self, "size", None),
121
+ "props": getattr(self, "props", None),
118
122
  "page": getattr(self, "page", None),
119
123
  "autoPlay": getattr(self, "auto_play", None),
120
124
  "playerConfig": getattr(self, "player_config", None),
@@ -154,7 +158,7 @@ class Element:
154
158
  try:
155
159
  asyncio.create_task(data_layer.create_element(self))
156
160
  except Exception as e:
157
- logger.error(f"Failed to create element: {str(e)}")
161
+ logger.error(f"Failed to create element: {e!s}")
158
162
  if not self.url and (not self.chainlit_key or self.updatable):
159
163
  file_dict = await context.session.persist_file(
160
164
  name=self.name,
@@ -352,8 +356,7 @@ class Plotly(Element):
352
356
  content: str = ""
353
357
 
354
358
  def __post_init__(self) -> None:
355
- from plotly import graph_objects as go
356
- from plotly import io as pio
359
+ from plotly import graph_objects as go, io as pio
357
360
 
358
361
  if not isinstance(self.figure, go.Figure):
359
362
  raise TypeError("figure must be a plotly.graph_objects.Figure")
@@ -387,14 +390,15 @@ class Dataframe(Element):
387
390
 
388
391
 
389
392
  @dataclass
390
- class Component(Element):
391
- """Useful to send a custom component to the UI."""
393
+ class CustomElement(Element):
394
+ """Useful to send a custom element to the UI."""
392
395
 
393
- type: ClassVar[ElementType] = "component"
396
+ type: ClassVar[ElementType] = "custom"
394
397
  mime: str = "application/json"
395
398
  props: Dict = Field(default_factory=dict)
396
399
 
397
400
  def __post_init__(self) -> None:
398
401
  self.content = json.dumps(self.props)
402
+ self.updatable = True
399
403
 
400
404
  super().__post_init__()
chainlit/emitter.py CHANGED
@@ -2,6 +2,9 @@ import asyncio
2
2
  import uuid
3
3
  from typing import Any, Dict, List, Literal, Optional, Union, cast
4
4
 
5
+ from literalai.helper import utc_now
6
+ from socketio.exceptions import TimeoutError
7
+
5
8
  from chainlit.chat_context import chat_context
6
9
  from chainlit.config import config
7
10
  from chainlit.data import get_data_layer
@@ -16,12 +19,10 @@ from chainlit.types import (
16
19
  FileDict,
17
20
  FileReference,
18
21
  MessagePayload,
22
+ OutputAudioChunk,
19
23
  ThreadDict,
20
- OutputAudioChunk
21
24
  )
22
25
  from chainlit.user import PersistedUser
23
- from literalai.helper import utc_now
24
- from socketio.exceptions import TimeoutError
25
26
 
26
27
 
27
28
  class BaseChainlitEmitter:
@@ -52,15 +53,15 @@ class BaseChainlitEmitter:
52
53
  async def send_element(self, element_dict: ElementDict):
53
54
  """Stub method to send an element to the UI."""
54
55
  pass
55
-
56
+
56
57
  async def update_audio_connection(self, state: Literal["on", "off"]):
57
58
  """Audio connection signaling."""
58
59
  pass
59
-
60
+
60
61
  async def send_audio_chunk(self, chunk: OutputAudioChunk):
61
62
  """Stub method to send an audio chunk to the UI."""
62
63
  pass
63
-
64
+
64
65
  async def send_audio_interrupt(self):
65
66
  """Stub method to interrupt the current audio response."""
66
67
  pass
@@ -127,10 +128,8 @@ class BaseChainlitEmitter:
127
128
  """Stub method to set chat settings."""
128
129
  pass
129
130
 
130
- async def send_action_response(
131
- self, id: str, status: bool, response: Optional[str] = None
132
- ):
133
- """Send an action response to the UI."""
131
+ async def send_window_message(self, data: Any):
132
+ """Stub method to send custom data to the host window."""
134
133
  pass
135
134
 
136
135
 
@@ -177,7 +176,7 @@ class ChainlitEmitter(BaseChainlitEmitter):
177
176
  async def send_audio_chunk(self, chunk: OutputAudioChunk):
178
177
  """Send an audio chunk to the UI."""
179
178
  await self.emit("audio_chunk", chunk)
180
-
179
+
181
180
  async def send_audio_interrupt(self):
182
181
  """Method to interrupt the current audio response."""
183
182
  await self.emit("audio_interrupt", {})
@@ -283,9 +282,9 @@ class ChainlitEmitter(BaseChainlitEmitter):
283
282
  # End the task temporarily so that the User can answer the prompt
284
283
  await self.task_end()
285
284
 
286
- final_res: Optional[
287
- Union["StepDict", "AskActionResponse", List["FileDict"]]
288
- ] = None
285
+ final_res: Optional[Union[StepDict, AskActionResponse, List[FileDict]]] = (
286
+ None
287
+ )
289
288
 
290
289
  if user_res:
291
290
  interaction: Union[str, None] = None
@@ -320,7 +319,7 @@ class ChainlitEmitter(BaseChainlitEmitter):
320
319
  elif spec.type == "action":
321
320
  action_res = cast(AskActionResponse, user_res)
322
321
  final_res = action_res
323
- interaction = action_res["value"]
322
+ interaction = action_res["name"]
324
323
 
325
324
  if not self.session.has_first_interaction and interaction:
326
325
  self.session.has_first_interaction = True
@@ -386,9 +385,6 @@ class ChainlitEmitter(BaseChainlitEmitter):
386
385
  def set_chat_settings(self, settings: Dict[str, Any]):
387
386
  self.session.chat_settings = settings
388
387
 
389
- def send_action_response(
390
- self, id: str, status: bool, response: Optional[str] = None
391
- ):
392
- return self.emit(
393
- "action_response", {"id": id, "status": status, "response": response}
394
- )
388
+ def send_window_message(self, data: Any):
389
+ """Send custom data to the host window."""
390
+ return self.emit("window_message", data)
@@ -1 +1 @@
1
- import{g as P,r as v,u as D,a as O}from"./index-2yAiK0R5.js";function b(t,e){for(var r=0;r<e.length;r++){const o=e[r];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(o,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D};
1
+ import{n as P,r as v,o as D,q as O}from"./index-D7lZEN9m.js";function b(t,e){for(var r=0;r<e.length;r++){const o=e[r];if(typeof o!="string"&&!Array.isArray(o)){for(const a in o)if(a!=="default"&&!(a in t)){const i=Object.getOwnPropertyDescriptor(o,a);i&&Object.defineProperty(t,a,i.get?i:{enumerable:!0,get:()=>o[a]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var M=Object.create,s=Object.defineProperty,w=Object.getOwnPropertyDescriptor,S=Object.getOwnPropertyNames,j=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty,E=(t,e,r)=>e in t?s(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A=(t,e)=>{for(var r in e)s(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of S(e))!T.call(t,a)&&a!==r&&s(t,a,{get:()=>e[a],enumerable:!(o=w(e,a))||o.enumerable});return t},L=(t,e,r)=>(r=t!=null?M(j(t)):{},h(!t||!t.__esModule?s(r,"default",{value:t,enumerable:!0}):r,t)),C=t=>h(s({},"__esModule",{value:!0}),t),n=(t,e,r)=>(E(t,typeof e!="symbol"?e+"":e,r),r),d={};A(d,{default:()=>p});var _=C(d),c=L(v),l=D,f=O;const N="https://api.dmcdn.net/all.js",x="DM",K="dmAsyncInit";class p extends c.Component{constructor(){super(...arguments),n(this,"callPlayer",l.callPlayer),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.callPlayer("setMuted",!0)}),n(this,"unmute",()=>{this.callPlayer("setMuted",!1)}),n(this,"ref",e=>{this.container=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){const{controls:r,config:o,onError:a,playing:i}=this.props,[,y]=e.match(f.MATCH_URL_DAILYMOTION);if(this.player){this.player.load(y,{start:(0,l.parseStartTime)(e),autoplay:i});return}(0,l.getSDK)(N,x,K,u=>u.player).then(u=>{if(!this.container)return;const g=u.player;this.player=new g(this.container,{width:"100%",height:"100%",video:y,params:{controls:r,autoplay:this.props.playing,mute:this.props.muted,start:(0,l.parseStartTime)(e),origin:window.location.origin,...o.params},events:{apiready:this.props.onReady,seeked:()=>this.props.onSeek(this.player.currentTime),video_end:this.props.onEnded,durationchange:this.onDurationChange,pause:this.props.onPause,playing:this.props.onPlay,waiting:this.props.onBuffer,error:m=>a(m)}})},a)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}getDuration(){return this.player.duration||null}getCurrentTime(){return this.player.currentTime}getSecondsLoaded(){return this.player.bufferedTime}render(){const{display:e}=this.props,r={width:"100%",height:"100%",display:e};return c.default.createElement("div",{style:r},c.default.createElement("div",{ref:this.ref}))}}n(p,"displayName","DailyMotion");n(p,"canPlay",f.canPlay.dailymotion);n(p,"loopOnEnded",!0);const R=P(_),I=b({__proto__:null,default:R},[_]);export{I as D};
@@ -0,0 +1,22 @@
1
+ import{r as E,u as ve,j as v,L as he,A as _e,a as Fe,b as $e,P as j,c as xe,T as Pe,d as Me,e as B,f as Ve,g as Ie,h as re,i as ye,k as Ee,l as De,m as He}from"./index-D7lZEN9m.js";/**
2
+ * table-core
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */function I(e,o){return typeof e=="function"?e(o):e}function x(e,o){return t=>{o.setState(n=>({...n,[e]:I(t,n[e])}))}}function O(e){return e instanceof Function}function Ae(e){return Array.isArray(e)&&e.every(o=>typeof o=="number")}function Ge(e,o){const t=[],n=i=>{i.forEach(r=>{t.push(r);const l=o(r);l!=null&&l.length&&n(l)})};return n(e),t}function m(e,o,t){let n=[],i;return r=>{let l;t.key&&t.debug&&(l=Date.now());const s=e(r);if(!(s.length!==n.length||s.some((d,f)=>n[f]!==d)))return i;n=s;let a;if(t.key&&t.debug&&(a=Date.now()),i=o(...s),t==null||t.onChange==null||t.onChange(i),t.key&&t.debug&&t!=null&&t.debug()){const d=Math.round((Date.now()-l)*100)/100,f=Math.round((Date.now()-a)*100)/100,c=f/16,g=(p,S)=>{for(p=String(p);p.length<S;)p=" "+p;return p};console.info(`%c⏱ ${g(f,5)} /${g(d,5)} ms`,`
11
+ font-size: .6rem;
12
+ font-weight: bold;
13
+ color: hsl(${Math.max(0,Math.min(120-120*c,120))}deg 100% 31%);`,t==null?void 0:t.key)}return i}}function C(e,o,t,n){return{debug:()=>{var i;return(i=e==null?void 0:e.debugAll)!=null?i:e[o]},key:!1,onChange:n}}function ze(e,o,t,n){const i=()=>{var l;return(l=r.getValue())!=null?l:e.options.renderFallbackValue},r={id:`${o.id}_${t.id}`,row:o,column:t,getValue:()=>o.getValue(n),renderValue:i,getContext:m(()=>[e,t,o,r],(l,s,u,a)=>({table:l,column:s,row:u,cell:a,getValue:a.getValue,renderValue:a.renderValue}),C(e.options,"debugCells"))};return e._features.forEach(l=>{l.createCell==null||l.createCell(r,t,o,e)},{}),r}function Le(e,o,t,n){var i,r;const s={...e._getDefaultColumnDef(),...o},u=s.accessorKey;let a=(i=(r=s.id)!=null?r:u?typeof String.prototype.replaceAll=="function"?u.replaceAll(".","_"):u.replace(/\./g,"_"):void 0)!=null?i:typeof s.header=="string"?s.header:void 0,d;if(s.accessorFn?d=s.accessorFn:u&&(u.includes(".")?d=c=>{let g=c;for(const S of u.split(".")){var p;g=(p=g)==null?void 0:p[S]}return g}:d=c=>c[s.accessorKey]),!a)throw new Error;let f={id:`${String(a)}`,accessorFn:d,parent:n,depth:t,columnDef:s,columns:[],getFlatColumns:m(()=>[!0],()=>{var c;return[f,...(c=f.columns)==null?void 0:c.flatMap(g=>g.getFlatColumns())]},C(e.options,"debugColumns")),getLeafColumns:m(()=>[e._getOrderColumnsFn()],c=>{var g;if((g=f.columns)!=null&&g.length){let p=f.columns.flatMap(S=>S.getLeafColumns());return c(p)}return[f]},C(e.options,"debugColumns"))};for(const c of e._features)c.createColumn==null||c.createColumn(f,e);return f}const F="debugHeaders";function le(e,o,t){var n;let r={id:(n=t.id)!=null?n:o.id,column:o,index:t.index,isPlaceholder:!!t.isPlaceholder,placeholderId:t.placeholderId,depth:t.depth,subHeaders:[],colSpan:0,rowSpan:0,headerGroup:null,getLeafHeaders:()=>{const l=[],s=u=>{u.subHeaders&&u.subHeaders.length&&u.subHeaders.map(s),l.push(u)};return s(r),l},getContext:()=>({table:e,header:r,column:o})};return e._features.forEach(l=>{l.createHeader==null||l.createHeader(r,e)}),r}const Oe={createTable:e=>{e.getHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>{var r,l;const s=(r=n==null?void 0:n.map(f=>t.find(c=>c.id===f)).filter(Boolean))!=null?r:[],u=(l=i==null?void 0:i.map(f=>t.find(c=>c.id===f)).filter(Boolean))!=null?l:[],a=t.filter(f=>!(n!=null&&n.includes(f.id))&&!(i!=null&&i.includes(f.id)));return G(o,[...s,...a,...u],e)},C(e.options,F)),e.getCenterHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n,i)=>(t=t.filter(r=>!(n!=null&&n.includes(r.id))&&!(i!=null&&i.includes(r.id))),G(o,t,e,"center")),C(e.options,F)),e.getLeftHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.left],(o,t,n)=>{var i;const r=(i=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"left")},C(e.options,F)),e.getRightHeaderGroups=m(()=>[e.getAllColumns(),e.getVisibleLeafColumns(),e.getState().columnPinning.right],(o,t,n)=>{var i;const r=(i=n==null?void 0:n.map(l=>t.find(s=>s.id===l)).filter(Boolean))!=null?i:[];return G(o,r,e,"right")},C(e.options,F)),e.getFooterGroups=m(()=>[e.getHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getLeftFooterGroups=m(()=>[e.getLeftHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getCenterFooterGroups=m(()=>[e.getCenterHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getRightFooterGroups=m(()=>[e.getRightHeaderGroups()],o=>[...o].reverse(),C(e.options,F)),e.getFlatHeaders=m(()=>[e.getHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getLeftFlatHeaders=m(()=>[e.getLeftHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getCenterFlatHeaders=m(()=>[e.getCenterHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getRightFlatHeaders=m(()=>[e.getRightHeaderGroups()],o=>o.map(t=>t.headers).flat(),C(e.options,F)),e.getCenterLeafHeaders=m(()=>[e.getCenterFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getLeftLeafHeaders=m(()=>[e.getLeftFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getRightLeafHeaders=m(()=>[e.getRightFlatHeaders()],o=>o.filter(t=>{var n;return!((n=t.subHeaders)!=null&&n.length)}),C(e.options,F)),e.getLeafHeaders=m(()=>[e.getLeftHeaderGroups(),e.getCenterHeaderGroups(),e.getRightHeaderGroups()],(o,t,n)=>{var i,r,l,s,u,a;return[...(i=(r=o[0])==null?void 0:r.headers)!=null?i:[],...(l=(s=t[0])==null?void 0:s.headers)!=null?l:[],...(u=(a=n[0])==null?void 0:a.headers)!=null?u:[]].map(d=>d.getLeafHeaders()).flat()},C(e.options,F))}};function G(e,o,t,n){var i,r;let l=0;const s=function(c,g){g===void 0&&(g=1),l=Math.max(l,g),c.filter(p=>p.getIsVisible()).forEach(p=>{var S;(S=p.columns)!=null&&S.length&&s(p.columns,g+1)},0)};s(e);let u=[];const a=(c,g)=>{const p={depth:g,id:[n,`${g}`].filter(Boolean).join("_"),headers:[]},S=[];c.forEach(w=>{const R=[...S].reverse()[0],h=w.column.depth===p.depth;let _,M=!1;if(h&&w.column.parent?_=w.column.parent:(_=w.column,M=!0),R&&(R==null?void 0:R.column)===_)R.subHeaders.push(w);else{const $=le(t,_,{id:[n,g,_.id,w==null?void 0:w.id].filter(Boolean).join("_"),isPlaceholder:M,placeholderId:M?`${S.filter(D=>D.column===_).length}`:void 0,depth:g,index:S.length});$.subHeaders.push(w),S.push($)}p.headers.push(w),w.headerGroup=p}),u.push(p),g>0&&a(S,g-1)},d=o.map((c,g)=>le(t,c,{depth:l,index:g}));a(d,l-1),u.reverse();const f=c=>c.filter(p=>p.column.getIsVisible()).map(p=>{let S=0,w=0,R=[0];p.subHeaders&&p.subHeaders.length?(R=[],f(p.subHeaders).forEach(_=>{let{colSpan:M,rowSpan:$}=_;S+=M,R.push($)})):S=1;const h=Math.min(...R);return w=w+h,p.colSpan=S,p.rowSpan=w,{colSpan:S,rowSpan:w}});return f((i=(r=u[0])==null?void 0:r.headers)!=null?i:[]),u}const je=(e,o,t,n,i,r,l)=>{let s={id:o,index:n,original:t,depth:i,parentId:l,_valuesCache:{},_uniqueValuesCache:{},getValue:u=>{if(s._valuesCache.hasOwnProperty(u))return s._valuesCache[u];const a=e.getColumn(u);if(a!=null&&a.accessorFn)return s._valuesCache[u]=a.accessorFn(s.original,n),s._valuesCache[u]},getUniqueValues:u=>{if(s._uniqueValuesCache.hasOwnProperty(u))return s._uniqueValuesCache[u];const a=e.getColumn(u);if(a!=null&&a.accessorFn)return a.columnDef.getUniqueValues?(s._uniqueValuesCache[u]=a.columnDef.getUniqueValues(s.original,n),s._uniqueValuesCache[u]):(s._uniqueValuesCache[u]=[s.getValue(u)],s._uniqueValuesCache[u])},renderValue:u=>{var a;return(a=s.getValue(u))!=null?a:e.options.renderFallbackValue},subRows:[],getLeafRows:()=>Ge(s.subRows,u=>u.subRows),getParentRow:()=>s.parentId?e.getRow(s.parentId,!0):void 0,getParentRows:()=>{let u=[],a=s;for(;;){const d=a.getParentRow();if(!d)break;u.push(d),a=d}return u.reverse()},getAllCells:m(()=>[e.getAllLeafColumns()],u=>u.map(a=>ze(e,s,a,a.id)),C(e.options,"debugRows")),_getAllCellsByColumnId:m(()=>[s.getAllCells()],u=>u.reduce((a,d)=>(a[d.column.id]=d,a),{}),C(e.options,"debugRows"))};for(let u=0;u<e._features.length;u++){const a=e._features[u];a==null||a.createRow==null||a.createRow(s,e)}return s},Be={createColumn:(e,o)=>{e._getFacetedRowModel=o.options.getFacetedRowModel&&o.options.getFacetedRowModel(o,e.id),e.getFacetedRowModel=()=>e._getFacetedRowModel?e._getFacetedRowModel():o.getPreFilteredRowModel(),e._getFacetedUniqueValues=o.options.getFacetedUniqueValues&&o.options.getFacetedUniqueValues(o,e.id),e.getFacetedUniqueValues=()=>e._getFacetedUniqueValues?e._getFacetedUniqueValues():new Map,e._getFacetedMinMaxValues=o.options.getFacetedMinMaxValues&&o.options.getFacetedMinMaxValues(o,e.id),e.getFacetedMinMaxValues=()=>{if(e._getFacetedMinMaxValues)return e._getFacetedMinMaxValues()}}},ae=(e,o,t)=>{var n,i;const r=t==null||(n=t.toString())==null?void 0:n.toLowerCase();return!!(!((i=e.getValue(o))==null||(i=i.toString())==null||(i=i.toLowerCase())==null)&&i.includes(r))};ae.autoRemove=e=>P(e);const ge=(e,o,t)=>{var n;return!!(!((n=e.getValue(o))==null||(n=n.toString())==null)&&n.includes(t))};ge.autoRemove=e=>P(e);const de=(e,o,t)=>{var n;return((n=e.getValue(o))==null||(n=n.toString())==null?void 0:n.toLowerCase())===(t==null?void 0:t.toLowerCase())};de.autoRemove=e=>P(e);const ce=(e,o,t)=>{var n;return(n=e.getValue(o))==null?void 0:n.includes(t)};ce.autoRemove=e=>P(e)||!(e!=null&&e.length);const fe=(e,o,t)=>!t.some(n=>{var i;return!((i=e.getValue(o))!=null&&i.includes(n))});fe.autoRemove=e=>P(e)||!(e!=null&&e.length);const pe=(e,o,t)=>t.some(n=>{var i;return(i=e.getValue(o))==null?void 0:i.includes(n)});pe.autoRemove=e=>P(e)||!(e!=null&&e.length);const Se=(e,o,t)=>e.getValue(o)===t;Se.autoRemove=e=>P(e);const me=(e,o,t)=>e.getValue(o)==t;me.autoRemove=e=>P(e);const b=(e,o,t)=>{let[n,i]=t;const r=e.getValue(o);return r>=n&&r<=i};b.resolveFilterValue=e=>{let[o,t]=e,n=typeof o!="number"?parseFloat(o):o,i=typeof t!="number"?parseFloat(t):t,r=o===null||Number.isNaN(n)?-1/0:n,l=t===null||Number.isNaN(i)?1/0:i;if(r>l){const s=r;r=l,l=s}return[r,l]};b.autoRemove=e=>P(e)||P(e[0])&&P(e[1]);const V={includesString:ae,includesStringSensitive:ge,equalsString:de,arrIncludes:ce,arrIncludesAll:fe,arrIncludesSome:pe,equals:Se,weakEquals:me,inNumberRange:b};function P(e){return e==null||e===""}const Te={getDefaultColumnDef:()=>({filterFn:"auto"}),getInitialState:e=>({columnFilters:[],...e}),getDefaultOptions:e=>({onColumnFiltersChange:x("columnFilters",e),filterFromLeafRows:!1,maxLeafRowFilterDepth:100}),createColumn:(e,o)=>{e.getAutoFilterFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);return typeof n=="string"?V.includesString:typeof n=="number"?V.inNumberRange:typeof n=="boolean"||n!==null&&typeof n=="object"?V.equals:Array.isArray(n)?V.arrIncludes:V.weakEquals},e.getFilterFn=()=>{var t,n;return O(e.columnDef.filterFn)?e.columnDef.filterFn:e.columnDef.filterFn==="auto"?e.getAutoFilterFn():(t=(n=o.options.filterFns)==null?void 0:n[e.columnDef.filterFn])!=null?t:V[e.columnDef.filterFn]},e.getCanFilter=()=>{var t,n,i;return((t=e.columnDef.enableColumnFilter)!=null?t:!0)&&((n=o.options.enableColumnFilters)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&!!e.accessorFn},e.getIsFiltered=()=>e.getFilterIndex()>-1,e.getFilterValue=()=>{var t;return(t=o.getState().columnFilters)==null||(t=t.find(n=>n.id===e.id))==null?void 0:t.value},e.getFilterIndex=()=>{var t,n;return(t=(n=o.getState().columnFilters)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.setFilterValue=t=>{o.setColumnFilters(n=>{const i=e.getFilterFn(),r=n==null?void 0:n.find(d=>d.id===e.id),l=I(t,r?r.value:void 0);if(se(i,l,e)){var s;return(s=n==null?void 0:n.filter(d=>d.id!==e.id))!=null?s:[]}const u={id:e.id,value:l};if(r){var a;return(a=n==null?void 0:n.map(d=>d.id===e.id?u:d))!=null?a:[]}return n!=null&&n.length?[...n,u]:[u]})}},createRow:(e,o)=>{e.columnFilters={},e.columnFiltersMeta={}},createTable:e=>{e.setColumnFilters=o=>{const t=e.getAllLeafColumns(),n=i=>{var r;return(r=I(o,i))==null?void 0:r.filter(l=>{const s=t.find(u=>u.id===l.id);if(s){const u=s.getFilterFn();if(se(u,l.value,s))return!1}return!0})};e.options.onColumnFiltersChange==null||e.options.onColumnFiltersChange(n)},e.resetColumnFilters=o=>{var t,n;e.setColumnFilters(o?[]:(t=(n=e.initialState)==null?void 0:n.columnFilters)!=null?t:[])},e.getPreFilteredRowModel=()=>e.getCoreRowModel(),e.getFilteredRowModel=()=>(!e._getFilteredRowModel&&e.options.getFilteredRowModel&&(e._getFilteredRowModel=e.options.getFilteredRowModel(e)),e.options.manualFiltering||!e._getFilteredRowModel?e.getPreFilteredRowModel():e._getFilteredRowModel())}};function se(e,o,t){return(e&&e.autoRemove?e.autoRemove(o,t):!1)||typeof o>"u"||typeof o=="string"&&!o}const Ne=(e,o,t)=>t.reduce((n,i)=>{const r=i.getValue(e);return n+(typeof r=="number"?r:0)},0),ke=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n>r||n===void 0&&r>=r)&&(n=r)}),n},qe=(e,o,t)=>{let n;return t.forEach(i=>{const r=i.getValue(e);r!=null&&(n<r||n===void 0&&r>=r)&&(n=r)}),n},Ue=(e,o,t)=>{let n,i;return t.forEach(r=>{const l=r.getValue(e);l!=null&&(n===void 0?l>=l&&(n=i=l):(n>l&&(n=l),i<l&&(i=l)))}),[n,i]},Xe=(e,o)=>{let t=0,n=0;if(o.forEach(i=>{let r=i.getValue(e);r!=null&&(r=+r)>=r&&(++t,n+=r)}),t)return n/t},Ke=(e,o)=>{if(!o.length)return;const t=o.map(r=>r.getValue(e));if(!Ae(t))return;if(t.length===1)return t[0];const n=Math.floor(t.length/2),i=t.sort((r,l)=>r-l);return t.length%2!==0?i[n]:(i[n-1]+i[n])/2},Je=(e,o)=>Array.from(new Set(o.map(t=>t.getValue(e))).values()),Qe=(e,o)=>new Set(o.map(t=>t.getValue(e))).size,We=(e,o)=>o.length,T={sum:Ne,min:ke,max:qe,extent:Ue,mean:Xe,median:Ke,unique:Je,uniqueCount:Qe,count:We},Ye={getDefaultColumnDef:()=>({aggregatedCell:e=>{var o,t;return(o=(t=e.getValue())==null||t.toString==null?void 0:t.toString())!=null?o:null},aggregationFn:"auto"}),getInitialState:e=>({grouping:[],...e}),getDefaultOptions:e=>({onGroupingChange:x("grouping",e),groupedColumnMode:"reorder"}),createColumn:(e,o)=>{e.toggleGrouping=()=>{o.setGrouping(t=>t!=null&&t.includes(e.id)?t.filter(n=>n!==e.id):[...t??[],e.id])},e.getCanGroup=()=>{var t,n;return((t=e.columnDef.enableGrouping)!=null?t:!0)&&((n=o.options.enableGrouping)!=null?n:!0)&&(!!e.accessorFn||!!e.columnDef.getGroupingValue)},e.getIsGrouped=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.includes(e.id)},e.getGroupedIndex=()=>{var t;return(t=o.getState().grouping)==null?void 0:t.indexOf(e.id)},e.getToggleGroupingHandler=()=>{const t=e.getCanGroup();return()=>{t&&e.toggleGrouping()}},e.getAutoAggregationFn=()=>{const t=o.getCoreRowModel().flatRows[0],n=t==null?void 0:t.getValue(e.id);if(typeof n=="number")return T.sum;if(Object.prototype.toString.call(n)==="[object Date]")return T.extent},e.getAggregationFn=()=>{var t,n;if(!e)throw new Error;return O(e.columnDef.aggregationFn)?e.columnDef.aggregationFn:e.columnDef.aggregationFn==="auto"?e.getAutoAggregationFn():(t=(n=o.options.aggregationFns)==null?void 0:n[e.columnDef.aggregationFn])!=null?t:T[e.columnDef.aggregationFn]}},createTable:e=>{e.setGrouping=o=>e.options.onGroupingChange==null?void 0:e.options.onGroupingChange(o),e.resetGrouping=o=>{var t,n;e.setGrouping(o?[]:(t=(n=e.initialState)==null?void 0:n.grouping)!=null?t:[])},e.getPreGroupedRowModel=()=>e.getFilteredRowModel(),e.getGroupedRowModel=()=>(!e._getGroupedRowModel&&e.options.getGroupedRowModel&&(e._getGroupedRowModel=e.options.getGroupedRowModel(e)),e.options.manualGrouping||!e._getGroupedRowModel?e.getPreGroupedRowModel():e._getGroupedRowModel())},createRow:(e,o)=>{e.getIsGrouped=()=>!!e.groupingColumnId,e.getGroupingValue=t=>{if(e._groupingValuesCache.hasOwnProperty(t))return e._groupingValuesCache[t];const n=o.getColumn(t);return n!=null&&n.columnDef.getGroupingValue?(e._groupingValuesCache[t]=n.columnDef.getGroupingValue(e.original),e._groupingValuesCache[t]):e.getValue(t)},e._groupingValuesCache={}},createCell:(e,o,t,n)=>{e.getIsGrouped=()=>o.getIsGrouped()&&o.id===t.groupingColumnId,e.getIsPlaceholder=()=>!e.getIsGrouped()&&o.getIsGrouped(),e.getIsAggregated=()=>{var i;return!e.getIsGrouped()&&!e.getIsPlaceholder()&&!!((i=t.subRows)!=null&&i.length)}}};function Ze(e,o,t){if(!(o!=null&&o.length)||!t)return e;const n=e.filter(r=>!o.includes(r.id));return t==="remove"?n:[...o.map(r=>e.find(l=>l.id===r)).filter(Boolean),...n]}const be={getInitialState:e=>({columnOrder:[],...e}),getDefaultOptions:e=>({onColumnOrderChange:x("columnOrder",e)}),createColumn:(e,o)=>{e.getIndex=m(t=>[A(o,t)],t=>t.findIndex(n=>n.id===e.id),C(o.options,"debugColumns")),e.getIsFirstColumn=t=>{var n;return((n=A(o,t)[0])==null?void 0:n.id)===e.id},e.getIsLastColumn=t=>{var n;const i=A(o,t);return((n=i[i.length-1])==null?void 0:n.id)===e.id}},createTable:e=>{e.setColumnOrder=o=>e.options.onColumnOrderChange==null?void 0:e.options.onColumnOrderChange(o),e.resetColumnOrder=o=>{var t;e.setColumnOrder(o?[]:(t=e.initialState.columnOrder)!=null?t:[])},e._getOrderColumnsFn=m(()=>[e.getState().columnOrder,e.getState().grouping,e.options.groupedColumnMode],(o,t,n)=>i=>{let r=[];if(!(o!=null&&o.length))r=i;else{const l=[...o],s=[...i];for(;s.length&&l.length;){const u=l.shift(),a=s.findIndex(d=>d.id===u);a>-1&&r.push(s.splice(a,1)[0])}r=[...r,...s]}return Ze(r,t,n)},C(e.options,"debugTable"))}},N=()=>({left:[],right:[]}),et={getInitialState:e=>({columnPinning:N(),...e}),getDefaultOptions:e=>({onColumnPinningChange:x("columnPinning",e)}),createColumn:(e,o)=>{e.pin=t=>{const n=e.getLeafColumns().map(i=>i.id).filter(Boolean);o.setColumnPinning(i=>{var r,l;if(t==="right"){var s,u;return{left:((s=i==null?void 0:i.left)!=null?s:[]).filter(f=>!(n!=null&&n.includes(f))),right:[...((u=i==null?void 0:i.right)!=null?u:[]).filter(f=>!(n!=null&&n.includes(f))),...n]}}if(t==="left"){var a,d;return{left:[...((a=i==null?void 0:i.left)!=null?a:[]).filter(f=>!(n!=null&&n.includes(f))),...n],right:((d=i==null?void 0:i.right)!=null?d:[]).filter(f=>!(n!=null&&n.includes(f)))}}return{left:((r=i==null?void 0:i.left)!=null?r:[]).filter(f=>!(n!=null&&n.includes(f))),right:((l=i==null?void 0:i.right)!=null?l:[]).filter(f=>!(n!=null&&n.includes(f)))}})},e.getCanPin=()=>e.getLeafColumns().some(n=>{var i,r,l;return((i=n.columnDef.enablePinning)!=null?i:!0)&&((r=(l=o.options.enableColumnPinning)!=null?l:o.options.enablePinning)!=null?r:!0)}),e.getIsPinned=()=>{const t=e.getLeafColumns().map(s=>s.id),{left:n,right:i}=o.getState().columnPinning,r=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>i==null?void 0:i.includes(s));return r?"left":l?"right":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();return i?(t=(n=o.getState().columnPinning)==null||(n=n[i])==null?void 0:n.indexOf(e.id))!=null?t:-1:0}},createRow:(e,o)=>{e.getCenterVisibleCells=m(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left,o.getState().columnPinning.right],(t,n,i)=>{const r=[...n??[],...i??[]];return t.filter(l=>!r.includes(l.column.id))},C(o.options,"debugRows")),e.getLeftVisibleCells=m(()=>[e._getAllVisibleCells(),o.getState().columnPinning.left],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"left"})),C(o.options,"debugRows")),e.getRightVisibleCells=m(()=>[e._getAllVisibleCells(),o.getState().columnPinning.right],(t,n)=>(n??[]).map(r=>t.find(l=>l.column.id===r)).filter(Boolean).map(r=>({...r,position:"right"})),C(o.options,"debugRows"))},createTable:e=>{e.setColumnPinning=o=>e.options.onColumnPinningChange==null?void 0:e.options.onColumnPinningChange(o),e.resetColumnPinning=o=>{var t,n;return e.setColumnPinning(o?N():(t=(n=e.initialState)==null?void 0:n.columnPinning)!=null?t:N())},e.getIsSomeColumnsPinned=o=>{var t;const n=e.getState().columnPinning;if(!o){var i,r;return!!((i=n.left)!=null&&i.length||(r=n.right)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e.getLeftLeafColumns=m(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getRightLeafColumns=m(()=>[e.getAllLeafColumns(),e.getState().columnPinning.right],(o,t)=>(t??[]).map(n=>o.find(i=>i.id===n)).filter(Boolean),C(e.options,"debugColumns")),e.getCenterLeafColumns=m(()=>[e.getAllLeafColumns(),e.getState().columnPinning.left,e.getState().columnPinning.right],(o,t,n)=>{const i=[...t??[],...n??[]];return o.filter(r=>!i.includes(r.id))},C(e.options,"debugColumns"))}},z={size:150,minSize:20,maxSize:Number.MAX_SAFE_INTEGER},k=()=>({startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,isResizingColumn:!1,columnSizingStart:[]}),tt={getDefaultColumnDef:()=>z,getInitialState:e=>({columnSizing:{},columnSizingInfo:k(),...e}),getDefaultOptions:e=>({columnResizeMode:"onEnd",columnResizeDirection:"ltr",onColumnSizingChange:x("columnSizing",e),onColumnSizingInfoChange:x("columnSizingInfo",e)}),createColumn:(e,o)=>{e.getSize=()=>{var t,n,i;const r=o.getState().columnSizing[e.id];return Math.min(Math.max((t=e.columnDef.minSize)!=null?t:z.minSize,(n=r??e.columnDef.size)!=null?n:z.size),(i=e.columnDef.maxSize)!=null?i:z.maxSize)},e.getStart=m(t=>[t,A(o,t),o.getState().columnSizing],(t,n)=>n.slice(0,e.getIndex(t)).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns")),e.getAfter=m(t=>[t,A(o,t),o.getState().columnSizing],(t,n)=>n.slice(e.getIndex(t)+1).reduce((i,r)=>i+r.getSize(),0),C(o.options,"debugColumns")),e.resetSize=()=>{o.setColumnSizing(t=>{let{[e.id]:n,...i}=t;return i})},e.getCanResize=()=>{var t,n;return((t=e.columnDef.enableResizing)!=null?t:!0)&&((n=o.options.enableColumnResizing)!=null?n:!0)},e.getIsResizing=()=>o.getState().columnSizingInfo.isResizingColumn===e.id},createHeader:(e,o)=>{e.getSize=()=>{let t=0;const n=i=>{if(i.subHeaders.length)i.subHeaders.forEach(n);else{var r;t+=(r=i.column.getSize())!=null?r:0}};return n(e),t},e.getStart=()=>{if(e.index>0){const t=e.headerGroup.headers[e.index-1];return t.getStart()+t.getSize()}return 0},e.getResizeHandler=t=>{const n=o.getColumn(e.column.id),i=n==null?void 0:n.getCanResize();return r=>{if(!n||!i||(r.persist==null||r.persist(),q(r)&&r.touches&&r.touches.length>1))return;const l=e.getSize(),s=e?e.getLeafHeaders().map(R=>[R.column.id,R.column.getSize()]):[[n.id,n.getSize()]],u=q(r)?Math.round(r.touches[0].clientX):r.clientX,a={},d=(R,h)=>{typeof h=="number"&&(o.setColumnSizingInfo(_=>{var M,$;const D=o.options.columnResizeDirection==="rtl"?-1:1,ne=(h-((M=_==null?void 0:_.startOffset)!=null?M:0))*D,oe=Math.max(ne/(($=_==null?void 0:_.startSize)!=null?$:0),-.999999);return _.columnSizingStart.forEach(Re=>{let[we,ie]=Re;a[we]=Math.round(Math.max(ie+ie*oe,0)*100)/100}),{..._,deltaOffset:ne,deltaPercentage:oe}}),(o.options.columnResizeMode==="onChange"||R==="end")&&o.setColumnSizing(_=>({..._,...a})))},f=R=>d("move",R),c=R=>{d("end",R),o.setColumnSizingInfo(h=>({...h,isResizingColumn:!1,startOffset:null,startSize:null,deltaOffset:null,deltaPercentage:null,columnSizingStart:[]}))},g=t||typeof document<"u"?document:null,p={moveHandler:R=>f(R.clientX),upHandler:R=>{g==null||g.removeEventListener("mousemove",p.moveHandler),g==null||g.removeEventListener("mouseup",p.upHandler),c(R.clientX)}},S={moveHandler:R=>(R.cancelable&&(R.preventDefault(),R.stopPropagation()),f(R.touches[0].clientX),!1),upHandler:R=>{var h;g==null||g.removeEventListener("touchmove",S.moveHandler),g==null||g.removeEventListener("touchend",S.upHandler),R.cancelable&&(R.preventDefault(),R.stopPropagation()),c((h=R.touches[0])==null?void 0:h.clientX)}},w=nt()?{passive:!1}:!1;q(r)?(g==null||g.addEventListener("touchmove",S.moveHandler,w),g==null||g.addEventListener("touchend",S.upHandler,w)):(g==null||g.addEventListener("mousemove",p.moveHandler,w),g==null||g.addEventListener("mouseup",p.upHandler,w)),o.setColumnSizingInfo(R=>({...R,startOffset:u,startSize:l,deltaOffset:0,deltaPercentage:0,columnSizingStart:s,isResizingColumn:n.id}))}}},createTable:e=>{e.setColumnSizing=o=>e.options.onColumnSizingChange==null?void 0:e.options.onColumnSizingChange(o),e.setColumnSizingInfo=o=>e.options.onColumnSizingInfoChange==null?void 0:e.options.onColumnSizingInfoChange(o),e.resetColumnSizing=o=>{var t;e.setColumnSizing(o?{}:(t=e.initialState.columnSizing)!=null?t:{})},e.resetHeaderSizeInfo=o=>{var t;e.setColumnSizingInfo(o?k():(t=e.initialState.columnSizingInfo)!=null?t:k())},e.getTotalSize=()=>{var o,t;return(o=(t=e.getHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getLeftTotalSize=()=>{var o,t;return(o=(t=e.getLeftHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getCenterTotalSize=()=>{var o,t;return(o=(t=e.getCenterHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0},e.getRightTotalSize=()=>{var o,t;return(o=(t=e.getRightHeaderGroups()[0])==null?void 0:t.headers.reduce((n,i)=>n+i.getSize(),0))!=null?o:0}}};let L=null;function nt(){if(typeof L=="boolean")return L;let e=!1;try{const o={get passive(){return e=!0,!1}},t=()=>{};window.addEventListener("test",t,o),window.removeEventListener("test",t)}catch{e=!1}return L=e,L}function q(e){return e.type==="touchstart"}const ot={getInitialState:e=>({columnVisibility:{},...e}),getDefaultOptions:e=>({onColumnVisibilityChange:x("columnVisibility",e)}),createColumn:(e,o)=>{e.toggleVisibility=t=>{e.getCanHide()&&o.setColumnVisibility(n=>({...n,[e.id]:t??!e.getIsVisible()}))},e.getIsVisible=()=>{var t,n;const i=e.columns;return(t=i.length?i.some(r=>r.getIsVisible()):(n=o.getState().columnVisibility)==null?void 0:n[e.id])!=null?t:!0},e.getCanHide=()=>{var t,n;return((t=e.columnDef.enableHiding)!=null?t:!0)&&((n=o.options.enableHiding)!=null?n:!0)},e.getToggleVisibilityHandler=()=>t=>{e.toggleVisibility==null||e.toggleVisibility(t.target.checked)}},createRow:(e,o)=>{e._getAllVisibleCells=m(()=>[e.getAllCells(),o.getState().columnVisibility],t=>t.filter(n=>n.column.getIsVisible()),C(o.options,"debugRows")),e.getVisibleCells=m(()=>[e.getLeftVisibleCells(),e.getCenterVisibleCells(),e.getRightVisibleCells()],(t,n,i)=>[...t,...n,...i],C(o.options,"debugRows"))},createTable:e=>{const o=(t,n)=>m(()=>[n(),n().filter(i=>i.getIsVisible()).map(i=>i.id).join("_")],i=>i.filter(r=>r.getIsVisible==null?void 0:r.getIsVisible()),C(e.options,"debugColumns"));e.getVisibleFlatColumns=o("getVisibleFlatColumns",()=>e.getAllFlatColumns()),e.getVisibleLeafColumns=o("getVisibleLeafColumns",()=>e.getAllLeafColumns()),e.getLeftVisibleLeafColumns=o("getLeftVisibleLeafColumns",()=>e.getLeftLeafColumns()),e.getRightVisibleLeafColumns=o("getRightVisibleLeafColumns",()=>e.getRightLeafColumns()),e.getCenterVisibleLeafColumns=o("getCenterVisibleLeafColumns",()=>e.getCenterLeafColumns()),e.setColumnVisibility=t=>e.options.onColumnVisibilityChange==null?void 0:e.options.onColumnVisibilityChange(t),e.resetColumnVisibility=t=>{var n;e.setColumnVisibility(t?{}:(n=e.initialState.columnVisibility)!=null?n:{})},e.toggleAllColumnsVisible=t=>{var n;t=(n=t)!=null?n:!e.getIsAllColumnsVisible(),e.setColumnVisibility(e.getAllLeafColumns().reduce((i,r)=>({...i,[r.id]:t||!(r.getCanHide!=null&&r.getCanHide())}),{}))},e.getIsAllColumnsVisible=()=>!e.getAllLeafColumns().some(t=>!(t.getIsVisible!=null&&t.getIsVisible())),e.getIsSomeColumnsVisible=()=>e.getAllLeafColumns().some(t=>t.getIsVisible==null?void 0:t.getIsVisible()),e.getToggleAllColumnsVisibilityHandler=()=>t=>{var n;e.toggleAllColumnsVisible((n=t.target)==null?void 0:n.checked)}}};function A(e,o){return o?o==="center"?e.getCenterVisibleLeafColumns():o==="left"?e.getLeftVisibleLeafColumns():e.getRightVisibleLeafColumns():e.getVisibleLeafColumns()}const it={createTable:e=>{e._getGlobalFacetedRowModel=e.options.getFacetedRowModel&&e.options.getFacetedRowModel(e,"__global__"),e.getGlobalFacetedRowModel=()=>e.options.manualFiltering||!e._getGlobalFacetedRowModel?e.getPreFilteredRowModel():e._getGlobalFacetedRowModel(),e._getGlobalFacetedUniqueValues=e.options.getFacetedUniqueValues&&e.options.getFacetedUniqueValues(e,"__global__"),e.getGlobalFacetedUniqueValues=()=>e._getGlobalFacetedUniqueValues?e._getGlobalFacetedUniqueValues():new Map,e._getGlobalFacetedMinMaxValues=e.options.getFacetedMinMaxValues&&e.options.getFacetedMinMaxValues(e,"__global__"),e.getGlobalFacetedMinMaxValues=()=>{if(e._getGlobalFacetedMinMaxValues)return e._getGlobalFacetedMinMaxValues()}}},rt={getInitialState:e=>({globalFilter:void 0,...e}),getDefaultOptions:e=>({onGlobalFilterChange:x("globalFilter",e),globalFilterFn:"auto",getColumnCanGlobalFilter:o=>{var t;const n=(t=e.getCoreRowModel().flatRows[0])==null||(t=t._getAllCellsByColumnId()[o.id])==null?void 0:t.getValue();return typeof n=="string"||typeof n=="number"}}),createColumn:(e,o)=>{e.getCanGlobalFilter=()=>{var t,n,i,r;return((t=e.columnDef.enableGlobalFilter)!=null?t:!0)&&((n=o.options.enableGlobalFilter)!=null?n:!0)&&((i=o.options.enableFilters)!=null?i:!0)&&((r=o.options.getColumnCanGlobalFilter==null?void 0:o.options.getColumnCanGlobalFilter(e))!=null?r:!0)&&!!e.accessorFn}},createTable:e=>{e.getGlobalAutoFilterFn=()=>V.includesString,e.getGlobalFilterFn=()=>{var o,t;const{globalFilterFn:n}=e.options;return O(n)?n:n==="auto"?e.getGlobalAutoFilterFn():(o=(t=e.options.filterFns)==null?void 0:t[n])!=null?o:V[n]},e.setGlobalFilter=o=>{e.options.onGlobalFilterChange==null||e.options.onGlobalFilterChange(o)},e.resetGlobalFilter=o=>{e.setGlobalFilter(o?void 0:e.initialState.globalFilter)}}},lt={getInitialState:e=>({expanded:{},...e}),getDefaultOptions:e=>({onExpandedChange:x("expanded",e),paginateExpandedRows:!0}),createTable:e=>{let o=!1,t=!1;e._autoResetExpanded=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetExpanded)!=null?n:!e.options.manualExpanding){if(t)return;t=!0,e._queue(()=>{e.resetExpanded(),t=!1})}},e.setExpanded=n=>e.options.onExpandedChange==null?void 0:e.options.onExpandedChange(n),e.toggleAllRowsExpanded=n=>{n??!e.getIsAllRowsExpanded()?e.setExpanded(!0):e.setExpanded({})},e.resetExpanded=n=>{var i,r;e.setExpanded(n?{}:(i=(r=e.initialState)==null?void 0:r.expanded)!=null?i:{})},e.getCanSomeRowsExpand=()=>e.getPrePaginationRowModel().flatRows.some(n=>n.getCanExpand()),e.getToggleAllRowsExpandedHandler=()=>n=>{n.persist==null||n.persist(),e.toggleAllRowsExpanded()},e.getIsSomeRowsExpanded=()=>{const n=e.getState().expanded;return n===!0||Object.values(n).some(Boolean)},e.getIsAllRowsExpanded=()=>{const n=e.getState().expanded;return typeof n=="boolean"?n===!0:!(!Object.keys(n).length||e.getRowModel().flatRows.some(i=>!i.getIsExpanded()))},e.getExpandedDepth=()=>{let n=0;return(e.getState().expanded===!0?Object.keys(e.getRowModel().rowsById):Object.keys(e.getState().expanded)).forEach(r=>{const l=r.split(".");n=Math.max(n,l.length)}),n},e.getPreExpandedRowModel=()=>e.getSortedRowModel(),e.getExpandedRowModel=()=>(!e._getExpandedRowModel&&e.options.getExpandedRowModel&&(e._getExpandedRowModel=e.options.getExpandedRowModel(e)),e.options.manualExpanding||!e._getExpandedRowModel?e.getPreExpandedRowModel():e._getExpandedRowModel())},createRow:(e,o)=>{e.toggleExpanded=t=>{o.setExpanded(n=>{var i;const r=n===!0?!0:!!(n!=null&&n[e.id]);let l={};if(n===!0?Object.keys(o.getRowModel().rowsById).forEach(s=>{l[s]=!0}):l=n,t=(i=t)!=null?i:!r,!r&&t)return{...l,[e.id]:!0};if(r&&!t){const{[e.id]:s,...u}=l;return u}return n})},e.getIsExpanded=()=>{var t;const n=o.getState().expanded;return!!((t=o.options.getIsRowExpanded==null?void 0:o.options.getIsRowExpanded(e))!=null?t:n===!0||n!=null&&n[e.id])},e.getCanExpand=()=>{var t,n,i;return(t=o.options.getRowCanExpand==null?void 0:o.options.getRowCanExpand(e))!=null?t:((n=o.options.enableExpanding)!=null?n:!0)&&!!((i=e.subRows)!=null&&i.length)},e.getIsAllParentsExpanded=()=>{let t=!0,n=e;for(;t&&n.parentId;)n=o.getRow(n.parentId,!0),t=n.getIsExpanded();return t},e.getToggleExpandedHandler=()=>{const t=e.getCanExpand();return()=>{t&&e.toggleExpanded()}}}},J=0,Q=10,U=()=>({pageIndex:J,pageSize:Q}),st={getInitialState:e=>({...e,pagination:{...U(),...e==null?void 0:e.pagination}}),getDefaultOptions:e=>({onPaginationChange:x("pagination",e)}),createTable:e=>{let o=!1,t=!1;e._autoResetPageIndex=()=>{var n,i;if(!o){e._queue(()=>{o=!0});return}if((n=(i=e.options.autoResetAll)!=null?i:e.options.autoResetPageIndex)!=null?n:!e.options.manualPagination){if(t)return;t=!0,e._queue(()=>{e.resetPageIndex(),t=!1})}},e.setPagination=n=>{const i=r=>I(n,r);return e.options.onPaginationChange==null?void 0:e.options.onPaginationChange(i)},e.resetPagination=n=>{var i;e.setPagination(n?U():(i=e.initialState.pagination)!=null?i:U())},e.setPageIndex=n=>{e.setPagination(i=>{let r=I(n,i.pageIndex);const l=typeof e.options.pageCount>"u"||e.options.pageCount===-1?Number.MAX_SAFE_INTEGER:e.options.pageCount-1;return r=Math.max(0,Math.min(r,l)),{...i,pageIndex:r}})},e.resetPageIndex=n=>{var i,r;e.setPageIndex(n?J:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageIndex)!=null?i:J)},e.resetPageSize=n=>{var i,r;e.setPageSize(n?Q:(i=(r=e.initialState)==null||(r=r.pagination)==null?void 0:r.pageSize)!=null?i:Q)},e.setPageSize=n=>{e.setPagination(i=>{const r=Math.max(1,I(n,i.pageSize)),l=i.pageSize*i.pageIndex,s=Math.floor(l/r);return{...i,pageIndex:s,pageSize:r}})},e.setPageCount=n=>e.setPagination(i=>{var r;let l=I(n,(r=e.options.pageCount)!=null?r:-1);return typeof l=="number"&&(l=Math.max(-1,l)),{...i,pageCount:l}}),e.getPageOptions=m(()=>[e.getPageCount()],n=>{let i=[];return n&&n>0&&(i=[...new Array(n)].fill(null).map((r,l)=>l)),i},C(e.options,"debugTable")),e.getCanPreviousPage=()=>e.getState().pagination.pageIndex>0,e.getCanNextPage=()=>{const{pageIndex:n}=e.getState().pagination,i=e.getPageCount();return i===-1?!0:i===0?!1:n<i-1},e.previousPage=()=>e.setPageIndex(n=>n-1),e.nextPage=()=>e.setPageIndex(n=>n+1),e.firstPage=()=>e.setPageIndex(0),e.lastPage=()=>e.setPageIndex(e.getPageCount()-1),e.getPrePaginationRowModel=()=>e.getExpandedRowModel(),e.getPaginationRowModel=()=>(!e._getPaginationRowModel&&e.options.getPaginationRowModel&&(e._getPaginationRowModel=e.options.getPaginationRowModel(e)),e.options.manualPagination||!e._getPaginationRowModel?e.getPrePaginationRowModel():e._getPaginationRowModel()),e.getPageCount=()=>{var n;return(n=e.options.pageCount)!=null?n:Math.ceil(e.getRowCount()/e.getState().pagination.pageSize)},e.getRowCount=()=>{var n;return(n=e.options.rowCount)!=null?n:e.getPrePaginationRowModel().rows.length}}},X=()=>({top:[],bottom:[]}),ut={getInitialState:e=>({rowPinning:X(),...e}),getDefaultOptions:e=>({onRowPinningChange:x("rowPinning",e)}),createRow:(e,o)=>{e.pin=(t,n,i)=>{const r=n?e.getLeafRows().map(u=>{let{id:a}=u;return a}):[],l=i?e.getParentRows().map(u=>{let{id:a}=u;return a}):[],s=new Set([...l,e.id,...r]);o.setRowPinning(u=>{var a,d;if(t==="bottom"){var f,c;return{top:((f=u==null?void 0:u.top)!=null?f:[]).filter(S=>!(s!=null&&s.has(S))),bottom:[...((c=u==null?void 0:u.bottom)!=null?c:[]).filter(S=>!(s!=null&&s.has(S))),...Array.from(s)]}}if(t==="top"){var g,p;return{top:[...((g=u==null?void 0:u.top)!=null?g:[]).filter(S=>!(s!=null&&s.has(S))),...Array.from(s)],bottom:((p=u==null?void 0:u.bottom)!=null?p:[]).filter(S=>!(s!=null&&s.has(S)))}}return{top:((a=u==null?void 0:u.top)!=null?a:[]).filter(S=>!(s!=null&&s.has(S))),bottom:((d=u==null?void 0:u.bottom)!=null?d:[]).filter(S=>!(s!=null&&s.has(S)))}})},e.getCanPin=()=>{var t;const{enableRowPinning:n,enablePinning:i}=o.options;return typeof n=="function"?n(e):(t=n??i)!=null?t:!0},e.getIsPinned=()=>{const t=[e.id],{top:n,bottom:i}=o.getState().rowPinning,r=t.some(s=>n==null?void 0:n.includes(s)),l=t.some(s=>i==null?void 0:i.includes(s));return r?"top":l?"bottom":!1},e.getPinnedIndex=()=>{var t,n;const i=e.getIsPinned();if(!i)return-1;const r=(t=i==="top"?o.getTopRows():o.getBottomRows())==null?void 0:t.map(l=>{let{id:s}=l;return s});return(n=r==null?void 0:r.indexOf(e.id))!=null?n:-1}},createTable:e=>{e.setRowPinning=o=>e.options.onRowPinningChange==null?void 0:e.options.onRowPinningChange(o),e.resetRowPinning=o=>{var t,n;return e.setRowPinning(o?X():(t=(n=e.initialState)==null?void 0:n.rowPinning)!=null?t:X())},e.getIsSomeRowsPinned=o=>{var t;const n=e.getState().rowPinning;if(!o){var i,r;return!!((i=n.top)!=null&&i.length||(r=n.bottom)!=null&&r.length)}return!!((t=n[o])!=null&&t.length)},e._getPinnedRows=(o,t,n)=>{var i;return((i=e.options.keepPinnedRows)==null||i?(t??[]).map(l=>{const s=e.getRow(l,!0);return s.getIsAllParentsExpanded()?s:null}):(t??[]).map(l=>o.find(s=>s.id===l))).filter(Boolean).map(l=>({...l,position:n}))},e.getTopRows=m(()=>[e.getRowModel().rows,e.getState().rowPinning.top],(o,t)=>e._getPinnedRows(o,t,"top"),C(e.options,"debugRows")),e.getBottomRows=m(()=>[e.getRowModel().rows,e.getState().rowPinning.bottom],(o,t)=>e._getPinnedRows(o,t,"bottom"),C(e.options,"debugRows")),e.getCenterRows=m(()=>[e.getRowModel().rows,e.getState().rowPinning.top,e.getState().rowPinning.bottom],(o,t,n)=>{const i=new Set([...t??[],...n??[]]);return o.filter(r=>!i.has(r.id))},C(e.options,"debugRows"))}},at={getInitialState:e=>({rowSelection:{},...e}),getDefaultOptions:e=>({onRowSelectionChange:x("rowSelection",e),enableRowSelection:!0,enableMultiRowSelection:!0,enableSubRowSelection:!0}),createTable:e=>{e.setRowSelection=o=>e.options.onRowSelectionChange==null?void 0:e.options.onRowSelectionChange(o),e.resetRowSelection=o=>{var t;return e.setRowSelection(o?{}:(t=e.initialState.rowSelection)!=null?t:{})},e.toggleAllRowsSelected=o=>{e.setRowSelection(t=>{o=typeof o<"u"?o:!e.getIsAllRowsSelected();const n={...t},i=e.getPreGroupedRowModel().flatRows;return o?i.forEach(r=>{r.getCanSelect()&&(n[r.id]=!0)}):i.forEach(r=>{delete n[r.id]}),n})},e.toggleAllPageRowsSelected=o=>e.setRowSelection(t=>{const n=typeof o<"u"?o:!e.getIsAllPageRowsSelected(),i={...t};return e.getRowModel().rows.forEach(r=>{W(i,r.id,n,!0,e)}),i}),e.getPreSelectedRowModel=()=>e.getCoreRowModel(),e.getSelectedRowModel=m(()=>[e.getState().rowSelection,e.getCoreRowModel()],(o,t)=>Object.keys(o).length?K(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getFilteredSelectedRowModel=m(()=>[e.getState().rowSelection,e.getFilteredRowModel()],(o,t)=>Object.keys(o).length?K(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getGroupedSelectedRowModel=m(()=>[e.getState().rowSelection,e.getSortedRowModel()],(o,t)=>Object.keys(o).length?K(e,t):{rows:[],flatRows:[],rowsById:{}},C(e.options,"debugTable")),e.getIsAllRowsSelected=()=>{const o=e.getFilteredRowModel().flatRows,{rowSelection:t}=e.getState();let n=!!(o.length&&Object.keys(t).length);return n&&o.some(i=>i.getCanSelect()&&!t[i.id])&&(n=!1),n},e.getIsAllPageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows.filter(i=>i.getCanSelect()),{rowSelection:t}=e.getState();let n=!!o.length;return n&&o.some(i=>!t[i.id])&&(n=!1),n},e.getIsSomeRowsSelected=()=>{var o;const t=Object.keys((o=e.getState().rowSelection)!=null?o:{}).length;return t>0&&t<e.getFilteredRowModel().flatRows.length},e.getIsSomePageRowsSelected=()=>{const o=e.getPaginationRowModel().flatRows;return e.getIsAllPageRowsSelected()?!1:o.filter(t=>t.getCanSelect()).some(t=>t.getIsSelected()||t.getIsSomeSelected())},e.getToggleAllRowsSelectedHandler=()=>o=>{e.toggleAllRowsSelected(o.target.checked)},e.getToggleAllPageRowsSelectedHandler=()=>o=>{e.toggleAllPageRowsSelected(o.target.checked)}},createRow:(e,o)=>{e.toggleSelected=(t,n)=>{const i=e.getIsSelected();o.setRowSelection(r=>{var l;if(t=typeof t<"u"?t:!i,e.getCanSelect()&&i===t)return r;const s={...r};return W(s,e.id,t,(l=n==null?void 0:n.selectChildren)!=null?l:!0,o),s})},e.getIsSelected=()=>{const{rowSelection:t}=o.getState();return ee(e,t)},e.getIsSomeSelected=()=>{const{rowSelection:t}=o.getState();return Y(e,t)==="some"},e.getIsAllSubRowsSelected=()=>{const{rowSelection:t}=o.getState();return Y(e,t)==="all"},e.getCanSelect=()=>{var t;return typeof o.options.enableRowSelection=="function"?o.options.enableRowSelection(e):(t=o.options.enableRowSelection)!=null?t:!0},e.getCanSelectSubRows=()=>{var t;return typeof o.options.enableSubRowSelection=="function"?o.options.enableSubRowSelection(e):(t=o.options.enableSubRowSelection)!=null?t:!0},e.getCanMultiSelect=()=>{var t;return typeof o.options.enableMultiRowSelection=="function"?o.options.enableMultiRowSelection(e):(t=o.options.enableMultiRowSelection)!=null?t:!0},e.getToggleSelectedHandler=()=>{const t=e.getCanSelect();return n=>{var i;t&&e.toggleSelected((i=n.target)==null?void 0:i.checked)}}}},W=(e,o,t,n,i)=>{var r;const l=i.getRow(o,!0);t?(l.getCanMultiSelect()||Object.keys(e).forEach(s=>delete e[s]),l.getCanSelect()&&(e[o]=!0)):delete e[o],n&&(r=l.subRows)!=null&&r.length&&l.getCanSelectSubRows()&&l.subRows.forEach(s=>W(e,s.id,t,n,i))};function K(e,o){const t=e.getState().rowSelection,n=[],i={},r=function(l,s){return l.map(u=>{var a;const d=ee(u,t);if(d&&(n.push(u),i[u.id]=u),(a=u.subRows)!=null&&a.length&&(u={...u,subRows:r(u.subRows)}),d)return u}).filter(Boolean)};return{rows:r(o.rows),flatRows:n,rowsById:i}}function ee(e,o){var t;return(t=o[e.id])!=null?t:!1}function Y(e,o,t){var n;if(!((n=e.subRows)!=null&&n.length))return!1;let i=!0,r=!1;return e.subRows.forEach(l=>{if(!(r&&!i)&&(l.getCanSelect()&&(ee(l,o)?r=!0:i=!1),l.subRows&&l.subRows.length)){const s=Y(l,o);s==="all"?r=!0:(s==="some"&&(r=!0),i=!1)}}),i?"all":r?"some":!1}const Z=/([0-9]+)/gm,gt=(e,o,t)=>Ce(y(e.getValue(t)).toLowerCase(),y(o.getValue(t)).toLowerCase()),dt=(e,o,t)=>Ce(y(e.getValue(t)),y(o.getValue(t))),ct=(e,o,t)=>te(y(e.getValue(t)).toLowerCase(),y(o.getValue(t)).toLowerCase()),ft=(e,o,t)=>te(y(e.getValue(t)),y(o.getValue(t))),pt=(e,o,t)=>{const n=e.getValue(t),i=o.getValue(t);return n>i?1:n<i?-1:0},St=(e,o,t)=>te(e.getValue(t),o.getValue(t));function te(e,o){return e===o?0:e>o?1:-1}function y(e){return typeof e=="number"?isNaN(e)||e===1/0||e===-1/0?"":String(e):typeof e=="string"?e:""}function Ce(e,o){const t=e.split(Z).filter(Boolean),n=o.split(Z).filter(Boolean);for(;t.length&&n.length;){const i=t.shift(),r=n.shift(),l=parseInt(i,10),s=parseInt(r,10),u=[l,s].sort();if(isNaN(u[0])){if(i>r)return 1;if(r>i)return-1;continue}if(isNaN(u[1]))return isNaN(l)?-1:1;if(l>s)return 1;if(s>l)return-1}return t.length-n.length}const H={alphanumeric:gt,alphanumericCaseSensitive:dt,text:ct,textCaseSensitive:ft,datetime:pt,basic:St},mt={getInitialState:e=>({sorting:[],...e}),getDefaultColumnDef:()=>({sortingFn:"auto",sortUndefined:1}),getDefaultOptions:e=>({onSortingChange:x("sorting",e),isMultiSortEvent:o=>o.shiftKey}),createColumn:(e,o)=>{e.getAutoSortingFn=()=>{const t=o.getFilteredRowModel().flatRows.slice(10);let n=!1;for(const i of t){const r=i==null?void 0:i.getValue(e.id);if(Object.prototype.toString.call(r)==="[object Date]")return H.datetime;if(typeof r=="string"&&(n=!0,r.split(Z).length>1))return H.alphanumeric}return n?H.text:H.basic},e.getAutoSortDir=()=>{const t=o.getFilteredRowModel().flatRows[0];return typeof(t==null?void 0:t.getValue(e.id))=="string"?"asc":"desc"},e.getSortingFn=()=>{var t,n;if(!e)throw new Error;return O(e.columnDef.sortingFn)?e.columnDef.sortingFn:e.columnDef.sortingFn==="auto"?e.getAutoSortingFn():(t=(n=o.options.sortingFns)==null?void 0:n[e.columnDef.sortingFn])!=null?t:H[e.columnDef.sortingFn]},e.toggleSorting=(t,n)=>{const i=e.getNextSortingOrder(),r=typeof t<"u"&&t!==null;o.setSorting(l=>{const s=l==null?void 0:l.find(g=>g.id===e.id),u=l==null?void 0:l.findIndex(g=>g.id===e.id);let a=[],d,f=r?t:i==="desc";if(l!=null&&l.length&&e.getCanMultiSort()&&n?s?d="toggle":d="add":l!=null&&l.length&&u!==l.length-1?d="replace":s?d="toggle":d="replace",d==="toggle"&&(r||i||(d="remove")),d==="add"){var c;a=[...l,{id:e.id,desc:f}],a.splice(0,a.length-((c=o.options.maxMultiSortColCount)!=null?c:Number.MAX_SAFE_INTEGER))}else d==="toggle"?a=l.map(g=>g.id===e.id?{...g,desc:f}:g):d==="remove"?a=l.filter(g=>g.id!==e.id):a=[{id:e.id,desc:f}];return a})},e.getFirstSortDir=()=>{var t,n;return((t=(n=e.columnDef.sortDescFirst)!=null?n:o.options.sortDescFirst)!=null?t:e.getAutoSortDir()==="desc")?"desc":"asc"},e.getNextSortingOrder=t=>{var n,i;const r=e.getFirstSortDir(),l=e.getIsSorted();return l?l!==r&&((n=o.options.enableSortingRemoval)==null||n)&&(!(t&&(i=o.options.enableMultiRemove)!=null)||i)?!1:l==="desc"?"asc":"desc":r},e.getCanSort=()=>{var t,n;return((t=e.columnDef.enableSorting)!=null?t:!0)&&((n=o.options.enableSorting)!=null?n:!0)&&!!e.accessorFn},e.getCanMultiSort=()=>{var t,n;return(t=(n=e.columnDef.enableMultiSort)!=null?n:o.options.enableMultiSort)!=null?t:!!e.accessorFn},e.getIsSorted=()=>{var t;const n=(t=o.getState().sorting)==null?void 0:t.find(i=>i.id===e.id);return n?n.desc?"desc":"asc":!1},e.getSortIndex=()=>{var t,n;return(t=(n=o.getState().sorting)==null?void 0:n.findIndex(i=>i.id===e.id))!=null?t:-1},e.clearSorting=()=>{o.setSorting(t=>t!=null&&t.length?t.filter(n=>n.id!==e.id):[])},e.getToggleSortingHandler=()=>{const t=e.getCanSort();return n=>{t&&(n.persist==null||n.persist(),e.toggleSorting==null||e.toggleSorting(void 0,e.getCanMultiSort()?o.options.isMultiSortEvent==null?void 0:o.options.isMultiSortEvent(n):!1))}}},createTable:e=>{e.setSorting=o=>e.options.onSortingChange==null?void 0:e.options.onSortingChange(o),e.resetSorting=o=>{var t,n;e.setSorting(o?[]:(t=(n=e.initialState)==null?void 0:n.sorting)!=null?t:[])},e.getPreSortedRowModel=()=>e.getGroupedRowModel(),e.getSortedRowModel=()=>(!e._getSortedRowModel&&e.options.getSortedRowModel&&(e._getSortedRowModel=e.options.getSortedRowModel(e)),e.options.manualSorting||!e._getSortedRowModel?e.getPreSortedRowModel():e._getSortedRowModel())}},Ct=[Oe,ot,be,et,Be,Te,it,rt,mt,Ye,lt,st,ut,at,tt];function Rt(e){var o,t;const n=[...Ct,...(o=e._features)!=null?o:[]];let i={_features:n};const r=i._features.reduce((c,g)=>Object.assign(c,g.getDefaultOptions==null?void 0:g.getDefaultOptions(i)),{}),l=c=>i.options.mergeOptions?i.options.mergeOptions(r,c):{...r,...c};let u={...{},...(t=e.initialState)!=null?t:{}};i._features.forEach(c=>{var g;u=(g=c.getInitialState==null?void 0:c.getInitialState(u))!=null?g:u});const a=[];let d=!1;const f={_features:n,options:{...r,...e},initialState:u,_queue:c=>{a.push(c),d||(d=!0,Promise.resolve().then(()=>{for(;a.length;)a.shift()();d=!1}).catch(g=>setTimeout(()=>{throw g})))},reset:()=>{i.setState(i.initialState)},setOptions:c=>{const g=I(c,i.options);i.options=l(g)},getState:()=>i.options.state,setState:c=>{i.options.onStateChange==null||i.options.onStateChange(c)},_getRowId:(c,g,p)=>{var S;return(S=i.options.getRowId==null?void 0:i.options.getRowId(c,g,p))!=null?S:`${p?[p.id,g].join("."):g}`},getCoreRowModel:()=>(i._getCoreRowModel||(i._getCoreRowModel=i.options.getCoreRowModel(i)),i._getCoreRowModel()),getRowModel:()=>i.getPaginationRowModel(),getRow:(c,g)=>{let p=(g?i.getPrePaginationRowModel():i.getRowModel()).rowsById[c];if(!p&&(p=i.getCoreRowModel().rowsById[c],!p))throw new Error;return p},_getDefaultColumnDef:m(()=>[i.options.defaultColumn],c=>{var g;return c=(g=c)!=null?g:{},{header:p=>{const S=p.header.column.columnDef;return S.accessorKey?S.accessorKey:S.accessorFn?S.id:null},cell:p=>{var S,w;return(S=(w=p.renderValue())==null||w.toString==null?void 0:w.toString())!=null?S:null},...i._features.reduce((p,S)=>Object.assign(p,S.getDefaultColumnDef==null?void 0:S.getDefaultColumnDef()),{}),...c}},C(e,"debugColumns")),_getColumnDefs:()=>i.options.columns,getAllColumns:m(()=>[i._getColumnDefs()],c=>{const g=function(p,S,w){return w===void 0&&(w=0),p.map(R=>{const h=Le(i,R,w,S),_=R;return h.columns=_.columns?g(_.columns,h,w+1):[],h})};return g(c)},C(e,"debugColumns")),getAllFlatColumns:m(()=>[i.getAllColumns()],c=>c.flatMap(g=>g.getFlatColumns()),C(e,"debugColumns")),_getAllFlatColumnsById:m(()=>[i.getAllFlatColumns()],c=>c.reduce((g,p)=>(g[p.id]=p,g),{}),C(e,"debugColumns")),getAllLeafColumns:m(()=>[i.getAllColumns(),i._getOrderColumnsFn()],(c,g)=>{let p=c.flatMap(S=>S.getLeafColumns());return g(p)},C(e,"debugColumns")),getColumn:c=>i._getAllFlatColumnsById()[c]};Object.assign(i,f);for(let c=0;c<i._features.length;c++){const g=i._features[c];g==null||g.createTable==null||g.createTable(i)}return i}function wt(){return e=>m(()=>[e.options.data],o=>{const t={rows:[],flatRows:[],rowsById:{}},n=function(i,r,l){r===void 0&&(r=0);const s=[];for(let a=0;a<i.length;a++){const d=je(e,e._getRowId(i[a],a,l),i[a],a,r,void 0,l==null?void 0:l.id);if(t.flatRows.push(d),t.rowsById[d.id]=d,s.push(d),e.options.getSubRows){var u;d.originalSubRows=e.options.getSubRows(i[a],a),(u=d.originalSubRows)!=null&&u.length&&(d.subRows=n(d.originalSubRows,r+1,d))}}return s};return t.rows=n(o),t},C(e.options,"debugTable","getRowModel",()=>e._autoResetPageIndex()))}function vt(e){const o=[],t=n=>{var i;o.push(n),(i=n.subRows)!=null&&i.length&&n.getIsExpanded()&&n.subRows.forEach(t)};return e.rows.forEach(t),{rows:o,flatRows:e.flatRows,rowsById:e.rowsById}}function ht(e){return o=>m(()=>[o.getState().pagination,o.getPrePaginationRowModel(),o.options.paginateExpandedRows?void 0:o.getState().expanded],(t,n)=>{if(!n.rows.length)return n;const{pageSize:i,pageIndex:r}=t;let{rows:l,flatRows:s,rowsById:u}=n;const a=i*r,d=a+i;l=l.slice(a,d);let f;o.options.paginateExpandedRows?f={rows:l,flatRows:s,rowsById:u}:f=vt({rows:l,flatRows:s,rowsById:u}),f.flatRows=[];const c=g=>{f.flatRows.push(g),g.subRows.length&&g.subRows.forEach(c)};return f.rows.forEach(c),f},C(o.options,"debugTable"))}function _t(){return e=>m(()=>[e.getState().sorting,e.getPreSortedRowModel()],(o,t)=>{if(!t.rows.length||!(o!=null&&o.length))return t;const n=e.getState().sorting,i=[],r=n.filter(u=>{var a;return(a=e.getColumn(u.id))==null?void 0:a.getCanSort()}),l={};r.forEach(u=>{const a=e.getColumn(u.id);a&&(l[u.id]={sortUndefined:a.columnDef.sortUndefined,invertSorting:a.columnDef.invertSorting,sortingFn:a.getSortingFn()})});const s=u=>{const a=u.map(d=>({...d}));return a.sort((d,f)=>{for(let g=0;g<r.length;g+=1){var c;const p=r[g],S=l[p.id],w=S.sortUndefined,R=(c=p==null?void 0:p.desc)!=null?c:!1;let h=0;if(w){const _=d.getValue(p.id),M=f.getValue(p.id),$=_===void 0,D=M===void 0;if($||D){if(w==="first")return $?-1:1;if(w==="last")return $?1:-1;h=$&&D?0:$?w:-w}}if(h===0&&(h=S.sortingFn(d,f,p.id)),h!==0)return R&&(h*=-1),S.invertSorting&&(h*=-1),h}return d.index-f.index}),a.forEach(d=>{var f;i.push(d),(f=d.subRows)!=null&&f.length&&(d.subRows=s(d.subRows))}),a};return{rows:s(t.rows),flatRows:i,rowsById:t.rowsById}},C(e.options,"debugTable","getSortedRowModel",()=>e._autoResetPageIndex()))}/**
14
+ * react-table
15
+ *
16
+ * Copyright (c) TanStack
17
+ *
18
+ * This source code is licensed under the MIT license found in the
19
+ * LICENSE.md file in the root directory of this source tree.
20
+ *
21
+ * @license MIT
22
+ */function ue(e,o){return e?Ft(e)?E.createElement(e,o):e:null}function Ft(e){return $t(e)||typeof e=="function"||xt(e)}function $t(e){return typeof e=="function"&&(()=>{const o=Object.getPrototypeOf(e);return o.prototype&&o.prototype.isReactComponent})()}function xt(e){return typeof e=="object"&&typeof e.$$typeof=="symbol"&&["react.memo","react.forward_ref"].includes(e.$$typeof.description)}function Pt(e){const o={state:{},onStateChange:()=>{},renderFallbackValue:null,...e},[t]=E.useState(()=>({current:Rt(o)})),[n,i]=E.useState(()=>t.current.initialState);return t.current.setOptions(r=>({...r,...e,state:{...n,...e.state},onStateChange:l=>{i(l),e.onStateChange==null||e.onStateChange(l)}})),t.current}const Mt=({data:e})=>{var u;const{index:o,columns:t,data:n}=e,i=E.useMemo(()=>t.map(a=>({accessorKey:a,header:({column:d})=>{const f=d.getIsSorted();return v.jsxs("div",{className:"flex items-center cursor-pointer",onClick:()=>d.toggleSorting(),children:[a,f==="asc"&&v.jsx(Fe,{className:"ml-2 !size-3"}),f==="desc"&&v.jsx($e,{className:"ml-2 !size-3"})]})}})),[t]),r=E.useMemo(()=>n.map((a,d)=>{const f={id:o[d]};return t.forEach((c,g)=>{f[c]=a[g]}),f}),[n,t,o]),l=Pt({data:r,columns:i,getCoreRowModel:wt(),getPaginationRowModel:ht(),getSortedRowModel:_t(),initialState:{pagination:{pageSize:10}}}),s=E.useCallback(()=>Array.from({length:l.getPageCount()},(a,d)=>v.jsx(j,{children:v.jsx(xe,{onClick:()=>l.setPageIndex(d),isActive:l.getState().pagination.pageIndex===d,children:d+1})},d)),[l.getPageCount(),l.getState().pagination.pageIndex]);return v.jsxs("div",{className:"flex flex-col gap-2 h-full overflow-y-auto dataframe",children:[v.jsx("div",{className:"rounded-md border overflow-y-auto",children:v.jsxs(Pe,{children:[v.jsx(Me,{children:l.getHeaderGroups().map(a=>v.jsx(B,{children:a.headers.map(d=>v.jsx(Ve,{children:d.isPlaceholder?null:ue(d.column.columnDef.header,d.getContext())},d.id))},a.id))}),v.jsx(Ie,{children:(u=l.getRowModel().rows)!=null&&u.length?l.getRowModel().rows.map(a=>v.jsx(B,{children:a.getVisibleCells().map(d=>v.jsx(re,{children:ue(d.column.columnDef.cell,d.getContext())},d.id))},a.id)):v.jsx(B,{children:v.jsx(re,{colSpan:t.length,className:"h-24 text-center",children:"No results."})})})]})}),v.jsx(ye,{children:v.jsxs(Ee,{className:"ml-auto",children:[v.jsx(j,{children:v.jsx(De,{onClick:()=>l.previousPage(),className:l.getCanPreviousPage()?"cursor-pointer":"pointer-events-none opacity-50"})}),s(),v.jsx(j,{children:v.jsx(He,{onClick:()=>l.nextPage(),className:l.getCanNextPage()?"cursor-pointer":"pointer-events-none opacity-50"})})]})})]})};function It({element:e}){const{data:o,isLoading:t,error:n}=ve(e.url||null),i=E.useMemo(()=>{if(o)return JSON.parse(o)},[o]);return t?v.jsx("div",{className:"flex items-center justify-center h-full w-full bg-muted",children:v.jsx(he,{})}):n?v.jsx(_e,{variant:"error",children:n.message}):v.jsx(Mt,{data:i})}export{It as default};