@banou/ftube 0.0.0-stage → 0.0.0

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.
Files changed (91) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -2
  3. package/__yt_engine__/engine.html +9 -0
  4. package/app.webmanifest +31 -0
  5. package/assets/account-BL8Hv7lS.js +157 -0
  6. package/assets/account-By94iboj.js +1 -0
  7. package/assets/account-DfiXzypA-YE6OyKjK.js +1 -0
  8. package/assets/account-generation-BP_-Qyck-BOth6YQ_.js +1 -0
  9. package/assets/agent-source-E4g0cDzU.js +1 -0
  10. package/assets/api-1NDCtwel-CAaxX8P1.js +3 -0
  11. package/assets/binary-encoding-By5K7InN.js +1 -0
  12. package/assets/build-CNn3bm6X.js +1 -0
  13. package/assets/busy-C1JPjoZ_-CJ0641jK.js +1 -0
  14. package/assets/cards-Csel8naI.js +2334 -0
  15. package/assets/channel-B5f9YTIf.js +1160 -0
  16. package/assets/client-version-D9kIz6Gz.js +1 -0
  17. package/assets/comments-CJp9O808.js +612 -0
  18. package/assets/dislikes-DH5jCVEY.js +1 -0
  19. package/assets/dist-7VpLCl1k.js +1 -0
  20. package/assets/dist-BOrL1gYg.js +2 -0
  21. package/assets/downloads-CMXDjA_E.js +191 -0
  22. package/assets/egress.worker-DopXr5uP.js +104 -0
  23. package/assets/engine-B_kFyW7L.js +2 -0
  24. package/assets/feed-channels-Dg2mvF5x.js +251 -0
  25. package/assets/feed-groups-CnyR4sOO.js +160 -0
  26. package/assets/feed-history-BDAGG9N5.js +368 -0
  27. package/assets/feed-playlists-DcGR2AL6.js +167 -0
  28. package/assets/feed-subscriptions-Sm3tKz4P.js +165 -0
  29. package/assets/feed-you-lxbqknXX.js +110 -0
  30. package/assets/formats-CDwXfKnr.js +1 -0
  31. package/assets/frame-BrGNSf3s.js +2 -0
  32. package/assets/fs-CjRTQ7Nu.js +1 -0
  33. package/assets/fs-CwRtKje1-CBsYhX2-.js +1 -0
  34. package/assets/fullscreen-view-BLgosU84.js +269 -0
  35. package/assets/group-C00s0aT7.js +183 -0
  36. package/assets/groups-button-CvVnqwlu.js +25 -0
  37. package/assets/hashtag-CCIhITaL.js +115 -0
  38. package/assets/icons-DKsqNLSs.js +1 -0
  39. package/assets/index-A5dHbptn.css +1 -0
  40. package/assets/index-DwsYJ-bu.js +1328 -0
  41. package/assets/lib-h0P14ZFl.js +70 -0
  42. package/assets/linkify-B6hdFhsL.js +1 -0
  43. package/assets/packages-C3w3tSjj-BCtDk0vj.js +1 -0
  44. package/assets/party-CUcxsJDF.js +180 -0
  45. package/assets/playlist-DF7wsidw.js +521 -0
  46. package/assets/playlist-card-Btoc7D8f.js +91 -0
  47. package/assets/playlist-panel-D97BwT1f.js +199 -0
  48. package/assets/post-CQ9mfVos.js +39 -0
  49. package/assets/post-card-ZUQixO1G.js +76 -0
  50. package/assets/privacy-hkbqXFeB.js +46 -0
  51. package/assets/protobuf-BXZ2dCCc.js +1 -0
  52. package/assets/read-more-BhddUSlS.js +20 -0
  53. package/assets/rich-text-07paR5O3.js +25 -0
  54. package/assets/roboto-cyrillic-ext-BCp_3N7R.woff2 +0 -0
  55. package/assets/roboto-cyrillic-fOt7epNf.woff2 +0 -0
  56. package/assets/roboto-greek-DlT9XTxE.woff2 +0 -0
  57. package/assets/roboto-greek-ext-Bgw4czJT.woff2 +0 -0
  58. package/assets/roboto-latin-ccAYIvAh.woff2 +0 -0
  59. package/assets/roboto-latin-ext-DYIxWhlt.woff2 +0 -0
  60. package/assets/roboto-math-4a3xuzGk.woff2 +0 -0
  61. package/assets/roboto-symbols-B7iHSfaG.woff2 +0 -0
  62. package/assets/roboto-vietnamese-_f1XEJpo.woff2 +0 -0
  63. package/assets/rooms-B-AvBY-c-FNDqRDHE.js +1 -0
  64. package/assets/rooms-B91zuirR.js +1 -0
  65. package/assets/save-menu-DF1WKqSE.js +462 -0
  66. package/assets/search-Cx5IpDtZ.js +1026 -0
  67. package/assets/settings-kESE_uBm.js +99 -0
  68. package/assets/shaka-BwT9pJcV.js +36 -0
  69. package/assets/share-dialog-Cp0BJ6bg.js +156 -0
  70. package/assets/shorts-BxDB7m0c.js +686 -0
  71. package/assets/shorts-grid-Bgbkl5dP.js +11 -0
  72. package/assets/sign-in-Bx3zmj-m.js +97 -0
  73. package/assets/signed-out-prompt-CEAx65kq.js +79 -0
  74. package/assets/signin-DkI8Ogzz.js +18 -0
  75. package/assets/social-bXt3vmd4.js +1 -0
  76. package/assets/video-card-compact-r-K4XyDb.js +190 -0
  77. package/assets/watch-CkxSP1IA.js +1802 -0
  78. package/assets/web-BNanCsH5.js +43 -0
  79. package/favicon.ico +0 -0
  80. package/favicon.svg +5 -0
  81. package/icons/icon-192.png +0 -0
  82. package/icons/icon-512.png +0 -0
  83. package/index-Bj-Q3X8Q.js +4120 -0
  84. package/index.html +32 -0
  85. package/package.json +45 -4
  86. package/store/background.webp +0 -0
  87. package/store/channel.webp +0 -0
  88. package/store/cover.webp +0 -0
  89. package/store/phone.webp +0 -0
  90. package/store/search.webp +0 -0
  91. package/store/watch.webp +0 -0
