chainlit 2.0.dev0__py3-none-any.whl → 2.0.dev1__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.
- chainlit/__init__.py +1 -0
- chainlit/auth.py +9 -3
- chainlit/cache.py +2 -5
- chainlit/cli/__init__.py +1 -1
- chainlit/config.py +6 -1
- chainlit/context.py +6 -8
- chainlit/copilot/dist/index.js +459 -398
- chainlit/data/base.py +0 -14
- chainlit/data/dynamodb.py +2 -1
- chainlit/data/sql_alchemy.py +3 -3
- chainlit/data/storage_clients/__init__.py +0 -0
- chainlit/data/{storage_clients.py → storage_clients/azure.py} +1 -33
- chainlit/data/storage_clients/base.py +16 -0
- chainlit/data/storage_clients/s3.py +36 -0
- chainlit/discord/__init__.py +4 -4
- chainlit/element.py +29 -1
- chainlit/frontend/dist/assets/DailyMotion-D1ipkdPJ.js +1 -0
- chainlit/frontend/dist/assets/Facebook-d4TLeTik.js +1 -0
- chainlit/frontend/dist/assets/FilePlayer-BcU7tttX.js +1 -0
- chainlit/frontend/dist/assets/Kaltura-DdaRjZrh.js +1 -0
- chainlit/frontend/dist/assets/Mixcloud-BaJoMsaU.js +1 -0
- chainlit/frontend/dist/assets/Mux-DxPCM5d3.js +1 -0
- chainlit/frontend/dist/assets/Preview-tUK_Z9pZ.js +1 -0
- chainlit/frontend/dist/assets/SoundCloud-K8-lFZC6.js +1 -0
- chainlit/frontend/dist/assets/Streamable-hB-AQ54w.js +1 -0
- chainlit/frontend/dist/assets/Twitch-pmuNY0J5.js +1 -0
- chainlit/frontend/dist/assets/Vidyard-BSUm6trV.js +1 -0
- chainlit/frontend/dist/assets/Vimeo-JIPn71zS.js +1 -0
- chainlit/frontend/dist/assets/Wistia-D75KkqOG.js +1 -0
- chainlit/frontend/dist/assets/YouTube-CPlwqNm_.js +1 -0
- chainlit/frontend/dist/assets/index-CuSbXjG5.js +1091 -0
- chainlit/frontend/dist/assets/{react-plotly-f0315f86.js → react-plotly-DALmanjC.js} +94 -94
- chainlit/frontend/dist/index.html +2 -3
- chainlit/message.py +2 -3
- chainlit/oauth_providers.py +43 -9
- chainlit/openai/__init__.py +3 -5
- chainlit/server.py +20 -10
- chainlit/slack/__init__.py +3 -3
- chainlit/step.py +10 -18
- chainlit/teams/__init__.py +3 -3
- chainlit/version.py +3 -2
- {chainlit-2.0.dev0.dist-info → chainlit-2.0.dev1.dist-info}/METADATA +23 -5
- chainlit-2.0.dev1.dist-info/RECORD +99 -0
- chainlit/frontend/dist/assets/DailyMotion-b4b7af47.js +0 -1
- chainlit/frontend/dist/assets/Facebook-572972a0.js +0 -1
- chainlit/frontend/dist/assets/FilePlayer-85c69ca8.js +0 -1
- chainlit/frontend/dist/assets/Kaltura-dfc24672.js +0 -1
- chainlit/frontend/dist/assets/Mixcloud-705011f4.js +0 -1
- chainlit/frontend/dist/assets/Mux-4201a9e6.js +0 -1
- chainlit/frontend/dist/assets/Preview-23ba40a6.js +0 -1
- chainlit/frontend/dist/assets/SoundCloud-1a582d51.js +0 -1
- chainlit/frontend/dist/assets/Streamable-5017c4ba.js +0 -1
- chainlit/frontend/dist/assets/Twitch-bb2de2fa.js +0 -1
- chainlit/frontend/dist/assets/Vidyard-54e269b1.js +0 -1
- chainlit/frontend/dist/assets/Vimeo-d92c37dd.js +0 -1
- chainlit/frontend/dist/assets/Wistia-25a1363b.js +0 -1
- chainlit/frontend/dist/assets/YouTube-616e8cb7.js +0 -1
- chainlit/frontend/dist/assets/index-f5df2072.js +0 -1027
- chainlit-2.0.dev0.dist-info/RECORD +0 -96
- /chainlit/copilot/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/copilot/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- /chainlit/frontend/dist/assets/{index-aaf974a9.css → index-CwmincdQ.css} +0 -0
- /chainlit/frontend/dist/assets/{logo_dark-2a3cf740.svg → logo_dark-IkGJ_IwC.svg} +0 -0
- /chainlit/frontend/dist/assets/{logo_light-b078e7bc.svg → logo_light-Bb_IPh6r.svg} +0 -0
- {chainlit-2.0.dev0.dist-info → chainlit-2.0.dev1.dist-info}/WHEEL +0 -0
- {chainlit-2.0.dev0.dist-info → chainlit-2.0.dev1.dist-info}/entry_points.txt +0 -0
|
@@ -21,11 +21,10 @@
|
|
|
21
21
|
<script>
|
|
22
22
|
const global = globalThis;
|
|
23
23
|
</script>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
-
<link rel="stylesheet" href="/assets/index-
|
|
24
|
+
<script type="module" crossorigin src="/assets/index-CuSbXjG5.js"></script>
|
|
25
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CwmincdQ.css">
|
|
26
26
|
</head>
|
|
27
27
|
<body>
|
|
28
28
|
<div id="root"></div>
|
|
29
|
-
|
|
30
29
|
</body>
|
|
31
30
|
</html>
|
chainlit/message.py
CHANGED
|
@@ -59,7 +59,7 @@ class MessageBase(ABC):
|
|
|
59
59
|
@classmethod
|
|
60
60
|
def from_dict(self, _dict: StepDict):
|
|
61
61
|
type = _dict.get("type", "assistant_message")
|
|
62
|
-
|
|
62
|
+
return Message(
|
|
63
63
|
id=_dict["id"],
|
|
64
64
|
parent_id=_dict.get("parentId"),
|
|
65
65
|
created_at=_dict["createdAt"],
|
|
@@ -67,10 +67,9 @@ class MessageBase(ABC):
|
|
|
67
67
|
author=_dict.get("name", config.ui.name),
|
|
68
68
|
type=type, # type: ignore
|
|
69
69
|
language=_dict.get("language"),
|
|
70
|
+
metadata=_dict.get("metadata", {}),
|
|
70
71
|
)
|
|
71
72
|
|
|
72
|
-
return message
|
|
73
|
-
|
|
74
73
|
def to_dict(self) -> StepDict:
|
|
75
74
|
_dict: StepDict = {
|
|
76
75
|
"id": self.id,
|
chainlit/oauth_providers.py
CHANGED
|
@@ -16,6 +16,7 @@ class OAuthProvider:
|
|
|
16
16
|
client_secret: str
|
|
17
17
|
authorize_url: str
|
|
18
18
|
authorize_params: Dict[str, str]
|
|
19
|
+
default_prompt: Optional[str] = None
|
|
19
20
|
|
|
20
21
|
def is_configured(self):
|
|
21
22
|
return all([os.environ.get(env) for env in self.env])
|
|
@@ -26,6 +27,21 @@ class OAuthProvider:
|
|
|
26
27
|
async def get_user_info(self, token: str) -> Tuple[Dict[str, str], User]:
|
|
27
28
|
raise NotImplementedError()
|
|
28
29
|
|
|
30
|
+
def get_env_prefix(self) -> str:
|
|
31
|
+
"""Return environment prefix, like AZURE_AD."""
|
|
32
|
+
|
|
33
|
+
return self.id.replace("-", "_").upper()
|
|
34
|
+
|
|
35
|
+
def get_prompt(self) -> Optional[str]:
|
|
36
|
+
"""Return OAuth prompt param."""
|
|
37
|
+
if prompt := os.environ.get(f"OAUTH_{self.get_env_prefix()}_PROMPT"):
|
|
38
|
+
return prompt
|
|
39
|
+
|
|
40
|
+
if prompt := os.environ.get("OAUTH_PROMPT"):
|
|
41
|
+
return prompt
|
|
42
|
+
|
|
43
|
+
return self.default_prompt
|
|
44
|
+
|
|
29
45
|
|
|
30
46
|
class GithubOAuthProvider(OAuthProvider):
|
|
31
47
|
id = "github"
|
|
@@ -37,9 +53,11 @@ class GithubOAuthProvider(OAuthProvider):
|
|
|
37
53
|
self.client_secret = os.environ.get("OAUTH_GITHUB_CLIENT_SECRET")
|
|
38
54
|
self.authorize_params = {
|
|
39
55
|
"scope": "user:email",
|
|
40
|
-
"prompt": "consent",
|
|
41
56
|
}
|
|
42
57
|
|
|
58
|
+
if prompt := self.get_prompt():
|
|
59
|
+
self.authorize_params["prompt"] = prompt
|
|
60
|
+
|
|
43
61
|
async def get_token(self, code: str, url: str):
|
|
44
62
|
payload = {
|
|
45
63
|
"client_id": self.client_id,
|
|
@@ -96,9 +114,11 @@ class GoogleOAuthProvider(OAuthProvider):
|
|
|
96
114
|
"scope": "https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email",
|
|
97
115
|
"response_type": "code",
|
|
98
116
|
"access_type": "offline",
|
|
99
|
-
"prompt": "login",
|
|
100
117
|
}
|
|
101
118
|
|
|
119
|
+
if prompt := self.get_prompt():
|
|
120
|
+
self.authorize_params["prompt"] = prompt
|
|
121
|
+
|
|
102
122
|
async def get_token(self, code: str, url: str):
|
|
103
123
|
payload = {
|
|
104
124
|
"client_id": self.client_id,
|
|
@@ -164,9 +184,11 @@ class AzureADOAuthProvider(OAuthProvider):
|
|
|
164
184
|
"response_type": "code",
|
|
165
185
|
"scope": "https://graph.microsoft.com/User.Read",
|
|
166
186
|
"response_mode": "query",
|
|
167
|
-
"prompt": "login",
|
|
168
187
|
}
|
|
169
188
|
|
|
189
|
+
if prompt := self.get_prompt():
|
|
190
|
+
self.authorize_params["prompt"] = prompt
|
|
191
|
+
|
|
170
192
|
async def get_token(self, code: str, url: str):
|
|
171
193
|
payload = {
|
|
172
194
|
"client_id": self.client_id,
|
|
@@ -249,9 +271,11 @@ class AzureADHybridOAuthProvider(OAuthProvider):
|
|
|
249
271
|
"scope": "https://graph.microsoft.com/User.Read https://graph.microsoft.com/openid",
|
|
250
272
|
"response_mode": "form_post",
|
|
251
273
|
"nonce": nonce,
|
|
252
|
-
"prompt": "login",
|
|
253
274
|
}
|
|
254
275
|
|
|
276
|
+
if prompt := self.get_prompt():
|
|
277
|
+
self.authorize_params["prompt"] = prompt
|
|
278
|
+
|
|
255
279
|
async def get_token(self, code: str, url: str):
|
|
256
280
|
payload = {
|
|
257
281
|
"client_id": self.client_id,
|
|
@@ -329,9 +353,11 @@ class OktaOAuthProvider(OAuthProvider):
|
|
|
329
353
|
"response_type": "code",
|
|
330
354
|
"scope": "openid profile email",
|
|
331
355
|
"response_mode": "query",
|
|
332
|
-
"prompt": "login",
|
|
333
356
|
}
|
|
334
357
|
|
|
358
|
+
if prompt := self.get_prompt():
|
|
359
|
+
self.authorize_params["prompt"] = prompt
|
|
360
|
+
|
|
335
361
|
def get_authorization_server_path(self):
|
|
336
362
|
if not self.authorization_server_id:
|
|
337
363
|
return "/default"
|
|
@@ -401,9 +427,11 @@ class Auth0OAuthProvider(OAuthProvider):
|
|
|
401
427
|
"response_type": "code",
|
|
402
428
|
"scope": "openid profile email",
|
|
403
429
|
"audience": f"{self.original_domain}/userinfo",
|
|
404
|
-
"prompt": "login",
|
|
405
430
|
}
|
|
406
431
|
|
|
432
|
+
if prompt := self.get_prompt():
|
|
433
|
+
self.authorize_params["prompt"] = prompt
|
|
434
|
+
|
|
407
435
|
async def get_token(self, code: str, url: str):
|
|
408
436
|
payload = {
|
|
409
437
|
"client_id": self.client_id,
|
|
@@ -459,9 +487,11 @@ class DescopeOAuthProvider(OAuthProvider):
|
|
|
459
487
|
"response_type": "code",
|
|
460
488
|
"scope": "openid profile email",
|
|
461
489
|
"audience": f"{self.domain}/userinfo",
|
|
462
|
-
"prompt": "login",
|
|
463
490
|
}
|
|
464
491
|
|
|
492
|
+
if prompt := self.get_prompt():
|
|
493
|
+
self.authorize_params["prompt"] = prompt
|
|
494
|
+
|
|
465
495
|
async def get_token(self, code: str, url: str):
|
|
466
496
|
payload = {
|
|
467
497
|
"client_id": self.client_id,
|
|
@@ -518,9 +548,11 @@ class AWSCognitoOAuthProvider(OAuthProvider):
|
|
|
518
548
|
"response_type": "code",
|
|
519
549
|
"client_id": self.client_id,
|
|
520
550
|
"scope": "openid profile email",
|
|
521
|
-
"prompt": "login",
|
|
522
551
|
}
|
|
523
552
|
|
|
553
|
+
if prompt := self.get_prompt():
|
|
554
|
+
self.authorize_params["prompt"] = prompt
|
|
555
|
+
|
|
524
556
|
async def get_token(self, code: str, url: str):
|
|
525
557
|
payload = {
|
|
526
558
|
"client_id": self.client_id,
|
|
@@ -587,9 +619,11 @@ class GitlabOAuthProvider(OAuthProvider):
|
|
|
587
619
|
self.authorize_params = {
|
|
588
620
|
"scope": "openid profile email",
|
|
589
621
|
"response_type": "code",
|
|
590
|
-
"prompt": "login",
|
|
591
622
|
}
|
|
592
623
|
|
|
624
|
+
if prompt := self.get_prompt():
|
|
625
|
+
self.authorize_params["prompt"] = prompt
|
|
626
|
+
|
|
593
627
|
async def get_token(self, code: str, url: str):
|
|
594
628
|
payload = {
|
|
595
629
|
"client_id": self.client_id,
|
chainlit/openai/__init__.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from typing import Union
|
|
3
3
|
|
|
4
|
-
from chainlit.context import
|
|
4
|
+
from chainlit.context import local_steps
|
|
5
5
|
from chainlit.step import Step
|
|
6
6
|
from chainlit.utils import check_module_version
|
|
7
7
|
from literalai import ChatGeneration, CompletionGeneration
|
|
@@ -19,11 +19,9 @@ def instrument_openai():
|
|
|
19
19
|
def on_new_generation(
|
|
20
20
|
generation: Union["ChatGeneration", "CompletionGeneration"], timing
|
|
21
21
|
):
|
|
22
|
-
|
|
22
|
+
previous_steps = local_steps.get()
|
|
23
23
|
|
|
24
|
-
parent_id = None
|
|
25
|
-
if context.current_step:
|
|
26
|
-
parent_id = context.current_step.id
|
|
24
|
+
parent_id = previous_steps[-1].id if previous_steps else None
|
|
27
25
|
|
|
28
26
|
step = Step(
|
|
29
27
|
name=generation.model if generation.model else generation.provider,
|
chainlit/server.py
CHANGED
|
@@ -41,6 +41,7 @@ from fastapi import (
|
|
|
41
41
|
APIRouter,
|
|
42
42
|
Depends,
|
|
43
43
|
FastAPI,
|
|
44
|
+
File,
|
|
44
45
|
Form,
|
|
45
46
|
HTTPException,
|
|
46
47
|
Query,
|
|
@@ -645,7 +646,7 @@ async def oauth_azure_hf_callback(
|
|
|
645
646
|
|
|
646
647
|
|
|
647
648
|
_language_pattern = (
|
|
648
|
-
"^[a-zA-Z]{2,3}(-[a-zA-
|
|
649
|
+
"^[a-zA-Z]{2,3}(-[a-zA-Z0-9]{2,3})?(-[a-zA-Z0-9]{2,8})?(-x-[a-zA-Z0-9]{1,8})?$"
|
|
649
650
|
)
|
|
650
651
|
|
|
651
652
|
|
|
@@ -730,7 +731,7 @@ async def update_feedback(
|
|
|
730
731
|
try:
|
|
731
732
|
feedback_id = await data_layer.upsert_feedback(feedback=update.feedback)
|
|
732
733
|
except Exception as e:
|
|
733
|
-
raise HTTPException(detail=str(e), status_code=500)
|
|
734
|
+
raise HTTPException(detail=str(e), status_code=500) from e
|
|
734
735
|
|
|
735
736
|
return JSONResponse(content={"success": True, "feedbackId": feedback_id})
|
|
736
737
|
|
|
@@ -839,11 +840,9 @@ async def delete_thread(
|
|
|
839
840
|
|
|
840
841
|
@router.post("/project/file")
|
|
841
842
|
async def upload_file(
|
|
843
|
+
current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
|
|
842
844
|
session_id: str,
|
|
843
845
|
file: UploadFile,
|
|
844
|
-
current_user: Annotated[
|
|
845
|
-
Union[None, User, PersistedUser], Depends(get_current_user)
|
|
846
|
-
],
|
|
847
846
|
):
|
|
848
847
|
"""Upload a file to the session files directory."""
|
|
849
848
|
|
|
@@ -868,17 +867,21 @@ async def upload_file(
|
|
|
868
867
|
|
|
869
868
|
content = await file.read()
|
|
870
869
|
|
|
870
|
+
assert file.filename, "No filename for uploaded file"
|
|
871
|
+
assert file.content_type, "No content type for uploaded file"
|
|
872
|
+
|
|
871
873
|
file_response = await session.persist_file(
|
|
872
874
|
name=file.filename, content=content, mime=file.content_type
|
|
873
875
|
)
|
|
874
876
|
|
|
875
|
-
return JSONResponse(file_response)
|
|
877
|
+
return JSONResponse(content=file_response)
|
|
876
878
|
|
|
877
879
|
|
|
878
880
|
@router.get("/project/file/{file_id}")
|
|
879
881
|
async def get_file(
|
|
880
882
|
file_id: str,
|
|
881
|
-
session_id:
|
|
883
|
+
session_id: str,
|
|
884
|
+
current_user: Annotated[Union[User, PersistedUser], Depends(get_current_user)],
|
|
882
885
|
):
|
|
883
886
|
"""Get a file from the session files directory."""
|
|
884
887
|
|
|
@@ -888,10 +891,17 @@ async def get_file(
|
|
|
888
891
|
|
|
889
892
|
if not session:
|
|
890
893
|
raise HTTPException(
|
|
891
|
-
status_code=
|
|
892
|
-
detail="
|
|
894
|
+
status_code=401,
|
|
895
|
+
detail="Unauthorized",
|
|
893
896
|
)
|
|
894
897
|
|
|
898
|
+
if current_user:
|
|
899
|
+
if not session.user or session.user.identifier != current_user.identifier:
|
|
900
|
+
raise HTTPException(
|
|
901
|
+
status_code=401,
|
|
902
|
+
detail="You are not authorized to download files from this session",
|
|
903
|
+
)
|
|
904
|
+
|
|
895
905
|
if file_id in session.files:
|
|
896
906
|
file = session.files[file_id]
|
|
897
907
|
return FileResponse(file["path"], media_type=file["type"])
|
|
@@ -961,7 +971,7 @@ async def get_logo(theme: Optional[Theme] = Query(Theme.light)):
|
|
|
961
971
|
@router.get("/avatars/{avatar_id:str}")
|
|
962
972
|
async def get_avatar(avatar_id: str):
|
|
963
973
|
"""Get the avatar for the user based on the avatar_id."""
|
|
964
|
-
if not re.match(r"^[a-zA-Z0-9_-]+$", avatar_id):
|
|
974
|
+
if not re.match(r"^[a-zA-Z0-9_ -]+$", avatar_id):
|
|
965
975
|
raise HTTPException(status_code=400, detail="Invalid avatar_id")
|
|
966
976
|
|
|
967
977
|
if avatar_id == "default":
|
chainlit/slack/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import importlib.util
|
|
2
|
+
|
|
3
|
+
if importlib.util.find_spec("slack_bolt") is None:
|
|
4
4
|
raise ValueError(
|
|
5
5
|
"The slack_bolt package is required to integrate Chainlit with a Slack app. Run `pip install slack_bolt --upgrade`"
|
|
6
6
|
)
|
chainlit/step.py
CHANGED
|
@@ -65,7 +65,7 @@ class StepDict(TypedDict, total=False):
|
|
|
65
65
|
feedback: Optional[FeedbackDict]
|
|
66
66
|
|
|
67
67
|
|
|
68
|
-
def flatten_args_kwargs(func,
|
|
68
|
+
def flatten_args_kwargs(func, args, kwargs):
|
|
69
69
|
signature = inspect.signature(func)
|
|
70
70
|
bound_arguments = signature.bind(*args, **kwargs)
|
|
71
71
|
bound_arguments.apply_defaults()
|
|
@@ -140,7 +140,7 @@ def step(
|
|
|
140
140
|
try:
|
|
141
141
|
if result and not step.output:
|
|
142
142
|
step.output = result
|
|
143
|
-
except:
|
|
143
|
+
except Exception as e:
|
|
144
144
|
step.is_error = True
|
|
145
145
|
step.output = str(e)
|
|
146
146
|
return result
|
|
@@ -434,7 +434,6 @@ class Step:
|
|
|
434
434
|
if not self.parent_id:
|
|
435
435
|
if parent_step:
|
|
436
436
|
self.parent_id = parent_step.id
|
|
437
|
-
context.active_steps.append(self)
|
|
438
437
|
local_steps.set(previous_steps + [self])
|
|
439
438
|
await self.send()
|
|
440
439
|
return self
|
|
@@ -446,13 +445,10 @@ class Step:
|
|
|
446
445
|
self.output = str(exc_val)
|
|
447
446
|
self.is_error = True
|
|
448
447
|
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
if local_active_steps and self in local_active_steps:
|
|
454
|
-
local_active_steps.remove(self)
|
|
455
|
-
local_steps.set(local_active_steps)
|
|
448
|
+
current_steps = local_steps.get()
|
|
449
|
+
if current_steps and self in current_steps:
|
|
450
|
+
current_steps.remove(self)
|
|
451
|
+
local_steps.set(current_steps)
|
|
456
452
|
|
|
457
453
|
await self.update()
|
|
458
454
|
|
|
@@ -465,7 +461,6 @@ class Step:
|
|
|
465
461
|
if not self.parent_id:
|
|
466
462
|
if parent_step:
|
|
467
463
|
self.parent_id = parent_step.id
|
|
468
|
-
context.active_steps.append(self)
|
|
469
464
|
local_steps.set(previous_steps + [self])
|
|
470
465
|
|
|
471
466
|
asyncio.create_task(self.send())
|
|
@@ -478,12 +473,9 @@ class Step:
|
|
|
478
473
|
self.output = str(exc_val)
|
|
479
474
|
self.is_error = True
|
|
480
475
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
if local_active_steps and self in local_active_steps:
|
|
486
|
-
local_active_steps.remove(self)
|
|
487
|
-
local_steps.set(local_active_steps)
|
|
476
|
+
current_steps = local_steps.get()
|
|
477
|
+
if current_steps and self in current_steps:
|
|
478
|
+
current_steps.remove(self)
|
|
479
|
+
local_steps.set(current_steps)
|
|
488
480
|
|
|
489
481
|
asyncio.create_task(self.update())
|
chainlit/teams/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import importlib.util
|
|
2
|
+
|
|
3
|
+
if importlib.util.find_spec("botbuilder") is None:
|
|
4
4
|
raise ValueError(
|
|
5
5
|
"The botbuilder-core package is required to integrate Chainlit with a Slack app. Run `pip install botbuilder-core --upgrade`"
|
|
6
6
|
)
|
chainlit/version.py
CHANGED
|
@@ -3,5 +3,6 @@ from importlib import metadata
|
|
|
3
3
|
try:
|
|
4
4
|
__version__ = metadata.version(__package__)
|
|
5
5
|
except metadata.PackageNotFoundError:
|
|
6
|
-
# Case where package metadata is not available.
|
|
7
|
-
|
|
6
|
+
# Case where package metadata is not available, default to a 'non-outdated' version.
|
|
7
|
+
# Ref: config.py::load_settings()
|
|
8
|
+
__version__ = "0.3.1"
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: chainlit
|
|
3
|
-
Version: 2.0.
|
|
3
|
+
Version: 2.0.dev1
|
|
4
4
|
Summary: Build Conversational AI.
|
|
5
|
-
Home-page: https://
|
|
6
|
-
License:
|
|
5
|
+
Home-page: https://chainlit.io/
|
|
6
|
+
License: Apache-2.0
|
|
7
7
|
Keywords: LLM,Agents,gen ai,chat ui,chatbot ui,openai,copilot,langchain,conversational ai
|
|
8
|
-
Author:
|
|
8
|
+
Author: Willy Douhard
|
|
9
9
|
Requires-Python: >=3.9,<4.0.0
|
|
10
|
+
Classifier: Environment :: Web Environment
|
|
11
|
+
Classifier: Framework :: FastAPI
|
|
10
12
|
Classifier: License :: Other/Proprietary License
|
|
13
|
+
Classifier: Programming Language :: JavaScript
|
|
11
14
|
Classifier: Programming Language :: Python :: 3
|
|
12
15
|
Classifier: Programming Language :: Python :: 3.9
|
|
13
16
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
17
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
18
|
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Communications :: Chat
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Topic :: Software Development :: User Interfaces
|
|
16
23
|
Requires-Dist: aiofiles (>=23.1.0,<24.0.0)
|
|
17
24
|
Requires-Dist: asyncer (>=0.0.7,<0.0.8)
|
|
18
25
|
Requires-Dist: click (>=8.1.3,<9.0.0)
|
|
@@ -36,6 +43,7 @@ Requires-Dist: tomli (>=2.0.1,<3.0.0)
|
|
|
36
43
|
Requires-Dist: uptrace (>=1.22.0,<2.0.0)
|
|
37
44
|
Requires-Dist: uvicorn (>=0.25.0,<0.26.0)
|
|
38
45
|
Requires-Dist: watchfiles (>=0.20.0,<0.21.0)
|
|
46
|
+
Project-URL: Documentation, https://docs.chainlit.io/
|
|
39
47
|
Project-URL: Repository, https://github.com/Chainlit/chainlit
|
|
40
48
|
Description-Content-Type: text/markdown
|
|
41
49
|
|
|
@@ -61,7 +69,7 @@ Full documentation is available [here](https://docs.chainlit.io). You can ask Ch
|
|
|
61
69
|
|
|
62
70
|
> [!NOTE]
|
|
63
71
|
> Check out [Literal AI](https://literalai.com), our product to monitor and evaluate LLM applications! It works with any Python or TypeScript applications and [seamlessly](https://docs.chainlit.io/data-persistence/overview) with Chainlit by adding a `LITERAL_API_KEY` in your project.
|
|
64
|
-
>
|
|
72
|
+
>
|
|
65
73
|
> Chainlit is developed and maintained by the Literal AI team, which is currently focused on expanding the capabilities of Literal AI. While we continue to support and maintain Chainlit, we are also committed to enabling the community to contribute, particularly in areas like integrations and data layers.
|
|
66
74
|
|
|
67
75
|
<p align="center">
|
|
@@ -79,6 +87,16 @@ chainlit hello
|
|
|
79
87
|
|
|
80
88
|
If this opens the `hello app` in your browser, you're all set!
|
|
81
89
|
|
|
90
|
+
### Development version
|
|
91
|
+
|
|
92
|
+
The latest in-development version can be installed straight from GitHub with:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
pip install git+https://github.com/Chainlit/chainlit.git@dokterbob/build_frontend_on_poetry_build#subdirectory=backend/
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
(Requires Node and pnpm installed on the system.)
|
|
99
|
+
|
|
82
100
|
## 🚀 Quickstart
|
|
83
101
|
|
|
84
102
|
### 🐍 Pure Python
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
chainlit/__init__.py,sha256=a9Kp1l-bWiCWV8zn4Eo-TDwFp7Uy6bgf0u7di2bZaNo,4433
|
|
2
|
+
chainlit/__main__.py,sha256=7Vg3w3T3qDuz4KDu5lQhLH6lQ3cYdume7gHH7Z1V97U,87
|
|
3
|
+
chainlit/_utils.py,sha256=vaKfEpXcL4kXktp54IRQWZRK4L_HGK8gJuAoIM29YYc,289
|
|
4
|
+
chainlit/action.py,sha256=k-GsblVHI4DnDWFyF-RZgq3KfdfAFICFh2OBeU4w8N8,1410
|
|
5
|
+
chainlit/auth.py,sha256=Ut_sQTgYDQ7K2t3QG0ByO4Gw5t0PmmYI4Cr48cJmHCA,2846
|
|
6
|
+
chainlit/cache.py,sha256=d6A8u3aWKJouuN7Ikx6e9bnsrZzPlaCy42PXSEQYrNY,1348
|
|
7
|
+
chainlit/callbacks.py,sha256=cz8RBC4yT2M8mK--lrazMFt4ZPrdPKwca4iSLZFm_mI,8886
|
|
8
|
+
chainlit/chat_context.py,sha256=X1NInuCkhrfFhFUNIbipVaqf-90xXuyCAB9fvJlEUD4,1868
|
|
9
|
+
chainlit/chat_settings.py,sha256=2ByenmwS8O6jQjDVJjhhbLrBPGA5aY2F7R3VvQQxXPk,877
|
|
10
|
+
chainlit/cli/__init__.py,sha256=EBm7RAcR9579s1uglKQ5O9UxSEQ5FEIXh2-joljRSFc,6244
|
|
11
|
+
chainlit/config.py,sha256=8o06uZt3w6GUO-jbkOrJoYsBi8ZU7hfUctRGb44GjTs,16907
|
|
12
|
+
chainlit/context.py,sha256=yAN5da8w2P5pZ8OhQLVpsoc5eqeNoo_mFSGNE6C_AGo,3318
|
|
13
|
+
chainlit/copilot/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
14
|
+
chainlit/copilot/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
15
|
+
chainlit/copilot/dist/index.js,sha256=hfHsPAAtWdDTi9mJ28pU5T57FNZRxjIbHT_OH4ej8mo,7126630
|
|
16
|
+
chainlit/data/__init__.py,sha256=oaKft5-ejrduen95fTMVmqLMLXVyEa97mQI72oDDSlE,751
|
|
17
|
+
chainlit/data/acl.py,sha256=5EwZuKVcZediw77L661MohGce3JzGIaYmw6NutmMTw0,578
|
|
18
|
+
chainlit/data/base.py,sha256=U8MTp_7Ywmnt3j5W6TmYvBqqK61TOZ1T7kYi7RTyUGc,2539
|
|
19
|
+
chainlit/data/dynamodb.py,sha256=lb_XM5ApL82ATMmvqoHyD-Hror22TXedXLDFGFh9qZM,19456
|
|
20
|
+
chainlit/data/literalai.py,sha256=H6fxhqwJVeA6movnmlcB_TToD7jslY1X8u2vg3gIku0,17256
|
|
21
|
+
chainlit/data/sql_alchemy.py,sha256=1Kc3d6FSNVj7f2L1ms34NiAW7uAJ9fxJhUL9cjzTDyI,29562
|
|
22
|
+
chainlit/data/storage_clients/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
+
chainlit/data/storage_clients/azure.py,sha256=25VCLfSUuiwbS68r8YUaQnquDkbhvjt8iXeD78Oay_E,2530
|
|
24
|
+
chainlit/data/storage_clients/base.py,sha256=mOu3yWgLaqtdPZFjdngJ8ItTR_8Nwq05JxIjXfXlYMg,440
|
|
25
|
+
chainlit/data/storage_clients/s3.py,sha256=LcXABHtc4zX5YiMBLN4Xr7YAXpb0zPXojTMkrNjUKj0,1158
|
|
26
|
+
chainlit/data/utils.py,sha256=cVe8p9F-lITgmAD2xhON_h0nKJVrh1P0AUoLCq6JCWs,966
|
|
27
|
+
chainlit/discord/__init__.py,sha256=lTHHcYQmfa2wpJ35m3eveEpUbp6ti2YSA7AdopfsREs,219
|
|
28
|
+
chainlit/discord/app.py,sha256=-efl4v9wNvfidYPjS2kqNqaaUCvvfBlErZe6lyQF_IE,11174
|
|
29
|
+
chainlit/element.py,sha256=3bWesS5LVR3nJgrqsipDc0UqfrPOQekQWMmpgL91GDw,11632
|
|
30
|
+
chainlit/emitter.py,sha256=DvxpQYS_BKPHQ6WUEOOhAOkl9M14Tm1FQ8uFI2xi75E,13946
|
|
31
|
+
chainlit/frontend/dist/assets/DailyMotion-D1ipkdPJ.js,sha256=lfI-aAHQqeU7vKM-4nWByYOkCCOavciTgXwCVLlLR58,2958
|
|
32
|
+
chainlit/frontend/dist/assets/Facebook-d4TLeTik.js,sha256=UYx9xHuTTPbxfY8EAzQ4IoEAJKb53pa_rqKSR4ggqRE,3213
|
|
33
|
+
chainlit/frontend/dist/assets/FilePlayer-BcU7tttX.js,sha256=0MPqwM_Z2hMWD7RC_gwDHlWgsIamSeFFL4j2tOgjJo0,9038
|
|
34
|
+
chainlit/frontend/dist/assets/Kaltura-DdaRjZrh.js,sha256=_eegLbhKDAjJ0-GZK2e0Az-WF-pJOpUkChSXIjjvhso,2787
|
|
35
|
+
chainlit/frontend/dist/assets/Mixcloud-BaJoMsaU.js,sha256=5_A4jZhkc9QAPMvSpE1OQrmy_fHTwGgia_xK5X3AD6Y,2635
|
|
36
|
+
chainlit/frontend/dist/assets/Mux-DxPCM5d3.js,sha256=dZb7Vr5Rf91Ql43b5whuo9bBJDCbitChES4PHDIfWDk,5357
|
|
37
|
+
chainlit/frontend/dist/assets/Preview-tUK_Z9pZ.js,sha256=kjPNO2PZVlSRWy7pIF5zMFtHsQ1j5Mr2-X2wiHgrXTY,3008
|
|
38
|
+
chainlit/frontend/dist/assets/SoundCloud-K8-lFZC6.js,sha256=hzRPMiai5ojIEiM6E4kV5xue_bH41bEh4zOGY7PwzvM,2920
|
|
39
|
+
chainlit/frontend/dist/assets/Streamable-hB-AQ54w.js,sha256=FyErjgWAGbxutmgMZmOyMR4B3s0Rv_3a_zAJB21ah0A,2932
|
|
40
|
+
chainlit/frontend/dist/assets/Twitch-pmuNY0J5.js,sha256=uK1rfxa-DcQxmtg874BotoDLsDuL0mxiTrI9aQKjgBE,3080
|
|
41
|
+
chainlit/frontend/dist/assets/Vidyard-BSUm6trV.js,sha256=lnn3nNL0FaSUvMOURTKCWye-xGgustAGEKfUiR5swaE,2854
|
|
42
|
+
chainlit/frontend/dist/assets/Vimeo-JIPn71zS.js,sha256=M2SFC9RInnw2bXL-svvrh8SozvtUjxGzejGLLvo8NUE,3624
|
|
43
|
+
chainlit/frontend/dist/assets/Wistia-D75KkqOG.js,sha256=cE8UHEmoZ7_HeGU0Nccfeyq4HXjqpzR5v9hyZ-JpmV4,3511
|
|
44
|
+
chainlit/frontend/dist/assets/YouTube-CPlwqNm_.js,sha256=IEu7N_8-p8TQUW0m1Fqx2egYvOWS2k43-BcfCGKR6FE,4445
|
|
45
|
+
chainlit/frontend/dist/assets/index-CuSbXjG5.js,sha256=8mZvRkklEqjcYWBHkQwLFuSIWofAmMrsFilS6WtUrNQ,3086883
|
|
46
|
+
chainlit/frontend/dist/assets/index-CwmincdQ.css,sha256=qvl0qUmR5u0JcmJAfkzaZpN-0ZKdQjzqCSE9cnrQpZQ,2559
|
|
47
|
+
chainlit/frontend/dist/assets/logo_dark-IkGJ_IwC.svg,sha256=Kjz3QMh-oh-ag4YatjU0YCPqGF7F8nHh8VUQoJIs01E,8887
|
|
48
|
+
chainlit/frontend/dist/assets/logo_light-Bb_IPh6r.svg,sha256=sHjnvEq1rfqh3bcexJNYUY7WEDdTQZq3aKZYpi4w4ck,8889
|
|
49
|
+
chainlit/frontend/dist/assets/react-plotly-DALmanjC.js,sha256=MtXH8sP_q-N7gE344TAaTEe8gxmIRSiltHN4tDGkx5g,3762918
|
|
50
|
+
chainlit/frontend/dist/favicon.svg,sha256=0Cy8x28obT5eWW3nxZRhsEvu6_zMqrqbg0y6hT3D0Q0,6455
|
|
51
|
+
chainlit/frontend/dist/index.html,sha256=SK_O7tN4N8B6npXJwHS4lfYevWECNQW3TbSQtJf32Dc,972
|
|
52
|
+
chainlit/haystack/__init__.py,sha256=uZ77YiPy-qleSTi3dQCDO9HE6S6F6GpJWmh7jO4cxXA,217
|
|
53
|
+
chainlit/haystack/callbacks.py,sha256=mh6CS6n0Z70u9B1s72iF0kSl-qi2N55T-AgaMtUvq9Y,5036
|
|
54
|
+
chainlit/hello.py,sha256=LwENQWo5s5r8nNDn4iKSV77vX60Ky5r_qGjQhyi7qlY,416
|
|
55
|
+
chainlit/input_widget.py,sha256=KmOn1nPTBvnld3iIBHR0Vih0KsCxVnTbo2t_xBNANzo,4949
|
|
56
|
+
chainlit/langchain/__init__.py,sha256=zErMw0_3ufSGeF9ye7X0ZX3wDat4mTOx97T40ePDO2g,217
|
|
57
|
+
chainlit/langchain/callbacks.py,sha256=qC9p_XKYOVEszy2gdRr2QTHVtKHBzK07OXfcoxmqMOE,21242
|
|
58
|
+
chainlit/langflow/__init__.py,sha256=wxhxdsl1yxdsRyNTgZticxFF_8VFtJJ4OdIy3tnEIyM,817
|
|
59
|
+
chainlit/llama_index/__init__.py,sha256=weRoIWCaRBGvA1LczCEfsqhWsltQSVlhtRnTovtdo8w,227
|
|
60
|
+
chainlit/llama_index/callbacks.py,sha256=HtxBRkfjHnwEBmhcuYDFsAD2gUVpsOi4ET39l4afh1M,7286
|
|
61
|
+
chainlit/logger.py,sha256=wTwRSZsLfXwWy6U4351IgWAm4KCMThgxm9EZpjGUEr4,373
|
|
62
|
+
chainlit/markdown.py,sha256=V-Op4hyqyTTvXInU5QrHfxs0nb71lBMU8trOSAlast8,2142
|
|
63
|
+
chainlit/message.py,sha256=Rd7CT0U-Zv0zu7jce_XB32h10Ui7z4Ahlis41YYJJxQ,17308
|
|
64
|
+
chainlit/mistralai/__init__.py,sha256=Zr3-mb-3ycNXR1e5ui_yX_7ZxGB0cu5d9E80ir7t-2w,1507
|
|
65
|
+
chainlit/oauth_providers.py,sha256=e-HupFy6HFPCAavBfD3XGBgwHU1n0JrGHO7QjeBp0ts,24297
|
|
66
|
+
chainlit/openai/__init__.py,sha256=CJp-3lr4NS3X-aZ0H3OvKcL5wFf-cJZffIK0Bwl9jxA,1690
|
|
67
|
+
chainlit/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
68
|
+
chainlit/secret.py,sha256=cQvIFGTQ7r2heC8EOGdgifSZZYqslh-qQxhUhKhD8vU,295
|
|
69
|
+
chainlit/server.py,sha256=AIHezi1QgJC1JWRhETZmeWFXCiRg93edwrhl3MfT1nY,30430
|
|
70
|
+
chainlit/session.py,sha256=dU56wmJ9LSuSAOwKBpYF8ZofV5SoN1oPmWycHWEN85k,9219
|
|
71
|
+
chainlit/slack/__init__.py,sha256=gkC1iYlQrWHDN8bbsWOquwwlyW9DtKAe22GizJJzY7A,226
|
|
72
|
+
chainlit/slack/app.py,sha256=jzy6Nz9kmnJ6j1wfoI94cweSNDjdv7X-ur_lWnq5oVE,11741
|
|
73
|
+
chainlit/socket.py,sha256=Hg1OC0diVii9o_KZjo1mqnFbgZjezrF3r60D1-UfoBs,12762
|
|
74
|
+
chainlit/step.py,sha256=jyrmaLfj6cwiNtRcJ7q1492g5ZIpuTXX3jjI2Mv35uM,14286
|
|
75
|
+
chainlit/sync.py,sha256=G1n-7-3WgXsN8y1bJkEyws_YwmHZIyDZoZUwhprigag,1235
|
|
76
|
+
chainlit/teams/__init__.py,sha256=_lUcuc5R4bYwUoC15jyKES10KTeH8ciSWqV5JyLrW6M,236
|
|
77
|
+
chainlit/teams/app.py,sha256=gJm_wBNzCawaTLIYtOEhDlpRwBDprnguTAIoWZhlO8o,10533
|
|
78
|
+
chainlit/telemetry.py,sha256=Rk4dnZv0OnGOgV4kD-VHdhgl4i7i3ypqhSE_R-LZceM,3060
|
|
79
|
+
chainlit/translations/bn.json,sha256=_44si0jO2AFZytfH9sBcINpOveQ4OZs77yf-_VlUtjs,13172
|
|
80
|
+
chainlit/translations/en-US.json,sha256=eS9YSnca-MFpWeZI4JhI0Yl0YBQlrsxB-yFM62K03bI,7778
|
|
81
|
+
chainlit/translations/gu.json,sha256=CkhAowZ0mgMJhQUMrUADfKPfsDgj5mvHlC3WtQ0UjQE,12699
|
|
82
|
+
chainlit/translations/he-IL.json,sha256=fu6FXfoqYqydSh_NcDpS6ZN7byQ-WZkr4zU0qXznqwc,8789
|
|
83
|
+
chainlit/translations/hi.json,sha256=J15GBkMu45RJMj1p5sFVnlackwAp_jKySRsKN-wRCUg,12397
|
|
84
|
+
chainlit/translations/kn.json,sha256=koYH5mEcX4ZfacgmiTu_UfKgNbDXXUwcEV7v6uq92eY,13575
|
|
85
|
+
chainlit/translations/ml.json,sha256=x_QV-3H0vCoijszWrjHajaTBtZzAdQ0y4V2uJgLf0S4,14270
|
|
86
|
+
chainlit/translations/mr.json,sha256=pUr540hPG3Vq-Nts7Pnj-oor_scw1Rx2gaIBnGOyPZU,12495
|
|
87
|
+
chainlit/translations/ta.json,sha256=kLXucUlMCD3jXlPhmOZ3FFZNdXfGDaqVxwqGqJqVF78,14152
|
|
88
|
+
chainlit/translations/te.json,sha256=spOs9mYNITEUy_mKp4_9qmXP2yACVrruiQKb1zlRIWU,13608
|
|
89
|
+
chainlit/translations/zh-CN.json,sha256=Y3MhXUDFi4YMxX8-agpCM68efYXCGcHqyqRAen8LLfk,7508
|
|
90
|
+
chainlit/translations.py,sha256=WG_r7HzxBYns-zk9tVvoGdoofv71okTZx8k1RlcoTIg,2034
|
|
91
|
+
chainlit/types.py,sha256=7pY4iePG2s5nPxU9LnmKbmNI3vT6l5gs6jy9VEH3P4A,5181
|
|
92
|
+
chainlit/user.py,sha256=mUhnGhYQ__qEx8YzigHhF2Z9xxuqQo5C2U8opKpiVRs,752
|
|
93
|
+
chainlit/user_session.py,sha256=T1nQVN_weELXTrkDIV54YgdrA3zIvJGe1tN-nypunt4,1531
|
|
94
|
+
chainlit/utils.py,sha256=hXb5z3jb2syJP0P_jTz3zjDEuIfl0IAmQbA3MooSCTs,3989
|
|
95
|
+
chainlit/version.py,sha256=VcRO6Iwchkv80BWb4hRGkOnBgDhj87-Yjorcv1u5Z3g,276
|
|
96
|
+
chainlit-2.0.dev1.dist-info/METADATA,sha256=s4MlZw9456xccBhQd3rs5ynj9K5NQuacctEfdD_52iM,7091
|
|
97
|
+
chainlit-2.0.dev1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
|
98
|
+
chainlit-2.0.dev1.dist-info/entry_points.txt,sha256=FrkqdjrFl8juSnvBndniyX7XuKojmUwO4ghRh-CFMQc,45
|
|
99
|
+
chainlit-2.0.dev1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as P,r as v,u as D,a as O}from"./index-f5df2072.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(e||!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 x="https://api.dmcdn.net/all.js",N="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)(x,N,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 +0,0 @@
|
|
|
1
|
-
import{g as _,r as g,u as P,a as m}from"./index-f5df2072.js";function v(t,e){for(var r=0;r<e.length;r++){const a=e[r];if(typeof a!="string"&&!Array.isArray(a)){for(const s in a)if(s!=="default"&&!(s in t)){const p=Object.getOwnPropertyDescriptor(a,s);p&&Object.defineProperty(t,s,p.get?p:{enumerable:!0,get:()=>a[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var O=Object.create,i=Object.defineProperty,D=Object.getOwnPropertyDescriptor,E=Object.getOwnPropertyNames,S=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty,I=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,k=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},h=(t,e,r,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of E(e))!j.call(t,s)&&s!==r&&i(t,s,{get:()=>e[s],enumerable:!(a=D(e,s))||a.enumerable});return t},w=(t,e,r)=>(r=t!=null?O(S(t)):{},h(e||!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),F=t=>h(i({},"__esModule",{value:!0}),t),o=(t,e,r)=>(I(t,typeof e!="symbol"?e+"":e,r),r),b={};k(b,{default:()=>l});var d=F(b),u=w(g),n=P,x=m;const c="https://connect.facebook.net/en_US/sdk.js",y="FB",f="fbAsyncInit",L="facebook-player-";class l extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",n.callPlayer),o(this,"playerID",this.props.config.playerId||`${L}${(0,n.randomString)()}`),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e,r){if(r){(0,n.getSDK)(c,y,f).then(a=>a.XFBML.parse());return}(0,n.getSDK)(c,y,f).then(a=>{a.init({appId:this.props.config.appId,xfbml:!0,version:this.props.config.version}),a.Event.subscribe("xfbml.render",s=>{this.props.onLoaded()}),a.Event.subscribe("xfbml.ready",s=>{s.type==="video"&&s.id===this.playerID&&(this.player=s.instance,this.player.subscribe("startedPlaying",this.props.onPlay),this.player.subscribe("paused",this.props.onPause),this.player.subscribe("finishedPlaying",this.props.onEnded),this.player.subscribe("startedBuffering",this.props.onBuffer),this.player.subscribe("finishedBuffering",this.props.onBufferEnd),this.player.subscribe("error",this.props.onError),this.props.muted?this.callPlayer("mute"):this.callPlayer("unmute"),this.props.onReady(),document.getElementById(this.playerID).querySelector("iframe").style.visibility="visible")})})}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.callPlayer("getDuration")}getCurrentTime(){return this.callPlayer("getCurrentPosition")}getSecondsLoaded(){return null}render(){const{attributes:e}=this.props.config,r={width:"100%",height:"100%"};return u.default.createElement("div",{style:r,id:this.playerID,className:"fb-video","data-href":this.props.url,"data-autoplay":this.props.playing?"true":"false","data-allowfullscreen":"true","data-controls":this.props.controls?"true":"false",...e})}}o(l,"displayName","Facebook");o(l,"canPlay",x.canPlay.facebook);o(l,"loopOnEnded",!0);const M=_(d),B=v({__proto__:null,default:M},[d]);export{B as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as b,r as _,u as O,a as A}from"./index-f5df2072.js";function R(s,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const n in i)if(n!=="default"&&!(n in s)){const l=Object.getOwnPropertyDescriptor(i,n);l&&Object.defineProperty(s,n,l.get?l:{enumerable:!0,get:()=>i[n]})}}}return Object.freeze(Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}))}var I=Object.create,u=Object.defineProperty,D=Object.getOwnPropertyDescriptor,w=Object.getOwnPropertyNames,M=Object.getPrototypeOf,k=Object.prototype.hasOwnProperty,U=(s,e,t)=>e in s?u(s,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):s[e]=t,N=(s,e)=>{for(var t in e)u(s,t,{get:e[t],enumerable:!0})},E=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of w(e))!k.call(s,n)&&n!==t&&u(s,n,{get:()=>e[n],enumerable:!(i=D(e,n))||i.enumerable});return s},j=(s,e,t)=>(t=s!=null?I(M(s)):{},E(e||!s||!s.__esModule?u(t,"default",{value:s,enumerable:!0}):t,s)),H=s=>E(u({},"__esModule",{value:!0}),s),r=(s,e,t)=>(U(s,typeof e!="symbol"?e+"":e,t),t),m={};N(m,{default:()=>P});var g=H(m),c=j(_),a=O,d=A;const y=typeof navigator<"u",F=y&&navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,v=y&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||F)&&!window.MSStream,V=y&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)&&!window.MSStream,T="https://cdn.jsdelivr.net/npm/hls.js@VERSION/dist/hls.min.js",C="Hls",B="https://cdnjs.cloudflare.com/ajax/libs/dashjs/VERSION/dash.all.min.js",x="dashjs",K="https://cdn.jsdelivr.net/npm/flv.js@VERSION/dist/flv.min.js",G="flvjs",X=/www\.dropbox\.com\/.+/,f=/https:\/\/watch\.cloudflarestream\.com\/([a-z0-9]+)/,W="https://videodelivery.net/{id}/manifest/video.m3u8";class P extends c.Component{constructor(){super(...arguments),r(this,"onReady",(...e)=>this.props.onReady(...e)),r(this,"onPlay",(...e)=>this.props.onPlay(...e)),r(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),r(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),r(this,"onPause",(...e)=>this.props.onPause(...e)),r(this,"onEnded",(...e)=>this.props.onEnded(...e)),r(this,"onError",(...e)=>this.props.onError(...e)),r(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),r(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),r(this,"onDisablePIP",e=>{const{onDisablePIP:t,playing:i}=this.props;t(e),i&&this.play()}),r(this,"onPresentationModeChange",e=>{if(this.player&&(0,a.supportsWebKitPresentationMode)(this.player)){const{webkitPresentationMode:t}=this.player;t==="picture-in-picture"?this.onEnablePIP(e):t==="inline"&&this.onDisablePIP(e)}}),r(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),r(this,"mute",()=>{this.player.muted=!0}),r(this,"unmute",()=>{this.player.muted=!1}),r(this,"renderSourceElement",(e,t)=>typeof e=="string"?c.default.createElement("source",{key:t,src:e}):c.default.createElement("source",{key:t,...e})),r(this,"renderTrack",(e,t)=>c.default.createElement("track",{key:t,...e})),r(this,"ref",e=>{this.player&&(this.prevPlayer=this.player),this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getSource(this.props.url);e&&(this.player.src=e),(v||this.props.config.forceDisableHls)&&this.player.load()}componentDidUpdate(e){this.shouldUseAudio(this.props)!==this.shouldUseAudio(e)&&(this.removeListeners(this.prevPlayer,e.url),this.addListeners(this.player)),this.props.url!==e.url&&!(0,a.isMediaStream)(this.props.url)&&!(this.props.url instanceof Array)&&(this.player.srcObject=null)}componentWillUnmount(){this.player.removeAttribute("src"),this.removeListeners(this.player),this.hls&&this.hls.destroy()}addListeners(e){const{url:t,playsinline:i}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.addEventListener("canplay",this.onReady),i&&(e.setAttribute("playsinline",""),e.setAttribute("webkit-playsinline",""),e.setAttribute("x5-playsinline",""))}removeListeners(e,t){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),this.shouldUseHLS(t)||e.removeEventListener("canplay",this.onReady)}shouldUseAudio(e){return e.config.forceVideo||e.config.attributes.poster?!1:d.AUDIO_EXTENSIONS.test(e.url)||e.config.forceAudio}shouldUseHLS(e){return V&&this.props.config.forceSafariHLS||this.props.config.forceHLS?!0:v||this.props.config.forceDisableHls?!1:d.HLS_EXTENSIONS.test(e)||f.test(e)}shouldUseDASH(e){return d.DASH_EXTENSIONS.test(e)||this.props.config.forceDASH}shouldUseFLV(e){return d.FLV_EXTENSIONS.test(e)||this.props.config.forceFLV}load(e){const{hlsVersion:t,hlsOptions:i,dashVersion:n,flvVersion:l}=this.props.config;if(this.hls&&this.hls.destroy(),this.dash&&this.dash.reset(),this.shouldUseHLS(e)&&(0,a.getSDK)(T.replace("VERSION",t),C).then(o=>{if(this.hls=new o(i),this.hls.on(o.Events.MANIFEST_PARSED,()=>{this.props.onReady()}),this.hls.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.hls,o)}),f.test(e)){const h=e.match(f)[1];this.hls.loadSource(W.replace("{id}",h))}else this.hls.loadSource(e);this.hls.attachMedia(this.player),this.props.onLoaded()}),this.shouldUseDASH(e)&&(0,a.getSDK)(B.replace("VERSION",n),x).then(o=>{this.dash=o.MediaPlayer().create(),this.dash.initialize(this.player,e,this.props.playing),this.dash.on("error",this.props.onError),parseInt(n)<3?this.dash.getDebug().setLogToBrowserConsole(!1):this.dash.updateSettings({debug:{logLevel:o.Debug.LOG_LEVEL_NONE}}),this.props.onLoaded()}),this.shouldUseFLV(e)&&(0,a.getSDK)(K.replace("VERSION",l),G).then(o=>{this.flv=o.createPlayer({type:"flv",url:e}),this.flv.attachMediaElement(this.player),this.flv.on(o.Events.ERROR,(h,p)=>{this.props.onError(h,p,this.flv,o)}),this.flv.load(),this.props.onLoaded()}),e instanceof Array)this.player.load();else if((0,a.isMediaStream)(e))try{this.player.srcObject=e}catch{this.player.src=window.URL.createObjectURL(e)}}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.removeAttribute("src"),this.dash&&this.dash.reset()}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player?this.player.requestPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="picture-in-picture"&&this.player.webkitSetPresentationMode("picture-in-picture")}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player?document.exitPictureInPicture():(0,a.supportsWebKitPresentationMode)(this.player)&&this.player.webkitPresentationMode!=="inline"&&this.player.webkitSetPresentationMode("inline")}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getSource(e){const t=this.shouldUseHLS(e),i=this.shouldUseDASH(e),n=this.shouldUseFLV(e);if(!(e instanceof Array||(0,a.isMediaStream)(e)||t||i||n))return X.test(e)?e.replace("www.dropbox.com","dl.dropboxusercontent.com"):e}render(){const{url:e,playing:t,loop:i,controls:n,muted:l,config:o,width:h,height:p}=this.props,L=this.shouldUseAudio(this.props)?"audio":"video",S={width:h==="auto"?h:"100%",height:p==="auto"?p:"100%"};return c.default.createElement(L,{ref:this.ref,src:this.getSource(e),style:S,preload:"auto",autoPlay:t||void 0,controls:n,muted:l,loop:i,...o.attributes},e instanceof Array&&e.map(this.renderSourceElement),o.tracks.map(this.renderTrack))}}r(P,"displayName","FilePlayer");r(P,"canPlay",d.canPlay.file);const z=b(g),J=R({__proto__:null,default:z},[g]);export{J as F};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as y,r as f,u as _,a as m}from"./index-f5df2072.js";function P(r,e){for(var t=0;t<e.length;t++){const s=e[t];if(typeof s!="string"&&!Array.isArray(s)){for(const a in s)if(a!=="default"&&!(a in r)){const l=Object.getOwnPropertyDescriptor(s,a);l&&Object.defineProperty(r,a,l.get?l:{enumerable:!0,get:()=>s[a]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var g=Object.create,n=Object.defineProperty,b=Object.getOwnPropertyDescriptor,v=Object.getOwnPropertyNames,O=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,j=(r,e,t)=>e in r?n(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,L=(r,e)=>{for(var t in e)n(r,t,{get:e[t],enumerable:!0})},c=(r,e,t,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of v(e))!w.call(r,a)&&a!==t&&n(r,a,{get:()=>e[a],enumerable:!(s=b(e,a))||s.enumerable});return r},K=(r,e,t)=>(t=r!=null?g(O(r)):{},c(e||!r||!r.__esModule?n(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>c(n({},"__esModule",{value:!0}),r),o=(r,e,t)=>(j(r,typeof e!="symbol"?e+"":e,t),t),h={};L(h,{default:()=>i});var d=D(h),u=K(f),p=_,S=m;const T="https://cdn.embed.ly/player-0.1.0.min.js",E="playerjs";class i extends u.Component{constructor(){super(...arguments),o(this,"callPlayer",p.callPlayer),o(this,"duration",null),o(this,"currentTime",null),o(this,"secondsLoaded",null),o(this,"mute",()=>{this.callPlayer("mute")}),o(this,"unmute",()=>{this.callPlayer("unmute")}),o(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,p.getSDK)(T,E).then(t=>{this.iframe&&(this.player=new t.Player(this.iframe),this.player.on("ready",()=>{setTimeout(()=>{this.player.isReady=!0,this.player.setLoop(this.props.loop),this.props.muted&&this.player.mute(),this.addListeners(this.player,this.props),this.props.onReady()},500)}))},this.props.onError)}addListeners(e,t){e.on("play",t.onPlay),e.on("pause",t.onPause),e.on("ended",t.onEnded),e.on("error",t.onError),e.on("timeupdate",({duration:s,seconds:a})=>{this.duration=s,this.currentTime=a})}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,t=!0){this.callPlayer("setCurrentTime",e),t||this.pause()}setVolume(e){this.callPlayer("setVolume",e)}setLoop(e){this.callPlayer("setLoop",e)}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return this.secondsLoaded}render(){const e={width:"100%",height:"100%"};return u.default.createElement("iframe",{ref:this.ref,src:this.props.url,frameBorder:"0",scrolling:"no",style:e,allow:"encrypted-media; autoplay; fullscreen;",referrerPolicy:"no-referrer-when-downgrade"})}}o(i,"displayName","Kaltura");o(i,"canPlay",S.canPlay.kaltura);const M=y(d),C=P({__proto__:null,default:M},[d]);export{C as K};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as _,r as f,u as m,a as g}from"./index-f5df2072.js";function v(t,e){for(var r=0;r<e.length;r++){const s=e[r];if(typeof s!="string"&&!Array.isArray(s)){for(const o in s)if(o!=="default"&&!(o in t)){const n=Object.getOwnPropertyDescriptor(s,o);n&&Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>s[o]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var P=Object.create,i=Object.defineProperty,O=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,M=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty,x=(t,e,r)=>e in t?i(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,j=(t,e)=>{for(var r in e)i(t,r,{get:e[r],enumerable:!0})},c=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of b(e))!w.call(t,o)&&o!==r&&i(t,o,{get:()=>e[o],enumerable:!(s=O(e,o))||s.enumerable});return t},D=(t,e,r)=>(r=t!=null?P(M(t)):{},c(e||!t||!t.__esModule?i(r,"default",{value:t,enumerable:!0}):r,t)),S=t=>c(i({},"__esModule",{value:!0}),t),a=(t,e,r)=>(x(t,typeof e!="symbol"?e+"":e,r),r),d={};j(d,{default:()=>l});var h=S(d),p=D(f),u=m,y=g;const E="https://widget.mixcloud.com/media/js/widgetApi.js",L="Mixcloud";class l extends p.Component{constructor(){super(...arguments),a(this,"callPlayer",u.callPlayer),a(this,"duration",null),a(this,"currentTime",null),a(this,"secondsLoaded",null),a(this,"mute",()=>{}),a(this,"unmute",()=>{}),a(this,"ref",e=>{this.iframe=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this)}load(e){(0,u.getSDK)(E,L).then(r=>{this.player=r.PlayerWidget(this.iframe),this.player.ready.then(()=>{this.player.events.play.on(this.props.onPlay),this.player.events.pause.on(this.props.onPause),this.player.events.ended.on(this.props.onEnded),this.player.events.error.on(this.props.error),this.player.events.progress.on((s,o)=>{this.currentTime=s,this.duration=o}),this.props.onReady()})},this.props.onError)}play(){this.callPlayer("play")}pause(){this.callPlayer("pause")}stop(){}seekTo(e,r=!0){this.callPlayer("seek",e),r||this.pause()}setVolume(e){}getDuration(){return this.duration}getCurrentTime(){return this.currentTime}getSecondsLoaded(){return null}render(){const{url:e,config:r}=this.props,s=e.match(y.MATCH_URL_MIXCLOUD)[1],o={width:"100%",height:"100%"},n=(0,u.queryString)({...r.options,feed:`/${s}/`});return p.default.createElement("iframe",{key:s,ref:this.ref,style:o,src:`https://www.mixcloud.com/widget/iframe/?${n}`,frameBorder:"0",allow:"autoplay"})}}a(l,"displayName","Mixcloud");a(l,"canPlay",y.canPlay.mixcloud);a(l,"loopOnEnded",!0);const T=_(h),A=v({__proto__:null,default:T},[h]);export{A as M};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{g as m,_ as E,r as g,a as _}from"./index-f5df2072.js";function b(r,e){for(var t=0;t<e.length;t++){const i=e[t];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in r)){const o=Object.getOwnPropertyDescriptor(i,s);o&&Object.defineProperty(r,s,o.get?o:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}var L=Object.create,u=Object.defineProperty,I=Object.getOwnPropertyDescriptor,k=Object.getOwnPropertyNames,O=Object.getPrototypeOf,x=Object.prototype.hasOwnProperty,M=(r,e,t)=>e in r?u(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,R=(r,e)=>{for(var t in e)u(r,t,{get:e[t],enumerable:!0})},f=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of k(e))!x.call(r,s)&&s!==t&&u(r,s,{get:()=>e[s],enumerable:!(i=I(e,s))||i.enumerable});return r},w=(r,e,t)=>(t=r!=null?L(O(r)):{},f(e||!r||!r.__esModule?u(t,"default",{value:r,enumerable:!0}):t,r)),D=r=>f(u({},"__esModule",{value:!0}),r),n=(r,e,t)=>(M(r,typeof e!="symbol"?e+"":e,t),t),y={};R(y,{default:()=>l});var P=D(y),v=w(g),p=_;const j="https://cdn.jsdelivr.net/npm/@mux/mux-player@VERSION/dist/mux-player.mjs";class l extends v.Component{constructor(){super(...arguments),n(this,"onReady",(...e)=>this.props.onReady(...e)),n(this,"onPlay",(...e)=>this.props.onPlay(...e)),n(this,"onBuffer",(...e)=>this.props.onBuffer(...e)),n(this,"onBufferEnd",(...e)=>this.props.onBufferEnd(...e)),n(this,"onPause",(...e)=>this.props.onPause(...e)),n(this,"onEnded",(...e)=>this.props.onEnded(...e)),n(this,"onError",(...e)=>this.props.onError(...e)),n(this,"onPlayBackRateChange",e=>this.props.onPlaybackRateChange(e.target.playbackRate)),n(this,"onEnablePIP",(...e)=>this.props.onEnablePIP(...e)),n(this,"onSeek",e=>{this.props.onSeek(e.target.currentTime)}),n(this,"onDurationChange",()=>{const e=this.getDuration();this.props.onDuration(e)}),n(this,"mute",()=>{this.player.muted=!0}),n(this,"unmute",()=>{this.player.muted=!1}),n(this,"ref",e=>{this.player=e})}componentDidMount(){this.props.onMount&&this.props.onMount(this),this.addListeners(this.player);const e=this.getPlaybackId(this.props.url);e&&(this.player.playbackId=e)}componentWillUnmount(){this.player.playbackId=null,this.removeListeners(this.player)}addListeners(e){const{playsinline:t}=this.props;e.addEventListener("play",this.onPlay),e.addEventListener("waiting",this.onBuffer),e.addEventListener("playing",this.onBufferEnd),e.addEventListener("pause",this.onPause),e.addEventListener("seeked",this.onSeek),e.addEventListener("ended",this.onEnded),e.addEventListener("error",this.onError),e.addEventListener("ratechange",this.onPlayBackRateChange),e.addEventListener("enterpictureinpicture",this.onEnablePIP),e.addEventListener("leavepictureinpicture",this.onDisablePIP),e.addEventListener("webkitpresentationmodechanged",this.onPresentationModeChange),e.addEventListener("canplay",this.onReady),t&&e.setAttribute("playsinline","")}removeListeners(e){e.removeEventListener("canplay",this.onReady),e.removeEventListener("play",this.onPlay),e.removeEventListener("waiting",this.onBuffer),e.removeEventListener("playing",this.onBufferEnd),e.removeEventListener("pause",this.onPause),e.removeEventListener("seeked",this.onSeek),e.removeEventListener("ended",this.onEnded),e.removeEventListener("error",this.onError),e.removeEventListener("ratechange",this.onPlayBackRateChange),e.removeEventListener("enterpictureinpicture",this.onEnablePIP),e.removeEventListener("leavepictureinpicture",this.onDisablePIP),e.removeEventListener("canplay",this.onReady)}async load(e){var t;const{onError:i,config:s}=this.props;if(!((t=globalThis.customElements)!=null&&t.get("mux-player")))try{const a=j.replace("VERSION",s.version);await E(()=>import(`${a}`),[]),this.props.onLoaded()}catch(a){i(a)}const[,o]=e.match(p.MATCH_URL_MUX);this.player.playbackId=o}play(){const e=this.player.play();e&&e.catch(this.props.onError)}pause(){this.player.pause()}stop(){this.player.playbackId=null}seekTo(e,t=!0){this.player.currentTime=e,t||this.pause()}setVolume(e){this.player.volume=e}enablePIP(){this.player.requestPictureInPicture&&document.pictureInPictureElement!==this.player&&this.player.requestPictureInPicture()}disablePIP(){document.exitPictureInPicture&&document.pictureInPictureElement===this.player&&document.exitPictureInPicture()}setPlaybackRate(e){try{this.player.playbackRate=e}catch(t){this.props.onError(t)}}getDuration(){if(!this.player)return null;const{duration:e,seekable:t}=this.player;return e===1/0&&t.length>0?t.end(t.length-1):e}getCurrentTime(){return this.player?this.player.currentTime:null}getSecondsLoaded(){if(!this.player)return null;const{buffered:e}=this.player;if(e.length===0)return 0;const t=e.end(e.length-1),i=this.getDuration();return t>i?i:t}getPlaybackId(e){const[,t]=e.match(p.MATCH_URL_MUX);return t}render(){const{url:e,playing:t,loop:i,controls:s,muted:o,config:a,width:h,height:c}=this.props,d={width:h==="auto"?h:"100%",height:c==="auto"?c:"100%"};return s===!1&&(d["--controls"]="none"),v.default.createElement("mux-player",{ref:this.ref,"playback-id":this.getPlaybackId(e),style:d,preload:"auto",autoPlay:t||void 0,muted:o?"":void 0,loop:i?"":void 0,...a.attributes})}}n(l,"displayName","Mux");n(l,"canPlay",p.canPlay.mux);const C=m(P),B=b({__proto__:null,default:C},[P]);export{B as M};
|