@nuralyui/video 0.0.1

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.
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ import { LitElement } from 'lit';
7
+ import '../video.component.js';
8
+ export declare class HyDatePickerDemoElement extends LitElement {
9
+ selectedLanguage: string;
10
+ render(): import("lit").TemplateResult<1>;
11
+ }
12
+ //# sourceMappingURL=video-demo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-demo.d.ts","sourceRoot":"","sources":["../../../../src/components/video/demo/video-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,uBAAuB,CAAC;AAE/B,qBACa,uBAAwB,SAAQ,UAAU;IAErD,gBAAgB,SAAQ;IAEf,MAAM;CAYhB"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2023 Google Laabidi Aymen
4
+ * SPDX-License-Identifier: MIT
5
+ */
6
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
11
+ };
12
+ import { LitElement, html } from 'lit';
13
+ import { customElement, state } from 'lit/decorators.js';
14
+ import '../video.component.js';
15
+ let HyDatePickerDemoElement = class HyDatePickerDemoElement extends LitElement {
16
+ constructor() {
17
+ super(...arguments);
18
+ this.selectedLanguage = 'en';
19
+ }
20
+ render() {
21
+ return html `
22
+ <hy-video-player
23
+ previewable="true"
24
+ id="url-viewer"
25
+ src="https://file-examples.com/storage/fe7d258bd9680a7429c6b40/2017/04/file_example_MP4_480_1_5MG.mp4"
26
+ width="100%"
27
+ height="500px"
28
+ previewable
29
+ ></hy-video-player>
30
+ `;
31
+ }
32
+ };
33
+ __decorate([
34
+ state()
35
+ ], HyDatePickerDemoElement.prototype, "selectedLanguage", void 0);
36
+ HyDatePickerDemoElement = __decorate([
37
+ customElement('hy-video-demo')
38
+ ], HyDatePickerDemoElement);
39
+ export { HyDatePickerDemoElement };
40
+ //# sourceMappingURL=video-demo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video-demo.js","sourceRoot":"","sources":["../../../../src/components/video/demo/video-demo.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,uBAAuB,CAAC;AAG/B,IAAa,uBAAuB,GAApC,MAAa,uBAAwB,SAAQ,UAAU;IAAvD;;QAEE,qBAAgB,GAAG,IAAI,CAAC;IAc1B,CAAC;IAZU,MAAM;QACb,OAAO,IAAI,CAAA;;;;;;;;;KASV,CAAC;IACJ,CAAC;CACF,CAAA;AAdC;IADC,KAAK,EAAE;iEACgB;AAFb,uBAAuB;IADnC,aAAa,CAAC,eAAe,CAAC;GAClB,uBAAuB,CAgBnC;SAhBY,uBAAuB","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html } from 'lit';\nimport { customElement, state } from 'lit/decorators.js';\nimport '../video.component.js';\n\n@customElement('hy-video-demo')\nexport class HyDatePickerDemoElement extends LitElement {\n @state()\n selectedLanguage = 'en';\n\n override render() {\n return html`\n <hy-video-player\n previewable=\"true\"\n id=\"url-viewer\"\n src=\"https://file-examples.com/storage/fe7d258bd9680a7429c6b40/2017/04/file_example_MP4_480_1_5MG.mp4\"\n width=\"100%\"\n height=\"500px\"\n previewable\n ></hy-video-player>\n `;\n }\n}"]}
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './video.component.js';
2
+ //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/video/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './video.component.js';
2
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/video/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA","sourcesContent":["export * from './video.component.js'"]}
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "@nuralyui/video",
3
+ "version": "0.0.1",
4
+ "description": "",
5
+ "main": "index.js",
6
+ "type": "module",
7
+ "scripts": {
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "Labidi Aymen",
11
+ "license": "ISC"
12
+ }
@@ -0,0 +1,18 @@
1
+ import { LitElement } from "lit";
2
+ export declare class HyVideoPlayer extends LitElement {
3
+ src: string;
4
+ width: string;
5
+ height: string;
6
+ fallback: null;
7
+ previewable: boolean;
8
+ private isFullscreen;
9
+ private hasError;
10
+ defaultFallBack: string;
11
+ static styles: import("lit").CSSResult;
12
+ render(): import("lit").TemplateResult<1>;
13
+ _handleError(e: Event): void;
14
+ _openFullscreen(): void;
15
+ _closeFullscreen(): void;
16
+ disconnectedCallback(): void;
17
+ }
18
+ //# sourceMappingURL=video.component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.component.d.ts","sourceRoot":"","sources":["../../../src/components/video/video.component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,aAAc,SAAQ,UAAU;IAE3C,GAAG,EAAG,MAAM,CAAC;IAGb,KAAK,SAAU;IAGf,MAAM,SAAU;IAGhB,QAAQ,OAAQ;IAGhB,WAAW,UAAS;IAGpB,OAAO,CAAC,YAAY,CAAS;IAG7B,OAAO,CAAC,QAAQ,CAAS;IAGzB,eAAe,SAkBV;IAEL,OAAgB,MAAM,0BAkHpB;IAEO,MAAM;IAqEf,YAAY,CAAC,CAAC,EAAE,KAAK;IAYrB,eAAe;IAKf,gBAAgB;IAKP,oBAAoB;CAM9B"}
@@ -0,0 +1,273 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { LitElement, html, css } from "lit";
8
+ import { customElement, property, state } from "lit/decorators.js";
9
+ let HyVideoPlayer = class HyVideoPlayer extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.width = 'auto';
13
+ this.height = 'auto';
14
+ this.fallback = null;
15
+ this.previewable = false;
16
+ this.isFullscreen = false;
17
+ this.hasError = false;
18
+ // Updated fallback with a broken video icon
19
+ this.defaultFallBack = `data:image/svg+xml;base64,${btoa(`
20
+ <svg width="240" height="180" viewBox="0 0 240 180" fill="none" xmlns="http://www.w3.org/2000/svg">
21
+ <rect width="240" height="180" fill="#F3F4F6"/>
22
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M120 82C109.507 82 101 90.5066 101 101C101 111.493 109.507 120 120 120C130.493 120 139 111.493 139 101C139 90.5066 130.493 82 120 82ZM105 101C105 92.7157 111.716 86 120 86C128.284 86 135 92.7157 135 101C135 109.284 128.284 116 120 116C111.716 116 105 109.284 105 101Z" fill="#9CA3AF"/>
23
+ <path d="M120 90V96" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
24
+ <path d="M120 106V112" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
25
+ <path d="M106.343 87.3431L110.686 91.6863" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
26
+ <path d="M129.314 110.314L133.657 114.657" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
27
+ <path d="M95 101H101" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
28
+ <path d="M139 101H145" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
29
+ <path d="M106.343 114.657L110.686 110.314" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
30
+ <path d="M129.314 91.6863L133.657 87.3431" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
31
+ <rect x="70" y="60" width="100" height="4" rx="2" fill="#9CA3AF"/>
32
+ <path d="M82 45C82 43.3431 83.3431 42 85 42H155C156.657 42 158 43.3431 158 45V60H82V45Z" fill="#9CA3AF"/>
33
+ <rect x="70" y="138" width="100" height="4" rx="2" fill="#9CA3AF"/>
34
+ <path d="M89 60H151C152.657 60 154 61.3431 154 63V138H86C84.3431 138 83 136.657 83 135V66C83 62.6863 85.6863 60 89 60Z" fill="#E5E7EB"/>
35
+ <path d="M188 69L168 89M168 69L188 89" stroke="#9CA3AF" stroke-width="4" stroke-linecap="round"/>
36
+ </svg>
37
+ `)}`;
38
+ }
39
+ render() {
40
+ return html `
41
+ <div class="video-container" style="width:${this.width}; height:${this.height};">
42
+ ${this.hasError ? html `
43
+ <div class="fallback-container">
44
+ <img
45
+ class="fallback-image"
46
+ src=${this.fallback || this.defaultFallBack}
47
+ alt="Video failed to load"
48
+ />
49
+ <p class="error-message">This video cannot be played.</p>
50
+ </div>
51
+ ` : html `
52
+ <video
53
+ class="video-element"
54
+ src="${this.src}"
55
+ controls
56
+ @error=${this._handleError}
57
+ ></video>
58
+
59
+ ${this.previewable ? html `
60
+ <button class="preview-button" @click=${this._openFullscreen}>
61
+ <svg width="14" height="14" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
62
+ <path d="M5.5 1H1.5C1.22386 1 1 1.22386 1 1.5V5.5C1 5.77614 1.22386 6 1.5 6C1.77614 6 2 5.77614 2 5.5V2H5.5C5.77614 2 6 1.77614 6 1.5C6 1.22386 5.77614 1 5.5 1Z" fill="currentColor"/>
63
+ <path d="M14.5 1H10.5C10.2239 1 10 1.22386 10 1.5C10 1.77614 10.2239 2 10.5 2H14V5.5C14 5.77614 14.2239 6 14.5 6C14.7761 6 15 5.77614 15 5.5V1.5C15 1.22386 14.7761 1 14.5 1Z" fill="currentColor"/>
64
+ <path d="M5.5 14H2V10.5C2 10.2239 1.77614 10 1.5 10C1.22386 10 1 10.2239 1 10.5V14.5C1 14.7761 1.22386 15 1.5 15H5.5C5.77614 15 6 14.7761 6 14.5C6 14.2239 5.77614 14 5.5 14Z" fill="currentColor"/>
65
+ <path d="M14.5 10C14.2239 10 14 10.2239 14 10.5V14H10.5C10.2239 14 10 14.2239 10 14.5C10 14.7761 10.2239 15 10.5 15H14.5C14.7761 15 15 14.7761 15 14.5V10.5C15 10.2239 14.7761 10 14.5 10Z" fill="currentColor"/>
66
+ </svg>
67
+ Fullscreen
68
+ </button>
69
+ ` : ''}
70
+ `}
71
+ </div>
72
+
73
+ ${this.isFullscreen ? html `
74
+ <div class="fullscreen-overlay">
75
+ <div class="fullscreen-header">
76
+ <button class="close-button" @click=${this._closeFullscreen}>
77
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
78
+ <path d="M12.5 3.5L3.5 12.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
79
+ <path d="M12.5 12.5L3.5 3.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
80
+ </svg>
81
+ </button>
82
+ </div>
83
+ <div class="fullscreen-content">
84
+ ${this.hasError ? html `
85
+ <div class="fallback-container" style="max-width: 100%; max-height: calc(100vh - 64px);">
86
+ <img
87
+ class="fallback-image"
88
+ src=${this.fallback || this.defaultFallBack}
89
+ alt="Video failed to load"
90
+ />
91
+ <p class="error-message">This video cannot be played.</p>
92
+ </div>
93
+ ` : html `
94
+ <video
95
+ class="video-element"
96
+ src="${this.src}"
97
+ controls
98
+ @error=${this._handleError}
99
+ style="max-width: 100%; max-height: calc(100vh - 64px);"
100
+ ></video>
101
+ `}
102
+ </div>
103
+ </div>
104
+ ` : ''}
105
+ `;
106
+ }
107
+ _handleError(e) {
108
+ console.error('Video loading error:', e);
109
+ this.hasError = true;
110
+ this.dispatchEvent(new CustomEvent('onError', {
111
+ bubbles: true,
112
+ composed: true,
113
+ detail: {
114
+ error: `Error loading video: Format not supported or file cannot be loaded`
115
+ }
116
+ }));
117
+ }
118
+ _openFullscreen() {
119
+ this.isFullscreen = true;
120
+ document.body.style.overflow = 'hidden';
121
+ }
122
+ _closeFullscreen() {
123
+ this.isFullscreen = false;
124
+ document.body.style.overflow = '';
125
+ }
126
+ disconnectedCallback() {
127
+ super.disconnectedCallback();
128
+ if (this.isFullscreen) {
129
+ document.body.style.overflow = '';
130
+ }
131
+ }
132
+ };
133
+ HyVideoPlayer.styles = css `
134
+ :host {
135
+ display: block;
136
+ }
137
+
138
+ .video-container {
139
+ position: relative;
140
+ overflow: hidden;
141
+ min-height: 100px;
142
+ background-color: black;
143
+ }
144
+
145
+ .video-element {
146
+ width: 100%;
147
+ height: 100%;
148
+ display: block;
149
+ }
150
+
151
+ .fallback-container {
152
+ width: 100%;
153
+ height: 100%;
154
+ display: flex;
155
+ flex-direction: column;
156
+ align-items: center;
157
+ justify-content: center;
158
+ background-color: #F3F4F6;
159
+ padding: 20px;
160
+ box-sizing: border-box;
161
+ }
162
+
163
+ .fallback-image {
164
+ max-width: 240px;
165
+ width: 100%;
166
+ height: auto;
167
+ margin-bottom: 16px;
168
+ }
169
+
170
+ .error-message {
171
+ font-family: system-ui, -apple-system, sans-serif;
172
+ color: #6B7280;
173
+ font-size: 14px;
174
+ text-align: center;
175
+ max-width: 300px;
176
+ margin: 0;
177
+ }
178
+
179
+ .preview-button {
180
+ position: absolute;
181
+ top: 10px;
182
+ right: 10px;
183
+ background-color: rgba(255, 255, 255, 0.8);
184
+ border: 1px solid #ccc;
185
+ border-radius: 4px;
186
+ padding: 5px 10px;
187
+ cursor: pointer;
188
+ display: flex;
189
+ align-items: center;
190
+ font-family: system-ui, -apple-system, sans-serif;
191
+ font-size: 12px;
192
+ z-index: 10;
193
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
194
+ }
195
+
196
+ .preview-button:hover {
197
+ background-color: rgba(255, 255, 255, 1);
198
+ }
199
+
200
+ .preview-button svg {
201
+ margin-right: 4px;
202
+ }
203
+
204
+ .fullscreen-overlay {
205
+ position: fixed;
206
+ top: 0;
207
+ left: 0;
208
+ width: 100vw;
209
+ height: 100vh;
210
+ background-color: black;
211
+ z-index: 9999;
212
+ display: flex;
213
+ flex-direction: column;
214
+ }
215
+
216
+ .fullscreen-header {
217
+ display: flex;
218
+ justify-content: flex-end;
219
+ padding: 16px;
220
+ background-color: rgba(0, 0, 0, 0.4);
221
+ }
222
+
223
+ .close-button {
224
+ background-color: white;
225
+ border: none;
226
+ border-radius: 4px;
227
+ padding: 8px;
228
+ cursor: pointer;
229
+ display: flex;
230
+ align-items: center;
231
+ justify-content: center;
232
+ width: 32px;
233
+ height: 32px;
234
+ box-shadow: 0 2px 4px rgba(0,0,0,0.2);
235
+ }
236
+
237
+ .close-button:hover {
238
+ background-color: #f0f0f0;
239
+ }
240
+
241
+ .fullscreen-content {
242
+ flex: 1;
243
+ display: flex;
244
+ align-items: center;
245
+ justify-content: center;
246
+ }
247
+ `;
248
+ __decorate([
249
+ property()
250
+ ], HyVideoPlayer.prototype, "src", void 0);
251
+ __decorate([
252
+ property()
253
+ ], HyVideoPlayer.prototype, "width", void 0);
254
+ __decorate([
255
+ property()
256
+ ], HyVideoPlayer.prototype, "height", void 0);
257
+ __decorate([
258
+ property({ type: Object })
259
+ ], HyVideoPlayer.prototype, "fallback", void 0);
260
+ __decorate([
261
+ property({ type: Boolean })
262
+ ], HyVideoPlayer.prototype, "previewable", void 0);
263
+ __decorate([
264
+ state()
265
+ ], HyVideoPlayer.prototype, "isFullscreen", void 0);
266
+ __decorate([
267
+ state()
268
+ ], HyVideoPlayer.prototype, "hasError", void 0);
269
+ HyVideoPlayer = __decorate([
270
+ customElement('hy-video-player')
271
+ ], HyVideoPlayer);
272
+ export { HyVideoPlayer };
273
+ //# sourceMappingURL=video.component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"video.component.js","sourceRoot":"","sources":["../../../src/components/video/video.component.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,UAAU;IAA7C;;QAKE,UAAK,GAAG,MAAM,CAAC;QAGf,WAAM,GAAG,MAAM,CAAC;QAGhB,aAAQ,GAAG,IAAI,CAAC;QAGhB,gBAAW,GAAG,KAAK,CAAC;QAGZ,iBAAY,GAAG,KAAK,CAAC;QAGrB,aAAQ,GAAG,KAAK,CAAC;QAEzB,4CAA4C;QAC5C,oBAAe,GAAG,6BAA6B,IAAI,CAAC;;;;;;;;;;;;;;;;;;GAkBnD,CAAC,EAAE,CAAC;IAuNP,CAAC;IAjGU,MAAM;QACb,OAAO,IAAI,CAAA;kDACmC,IAAI,CAAC,KAAK,YAAY,IAAI,CAAC,MAAM;UACzE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;;;;oBAIV,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe;;;;;SAKhD,CAAC,CAAC,CAAC,IAAI,CAAA;;;mBAGG,IAAI,CAAC,GAAG;;qBAEN,IAAI,CAAC,YAAY;;;YAG1B,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA;oDACiB,IAAI,CAAC,eAAe;;;;;;;;;WAS7D,CAAC,CAAC,CAAC,EAAE;SACP;;;QAGD,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAA;;;kDAGkB,IAAI,CAAC,gBAAgB;;;;;;;;cAQzD,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAA;;;;wBAIV,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,eAAe;;;;;aAKhD,CAAC,CAAC,CAAC,IAAI,CAAA;;;uBAGG,IAAI,CAAC,GAAG;;yBAEN,IAAI,CAAC,YAAY;;;aAG7B;;;OAGN,CAAC,CAAC,CAAC,EAAE;KACP,CAAC;IACJ,CAAC;IAED,YAAY,CAAC,CAAQ;QACnB,OAAO,CAAC,KAAK,CAAC,sBAAsB,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,SAAS,EAAE;YAC5C,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,IAAI;YACd,MAAM,EAAE;gBACN,KAAK,EAAE,oEAAoE;aAC5E;SACF,CAAC,CAAC,CAAC;IACN,CAAC;IAED,eAAe;QACb,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC1C,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC;QAC1B,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;IACpC,CAAC;IAEQ,oBAAoB;QAC3B,KAAK,CAAC,oBAAoB,EAAE,CAAC;QAC7B,IAAI,IAAI,CAAC,YAAY,EAAE;YACrB,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,EAAE,CAAC;SACnC;IACH,CAAC;CACF,CAAA;AArNiB,oBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkH1B,CAAA;AA3JF;IADC,QAAQ,EAAE;0CACE;AAGb;IADC,QAAQ,EAAE;4CACI;AAGf;IADC,QAAQ,EAAE;6CACK;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CACX;AAGhB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDACR;AAGpB;IADC,KAAK,EAAE;mDACqB;AAG7B;IADC,KAAK,EAAE;+CACiB;AApBd,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAgQzB;SAhQY,aAAa","sourcesContent":["import { LitElement, html, css } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\n\n@customElement('hy-video-player')\nexport class HyVideoPlayer extends LitElement {\n @property()\n src!: string;\n\n @property()\n width = 'auto';\n\n @property()\n height = 'auto';\n\n @property({ type: Object })\n fallback = null;\n\n @property({ type: Boolean })\n previewable = false;\n\n @state()\n private isFullscreen = false;\n\n @state()\n private hasError = false;\n\n // Updated fallback with a broken video icon\n defaultFallBack = `data:image/svg+xml;base64,${btoa(`\n <svg width=\"240\" height=\"180\" viewBox=\"0 0 240 180\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect width=\"240\" height=\"180\" fill=\"#F3F4F6\"/>\n <path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M120 82C109.507 82 101 90.5066 101 101C101 111.493 109.507 120 120 120C130.493 120 139 111.493 139 101C139 90.5066 130.493 82 120 82ZM105 101C105 92.7157 111.716 86 120 86C128.284 86 135 92.7157 135 101C135 109.284 128.284 116 120 116C111.716 116 105 109.284 105 101Z\" fill=\"#9CA3AF\"/>\n <path d=\"M120 90V96\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M120 106V112\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M106.343 87.3431L110.686 91.6863\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M129.314 110.314L133.657 114.657\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M95 101H101\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M139 101H145\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M106.343 114.657L110.686 110.314\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <path d=\"M129.314 91.6863L133.657 87.3431\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n <rect x=\"70\" y=\"60\" width=\"100\" height=\"4\" rx=\"2\" fill=\"#9CA3AF\"/>\n <path d=\"M82 45C82 43.3431 83.3431 42 85 42H155C156.657 42 158 43.3431 158 45V60H82V45Z\" fill=\"#9CA3AF\"/>\n <rect x=\"70\" y=\"138\" width=\"100\" height=\"4\" rx=\"2\" fill=\"#9CA3AF\"/>\n <path d=\"M89 60H151C152.657 60 154 61.3431 154 63V138H86C84.3431 138 83 136.657 83 135V66C83 62.6863 85.6863 60 89 60Z\" fill=\"#E5E7EB\"/>\n <path d=\"M188 69L168 89M168 69L188 89\" stroke=\"#9CA3AF\" stroke-width=\"4\" stroke-linecap=\"round\"/>\n </svg>\n `)}`;\n\n static override styles = css`\n :host {\n display: block;\n }\n \n .video-container {\n position: relative;\n overflow: hidden;\n min-height: 100px;\n background-color: black;\n }\n \n .video-element {\n width: 100%;\n height: 100%;\n display: block;\n }\n\n .fallback-container {\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background-color: #F3F4F6;\n padding: 20px;\n box-sizing: border-box;\n }\n\n .fallback-image {\n max-width: 240px;\n width: 100%;\n height: auto;\n margin-bottom: 16px;\n }\n\n .error-message {\n font-family: system-ui, -apple-system, sans-serif;\n color: #6B7280;\n font-size: 14px;\n text-align: center;\n max-width: 300px;\n margin: 0;\n }\n \n .preview-button {\n position: absolute;\n top: 10px;\n right: 10px;\n background-color: rgba(255, 255, 255, 0.8);\n border: 1px solid #ccc;\n border-radius: 4px;\n padding: 5px 10px;\n cursor: pointer;\n display: flex;\n align-items: center;\n font-family: system-ui, -apple-system, sans-serif;\n font-size: 12px;\n z-index: 10;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n }\n \n .preview-button:hover {\n background-color: rgba(255, 255, 255, 1);\n }\n\n .preview-button svg {\n margin-right: 4px;\n }\n \n .fullscreen-overlay {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n background-color: black;\n z-index: 9999;\n display: flex;\n flex-direction: column;\n }\n \n .fullscreen-header {\n display: flex;\n justify-content: flex-end;\n padding: 16px;\n background-color: rgba(0, 0, 0, 0.4);\n }\n \n .close-button {\n background-color: white;\n border: none;\n border-radius: 4px;\n padding: 8px;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 32px;\n height: 32px;\n box-shadow: 0 2px 4px rgba(0,0,0,0.2);\n }\n\n .close-button:hover {\n background-color: #f0f0f0;\n }\n \n .fullscreen-content {\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n `;\n\n override render() {\n return html`\n <div class=\"video-container\" style=\"width:${this.width}; height:${this.height};\">\n ${this.hasError ? html`\n <div class=\"fallback-container\">\n <img\n class=\"fallback-image\"\n src=${this.fallback || this.defaultFallBack}\n alt=\"Video failed to load\"\n />\n <p class=\"error-message\">This video cannot be played.</p>\n </div>\n ` : html`\n <video\n class=\"video-element\"\n src=\"${this.src}\"\n controls\n @error=${this._handleError}\n ></video>\n \n ${this.previewable ? html`\n <button class=\"preview-button\" @click=${this._openFullscreen}>\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M5.5 1H1.5C1.22386 1 1 1.22386 1 1.5V5.5C1 5.77614 1.22386 6 1.5 6C1.77614 6 2 5.77614 2 5.5V2H5.5C5.77614 2 6 1.77614 6 1.5C6 1.22386 5.77614 1 5.5 1Z\" fill=\"currentColor\"/>\n <path d=\"M14.5 1H10.5C10.2239 1 10 1.22386 10 1.5C10 1.77614 10.2239 2 10.5 2H14V5.5C14 5.77614 14.2239 6 14.5 6C14.7761 6 15 5.77614 15 5.5V1.5C15 1.22386 14.7761 1 14.5 1Z\" fill=\"currentColor\"/>\n <path d=\"M5.5 14H2V10.5C2 10.2239 1.77614 10 1.5 10C1.22386 10 1 10.2239 1 10.5V14.5C1 14.7761 1.22386 15 1.5 15H5.5C5.77614 15 6 14.7761 6 14.5C6 14.2239 5.77614 14 5.5 14Z\" fill=\"currentColor\"/>\n <path d=\"M14.5 10C14.2239 10 14 10.2239 14 10.5V14H10.5C10.2239 14 10 14.2239 10 14.5C10 14.7761 10.2239 15 10.5 15H14.5C14.7761 15 15 14.7761 15 14.5V10.5C15 10.2239 14.7761 10 14.5 10Z\" fill=\"currentColor\"/>\n </svg>\n Fullscreen\n </button>\n ` : ''}\n `}\n </div>\n \n ${this.isFullscreen ? html`\n <div class=\"fullscreen-overlay\">\n <div class=\"fullscreen-header\">\n <button class=\"close-button\" @click=${this._closeFullscreen}>\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12.5 3.5L3.5 12.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n <path d=\"M12.5 12.5L3.5 3.5\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n </div>\n <div class=\"fullscreen-content\">\n ${this.hasError ? html`\n <div class=\"fallback-container\" style=\"max-width: 100%; max-height: calc(100vh - 64px);\">\n <img\n class=\"fallback-image\"\n src=${this.fallback || this.defaultFallBack}\n alt=\"Video failed to load\"\n />\n <p class=\"error-message\">This video cannot be played.</p>\n </div>\n ` : html`\n <video\n class=\"video-element\"\n src=\"${this.src}\"\n controls\n @error=${this._handleError}\n style=\"max-width: 100%; max-height: calc(100vh - 64px);\"\n ></video>\n `}\n </div>\n </div>\n ` : ''}\n `;\n }\n\n _handleError(e: Event) {\n console.error('Video loading error:', e);\n this.hasError = true;\n this.dispatchEvent(new CustomEvent('onError', {\n bubbles: true,\n composed: true,\n detail: {\n error: `Error loading video: Format not supported or file cannot be loaded`\n }\n }));\n }\n\n _openFullscreen() {\n this.isFullscreen = true;\n document.body.style.overflow = 'hidden';\n }\n\n _closeFullscreen() {\n this.isFullscreen = false;\n document.body.style.overflow = '';\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n if (this.isFullscreen) {\n document.body.style.overflow = '';\n }\n }\n}"]}