@@ -0,0 +1,1026 @@
1
+ import{$ as e,A as t,an as n,jt as r,n as i,on as a,sn as o,y as s}from"./icons-DKsqNLSs.js";import{C as c,T as l,c as u,g as d,k as ee,ot as f,s as p,y as m}from"./sign-in-Bx3zmj-m.js";import{A as te,E as h,G as ne,H as g,I as re,K as _,Kt as v,P as y,Sn as b,T as x,Tn as S,U as C,W as w,Y as T,c as E,hn as D,in as O,j as ie,k,kt as A,ln as ae,rn as j,s as M,xn as N}from"./cards-Csel8naI.js";import{a as P,n as F}from"../index-Bj-Q3X8Q.js";import{i as I,t as L}from"./protobuf-BXZ2dCCc.js";o();var R=f`
2
+ /* youtube.com draws the card dark in both themes, so the tokens its contents
3
+ read are pinned to the dark palette here. */
4
+ --text-primary: #f1f1f1;
5
+ --text-secondary: #aaaaaa;
6
+ --bg-inverse: #f1f1f1;
7
+ --bg-inverse-hover: #ffffff;
8
+ --text-inverse: #0f0f0f;
9
+ --bg-chip: rgba(255, 255, 255, 0.1);
10
+ --bg-chip-hover: rgba(255, 255, 255, 0.2);
11
+ --bg-hover: rgba(255, 255, 255, 0.1);
12
+ --bg-elevated: #212121;
13
+ --bg-menu: #282828;
14
+ --border-subtle: rgba(255, 255, 255, 0.2);
15
+ color-scheme: dark;
16
+
17
+ position: relative;
18
+ isolation: isolate;
19
+ padding: 2.4rem;
20
+ border-radius: 2.4rem;
21
+ background: linear-gradient(to bottom, #3a3a3a, #0f0f0f 75%);
22
+ color: var(--text-primary);
23
+
24
+ .card-backdrop {
25
+ position: absolute;
26
+ inset: 0 0 0 40%;
27
+ z-index: -1;
28
+ border-radius: 0 2.4rem 2.4rem 0;
29
+ background-position: center 25%;
30
+ background-size: cover;
31
+ opacity: 0.45;
32
+ filter: blur(1rem);
33
+ mask-image: radial-gradient(ellipse at top right, #000 20%, transparent 70%);
34
+ }
35
+
36
+ .card-head {
37
+ display: flex;
38
+ flex-wrap: wrap;
39
+ align-items: center;
40
+ gap: 1.6rem 4.8rem;
41
+ }
42
+
43
+ .card-identity {
44
+ display: flex;
45
+ align-items: center;
46
+ gap: 1.6rem;
47
+ min-width: 0;
48
+ }
49
+
50
+ .card-avatar {
51
+ flex: none;
52
+ display: flex;
53
+ align-items: center;
54
+ justify-content: center;
55
+ width: 10.4rem;
56
+ height: 10.4rem;
57
+ border: 0.3rem solid rgba(255, 255, 255, 0.85);
58
+ border-radius: 50%;
59
+ overflow: hidden;
60
+ background: var(--bg-chip);
61
+ font-size: 4rem;
62
+ }
63
+
64
+ .card-avatar img {
65
+ width: 100%;
66
+ height: 100%;
67
+ object-fit: cover;
68
+ }
69
+
70
+ .card-name {
71
+ display: flex;
72
+ align-items: center;
73
+ margin: 0;
74
+ font-size: 3.6rem;
75
+ font-weight: 700;
76
+ line-height: 4.4rem;
77
+ }
78
+
79
+ .card-meta {
80
+ margin-top: 0.4rem;
81
+ font-size: 1.4rem;
82
+ color: var(--text-secondary);
83
+ }
84
+
85
+ .card-about {
86
+ flex: 1 1 36rem;
87
+ min-width: 0;
88
+ }
89
+
90
+ .card-description {
91
+ margin: 0 0 1.2rem;
92
+ font-size: 1.4rem;
93
+ line-height: 2rem;
94
+ color: var(--text-secondary);
95
+ display: -webkit-box;
96
+ -webkit-line-clamp: 2;
97
+ -webkit-box-orient: vertical;
98
+ overflow: hidden;
99
+ }
100
+
101
+ .card-actions {
102
+ display: flex;
103
+ flex-wrap: wrap;
104
+ gap: 0.8rem;
105
+ }
106
+
107
+ .card-pill {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ gap: 0.6rem;
111
+ height: 3.6rem;
112
+ padding: 0 1.6rem;
113
+ border: 1px solid var(--border-subtle);
114
+ border-radius: 1.8rem;
115
+ font-size: 1.4rem;
116
+ font-weight: 500;
117
+ transition: background 0.15s ease;
118
+ }
119
+
120
+ .card-pill:hover {
121
+ background: var(--bg-hover);
122
+ }
123
+
124
+ .card-rail {
125
+ margin-top: 2.4rem;
126
+ }
127
+
128
+ /* Three tiles to a row, as on youtube.com, with the rest behind the arrow. */
129
+ .card-tile {
130
+ width: max(24rem, calc((100% - 1.6rem) / 3));
131
+ }
132
+
133
+ .card-mix-thumb {
134
+ position: relative;
135
+ display: block;
136
+ aspect-ratio: 16 / 9;
137
+ border-radius: 1.2rem;
138
+ overflow: hidden;
139
+ background: var(--bg-elevated);
140
+ }
141
+
142
+ .card-mix-thumb img {
143
+ display: block;
144
+ width: 100%;
145
+ height: 100%;
146
+ object-fit: cover;
147
+ }
148
+
149
+ .card-mix-badge {
150
+ position: absolute;
151
+ right: 0.6rem;
152
+ bottom: 0.6rem;
153
+ display: flex;
154
+ align-items: center;
155
+ gap: 0.4rem;
156
+ padding: 0.1rem 0.4rem;
157
+ border-radius: 0.4rem;
158
+ background: var(--bg-badge);
159
+ color: var(--text-on-media);
160
+ font-size: 1.2rem;
161
+ font-weight: 500;
162
+ line-height: 1.8rem;
163
+ }
164
+
165
+ .card-mix-title {
166
+ display: block;
167
+ margin-top: 1.2rem;
168
+ font-size: 1.4rem;
169
+ font-weight: 500;
170
+ line-height: 2rem;
171
+ }
172
+ `,oe=({card:e})=>{let{cardChannel:n,mix:r,videos:i}=e,a=`/channel/${n.id}`,o=r?k(r.videoId,{list:r.id}):void 0,s=[n.handle,n.subscriberCountText,n.videoCountText].filter(Boolean).join(` • `);return u(`section`,{css:R,"aria-label":n.name,children:[n.avatar?p(`div`,{className:`card-backdrop`,style:{backgroundImage:`url(${JSON.stringify(n.avatar)})`},"aria-hidden":`true`}):void 0,u(`div`,{className:`card-head`,children:[u(`div`,{className:`card-identity`,children:[p(m,{href:a,className:`card-avatar`,tabIndex:-1,"aria-hidden":`true`,children:n.avatar?p(O,{src:n.avatar}):n.name.slice(0,1).toUpperCase()}),u(`div`,{children:[u(`h2`,{className:`card-name`,children:[p(m,{href:a,children:n.name}),p(j,{channel:n,size:24})]}),s?p(`div`,{className:`card-meta`,children:s}):void 0]})]}),u(`div`,{className:`card-about`,children:[n.description?p(`p`,{className:`card-description`,children:n.description}):void 0,u(`div`,{className:`card-actions`,children:[p(_,{channelId:n.id,subscribed:n.isSubscribed,notificationLevel:n.notificationLevel}),p(m,{href:a,className:`card-pill`,children:`View Channel`}),o?u(m,{href:o,className:`card-pill`,children:[p(t,{size:20,strokeWidth:1.5}),`Mix`]}):void 0]})]})]}),i.length>0||r?p(`div`,{className:`card-rail`,children:u(E,{label:`${n.name} videos`,count:i.length+ +!!r,children:[r&&o?u(m,{href:o,className:`card-tile`,children:[u(`span`,{className:`card-mix-thumb`,children:[r.thumbnail?p(O,{src:r.thumbnail}):void 0,u(`span`,{className:`card-mix-badge`,children:[p(t,{size:14,strokeWidth:2}),`Mix`]})]}),p(`span`,{className:`card-mix-title`,children:r.title})]}):void 0,i.map(e=>p(`div`,{className:`card-tile`,children:p(x,{video:e,variant:`shelf`})},e.id))]})}):void 0]})},z=[{id:`all`,label:`All`},{id:`shorts`,label:`Shorts`,param:`type`,value:`SHORTS`},{id:`unwatched`,label:`Unwatched`,param:`unwatched`,value:`1`},{id:`videos`,label:`Videos`,param:`type`,value:`VIDEO`},{id:`recent`,label:`Recently uploaded`,param:`upload_date`,value:`WEEK`},{id:`live`,label:`Live`,param:`features`,value:`LIVE`}],B=[`type`,`upload_date`,`features`,`unwatched`],se=e=>{let t=B.filter(t=>e.get(t));if(t.length===0)return`all`;if(!(t.length>1))return z.find(n=>n.param!==void 0&&n.param===t[0]&&e.get(n.param)===n.value)?.id},V=(e,t)=>{let n=new URLSearchParams(e);for(let e of B)n.delete(e);return t.param&&t.value&&n.set(t.param,t.value),n.toString()},H={param:`type`,label:`Type`,field:[2,2],options:[{value:`VIDEO`,label:`Videos`,code:1},{value:`SHORTS`,label:`Shorts`,code:9},{value:`CHANNEL`,label:`Channels`,code:2},{value:`PLAYLIST`,label:`Playlists`,code:3},{value:`MOVIE`,label:`Movies`,code:4}]},U={param:`duration`,label:`Duration`,field:[2,3],options:[{value:`UNDER_THREE_MINS`,label:`Under 3 minutes`,code:4},{value:`THREE_TO_TWENTY_MINS`,label:`3 - 20 minutes`,code:5},{value:`OVER_TWENTY_MINS`,label:`Over 20 minutes`,code:2}]},W={param:`upload_date`,label:`Upload date`,field:[2,1],options:[{value:`TODAY`,label:`Today`,code:2},{value:`WEEK`,label:`This week`,code:3},{value:`MONTH`,label:`This month`,code:4},{value:`YEAR`,label:`This year`,code:5}]},G={param:`features`,label:`Features`,field:[2],options:[{value:`LIVE`,label:`Live`,code:8},{value:`FOUR_K`,label:`4K`,code:14},{value:`HD`,label:`HD`,code:4},{value:`SUBTITLES`,label:`Subtitles/CC`,code:5},{value:`CREATIVE_COMMONS`,label:`Creative Commons`,code:6},{value:`THREE_SIXTY`,label:`360°`,code:15},{value:`VR180`,label:`VR180`,code:26},{value:`THREE_D`,label:`3D`,code:7},{value:`HDR`,label:`HDR`,code:25},{value:`LOCATION`,label:`Location`,code:23},{value:`PURCHASED`,label:`Purchased`,code:9}]},K={param:`sort`,label:`Prioritize`,field:[1],options:[{value:`RELEVANCE`,label:`Relevance`,code:0},{value:`POPULARITY`,label:`Popularity`,code:3}]},q=[H,U,W,G,K],J=(e,t)=>{let n=(e.param===`features`?[...new Set(t?.split(`,`))]:[t]).filter(t=>e.options.some(e=>e.value===t));return n.length>0?n.join(`,`):void 0},ce=e=>{let t=new URLSearchParams,n;try{n=L(e)}catch{return t}for(let e of q){let r=e.param===`features`?e.options.filter(t=>I(n,[...e.field,t.code])===1):e.options.filter(t=>I(n,e.field)===t.code);r.length>0&&t.set(e.param,r.map(e=>e.value).join(`,`))}return t},le=e=>{let t=new URLSearchParams(e),n=ce(t.get(`sp`)??``);t.delete(`sp`);for(let e of q){let r=J(e,t.get(e.param))??J(e,n.get(e.param));r===void 0?t.delete(e.param):t.set(e.param,r)}return t},Y=(e,t)=>e.get(t.param)?.split(`,`)??(t===K?[`RELEVANCE`]:[]),X=e=>e!==K,ue=(e,t,n)=>{let r=new URLSearchParams(e),i=Y(e,t),a=i.includes(n)?i.filter(e=>e!==n):t.param===`features`?[...i,n]:[n];return a.length===0||t===K&&a[0]===`RELEVANCE`?r.delete(t.param):r.set(t.param,a.join(`,`)),r.toString()},de=e=>{let t=e.get(`features`)?.split(`,`);return{uploadDate:e.get(`upload_date`)??void 0,type:e.get(`type`)??void 0,duration:e.get(`duration`)??void 0,sortBy:e.get(`sort`)??void 0,features:t,unwatched:e.get(`unwatched`)?!0:void 0}},fe=f`
173
+ .topic-head {
174
+ padding: 1.6rem;
175
+ border-radius: 1.2rem 1.2rem 0 0;
176
+ background: var(--bg-hover);
177
+ }
178
+
179
+ .topic-head-link {
180
+ display: block;
181
+ }
182
+
183
+ .topic-head-link.with-avatar {
184
+ display: flex;
185
+ align-items: center;
186
+ gap: 1.6rem;
187
+ }
188
+
189
+ .topic-avatar {
190
+ flex: none;
191
+ width: 6.4rem;
192
+ height: 6.4rem;
193
+ border-radius: 50%;
194
+ overflow: hidden;
195
+ background: var(--bg-chip);
196
+ }
197
+
198
+ .topic-avatar img {
199
+ display: block;
200
+ width: 100%;
201
+ height: 100%;
202
+ object-fit: cover;
203
+ }
204
+
205
+ .topic-identity {
206
+ min-width: 0;
207
+ }
208
+
209
+ .topic-title {
210
+ margin: 0;
211
+ font-size: 1.8rem;
212
+ font-weight: 400;
213
+ line-height: 2.6rem;
214
+ color: var(--text-primary);
215
+ }
216
+
217
+ .topic-subtitle {
218
+ display: block;
219
+ margin-top: 0.8rem;
220
+ font-size: 1.6rem;
221
+ line-height: 2.2rem;
222
+ color: var(--text-secondary);
223
+ }
224
+
225
+ .topic-head-link.with-avatar .topic-subtitle {
226
+ margin-top: 0.2rem;
227
+ font-size: 1.4rem;
228
+ line-height: 2rem;
229
+ }
230
+
231
+ .topic-actions {
232
+ margin-top: 1.2rem;
233
+ }
234
+
235
+ .topic-actions.indented {
236
+ padding-left: 8rem;
237
+ }
238
+
239
+ .topic-hero {
240
+ position: relative;
241
+ display: block;
242
+ aspect-ratio: 16 / 9;
243
+ border-radius: 0 0 1.2rem 1.2rem;
244
+ overflow: hidden;
245
+ background: var(--bg-chip);
246
+ }
247
+
248
+ .topic-hero img {
249
+ display: block;
250
+ width: 100%;
251
+ height: 100%;
252
+ object-fit: cover;
253
+ }
254
+
255
+ .topic-hero-text {
256
+ position: absolute;
257
+ right: 0;
258
+ bottom: 0;
259
+ left: 0;
260
+ display: flex;
261
+ flex-direction: column;
262
+ gap: 0.8rem;
263
+ padding: 10rem 1.6rem 2rem;
264
+ background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
265
+ color: var(--text-on-media);
266
+ }
267
+
268
+ .topic-hero-title {
269
+ overflow: hidden;
270
+ font-size: 1.8rem;
271
+ line-height: 2.6rem;
272
+ white-space: nowrap;
273
+ text-overflow: ellipsis;
274
+ }
275
+
276
+ .topic-hero-subtitle {
277
+ font-size: 1.2rem;
278
+ line-height: 1.8rem;
279
+ }
280
+
281
+ .topic-list {
282
+ display: flex;
283
+ flex-direction: column;
284
+ gap: 1.6rem;
285
+ margin-top: 1.6rem;
286
+ }
287
+
288
+ .topic-row {
289
+ display: grid;
290
+ grid-template-columns: 12rem minmax(0, 1fr);
291
+ gap: 1.6rem;
292
+ }
293
+
294
+ .topic-row-thumb {
295
+ position: relative;
296
+ display: block;
297
+ aspect-ratio: 120 / 68;
298
+ border-radius: 0.8rem;
299
+ overflow: hidden;
300
+ background: var(--bg-chip);
301
+ }
302
+
303
+ .topic-row-thumb img {
304
+ display: block;
305
+ width: 100%;
306
+ height: 100%;
307
+ object-fit: cover;
308
+ }
309
+
310
+ .topic-row-thumb .badge {
311
+ position: absolute;
312
+ right: 0.4rem;
313
+ bottom: 0.4rem;
314
+ padding: 0 0.4rem;
315
+ border-radius: 0.4rem;
316
+ background: var(--bg-badge);
317
+ color: var(--text-on-media);
318
+ font-size: 1.2rem;
319
+ font-weight: 500;
320
+ line-height: 1.8rem;
321
+ }
322
+
323
+ .topic-row-title {
324
+ margin: 0 0 0.4rem;
325
+ font-size: 1.4rem;
326
+ font-weight: 500;
327
+ line-height: 2rem;
328
+ color: var(--text-primary);
329
+ display: -webkit-box;
330
+ -webkit-line-clamp: 2;
331
+ -webkit-box-orient: vertical;
332
+ overflow: hidden;
333
+ }
334
+
335
+ .topic-row-line {
336
+ display: block;
337
+ width: fit-content;
338
+ font-size: 1.2rem;
339
+ line-height: 1.8rem;
340
+ color: var(--text-secondary);
341
+ }
342
+
343
+ .topic-all {
344
+ display: block;
345
+ margin-top: 1.6rem;
346
+ padding: 1.6rem 0;
347
+ border-bottom: 1px solid var(--border-subtle);
348
+ color: var(--text-primary);
349
+ font-size: 1.4rem;
350
+ font-weight: 500;
351
+ line-height: 2rem;
352
+ text-transform: uppercase;
353
+ }
354
+ `,pe=new Intl.DateTimeFormat(`en-US`,{dateStyle:`short`,timeStyle:`short`}),me=({video:e})=>{let t=k(e.id),n=N(e.durationSeconds),r=e.scheduledAt?`Scheduled for ${pe.format(new Date(e.scheduledAt))}`:e.subtitle;return u(`article`,{className:`topic-row`,children:[u(m,{href:t,className:`topic-row-thumb`,tabIndex:-1,"aria-hidden":`true`,children:[e.thumbnail?p(O,{src:e.thumbnail}):void 0,n?p(`span`,{className:`badge`,children:n}):void 0]}),u(`div`,{children:[p(`h3`,{className:`topic-row-title`,children:p(m,{href:t,children:e.title})}),e.channel?p(m,{href:`/channel/${e.channel.id}`,className:`topic-row-line`,children:e.channel.name}):void 0,r?p(`span`,{className:`topic-row-line`,children:r}):void 0]})]})},he=({topic:e,subscribed:t,notificationLevel:n})=>{let r=`/channel/${e.channelId}`,{hero:i}=e,a=e.isChannel===!0||e.subtitle?.startsWith(`@`)===!0;return u(`aside`,{css:fe,"aria-label":e.title,children:[u(`div`,{className:`topic-head`,children:[u(m,{href:r,className:e.avatar?`topic-head-link with-avatar`:`topic-head-link`,children:[e.avatar?p(`span`,{className:`topic-avatar`,children:p(O,{src:e.avatar})}):void 0,u(`div`,{className:`topic-identity`,children:[u(`h2`,{className:`topic-title`,children:[e.title,p(j,{channel:e,size:14})]}),e.subtitle?p(`span`,{className:`topic-subtitle`,children:e.subtitle}):void 0]})]}),a?p(`div`,{className:e.avatar?`topic-actions indented`:`topic-actions`,children:p(_,{channelId:e.channelId,subscribed:t,notificationLevel:n})}):void 0]}),i?u(m,{href:k(i.id),className:`topic-hero`,children:[i.thumbnail?p(O,{src:i.thumbnail}):void 0,u(`span`,{className:`topic-hero-text`,children:[p(`span`,{className:`topic-hero-title`,children:i.title}),i.subtitle?p(`span`,{className:`topic-hero-subtitle`,children:i.subtitle}):void 0]})]}):void 0,e.videos.length>0?p(`div`,{className:`topic-list`,children:e.videos.map(e=>p(me,{video:e},e.id))}):void 0,p(m,{href:r,className:`topic-all`,children:`View all`})]})},ge=(e,t)=>t?[...e,t]:e,_e=e=>e.__typename===`Video`,ve=e=>e.__typename===`SearchShelf`,Z=e=>e.__typename===`SearchCard`,ye=(e,t)=>{if(!t)return[...e];let n=[];for(let t of e){if(_e(t)){t.isShort||n.push(t);continue}if(ve(t)){if(t.shorts.length>0)continue;let e=t.videos.filter(e=>!e.isShort);e.length>0&&n.push({...t,videos:e});continue}if(Z(t)){n.push({...t,videos:t.videos.filter(e=>!e.isShort)});continue}n.push(t)}return n},be=d(`
355
+ query SearchResults($query: String!, $filters: SearchFilters, $cursor: String) {
356
+ search(query: $query, filters: $filters, cursor: $cursor) {
357
+ results {
358
+ __typename
359
+ ...SearchVideo
360
+ ... on Channel {
361
+ id
362
+ name
363
+ avatar
364
+ handle
365
+ subscriberCountText
366
+ videoCountText
367
+ description
368
+ isSubscribed
369
+ notificationLevel
370
+ isVerified
371
+ isVerifiedArtist
372
+ }
373
+ ... on Playlist {
374
+ id
375
+ title
376
+ thumbnail
377
+ videoCountText
378
+ channel { id name }
379
+ }
380
+ ... on SearchCard {
381
+ # aliased: the same selection holds a Video's nullable channel, and one field name cannot be both
382
+ cardChannel: channel {
383
+ id
384
+ name
385
+ avatar
386
+ handle
387
+ subscriberCountText
388
+ videoCountText
389
+ description
390
+ isSubscribed
391
+ notificationLevel
392
+ isVerified
393
+ isVerifiedArtist
394
+ }
395
+ mix { id title thumbnail videoId }
396
+ videos { ...SearchVideo }
397
+ }
398
+ ... on SearchShelf {
399
+ title
400
+ subtitle
401
+ horizontal
402
+ collapsedCount
403
+ videos { ...SearchVideo }
404
+ shorts { id title thumbnail viewCount shortsSequence }
405
+ }
406
+ }
407
+ topic {
408
+ title
409
+ subtitle
410
+ channelId
411
+ avatar
412
+ isChannel
413
+ isVerified
414
+ isVerifiedArtist
415
+ hero { id title thumbnail subtitle }
416
+ videos { id title thumbnail durationSeconds subtitle scheduledAt channel { id name } }
417
+ }
418
+ refinements
419
+ cursor
420
+ unwatchedChip
421
+ }
422
+ }
423
+
424
+ fragment SearchVideo on Video {
425
+ id
426
+ title
427
+ inlinePlayerParams
428
+ description
429
+ descriptionSnippet
430
+ snippetRuns { text bold }
431
+ thumbnail
432
+ thumbnailSrcset
433
+ durationSeconds
434
+ isMusic
435
+ viewCount
436
+ publishedText
437
+ isLive
438
+ isUpcoming
439
+ isShort
440
+ badges
441
+ channel { id name avatar isVerified isVerifiedArtist }
442
+ chapters { title startSeconds thumbnail }
443
+ chaptersTitle
444
+ byline { text isVerified isVerifiedArtist }
445
+ collaborators { id name avatar handle subscriberCountText isVerified isVerifiedArtist }
446
+ }
447
+ `),xe=f`
448
+ max-width: 109.6rem;
449
+ padding: 2.4rem 1.6rem;
450
+ /* youtube.com's More arrow hangs 16px past a carousel, so it stays inside
451
+ the 16px gutter: measured from 800 to 1600px on 2026-11-10. */
452
+ --rail-arrow-right: -1.6rem;
453
+
454
+ /* youtube.com caps the results and the topic card's column together at
455
+ 1280px, the results 855px wide from 1600 to 1920px: measured signed out
456
+ on 2026-11-10. */
457
+ &.with-topic {
458
+ max-width: 131.2rem;
459
+ }
460
+
461
+ .columns {
462
+ display: flex;
463
+ align-items: flex-start;
464
+ gap: 4rem;
465
+ }
466
+
467
+ .columns > .results {
468
+ flex: 1;
469
+ min-width: 0;
470
+ }
471
+
472
+ .topic {
473
+ flex: none;
474
+ width: 38.5rem;
475
+ margin-top: 1.6rem;
476
+ }
477
+
478
+ /* youtube.com drops the right column below 1091px rather than moving it
479
+ into the results: measured signed out on 2026-11-10. */
480
+ @media (max-width: 1090px) {
481
+ .topic {
482
+ display: none;
483
+ }
484
+ }
485
+
486
+ .sr-only {
487
+ position: absolute;
488
+ width: 1px;
489
+ height: 1px;
490
+ padding: 0;
491
+ margin: -1px;
492
+ overflow: hidden;
493
+ clip: rect(0 0 0 0);
494
+ clip-path: inset(50%);
495
+ white-space: nowrap;
496
+ border: 0;
497
+ }
498
+
499
+ .status {
500
+ color: var(--text-secondary);
501
+ }
502
+
503
+ .toolbar {
504
+ display: flex;
505
+ align-items: center;
506
+ gap: 1.6rem;
507
+ padding-bottom: 1.2rem;
508
+ }
509
+
510
+ .filter-chips {
511
+ flex: 1;
512
+ min-width: 0;
513
+ display: flex;
514
+ gap: 1.2rem;
515
+ overflow-x: auto;
516
+ scrollbar-width: none;
517
+ }
518
+
519
+ .filter-chips::-webkit-scrollbar {
520
+ display: none;
521
+ }
522
+
523
+ .filter-chip {
524
+ flex: none;
525
+ height: 3.2rem;
526
+ padding: 0 1.2rem;
527
+ border: none;
528
+ border-radius: 0.8rem;
529
+ background: var(--bg-chip);
530
+ color: var(--text-primary);
531
+ font-size: 1.4rem;
532
+ font-weight: 500;
533
+ white-space: nowrap;
534
+ cursor: pointer;
535
+ transition: background 0.15s ease;
536
+ }
537
+
538
+ .filter-chip:hover {
539
+ background: var(--bg-chip-hover);
540
+ }
541
+
542
+ .filter-chip.active {
543
+ background: var(--bg-inverse);
544
+ color: var(--text-inverse);
545
+ }
546
+
547
+ .filter-chip.active:hover {
548
+ background: var(--bg-inverse-hover);
549
+ }
550
+
551
+ .filter-toggle {
552
+ flex: none;
553
+ display: inline-flex;
554
+ align-items: center;
555
+ gap: 0.8rem;
556
+ height: 3.6rem;
557
+ padding: 0 1.6rem;
558
+ border: none;
559
+ border-radius: 1.8rem;
560
+ background: transparent;
561
+ color: var(--text-primary);
562
+ font-size: 1.4rem;
563
+ font-weight: 500;
564
+ cursor: pointer;
565
+ transition: background 0.15s ease;
566
+ }
567
+
568
+ .filter-toggle:hover {
569
+ background: var(--bg-hover);
570
+ }
571
+
572
+ .filters {
573
+ display: grid;
574
+ grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
575
+ gap: 2.4rem;
576
+ }
577
+
578
+ .group-title {
579
+ margin: 0 0 0.8rem;
580
+ padding-bottom: 1.2rem;
581
+ border-bottom: 1px solid var(--border-subtle);
582
+ font-size: 1.2rem;
583
+ font-weight: 500;
584
+ color: var(--text-primary);
585
+ text-transform: uppercase;
586
+ letter-spacing: 0.05em;
587
+ }
588
+
589
+ .option {
590
+ display: flex;
591
+ align-items: center;
592
+ gap: 1.2rem;
593
+ width: fit-content;
594
+ padding: 0.8rem 0;
595
+ border: none;
596
+ background: transparent;
597
+ color: var(--text-secondary);
598
+ font-size: 1.4rem;
599
+ text-align: left;
600
+ cursor: pointer;
601
+ }
602
+
603
+ .option:hover {
604
+ color: var(--text-primary);
605
+ }
606
+
607
+ .option.active {
608
+ color: var(--text-primary);
609
+ font-weight: 500;
610
+ }
611
+
612
+ .option svg {
613
+ flex: none;
614
+ margin: -0.2rem 0;
615
+ }
616
+
617
+ .refinements {
618
+ display: flex;
619
+ flex-wrap: wrap;
620
+ gap: 0.8rem;
621
+ padding: 1.6rem 0;
622
+ }
623
+
624
+ .refinement {
625
+ height: 3.2rem;
626
+ padding: 0 1.2rem;
627
+ border: 1px solid var(--border);
628
+ border-radius: 1.6rem;
629
+ background: transparent;
630
+ color: var(--text-primary);
631
+ font-size: 1.3rem;
632
+ cursor: pointer;
633
+ transition: background 0.15s ease;
634
+ }
635
+
636
+ .refinement:hover {
637
+ background: var(--bg-hover);
638
+ }
639
+
640
+ .results {
641
+ display: flex;
642
+ flex-direction: column;
643
+ gap: 1.6rem;
644
+ padding-top: 1.6rem;
645
+ }
646
+
647
+ /* youtube.com's row: the thumbnail takes half the row, up to 500px. */
648
+ .result {
649
+ display: grid;
650
+ grid-template-columns: minmax(24rem, min(50rem, 50%)) minmax(0, 1fr);
651
+ gap: 1.6rem;
652
+ }
653
+
654
+ .result .thumb {
655
+ position: relative;
656
+ display: block;
657
+ aspect-ratio: 16 / 9;
658
+ border-radius: 1.2rem;
659
+ overflow: hidden;
660
+ background: var(--bg-chip);
661
+ }
662
+
663
+ .result .thumb img {
664
+ width: 100%;
665
+ height: 100%;
666
+ object-fit: cover;
667
+ }
668
+
669
+ .result .badge {
670
+ position: absolute;
671
+ right: 0.8rem;
672
+ bottom: 0.8rem;
673
+ display: flex;
674
+ align-items: center;
675
+ gap: 0.2rem;
676
+ padding: 0.2rem 0.4rem;
677
+ border-radius: 0.4rem;
678
+ background: rgba(0, 0, 0, 0.8);
679
+ color: #fff;
680
+ font-size: 1.2rem;
681
+ font-weight: 500;
682
+ }
683
+
684
+ .result .badge.live {
685
+ background: var(--brand-red);
686
+ }
687
+
688
+ .result .title-row {
689
+ display: flex;
690
+ align-items: flex-start;
691
+ gap: 0.8rem;
692
+ }
693
+
694
+ .result .title {
695
+ flex: 1;
696
+ min-width: 0;
697
+ margin: 0;
698
+ font-size: 1.8rem;
699
+ font-weight: 400;
700
+ line-height: 2.6rem;
701
+ color: var(--text-primary);
702
+ }
703
+
704
+ .result .more {
705
+ flex: none;
706
+ display: flex;
707
+ align-items: center;
708
+ justify-content: center;
709
+ width: 4rem;
710
+ height: 4rem;
711
+ margin-top: -0.7rem;
712
+ border: none;
713
+ border-radius: 50%;
714
+ background: transparent;
715
+ color: var(--text-primary);
716
+ cursor: pointer;
717
+ }
718
+
719
+ .result .more:hover {
720
+ background: var(--bg-hover);
721
+ }
722
+
723
+ .shelf-heading {
724
+ margin: 0.8rem 0 0;
725
+ font-size: 2rem;
726
+ font-weight: 700;
727
+ line-height: 2.8rem;
728
+ color: var(--text-primary);
729
+ }
730
+
731
+ /* youtube.com's carousel of video cards inside the results, measured signed
732
+ out at 1280 and 412px on 2026-11-10: 44px from the row above to its title,
733
+ cards 360px wide on a 364px step, 40px from them to the row below. */
734
+ .carousel-shelf {
735
+ padding: 2.8rem 0 2.4rem;
736
+ }
737
+
738
+ .carousel-shelf .shelf-heading {
739
+ margin: 0;
740
+ }
741
+
742
+ .shelf-subtitle {
743
+ margin: 0.4rem 0 0;
744
+ font-size: 1.4rem;
745
+ line-height: 2rem;
746
+ color: var(--text-secondary);
747
+ }
748
+
749
+ .carousel-rail {
750
+ --rail-gap: 0.4rem;
751
+ --rail-arrow-top: 8.1rem;
752
+ margin-top: 2.4rem;
753
+ }
754
+
755
+ .carousel-card {
756
+ width: 36rem;
757
+ }
758
+
759
+ @media (max-width: 599px) {
760
+ .carousel-shelf .shelf-heading {
761
+ font-size: 1.8rem;
762
+ line-height: 2.6rem;
763
+ }
764
+ }
765
+
766
+ .shelf-more-row {
767
+ display: flex;
768
+ align-items: center;
769
+ gap: 1.6rem;
770
+ margin-top: 0.4rem;
771
+ }
772
+
773
+ .shelf-more-row::before,
774
+ .shelf-more-row::after {
775
+ content: '';
776
+ flex: 1;
777
+ height: 1px;
778
+ background: var(--border-subtle);
779
+ }
780
+
781
+ .shelf-more {
782
+ flex: none;
783
+ display: inline-flex;
784
+ align-items: center;
785
+ justify-content: center;
786
+ gap: 0.6rem;
787
+ height: 3.6rem;
788
+ padding: 0 1.6rem;
789
+ border: 1px solid var(--border-subtle);
790
+ border-radius: 1.8rem;
791
+ background: transparent;
792
+ color: var(--text-primary);
793
+ font-size: 1.4rem;
794
+ font-weight: 500;
795
+ cursor: pointer;
796
+ transition: background 0.15s ease;
797
+ }
798
+
799
+ .shelf-more:hover {
800
+ background: var(--bg-hover);
801
+ }
802
+
803
+ .result .meta {
804
+ margin-top: 0.4rem;
805
+ font-size: 1.2rem;
806
+ line-height: 1.8rem;
807
+ color: var(--text-secondary);
808
+ }
809
+
810
+ .chips {
811
+ display: flex;
812
+ flex-wrap: wrap;
813
+ gap: 0.4rem;
814
+ margin-top: 0.8rem;
815
+ }
816
+
817
+ .chip {
818
+ padding: 0.2rem 0.6rem;
819
+ border-radius: 0.4rem;
820
+ background: var(--bg-chip);
821
+ font-size: 1.2rem;
822
+ font-weight: 500;
823
+ line-height: 1.6rem;
824
+ color: var(--text-secondary);
825
+ }
826
+
827
+ .channel {
828
+ display: inline-flex;
829
+ align-items: center;
830
+ gap: 0.8rem;
831
+ margin-top: 1.2rem;
832
+ font-size: 1.2rem;
833
+ color: var(--text-secondary);
834
+ }
835
+
836
+ .result .avatar {
837
+ display: flex;
838
+ align-items: center;
839
+ justify-content: center;
840
+ width: 2.4rem;
841
+ height: 2.4rem;
842
+ border-radius: 50%;
843
+ overflow: hidden;
844
+ background: var(--bg-chip);
845
+ font-size: 1.1rem;
846
+ }
847
+
848
+ .result .avatar img {
849
+ width: 100%;
850
+ height: 100%;
851
+ object-fit: cover;
852
+ }
853
+
854
+ .description {
855
+ margin: 1.2rem 0 0;
856
+ font-size: 1.2rem;
857
+ line-height: 1.8rem;
858
+ color: var(--text-secondary);
859
+ display: -webkit-box;
860
+ -webkit-line-clamp: 2;
861
+ -webkit-box-orient: vertical;
862
+ overflow: hidden;
863
+ }
864
+
865
+ .description b {
866
+ font-weight: 500;
867
+ }
868
+
869
+ /* A channel row is centred on its own axis rather than sharing the video
870
+ grid's top alignment, with Subscribe on the right, which is what youtube.com
871
+ does and what keeps a row with almost no metadata from looking unbalanced. */
872
+ .result.channel-row {
873
+ grid-template-columns: minmax(24rem, min(50rem, 50%)) minmax(0, 1fr) auto;
874
+ align-items: center;
875
+ }
876
+
877
+ .channel-avatar {
878
+ display: flex;
879
+ align-items: center;
880
+ justify-content: center;
881
+ width: 13.6rem;
882
+ height: 13.6rem;
883
+ margin: 0 auto;
884
+ border-radius: 50%;
885
+ overflow: hidden;
886
+ background: var(--bg-chip);
887
+ color: var(--text-primary);
888
+ font-size: 4rem;
889
+ }
890
+
891
+ .channel-avatar img {
892
+ width: 100%;
893
+ height: 100%;
894
+ object-fit: cover;
895
+ }
896
+
897
+ .result .channel-name {
898
+ margin: 0;
899
+ font-size: 1.8rem;
900
+ font-weight: 400;
901
+ color: var(--text-primary);
902
+ }
903
+
904
+ .channel-actions {
905
+ flex: none;
906
+ }
907
+
908
+ .playlist-stack {
909
+ position: relative;
910
+ padding-top: 0.6rem;
911
+ }
912
+
913
+ .playlist-stack::before {
914
+ content: '';
915
+ position: absolute;
916
+ top: 0;
917
+ left: 1.2rem;
918
+ right: 1.2rem;
919
+ height: 1.4rem;
920
+ border-radius: 0.8rem 0.8rem 0 0;
921
+ background: var(--bg-chip-hover);
922
+ opacity: 0.55;
923
+ }
924
+
925
+ .playlist-thumb {
926
+ position: relative;
927
+ display: block;
928
+ aspect-ratio: 16 / 9;
929
+ border-radius: 1.2rem;
930
+ overflow: hidden;
931
+ background: var(--bg-chip);
932
+ }
933
+
934
+ .playlist-thumb img {
935
+ width: 100%;
936
+ height: 100%;
937
+ object-fit: cover;
938
+ }
939
+
940
+ .playlist-count {
941
+ position: absolute;
942
+ right: 0.8rem;
943
+ bottom: 0.8rem;
944
+ display: flex;
945
+ align-items: center;
946
+ gap: 0.4rem;
947
+ padding: 0.2rem 0.6rem;
948
+ border-radius: 0.4rem;
949
+ background: var(--bg-badge);
950
+ color: var(--text-on-media);
951
+ font-size: 1.2rem;
952
+ font-weight: 500;
953
+ line-height: 1.8rem;
954
+ }
955
+
956
+ .playlist-link {
957
+ display: inline-block;
958
+ margin-top: 1.2rem;
959
+ font-size: 1.2rem;
960
+ font-weight: 500;
961
+ color: var(--text-secondary);
962
+ }
963
+
964
+ .playlist-link:hover {
965
+ color: var(--text-primary);
966
+ }
967
+
968
+ /* A row's own shape with nothing in it, drawn while the first page is on its way. */
969
+ .result-placeholder {
970
+ animation: search-placeholder-pulse 1.6s ease-in-out infinite;
971
+ }
972
+
973
+ .result-placeholder .bar {
974
+ display: block;
975
+ height: 1.6rem;
976
+ border-radius: 0.4rem;
977
+ background: var(--bg-chip);
978
+ }
979
+
980
+ .result-placeholder .bar-title {
981
+ width: 90%;
982
+ height: 2rem;
983
+ margin-top: 0.3rem;
984
+ }
985
+
986
+ .result-placeholder .bar-meta {
987
+ width: 40%;
988
+ margin-top: 0.8rem;
989
+ }
990
+
991
+ .result-placeholder .bar-channel {
992
+ width: 12rem;
993
+ }
994
+
995
+ .result-placeholder .bar-description {
996
+ width: 70%;
997
+ margin-top: 1.2rem;
998
+ }
999
+
1000
+ @keyframes search-placeholder-pulse {
1001
+ 0%,
1002
+ 100% {
1003
+ opacity: 1;
1004
+ }
1005
+
1006
+ 50% {
1007
+ opacity: 0.55;
1008
+ }
1009
+ }
1010
+
1011
+ @media (max-width: 900px) {
1012
+ .result,
1013
+ .result.channel-row {
1014
+ grid-template-columns: minmax(0, 1fr);
1015
+ }
1016
+
1017
+ .result .thumb {
1018
+ max-width: none;
1019
+ min-width: 0;
1020
+ }
1021
+
1022
+ .channel-actions {
1023
+ margin-top: 0.4rem;
1024
+ }
1025
+ }
1026
+ `,Q=e=>e.__typename===`SearchCard`?`card:${e.cardChannel.id}`:e.__typename===`SearchShelf`?`shelf:${e.title}:${(e.videos[0]??e.shorts[0])?.id}`:e.__typename===`Channel`?`channel:${e.id}`:`${e.__typename}:${e.id}`,Se=6,Ce=()=>u(`div`,{className:`result result-placeholder`,"aria-hidden":`true`,children:[p(`div`,{className:`thumb`}),u(`div`,{children:[p(`div`,{className:`bar bar-title`}),p(`div`,{className:`bar bar-meta`}),u(`div`,{className:`channel`,children:[p(`span`,{className:`avatar`}),p(`span`,{className:`bar bar-channel`})]}),p(`div`,{className:`bar bar-description`})]})]}),$=({row:e})=>{let t=e.isUpcoming===!0?void 0:e.inlinePlayerParams??void 0,n=D(e.id,t),[r,i]=a(!1),o=k(e.id),s=N(e.durationSeconds),c=b(e.viewCount,e.publishedText),l=e.snippetRuns?.map((e,t)=>e.bold?p(`b`,{children:e.text},t):e.text)??e.descriptionSnippet??e.description,d=v(t);return u(`article`,{className:`result`,onPointerEnter:e=>{t||n.onPointerEnter(),e.pointerType===`mouse`&&i(!0)},onPointerLeave:()=>{t||n.onPointerLeave(),i(!1)},onPointerDown:n.onPointerDown,children:[u(m,{href:o,state:d,className:`thumb`,tabIndex:-1,"aria-hidden":`true`,children:[e.thumbnail?p(O,{src:e.thumbnail,srcSet:e.thumbnailSrcset,sizes:`50rem`}):void 0,r&&t?p(A,{videoId:e.id,href:o,playerParams:t}):void 0,e.isLive?p(`span`,{className:`badge live`,children:`LIVE`}):s?u(`span`,{className:`badge`,children:[e.isMusic?p(y,{}):void 0,s]}):void 0]}),u(`div`,{className:`info`,children:[u(`div`,{className:`title-row`,children:[p(`h2`,{className:`title`,children:p(m,{href:o,state:d,children:e.title})}),p(h,{videoId:e.id,title:e.title,thumbnail:e.thumbnail,durationSeconds:e.durationSeconds,channel:e.channel,live:!!(e.isLive||e.isUpcoming),iconSize:24})]}),c?p(`div`,{className:`meta`,children:c}):void 0,S(e)===`names`?u(`div`,{className:`channel`,children:[e.collaborators?.length?p(w,{channels:e.collaborators,className:`avatars`,label:`Collaboration channels`,children:p(g,{channels:e.collaborators})}):void 0,p(m,{href:o,state:d,className:`names`,tabIndex:-1,children:p(C,{parts:e.byline,badgeSize:12})})]}):e.channel?u(m,{href:`/channel/${e.channel.id}`,className:`channel`,children:[p(`span`,{className:e.channel.avatar?`avatar`:`avatar fallback`,children:e.channel.avatar?p(O,{src:e.channel.avatar}):e.channel.name.slice(0,1).toUpperCase()}),u(`span`,{children:[e.channel.name,p(j,{channel:e.channel,size:12})]})]}):void 0,l?p(`p`,{className:`description`,children:l}):void 0,e.badges.length>0?p(`div`,{className:`chips`,children:e.badges.map(e=>p(`span`,{className:`chip`,children:e},e))}):void 0,e.chapters?.length?p(M,{videoId:e.id,chapters:e.chapters,title:e.chaptersTitle,playerParams:t}):void 0]})]})},we=({shelf:e})=>{let[t,n]=a(!1);if(e.shorts.length>0)return p(P,{shorts:e.shorts,title:e.title});if(e.horizontal)return u(`section`,{className:`carousel-shelf`,"aria-label":e.title,children:[p(`h2`,{className:`shelf-heading`,children:e.title}),e.subtitle?p(`p`,{className:`shelf-subtitle`,children:e.subtitle}):void 0,p(`div`,{className:`carousel-rail`,children:p(E,{label:e.title,count:e.videos.length,wholeCards:!0,children:e.videos.map(e=>p(`div`,{className:`carousel-card`,children:p(x,{video:e,variant:`carousel`})},e.id))})})]});let i=t||!e.collapsedCount?e.videos:e.videos.slice(0,e.collapsedCount),o=e.videos.length-i.length;return u(`section`,{className:`results`,"aria-label":e.title,children:[p(`h2`,{className:`shelf-heading`,children:e.title}),i.map(e=>p($,{row:e},e.id)),o>0?p(`div`,{className:`shelf-more-row`,children:u(`button`,{type:`button`,className:`shelf-more`,onClick:()=>n(!0),children:[`+`,o,` More`,p(r,{size:18,strokeWidth:1.5,"aria-hidden":`true`})]})}):void 0]})},Te=()=>{let t=le(l()),r=ae(`hideShorts`);r&&t.get(`type`)===`SHORTS`&&t.delete(`type`);let o=t.get(`search_query`)??``,[,d]=c();F(o.length>0?o:`Search`);let f=de(t),h=se(t),[g,v]=a(!1),y=n(()=>v(!1),[]),b=`${o}|${JSON.stringify(f)}`,[x,S]=a({key:b,pages:[]}),C=x.key===b?x.pages:[],[{data:w,error:E,fetching:D},k]=ee({query:be,variables:{query:o,filters:f,cursor:C[C.length-1]?.cursor},pause:o.length===0}),A=w?.search,{items:M,cursor:N}=ie({pages:ge(C,A).map(e=>({items:e.results,cursor:e.cursor})),key:Q}),P=ye(M,r),I=(C[0]??A)?.unwatchedChip??!0,L=(C[0]??A)?.topic,R=L?M.find(e=>e.__typename===`Channel`&&e.id===L.channelId):void 0,B=()=>{!A?.cursor||D||E||S({key:b,pages:C[C.length-1]===A?C:[...C,A]})},H=e=>{d(`/results?${new URLSearchParams({search_query:e})}`)};return u(`main`,{css:xe,className:L?`with-topic`:void 0,children:[u(`h1`,{className:`sr-only`,children:[`Results for `,o]}),u(`div`,{className:`toolbar`,children:[p(`div`,{className:`filter-chips`,children:z.filter(e=>(e.id!==`unwatched`||I)&&(!r||e.id!==`shorts`)).map(e=>p(`button`,{type:`button`,className:e.id===h?`filter-chip active`:`filter-chip`,"aria-pressed":e.id===h,onClick:()=>d(`/results?${V(t,e)}`),children:e.label},e.id))}),u(`button`,{type:`button`,className:`filter-toggle`,onClick:()=>v(!0),children:[`Filters`,p(s,{size:20,strokeWidth:1.5})]})]}),g?p(ne,{title:`Search filters`,wide:!0,onClose:y,children:p(`div`,{className:`filters`,children:q.map(e=>u(`div`,{children:[p(`h3`,{className:`group-title`,children:e.label}),e.options.filter(t=>!r||e.param!==`type`||t.value!==`SHORTS`).map(n=>{let r=Y(t,e).includes(n.value);return u(`button`,{type:`button`,className:r?`option active`:`option`,"aria-pressed":r,onClick:r&&!X(e)?void 0:()=>{v(!1),d(`/results?${ue(t,e,n.value)}`)},children:[n.label,r&&X(e)?p(i,{size:20,strokeWidth:1.5}):void 0]},n.value)})]},e.param))})}):void 0,A?.refinements&&A.refinements.length>0?p(`div`,{className:`refinements`,children:A.refinements.map(e=>p(`button`,{type:`button`,className:`refinement`,onClick:()=>H(e),children:e},e))}):void 0,u(`div`,{className:`columns`,children:[u(`div`,{className:`results`,children:[P.map(t=>{if(t.__typename===`SearchCard`)return p(oe,{card:t},Q(t));if(t.__typename===`SearchShelf`)return p(we,{shelf:t},Q(t));if(t.__typename===`Channel`)return u(`article`,{className:`result channel-row`,children:[p(m,{href:`/channel/${t.id}`,className:`channel-avatar`,tabIndex:-1,"aria-hidden":`true`,children:t.avatar?p(O,{src:t.avatar}):t.name.slice(0,1).toUpperCase()}),u(`div`,{children:[p(`h2`,{className:`channel-name`,children:u(m,{href:`/channel/${t.id}`,children:[t.name,p(j,{channel:t})]})}),p(`div`,{className:`meta`,children:[t.handle,t.subscriberCountText,t.videoCountText].filter(Boolean).join(` • `)}),t.description?p(`p`,{className:`description`,children:t.description}):void 0]}),p(`div`,{className:`channel-actions`,children:p(_,{channelId:t.id,subscribed:t.isSubscribed,notificationLevel:t.notificationLevel})})]},Q(t));if(t.__typename===`Playlist`){let n=re(t.id);return u(`article`,{className:`result`,children:[p(`div`,{className:`playlist-stack`,children:u(m,{href:n,className:`playlist-thumb`,tabIndex:-1,"aria-hidden":`true`,children:[t.thumbnail?p(O,{src:t.thumbnail}):void 0,t.videoCountText?u(`span`,{className:`playlist-count`,children:[p(e,{size:14,strokeWidth:1.5}),t.videoCountText]}):void 0]})}),u(`div`,{className:`info`,children:[p(`h2`,{className:`title`,children:p(m,{href:n,children:t.title})}),t.channel?p(m,{href:`/channel/${t.channel.id}`,className:`channel`,children:p(`span`,{children:t.channel.name})}):void 0,p(`div`,{children:p(m,{href:n,className:`playlist-link`,children:`View full playlist`})})]})]},Q(t))}return p($,{row:t},Q(t))}),D&&P.length===0?Array.from({length:Se},(e,t)=>p(Ce,{},t)):void 0]}),L?p(`div`,{className:`topic`,children:p(he,{topic:L,subscribed:R?.isSubscribed,notificationLevel:R?.notificationLevel})}):void 0]}),o.length>0&&!D&&!E&&P.length===0?p(`p`,{className:`status`,children:`No results found.`}):void 0,D&&P.length>0?p(`p`,{className:`status`,children:`Loading more…`}):void 0,E&&!D?p(T,{error:E,reexecute:k}):void 0,p(te,{onVisible:B,disabled:D||!N})]})};export{Te as default};