isaikr 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.
Files changed (51) hide show
  1. package/README.md +35 -0
  2. package/cdn/api.js +19 -0
  3. package/cdn/character.js +254 -0
  4. package/cdn/chat.js +33 -0
  5. package/cdn/code-editor.js +1131 -0
  6. package/cdn/community-compose.js +270 -0
  7. package/cdn/games/2048/index.html +12 -0
  8. package/cdn/games/breakout/index.html +13 -0
  9. package/cdn/games/clicker/index.html +26 -0
  10. package/cdn/games/flappy/index.html +11 -0
  11. package/cdn/games/memory/index.html +34 -0
  12. package/cdn/games/pong/index.html +13 -0
  13. package/cdn/games/reaction/index.html +38 -0
  14. package/cdn/games/runner/index.html +11 -0
  15. package/cdn/games/snake/index.html +11 -0
  16. package/cdn/games/tetris/index.html +14 -0
  17. package/cdn/games/whack/index.html +8 -0
  18. package/cdn/go.js +126 -0
  19. package/cdn/go2.js +127 -0
  20. package/cdn/header3_behavior.js +1167 -0
  21. package/cdn/header3_layout.js +1004 -0
  22. package/cdn/header3_layout.js.bak +1004 -0
  23. package/cdn/header3_style.css +3524 -0
  24. package/cdn/header3_style.css.bak +3514 -0
  25. package/cdn/lang.js +198 -0
  26. package/cdn/loading.js +143 -0
  27. package/cdn/loading2.js +144 -0
  28. package/cdn/local-model.js +2941 -0
  29. package/cdn/main.js +4 -0
  30. package/cdn/main_asset.js +1849 -0
  31. package/cdn/main_asset.js.bak +6999 -0
  32. package/cdn/main_index.css +287 -0
  33. package/cdn/re_board3.css +733 -0
  34. package/cdn/re_board3.js +734 -0
  35. package/cdn/re_chat_tts.js +652 -0
  36. package/cdn/re_local_runtime.js +2246 -0
  37. package/cdn/re_local_runtime.js.bak +2246 -0
  38. package/cdn/re_share.js +577 -0
  39. package/cdn/re_voice.js +542 -0
  40. package/cdn/utils.js +36 -0
  41. package/cdn/view.js +321 -0
  42. package/header3_behavior.js +804 -0
  43. package/header3_layout.js +998 -0
  44. package/header3_style.css +2740 -0
  45. package/index.js +0 -0
  46. package/lang.js +179 -0
  47. package/main_asset.js +2416 -0
  48. package/main_index.css +274 -0
  49. package/package.json +14 -0
  50. package/re_chat_tts.js +1419 -0
  51. package/re_voice.js +430 -0
@@ -0,0 +1,1004 @@
1
+ function __cleanAdHashAndScrollTop() {
2
+ const h = String(window.location.hash || '');
3
+ const isAdHash = /^#_/i.test(h) || /eniple|mobon|ad/i.test(h);
4
+ if (!isAdHash) return;
5
+ if (history && history.replaceState) {
6
+ history.replaceState(null, document.title, window.location.pathname + window.location.search);
7
+ }
8
+ window.scrollTo(0, 0);
9
+ }
10
+ __cleanAdHashAndScrollTop();
11
+ if ('scrollRestoration' in history) {
12
+ history.scrollRestoration = 'manual';
13
+ }
14
+ window.addEventListener('hashchange', __cleanAdHashAndScrollTop);
15
+ function __dockToolbarIfNeeded(toolbarArea, ultraNarrow) {
16
+ if (!toolbarArea) return;
17
+ // Keep toolbar in normal layout flow on mobile as requested.
18
+ toolbarArea.style.setProperty('position', 'relative', 'important');
19
+ toolbarArea.style.setProperty('right', 'auto', 'important');
20
+ toolbarArea.style.setProperty('top', 'auto', 'important');
21
+ toolbarArea.style.setProperty('left', 'auto', 'important');
22
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
23
+ }
24
+ function __syncAdFrameChildren(adFrame, desktopMode) {
25
+ if (!adFrame) return;
26
+ const nodes = adFrame.querySelectorAll('iframe, object, embed, img');
27
+ nodes.forEach(function (node) {
28
+ if (desktopMode) {
29
+ node.style.width = '';
30
+ node.style.height = '';
31
+ node.style.maxWidth = '';
32
+ node.style.maxHeight = '';
33
+ } else {
34
+ node.style.width = '100%';
35
+ node.style.height = '100%';
36
+ node.style.maxWidth = '100%';
37
+ node.style.maxHeight = '100%';
38
+ }
39
+ node.style.display = 'block';
40
+ node.style.margin = '0 auto';
41
+ });
42
+ }
43
+ function __measureAdContent(adFrame) {
44
+ if (!adFrame) return { width: 300, height: 250 };
45
+ let width = 300;
46
+ let height = 250;
47
+ const nodes = adFrame.querySelectorAll('iframe, object, embed, img, a, div');
48
+ nodes.forEach(function (node) {
49
+ const rect = typeof node.getBoundingClientRect === 'function' ? node.getBoundingClientRect() : null;
50
+ const w = Math.round(
51
+ Math.max(
52
+ rect ? rect.width : 0,
53
+ node.offsetWidth || 0,
54
+ node.clientWidth || 0,
55
+ node.scrollWidth || 0,
56
+ node.naturalWidth || 0
57
+ )
58
+ );
59
+ const h = Math.round(
60
+ Math.max(
61
+ rect ? rect.height : 0,
62
+ node.offsetHeight || 0,
63
+ node.clientHeight || 0,
64
+ node.scrollHeight || 0,
65
+ node.naturalHeight || 0
66
+ )
67
+ );
68
+ if (w > width) width = w;
69
+ if (h > height) height = h;
70
+ });
71
+ return {
72
+ width: Math.max(300, Math.min(336, width)),
73
+ height: Math.max(250, Math.min(280, height))
74
+ };
75
+ }
76
+ function __clearInlineStyleProps(el, props) {
77
+ if (!el || !el.style || !Array.isArray(props)) return;
78
+ props.forEach(function (prop) {
79
+ el.style.removeProperty(prop);
80
+ });
81
+ }
82
+ function __resetChatFullscreenLayoutStyles() {
83
+ const island = document.querySelector('.island-box');
84
+ const mainLayout = document.getElementById('main-layout');
85
+ const chatStack = document.getElementById('chat-main-stack');
86
+ const chatInputField = document.getElementById('chat-input-field');
87
+ const promptInput = document.getElementById('prompt-input');
88
+ const toolbarArea = document.getElementById('toolbar-area');
89
+ const controls = document.getElementById('toolbar-main-controls');
90
+ const iconWrap = document.getElementById('icon-scroll-wrapper');
91
+ const iconContainer = document.getElementById('icon-scroll-container');
92
+ const chatInputActions = document.getElementById('chat-input-actions');
93
+ const adWrap = document.getElementById('chat-side-ad');
94
+ const adBody = document.getElementById('chat-side-ad-body');
95
+ const adFrame = document.getElementById('chat-ad-frame');
96
+ const boardRail = document.getElementById('board-right-rail');
97
+ const rightPanel = document.getElementById('right-panel');
98
+
99
+ __clearInlineStyleProps(mainLayout, [
100
+ 'padding-left',
101
+ 'margin-left',
102
+ 'width',
103
+ 'max-width',
104
+ 'height',
105
+ 'min-height',
106
+ 'flex',
107
+ 'display'
108
+ ]);
109
+ __clearInlineStyleProps(island, [
110
+ 'position',
111
+ 'width',
112
+ 'height',
113
+ 'min-height',
114
+ 'max-height',
115
+ 'margin',
116
+ 'padding',
117
+ 'border-radius',
118
+ 'display',
119
+ 'grid-template-columns',
120
+ 'grid-template-rows',
121
+ 'align-items',
122
+ 'justify-items'
123
+ ]);
124
+ __clearInlineStyleProps(chatStack, [
125
+ 'display',
126
+ 'visibility',
127
+ 'opacity',
128
+ 'grid-column',
129
+ 'grid-row',
130
+ 'flex',
131
+ 'width',
132
+ 'max-width',
133
+ 'min-width',
134
+ 'min-height',
135
+ 'height',
136
+ 'max-height',
137
+ 'padding-right',
138
+ 'box-sizing'
139
+ ]);
140
+ __clearInlineStyleProps(chatInputField, [
141
+ 'width',
142
+ 'max-width',
143
+ 'padding',
144
+ 'padding-right',
145
+ 'box-sizing'
146
+ ]);
147
+ __clearInlineStyleProps(promptInput, [
148
+ 'width',
149
+ 'max-width',
150
+ 'padding',
151
+ 'padding-right',
152
+ 'padding-bottom',
153
+ 'padding-left'
154
+ ]);
155
+ __clearInlineStyleProps(toolbarArea, [
156
+ 'grid-column',
157
+ 'grid-row',
158
+ 'display',
159
+ 'flex',
160
+ 'width',
161
+ 'min-width',
162
+ 'max-width',
163
+ 'height',
164
+ 'min-height',
165
+ 'max-height',
166
+ 'position',
167
+ 'right',
168
+ 'top',
169
+ 'left',
170
+ 'bottom',
171
+ 'z-index',
172
+ 'visibility',
173
+ 'opacity',
174
+ 'pointer-events',
175
+ 'transform'
176
+ ]);
177
+ __clearInlineStyleProps(chatInputActions, [
178
+ 'position',
179
+ 'width',
180
+ 'top',
181
+ 'left',
182
+ 'right',
183
+ 'bottom',
184
+ 'justify-content',
185
+ 'z-index'
186
+ ]);
187
+ __clearInlineStyleProps(controls, [
188
+ 'display',
189
+ 'flex-direction',
190
+ 'align-items',
191
+ 'justify-content',
192
+ 'height',
193
+ 'min-height'
194
+ ]);
195
+ __clearInlineStyleProps(iconWrap, [
196
+ 'display',
197
+ 'width',
198
+ 'flex',
199
+ 'height',
200
+ 'min-height',
201
+ 'overflow',
202
+ 'overflow-y',
203
+ 'overflow-x',
204
+ 'justify-content',
205
+ 'align-items',
206
+ 'mask-image',
207
+ '-webkit-mask-image'
208
+ ]);
209
+ __clearInlineStyleProps(iconContainer, [
210
+ 'display',
211
+ 'flex-direction',
212
+ 'align-items',
213
+ 'justify-content',
214
+ 'width',
215
+ 'height',
216
+ 'min-height',
217
+ 'overflow-y',
218
+ 'overflow-x',
219
+ 'gap',
220
+ 'padding',
221
+ 'margin'
222
+ ]);
223
+ __clearInlineStyleProps(adWrap, [
224
+ 'display',
225
+ 'grid-column',
226
+ 'grid-row',
227
+ 'width',
228
+ 'min-width',
229
+ 'max-width',
230
+ 'flex',
231
+ 'height',
232
+ 'min-height',
233
+ 'max-height',
234
+ 'background'
235
+ ]);
236
+ __clearInlineStyleProps(adBody, [
237
+ 'display',
238
+ 'align-items',
239
+ 'justify-content',
240
+ 'padding',
241
+ 'overflow',
242
+ 'background',
243
+ 'width',
244
+ 'height',
245
+ 'min-height',
246
+ 'max-height'
247
+ ]);
248
+ __clearInlineStyleProps(adFrame, [
249
+ 'display',
250
+ 'width',
251
+ 'height',
252
+ 'min-width',
253
+ 'max-width',
254
+ 'margin',
255
+ 'overflow',
256
+ 'aspect-ratio',
257
+ 'transform',
258
+ 'transform-origin',
259
+ 'box-sizing',
260
+ 'padding'
261
+ ]);
262
+ __clearInlineStyleProps(boardRail, [
263
+ 'display',
264
+ 'grid-column',
265
+ 'grid-row',
266
+ 'width',
267
+ 'min-width',
268
+ 'max-width',
269
+ 'height',
270
+ 'min-height',
271
+ 'max-height'
272
+ ]);
273
+ __clearInlineStyleProps(rightPanel, [
274
+ 'display',
275
+ 'visibility',
276
+ 'grid-column',
277
+ 'grid-row',
278
+ 'width',
279
+ 'min-width',
280
+ 'max-width',
281
+ 'height',
282
+ 'min-height',
283
+ 'max-height',
284
+ 'opacity',
285
+ 'overflow',
286
+ 'position',
287
+ 'top',
288
+ 'left',
289
+ 'right',
290
+ 'bottom',
291
+ 'z-index',
292
+ 'border-top'
293
+ ]);
294
+ }
295
+ function __applyMobileChatRailSafety() {
296
+ const mainLayout = document.getElementById('main-layout');
297
+ const leftPanel = document.getElementById('left-panel');
298
+ const island = document.querySelector('.island-box');
299
+ const chatStack = document.getElementById('chat-main-stack');
300
+ const topZone = document.getElementById('top-zone');
301
+ const chatBox = document.getElementById('chat-box');
302
+ const chatInputShell = document.getElementById('chat-input-shell');
303
+ const chatInputField = document.getElementById('chat-input-field');
304
+ const promptInput = document.getElementById('prompt-input');
305
+ const toolbarArea = document.getElementById('toolbar-area');
306
+ const controls = document.getElementById('toolbar-main-controls');
307
+ const iconWrap = document.getElementById('icon-scroll-wrapper');
308
+ const iconContainer = document.getElementById('icon-scroll-container');
309
+ const chatInputActions = document.getElementById('chat-input-actions');
310
+ const adWrap = document.getElementById('chat-side-ad');
311
+ const adBody = document.getElementById('chat-side-ad-body');
312
+ const adFrame = document.getElementById('chat-ad-frame');
313
+ const boardRail = document.getElementById('board-right-rail');
314
+ const rightPanel = document.getElementById('right-panel');
315
+ const rightPanelOriginAnchor = document.getElementById('right-panel-origin-anchor');
316
+ const desktopCodePanelHost = document.getElementById('desktop-code-panel-host');
317
+ const fullscreenElement = document.fullscreenElement || document.webkitFullscreenElement || null;
318
+ const vw = window.innerWidth || document.documentElement.clientWidth || 0;
319
+ const mobileLike = vw <= 900;
320
+ const ultraNarrow = vw < 500;
321
+ const toolbarWidth = mobileLike ? 58 : 74;
322
+ const fullscreenActive = !!(fullscreenElement && fullscreenElement.classList && fullscreenElement.classList.contains('island-box'));
323
+ const bodyMode = document.body ? String(document.body.getAttribute('data-ui-mode') || '').trim() : '';
324
+ const runtimeMode = bodyMode || (typeof window !== 'undefined' ? String(window.currentMode || window.selectedMode || '').trim() : '');
325
+ const menuModeActive = !!(chatStack && chatStack.classList.contains('menu-mode'));
326
+ const settingsModeActive = runtimeMode === 'settings' || !!(chatStack && chatStack.classList.contains('settings-mode')) || !!(topZone && topZone.classList.contains('settings-mode'));
327
+ const immersiveTopMode = menuModeActive || settingsModeActive;
328
+ const codeModeActive = bodyMode === 'code' || !!(document.body && document.body.classList.contains('mode-code')) || !!(rightPanel && rightPanel.classList.contains('mobile-active'));
329
+ const desktopCodeMode = codeModeActive && !mobileLike;
330
+ const effectiveMobileLike = mobileLike;
331
+ const codePanelVisible = !!(rightPanel && (codeModeActive || rightPanel.classList.contains('mobile-active')));
332
+ const codePanelGridColumn = vw <= 1180 ? '1 / span 2' : '1 / span 4';
333
+ const codePanelGridRow = vw <= 900 ? '2' : (vw <= 1180 ? '3' : '2');
334
+ const codePanelMinHeight = vw <= 900 ? '240px' : '320px';
335
+ const codePanelMaxHeight = vw <= 900 ? '360px' : '520px';
336
+ const desktopFlowBypassModes = ['search', 'image', 'video', 'blog', 'music', 'translate', 'community', 'app'];
337
+
338
+ if (rightPanel) {
339
+ rightPanel.classList.toggle('mobile-active', codeModeActive && mobileLike);
340
+ }
341
+ if (document.body) {
342
+ document.body.classList.toggle('mode-code', codeModeActive && mobileLike);
343
+ document.body.classList.toggle('mobile-code-stacked', codeModeActive && mobileLike);
344
+ document.body.classList.remove('desktop-code-stage');
345
+ document.body.classList.toggle('desktop-code-open', desktopCodeMode);
346
+ document.body.classList.toggle('desktop-code-panel-mounted', desktopCodeMode && !fullscreenActive);
347
+ }
348
+ if (rightPanel && rightPanelOriginAnchor && desktopCodePanelHost) {
349
+ if (desktopCodeMode && !fullscreenActive) {
350
+ desktopCodePanelHost.style.display = 'block';
351
+ desktopCodePanelHost.style.width = '100%';
352
+ desktopCodePanelHost.style.minWidth = '0';
353
+ desktopCodePanelHost.style.minHeight = codePanelMinHeight;
354
+ desktopCodePanelHost.style.visibility = 'visible';
355
+ desktopCodePanelHost.style.opacity = '1';
356
+ if (rightPanel.parentElement !== desktopCodePanelHost) {
357
+ desktopCodePanelHost.appendChild(rightPanel);
358
+ }
359
+ } else {
360
+ desktopCodePanelHost.style.display = 'none';
361
+ desktopCodePanelHost.style.removeProperty('min-height');
362
+ desktopCodePanelHost.style.removeProperty('visibility');
363
+ desktopCodePanelHost.style.removeProperty('opacity');
364
+ desktopCodePanelHost.style.removeProperty('overflow');
365
+ if (rightPanel.parentElement !== rightPanelOriginAnchor.parentElement) {
366
+ rightPanelOriginAnchor.parentElement.insertBefore(rightPanel, rightPanelOriginAnchor.nextSibling);
367
+ }
368
+ }
369
+ }
370
+
371
+ if (chatInputField) {
372
+ chatInputField.style.setProperty('width', '100%', 'important');
373
+ chatInputField.style.setProperty('max-width', '100%', 'important');
374
+ chatInputField.style.setProperty('padding', '0', 'important');
375
+ chatInputField.style.setProperty('padding-right', '0', 'important');
376
+ chatInputField.style.setProperty('box-sizing', 'border-box', 'important');
377
+ }
378
+ if (promptInput) {
379
+ promptInput.style.setProperty('width', '100%', 'important');
380
+ promptInput.style.setProperty('max-width', '100%', 'important');
381
+ promptInput.style.setProperty('padding', '6px 0 0 0', 'important');
382
+ promptInput.style.setProperty('padding-right', '0', 'important');
383
+ }
384
+ if (topZone) {
385
+ if (settingsModeActive) {
386
+ topZone.style.setProperty('display', 'flex', 'important');
387
+ topZone.style.setProperty('flex', '1 1 auto', 'important');
388
+ topZone.style.setProperty('height', '100%', 'important');
389
+ topZone.style.setProperty('min-height', '0', 'important');
390
+ topZone.style.setProperty('max-height', '100%', 'important');
391
+ topZone.style.setProperty('overflow', 'hidden', 'important');
392
+ topZone.style.setProperty('visibility', 'visible', 'important');
393
+ topZone.style.setProperty('opacity', '1', 'important');
394
+ } else if (menuModeActive) {
395
+ topZone.style.setProperty('display', 'none', 'important');
396
+ topZone.style.setProperty('flex', '0 0 auto', 'important');
397
+ topZone.style.setProperty('height', '0', 'important');
398
+ topZone.style.setProperty('min-height', '0', 'important');
399
+ topZone.style.setProperty('max-height', '0', 'important');
400
+ topZone.style.setProperty('padding', '0', 'important');
401
+ topZone.style.setProperty('margin', '0', 'important');
402
+ topZone.style.setProperty('overflow', 'hidden', 'important');
403
+ topZone.style.setProperty('visibility', 'hidden', 'important');
404
+ topZone.style.setProperty('opacity', '0', 'important');
405
+ } else {
406
+ __clearInlineStyleProps(topZone, ['display', 'flex', 'height', 'min-height', 'max-height', 'padding', 'margin', 'overflow', 'visibility', 'opacity']);
407
+ }
408
+ }
409
+
410
+ if (fullscreenActive) {
411
+ if (mainLayout) {
412
+ mainLayout.style.paddingLeft = '0';
413
+ mainLayout.style.marginLeft = '0';
414
+ mainLayout.style.width = '100%';
415
+ mainLayout.style.maxWidth = '100%';
416
+ mainLayout.style.height = '100%';
417
+ mainLayout.style.minHeight = '100%';
418
+ }
419
+ if (island) {
420
+ island.style.position = 'relative';
421
+ island.style.width = '100vw';
422
+ island.style.height = `${window.innerHeight}px`;
423
+ island.style.minHeight = `${window.innerHeight}px`;
424
+ island.style.maxHeight = `${window.innerHeight}px`;
425
+ island.style.margin = '0';
426
+ island.style.padding = '0';
427
+ island.style.borderRadius = '0';
428
+ island.style.display = 'grid';
429
+ island.style.gridTemplateColumns = `minmax(0, 1fr) ${toolbarWidth}px`;
430
+ island.style.gridTemplateRows = codeModeActive ? 'minmax(0, 1fr) minmax(260px, 42vh)' : 'minmax(0, 1fr)';
431
+ island.style.alignItems = 'stretch';
432
+ island.style.justifyItems = 'stretch';
433
+ }
434
+ if (chatStack) {
435
+ chatStack.style.gridColumn = '1';
436
+ chatStack.style.gridRow = '1';
437
+ chatStack.style.flex = '1 1 auto';
438
+ chatStack.style.width = '100%';
439
+ chatStack.style.maxWidth = '100%';
440
+ chatStack.style.minWidth = '0';
441
+ chatStack.style.minHeight = '0';
442
+ chatStack.style.height = '100%';
443
+ chatStack.style.maxHeight = '100%';
444
+ chatStack.style.paddingRight = '0';
445
+ chatStack.style.boxSizing = 'border-box';
446
+ }
447
+ if (toolbarArea) {
448
+ toolbarArea.style.gridColumn = '2';
449
+ toolbarArea.style.gridRow = codeModeActive ? '1 / span 2' : '1';
450
+ toolbarArea.style.display = 'flex';
451
+ toolbarArea.style.flexDirection = 'column';
452
+ toolbarArea.style.flex = `0 0 ${toolbarWidth}px`;
453
+ toolbarArea.style.width = `${toolbarWidth}px`;
454
+ toolbarArea.style.minWidth = `${toolbarWidth}px`;
455
+ toolbarArea.style.maxWidth = `${toolbarWidth}px`;
456
+ toolbarArea.style.height = '100%';
457
+ toolbarArea.style.minHeight = '100%';
458
+ toolbarArea.style.maxHeight = '100%';
459
+ toolbarArea.style.setProperty('position', 'relative', 'important');
460
+ toolbarArea.style.setProperty('right', 'auto', 'important');
461
+ toolbarArea.style.setProperty('top', 'auto', 'important');
462
+ toolbarArea.style.setProperty('left', 'auto', 'important');
463
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
464
+ toolbarArea.style.zIndex = '260';
465
+ toolbarArea.style.visibility = 'visible';
466
+ toolbarArea.style.opacity = '1';
467
+ toolbarArea.style.pointerEvents = 'auto';
468
+ toolbarArea.style.transform = 'none';
469
+ toolbarArea.style.overflowY = 'auto';
470
+ toolbarArea.style.overflowX = 'visible';
471
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
472
+ }
473
+ if (chatInputActions) {
474
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
475
+ chatInputActions.style.setProperty('width', 'auto', 'important');
476
+ chatInputActions.style.setProperty('top', 'auto', 'important');
477
+ chatInputActions.style.setProperty('left', 'auto', 'important');
478
+ chatInputActions.style.setProperty('right', '12px', 'important');
479
+ chatInputActions.style.setProperty('bottom', '8px', 'important');
480
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
481
+ chatInputActions.style.zIndex = '280';
482
+ }
483
+ if (controls) {
484
+ controls.style.display = 'flex';
485
+ controls.style.flexDirection = 'column';
486
+ controls.style.alignItems = 'center';
487
+ controls.style.justifyContent = 'flex-start';
488
+ controls.style.width = '100%';
489
+ controls.style.flex = '0 0 auto';
490
+ controls.style.height = 'auto';
491
+ controls.style.minHeight = 'auto';
492
+ }
493
+ if (iconWrap) {
494
+ iconWrap.style.display = 'flex';
495
+ iconWrap.style.width = '100%';
496
+ iconWrap.style.flex = '0 0 auto';
497
+ iconWrap.style.height = 'auto';
498
+ iconWrap.style.minHeight = '0';
499
+ iconWrap.style.overflowY = 'visible';
500
+ iconWrap.style.overflowX = 'visible';
501
+ iconWrap.style.justifyContent = 'flex-start';
502
+ iconWrap.style.alignItems = 'flex-start';
503
+ iconWrap.style.maskImage = 'none';
504
+ iconWrap.style.webkitMaskImage = 'none';
505
+ }
506
+ if (iconContainer) {
507
+ iconContainer.style.display = 'flex';
508
+ iconContainer.style.flexDirection = 'column';
509
+ iconContainer.style.alignItems = 'center';
510
+ iconContainer.style.justifyContent = 'flex-start';
511
+ iconContainer.style.width = '100%';
512
+ iconContainer.style.height = 'auto';
513
+ iconContainer.style.minHeight = '0';
514
+ iconContainer.style.overflowY = 'visible';
515
+ iconContainer.style.overflowX = 'visible';
516
+ iconContainer.style.gap = '10px';
517
+ iconContainer.style.padding = '6px 2px 14px';
518
+ iconContainer.style.margin = '0 auto';
519
+ }
520
+ if (adWrap) adWrap.style.display = 'none';
521
+ if (adBody) adBody.style.display = 'none';
522
+ if (adFrame) adFrame.style.display = 'none';
523
+ if (boardRail) boardRail.style.display = 'none';
524
+ if (rightPanel) {
525
+ if (codeModeActive) {
526
+ rightPanel.classList.remove('hidden');
527
+ rightPanel.style.setProperty('grid-column', '1', 'important');
528
+ rightPanel.style.setProperty('grid-row', '2', 'important');
529
+ rightPanel.style.setProperty('width', '100%', 'important');
530
+ rightPanel.style.setProperty('min-width', '0', 'important');
531
+ rightPanel.style.setProperty('max-width', '100%', 'important');
532
+ rightPanel.style.setProperty('height', 'auto', 'important');
533
+ rightPanel.style.setProperty('min-height', '260px', 'important');
534
+ rightPanel.style.setProperty('max-height', '42vh', 'important');
535
+ rightPanel.style.setProperty('position', 'relative', 'important');
536
+ rightPanel.style.setProperty('top', 'auto', 'important');
537
+ rightPanel.style.setProperty('left', 'auto', 'important');
538
+ rightPanel.style.setProperty('right', 'auto', 'important');
539
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
540
+ rightPanel.style.setProperty('z-index', '20', 'important');
541
+ rightPanel.style.setProperty('display', 'flex', 'important');
542
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
543
+ rightPanel.style.setProperty('opacity', '1', 'important');
544
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
545
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
546
+ } else {
547
+ rightPanel.style.setProperty('display', 'none', 'important');
548
+ rightPanel.style.setProperty('visibility', 'hidden', 'important');
549
+ rightPanel.style.setProperty('opacity', '0', 'important');
550
+ }
551
+ }
552
+ return;
553
+ }
554
+
555
+ __resetChatFullscreenLayoutStyles();
556
+
557
+ if (!mobileLike && !codeModeActive && desktopFlowBypassModes.includes(runtimeMode)) {
558
+ if (desktopCodePanelHost) {
559
+ desktopCodePanelHost.style.display = 'none';
560
+ desktopCodePanelHost.style.removeProperty('min-height');
561
+ desktopCodePanelHost.style.removeProperty('visibility');
562
+ desktopCodePanelHost.style.removeProperty('opacity');
563
+ desktopCodePanelHost.style.removeProperty('overflow');
564
+ }
565
+ if (rightPanel && !rightPanel.classList.contains('mobile-active')) {
566
+ rightPanel.classList.add('hidden');
567
+ __clearInlineStyleProps(rightPanel, ['display', 'visibility', 'opacity', 'width', 'min-width', 'max-width', 'grid-row', 'grid-column', 'height', 'min-height', 'max-height', 'overflow', 'position', 'top', 'left', 'right', 'bottom', 'z-index', 'border-top']);
568
+ }
569
+ return;
570
+ }
571
+
572
+ if (desktopCodeMode) {
573
+ if (rightPanel) {
574
+ rightPanel.classList.remove('hidden');
575
+ rightPanel.classList.remove('mobile-active');
576
+ rightPanel.style.setProperty('display', 'flex', 'important');
577
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
578
+ rightPanel.style.setProperty('opacity', '1', 'important');
579
+ rightPanel.style.setProperty('width', '100%', 'important');
580
+ rightPanel.style.setProperty('min-width', '0', 'important');
581
+ rightPanel.style.setProperty('max-width', '100%', 'important');
582
+ rightPanel.style.removeProperty('grid-column');
583
+ rightPanel.style.removeProperty('grid-row');
584
+ rightPanel.style.setProperty('height', 'auto', 'important');
585
+ rightPanel.style.setProperty('min-height', codePanelMinHeight, 'important');
586
+ rightPanel.style.setProperty('max-height', codePanelMaxHeight, 'important');
587
+ rightPanel.style.setProperty('position', 'relative', 'important');
588
+ rightPanel.style.setProperty('top', 'auto', 'important');
589
+ rightPanel.style.setProperty('left', 'auto', 'important');
590
+ rightPanel.style.setProperty('right', 'auto', 'important');
591
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
592
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
593
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
594
+ }
595
+ return;
596
+ }
597
+
598
+ if (effectiveMobileLike && mainLayout) {
599
+ const h = mainLayout.getBoundingClientRect().height || 0;
600
+ const island = document.querySelector('.island-box');
601
+ if (h < 180) {
602
+ mainLayout.style.flex = '0 0 auto';
603
+ mainLayout.style.height = 'auto';
604
+ mainLayout.style.minHeight = '320px';
605
+ mainLayout.style.display = 'flex';
606
+ }
607
+ if (leftPanel) {
608
+ leftPanel.style.display = 'flex';
609
+ leftPanel.style.height = 'auto';
610
+ leftPanel.style.minHeight = '320px';
611
+ }
612
+ if (island) {
613
+ const mobileRows = codePanelVisible
614
+ ? (immersiveTopMode ? 'minmax(0, 1fr) minmax(240px, auto) 270px' : '320px minmax(240px, auto) 270px')
615
+ : (immersiveTopMode ? 'minmax(0, 1fr) auto 270px' : '320px auto 270px');
616
+ island.style.position = 'relative';
617
+ island.style.display = 'grid';
618
+ island.style.gridTemplateColumns = `minmax(0, 1fr) ${toolbarWidth}px`;
619
+ island.style.gridTemplateRows = mobileRows;
620
+ island.style.alignItems = 'stretch';
621
+ island.style.justifyItems = 'stretch';
622
+ }
623
+ if (chatStack) {
624
+ chatStack.style.gridColumn = '1';
625
+ chatStack.style.gridRow = '1';
626
+ chatStack.style.flex = '1 1 auto';
627
+ chatStack.style.width = '100%';
628
+ chatStack.style.maxWidth = '100%';
629
+ chatStack.style.minHeight = immersiveTopMode ? '0' : '320px';
630
+ chatStack.style.height = immersiveTopMode ? '100%' : '320px';
631
+ chatStack.style.maxHeight = immersiveTopMode ? '100%' : '320px';
632
+ chatStack.style.paddingRight = '0';
633
+ chatStack.style.boxSizing = 'border-box';
634
+ }
635
+ if (toolbarArea) {
636
+ toolbarArea.style.gridColumn = '2';
637
+ toolbarArea.style.gridRow = '1';
638
+ toolbarArea.style.display = 'flex';
639
+ toolbarArea.style.flexDirection = 'column';
640
+ toolbarArea.style.flex = `0 0 ${toolbarWidth}px`;
641
+ toolbarArea.style.width = `${toolbarWidth}px`;
642
+ toolbarArea.style.minWidth = `${toolbarWidth}px`;
643
+ toolbarArea.style.maxWidth = `${toolbarWidth}px`;
644
+ toolbarArea.style.height = '320px';
645
+ toolbarArea.style.minHeight = '320px';
646
+ toolbarArea.style.maxHeight = '320px';
647
+ toolbarArea.style.setProperty('position', 'relative', 'important');
648
+ toolbarArea.style.setProperty('right', 'auto', 'important');
649
+ toolbarArea.style.setProperty('top', 'auto', 'important');
650
+ toolbarArea.style.setProperty('left', 'auto', 'important');
651
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
652
+ toolbarArea.style.zIndex = '260';
653
+ toolbarArea.style.visibility = 'visible';
654
+ toolbarArea.style.opacity = '1';
655
+ toolbarArea.style.pointerEvents = 'auto';
656
+ toolbarArea.style.transform = 'none';
657
+ toolbarArea.style.alignSelf = 'stretch';
658
+ toolbarArea.style.justifySelf = 'stretch';
659
+ toolbarArea.style.overflowY = 'auto';
660
+ toolbarArea.style.overflowX = 'hidden';
661
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
662
+ }
663
+ if (chatInputActions) {
664
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
665
+ chatInputActions.style.setProperty('width', 'auto', 'important');
666
+ chatInputActions.style.setProperty('top', 'auto', 'important');
667
+ chatInputActions.style.setProperty('left', 'auto', 'important');
668
+ chatInputActions.style.setProperty('right', '12px', 'important');
669
+ chatInputActions.style.setProperty('bottom', '8px', 'important');
670
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
671
+ chatInputActions.style.zIndex = ultraNarrow ? '280' : '40';
672
+ }
673
+ __dockToolbarIfNeeded(toolbarArea, ultraNarrow);
674
+ if (boardRail) {
675
+ boardRail.style.display = 'flex';
676
+ boardRail.style.gridColumn = '2';
677
+ boardRail.style.gridRow = '3';
678
+ boardRail.style.width = `${toolbarWidth}px`;
679
+ boardRail.style.minWidth = `${toolbarWidth}px`;
680
+ boardRail.style.maxWidth = `${toolbarWidth}px`;
681
+ boardRail.style.height = '270px';
682
+ boardRail.style.minHeight = '270px';
683
+ boardRail.style.maxHeight = '270px';
684
+ boardRail.style.alignSelf = 'stretch';
685
+ boardRail.style.justifySelf = 'stretch';
686
+ }
687
+ if (rightPanel) {
688
+ rightPanel.style.gridColumn = '1 / span 2';
689
+ rightPanel.style.gridRow = '2';
690
+ rightPanel.style.width = '100%';
691
+ rightPanel.style.minWidth = '0';
692
+ rightPanel.style.maxWidth = '100%';
693
+ rightPanel.style.position = 'relative';
694
+ rightPanel.style.top = 'auto';
695
+ rightPanel.style.left = 'auto';
696
+ rightPanel.style.right = 'auto';
697
+ rightPanel.style.bottom = 'auto';
698
+ rightPanel.style.zIndex = codePanelVisible ? '8' : '20';
699
+ rightPanel.style.display = codePanelVisible ? 'flex' : 'none';
700
+ rightPanel.style.opacity = codePanelVisible ? '1' : '0';
701
+ rightPanel.style.minHeight = codePanelVisible ? '240px' : '0';
702
+ rightPanel.style.maxHeight = codePanelVisible ? '360px' : '0';
703
+ }
704
+ if (adWrap) {
705
+ adWrap.style.display = 'flex';
706
+ adWrap.style.gridColumn = '1';
707
+ adWrap.style.gridRow = '3';
708
+ adWrap.style.zIndex = '16';
709
+ adWrap.style.background = '#ffffff';
710
+ adWrap.style.width = 'auto';
711
+ adWrap.style.minWidth = '0';
712
+ adWrap.style.maxWidth = '100%';
713
+ adWrap.style.flex = '1 1 auto';
714
+ adWrap.style.height = '250px';
715
+ adWrap.style.minHeight = '250px';
716
+ adWrap.style.maxHeight = '250px';
717
+ adWrap.style.alignSelf = 'stretch';
718
+ adWrap.style.justifySelf = 'stretch';
719
+ adWrap.style.overflow = 'hidden';
720
+ }
721
+ if (adBody) {
722
+ adBody.style.display = 'flex';
723
+ adBody.style.alignItems = 'center';
724
+ adBody.style.justifyContent = 'center';
725
+ adBody.style.zIndex = '16';
726
+ adBody.style.padding = '8px 6px';
727
+ adBody.style.overflow = 'hidden';
728
+ adBody.style.background = '#ffffff';
729
+ adBody.style.width = '100%';
730
+ adBody.style.height = '250px';
731
+ adBody.style.minHeight = '250px';
732
+ adBody.style.maxHeight = '250px';
733
+ }
734
+ if (adFrame) {
735
+ const availableWidth = Math.max(160, (adBody ? adBody.clientWidth : 300) - 12);
736
+ const scale = Math.min(1, availableWidth / 300);
737
+ adFrame.style.width = '300px';
738
+ adFrame.style.height = '250px';
739
+ adFrame.style.minWidth = '0';
740
+ adFrame.style.maxWidth = '300px';
741
+ adFrame.style.margin = '0 auto';
742
+ adFrame.style.overflow = 'visible';
743
+ adFrame.style.aspectRatio = '';
744
+ adFrame.style.transform = `scale(${scale})`;
745
+ adFrame.style.transformOrigin = 'top center';
746
+ adFrame.style.boxSizing = 'border-box';
747
+ adFrame.style.padding = '0';
748
+ __syncAdFrameChildren(adFrame, true);
749
+ }
750
+ if (controls) {
751
+ controls.style.display = 'flex';
752
+ controls.style.flexDirection = 'column';
753
+ controls.style.alignItems = 'center';
754
+ controls.style.justifyContent = 'flex-start';
755
+ controls.style.flex = '0 0 auto';
756
+ controls.style.height = 'auto';
757
+ controls.style.width = '100%';
758
+ controls.style.minHeight = 'auto';
759
+ }
760
+ if (iconWrap) {
761
+ iconWrap.style.display = 'flex';
762
+ iconWrap.style.width = '100%';
763
+ iconWrap.style.flex = '0 0 auto';
764
+ iconWrap.style.height = 'auto';
765
+ iconWrap.style.minHeight = '0';
766
+ iconWrap.style.overflowY = 'visible';
767
+ iconWrap.style.overflowX = 'visible';
768
+ iconWrap.style.justifyContent = 'flex-start';
769
+ iconWrap.style.alignItems = 'flex-start';
770
+ iconWrap.style.maskImage = 'none';
771
+ iconWrap.style.webkitMaskImage = 'none';
772
+ }
773
+ if (iconContainer) {
774
+ iconContainer.style.display = 'flex';
775
+ iconContainer.style.flexDirection = 'column';
776
+ iconContainer.style.alignItems = 'center';
777
+ iconContainer.style.justifyContent = 'flex-start';
778
+ iconContainer.style.width = '100%';
779
+ iconContainer.style.height = 'auto';
780
+ iconContainer.style.minHeight = '0';
781
+ iconContainer.style.overflowY = 'visible';
782
+ iconContainer.style.overflowX = 'hidden';
783
+ iconContainer.style.gap = '10px';
784
+ iconContainer.style.padding = '6px 0 14px';
785
+ iconContainer.style.margin = '0 auto';
786
+ }
787
+ if (toolbarArea) {
788
+ const rect = toolbarArea.getBoundingClientRect();
789
+ if ((rect.width || 0) < 30 || (rect.height || 0) < 120) {
790
+ toolbarArea.style.setProperty('position', 'relative', 'important');
791
+ toolbarArea.style.setProperty('right', 'auto', 'important');
792
+ toolbarArea.style.setProperty('top', 'auto', 'important');
793
+ toolbarArea.style.setProperty('left', 'auto', 'important');
794
+ toolbarArea.style.setProperty('bottom', 'auto', 'important');
795
+ toolbarArea.style.height = '320px';
796
+ toolbarArea.style.minHeight = '320px';
797
+ toolbarArea.style.maxHeight = '320px';
798
+ toolbarArea.style.zIndex = '220';
799
+ }
800
+ }
801
+ } else {
802
+ __dockToolbarIfNeeded(toolbarArea, false);
803
+ if (chatInputActions) {
804
+ chatInputActions.style.setProperty('position', 'absolute', 'important');
805
+ chatInputActions.style.setProperty('width', 'auto', 'important');
806
+ chatInputActions.style.setProperty('top', 'auto', 'important');
807
+ chatInputActions.style.setProperty('left', 'auto', 'important');
808
+ chatInputActions.style.setProperty('right', '12px', 'important');
809
+ chatInputActions.style.setProperty('bottom', '8px', 'important');
810
+ chatInputActions.style.setProperty('justify-content', 'flex-end', 'important');
811
+ chatInputActions.style.zIndex = '12';
812
+ }
813
+ if (boardRail) {
814
+ boardRail.style.display = '';
815
+ }
816
+ const shouldPreserveCodePanel = codeModeActive || bodyMode === 'code' || (rightPanel && rightPanel.classList.contains('mobile-active'));
817
+ if (rightPanel && shouldPreserveCodePanel) {
818
+ rightPanel.classList.remove('hidden');
819
+ rightPanel.style.setProperty('display', 'flex', 'important');
820
+ rightPanel.style.setProperty('visibility', 'visible', 'important');
821
+ rightPanel.style.setProperty('opacity', '1', 'important');
822
+ rightPanel.style.setProperty('width', '100%', 'important');
823
+ rightPanel.style.setProperty('min-width', '0', 'important');
824
+ rightPanel.style.setProperty('max-width', '100%', 'important');
825
+ rightPanel.style.setProperty('grid-column', codePanelGridColumn, 'important');
826
+ rightPanel.style.setProperty('grid-row', codePanelGridRow, 'important');
827
+ rightPanel.style.setProperty('height', 'auto', 'important');
828
+ rightPanel.style.setProperty('min-height', codePanelMinHeight, 'important');
829
+ rightPanel.style.setProperty('max-height', codePanelMaxHeight, 'important');
830
+ rightPanel.style.setProperty('position', 'relative', 'important');
831
+ rightPanel.style.setProperty('top', 'auto', 'important');
832
+ rightPanel.style.setProperty('left', 'auto', 'important');
833
+ rightPanel.style.setProperty('right', 'auto', 'important');
834
+ rightPanel.style.setProperty('bottom', 'auto', 'important');
835
+ rightPanel.style.setProperty('overflow', 'hidden', 'important');
836
+ rightPanel.style.setProperty('border-top', '1px solid rgba(255, 255, 255, 0.06)', 'important');
837
+ } else if (rightPanel) {
838
+ rightPanel.style.display = '';
839
+ rightPanel.style.visibility = '';
840
+ rightPanel.style.opacity = '';
841
+ rightPanel.style.width = '';
842
+ rightPanel.style.minWidth = '';
843
+ rightPanel.style.maxWidth = '';
844
+ rightPanel.style.gridColumn = '';
845
+ rightPanel.style.gridRow = '';
846
+ rightPanel.style.height = '';
847
+ rightPanel.style.minHeight = '';
848
+ rightPanel.style.maxHeight = '';
849
+ rightPanel.style.position = '';
850
+ rightPanel.style.top = '';
851
+ rightPanel.style.left = '';
852
+ rightPanel.style.right = '';
853
+ rightPanel.style.bottom = '';
854
+ rightPanel.style.overflow = '';
855
+ rightPanel.style.borderTop = '';
856
+ }
857
+ if (chatStack) {
858
+ chatStack.style.gridColumn = '';
859
+ chatStack.style.gridRow = '';
860
+ chatStack.style.paddingRight = '';
861
+ chatStack.style.maxWidth = '';
862
+ chatStack.style.width = '';
863
+ chatStack.style.height = immersiveTopMode ? '100%' : '270px';
864
+ chatStack.style.minHeight = immersiveTopMode ? '0' : '270px';
865
+ chatStack.style.maxHeight = immersiveTopMode ? '100%' : '270px';
866
+ }
867
+ if (toolbarArea) {
868
+ toolbarArea.style.gridColumn = '';
869
+ toolbarArea.style.gridRow = '';
870
+ toolbarArea.style.display = 'flex';
871
+ toolbarArea.style.flexDirection = 'column';
872
+ toolbarArea.style.position = 'relative';
873
+ toolbarArea.style.right = '';
874
+ toolbarArea.style.top = '';
875
+ toolbarArea.style.left = '';
876
+ toolbarArea.style.bottom = '';
877
+ toolbarArea.style.flex = '0 0 74px';
878
+ toolbarArea.style.width = '74px';
879
+ toolbarArea.style.minWidth = '74px';
880
+ toolbarArea.style.maxWidth = '74px';
881
+ toolbarArea.style.height = '270px';
882
+ toolbarArea.style.minHeight = '270px';
883
+ toolbarArea.style.maxHeight = '270px';
884
+ toolbarArea.style.zIndex = '20';
885
+ toolbarArea.style.visibility = 'visible';
886
+ toolbarArea.style.opacity = '1';
887
+ toolbarArea.style.pointerEvents = 'auto';
888
+ toolbarArea.style.transform = '';
889
+ toolbarArea.style.overflowY = 'auto';
890
+ toolbarArea.style.overflowX = 'hidden';
891
+ toolbarArea.style.scrollbarGutter = 'stable both-edges';
892
+ }
893
+ if (controls) {
894
+ controls.style.display = 'flex';
895
+ controls.style.flexDirection = 'column';
896
+ controls.style.alignItems = 'center';
897
+ controls.style.justifyContent = 'flex-start';
898
+ controls.style.width = '100%';
899
+ controls.style.flex = '0 0 auto';
900
+ controls.style.height = 'auto';
901
+ controls.style.minHeight = 'auto';
902
+ }
903
+ if (iconWrap) {
904
+ iconWrap.style.display = 'flex';
905
+ iconWrap.style.width = '100%';
906
+ iconWrap.style.flex = '0 0 auto';
907
+ iconWrap.style.height = 'auto';
908
+ iconWrap.style.minHeight = '0';
909
+ iconWrap.style.overflowY = 'visible';
910
+ iconWrap.style.overflowX = 'visible';
911
+ iconWrap.style.justifyContent = 'flex-start';
912
+ iconWrap.style.alignItems = 'flex-start';
913
+ iconWrap.style.maskImage = 'none';
914
+ iconWrap.style.webkitMaskImage = 'none';
915
+ }
916
+ if (iconContainer) {
917
+ iconContainer.style.display = 'flex';
918
+ iconContainer.style.flexDirection = 'column';
919
+ iconContainer.style.alignItems = 'center';
920
+ iconContainer.style.justifyContent = 'flex-start';
921
+ iconContainer.style.width = '100%';
922
+ iconContainer.style.height = 'auto';
923
+ iconContainer.style.minHeight = '0';
924
+ iconContainer.style.overflowY = 'visible';
925
+ iconContainer.style.overflowX = 'hidden';
926
+ iconContainer.style.gap = '10px';
927
+ iconContainer.style.padding = '6px 0 14px';
928
+ }
929
+ if (adWrap) {
930
+ adWrap.style.display = 'flex';
931
+ adWrap.style.gridColumn = '';
932
+ adWrap.style.gridRow = '';
933
+ adWrap.style.background = '#ffffff';
934
+ }
935
+ if (adBody) {
936
+ adBody.style.display = 'flex';
937
+ adBody.style.alignItems = 'center';
938
+ adBody.style.justifyContent = 'center';
939
+ adBody.style.padding = '9px 11px';
940
+ adBody.style.overflow = 'visible';
941
+ adBody.style.background = '#ffffff';
942
+ }
943
+ if (adFrame) {
944
+ __syncAdFrameChildren(adFrame, true);
945
+ const measured = __measureAdContent(adFrame);
946
+ const desktopWidth = measured.width;
947
+ const desktopHeight = measured.height;
948
+ if (adWrap) {
949
+ const wrapWidth = desktopWidth + 24;
950
+ const wrapHeight = desktopHeight + 20;
951
+ adWrap.style.width = `${wrapWidth}px`;
952
+ adWrap.style.minWidth = `${wrapWidth}px`;
953
+ adWrap.style.flex = `0 0 ${wrapWidth}px`;
954
+ adWrap.style.height = `${wrapHeight}px`;
955
+ adWrap.style.minHeight = `${wrapHeight}px`;
956
+ }
957
+ if (adBody) {
958
+ adBody.style.height = `${desktopHeight + 20}px`;
959
+ adBody.style.minHeight = `${desktopHeight + 20}px`;
960
+ }
961
+ adFrame.style.width = `${desktopWidth}px`;
962
+ adFrame.style.height = `${desktopHeight}px`;
963
+ adFrame.style.minWidth = '0';
964
+ adFrame.style.maxWidth = `${desktopWidth}px`;
965
+ adFrame.style.margin = '0 auto';
966
+ adFrame.style.overflow = 'visible';
967
+ adFrame.style.aspectRatio = '';
968
+ adFrame.style.transform = 'none';
969
+ adFrame.style.transformOrigin = 'center center';
970
+ adFrame.style.boxSizing = 'content-box';
971
+ adFrame.style.padding = '1px';
972
+ }
973
+ }
974
+ }
975
+ function __handleChatFullscreenChange() {
976
+ syncFullscreenIcon();
977
+ __applyMobileChatRailSafety();
978
+ [0, 80, 220].forEach(function (delay) {
979
+ setTimeout(__applyMobileChatRailSafety, delay);
980
+ });
981
+ }
982
+ window.addEventListener('load', function () {
983
+ __applyMobileChatRailSafety();
984
+ window.addEventListener('resize', __applyMobileChatRailSafety);
985
+ window.addEventListener('orientationchange', __applyMobileChatRailSafety);
986
+ window.addEventListener('scroll', __applyMobileChatRailSafety, { passive: true });
987
+ document.addEventListener('fullscreenchange', __handleChatFullscreenChange);
988
+ document.addEventListener('webkitfullscreenchange', __handleChatFullscreenChange);
989
+ const adFrame = document.getElementById('chat-ad-frame');
990
+ if (adFrame && !window.__chatAdObserver) {
991
+ const observer = new MutationObserver(function () {
992
+ __applyMobileChatRailSafety();
993
+ });
994
+ observer.observe(adFrame, { childList: true, subtree: true });
995
+ window.__chatAdObserver = observer;
996
+ }
997
+ [0, 120, 360, 800].forEach(function (delay) {
998
+ setTimeout(function () {
999
+ __cleanAdHashAndScrollTop();
1000
+ __applyMobileChatRailSafety();
1001
+ if (!window.location.hash) window.scrollTo(0, 0);
1002
+ }, delay);
1003
+ });
1004
+ }, { once: true });