@readerseye2/cr_viewer 1.0.12 → 1.0.13
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.
- package/dist/CR_Viewer.d.ts +5 -3
- package/dist/CR_Viewer.d.ts.map +1 -1
- package/dist/components/PageSectionWrap.d.ts.map +1 -1
- package/dist/components/PaginationRender.d.ts.map +1 -1
- package/dist/components/RangeContextMenu.d.ts.map +1 -1
- package/dist/components/RenderRuns.d.ts.map +1 -1
- package/dist/components/ScrollSectionWrap.d.ts.map +1 -1
- package/dist/components/SectionRendererVirtuoso.d.ts.map +1 -1
- package/dist/components/btns/MoveSectionBtns.d.ts.map +1 -1
- package/dist/components/btns/SolveQuizBtn.d.ts.map +1 -1
- package/dist/components/quiz/QuizRenderer.d.ts.map +1 -1
- package/dist/hooks/useDebounce.d.ts +3 -2
- package/dist/hooks/useDebounce.d.ts.map +1 -1
- package/dist/hooks/useSwipePageClicks.d.ts +2 -0
- package/dist/hooks/useSwipePageClicks.d.ts.map +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4375 -4773
- package/dist/overlay-bars/ViewerSettingsSheet.d.ts.map +1 -1
- package/dist/overlay-bars/bottomBar/AudioControlsMini.d.ts.map +1 -1
- package/dist/overlay-bars/bottomBar/FakeAudioControlsMini.d.ts +1 -2
- package/dist/overlay-bars/bottomBar/FakeAudioControlsMini.d.ts.map +1 -1
- package/dist/overlay-bars/bottomBar/OverlayBottomBar.d.ts.map +1 -1
- package/dist/overlay-bars/bottomBar/ProgressScrubber.d.ts.map +1 -1
- package/dist/overlay-bars/bottomBar/SpeedButtons.d.ts +2 -0
- package/dist/overlay-bars/bottomBar/SpeedButtons.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/StepBtn.d.ts.map +1 -1
- package/dist/overlay-bars/topBar/OverlayTopBar.d.ts.map +1 -1
- package/dist/recording/DirectPlaybackController.d.ts +14 -0
- package/dist/recording/DirectPlaybackController.d.ts.map +1 -0
- package/dist/recording/RecordingEmitters.d.ts +14 -0
- package/dist/recording/RecordingEmitters.d.ts.map +1 -0
- package/dist/stores/audio/crViewer_audio.store.d.ts +2 -2
- package/dist/stores/audio/crViewer_audio.store.d.ts.map +1 -1
- package/dist/stores/eventBridge/viewerEventBridge.context.d.ts +13 -0
- package/dist/stores/eventBridge/viewerEventBridge.context.d.ts.map +1 -0
- package/dist/stores/eventBridge/viewerEventBridge.hooks.d.ts +19 -0
- package/dist/stores/eventBridge/viewerEventBridge.hooks.d.ts.map +1 -0
- package/dist/stores/{recorder/viewerRecorder.provider.d.ts → eventBridge/viewerEventBridge.provider.d.ts} +6 -4
- package/dist/stores/eventBridge/viewerEventBridge.provider.d.ts.map +1 -0
- package/dist/stores/{recorder/viewerRecorder.store.d.ts → eventBridge/viewerEventBridge.store.d.ts} +5 -5
- package/dist/stores/eventBridge/viewerEventBridge.store.d.ts.map +1 -0
- package/dist/stores/progress/crViewer_progress.store.d.ts +2 -2
- package/dist/stores/progress/crViewer_progress.store.d.ts.map +1 -1
- package/dist/stores/quizprogress/quiz_progress.store.d.ts.map +1 -1
- package/dist/stores/viewer/CRViewer.provider.d.ts +2 -2
- package/dist/stores/viewer/CRViewer.provider.d.ts.map +1 -1
- package/dist/stores/viewer/crViewer.hooks.d.ts +3 -3
- package/dist/stores/viewer/crViewer.hooks.d.ts.map +1 -1
- package/dist/stores/viewer/crViewer.store.d.ts +37 -10
- package/dist/stores/viewer/crViewer.store.d.ts.map +1 -1
- package/dist/types/viewerEvent.types.d.ts +1 -1
- package/dist/types/viewerEvent.types.d.ts.map +1 -1
- package/dist/utils/calcPage.util.d.ts.map +1 -1
- package/package.json +12 -2
- package/dist/overlay-bars/bottomBar/WPMSpeedButtons.d.ts +0 -2
- package/dist/overlay-bars/bottomBar/WPMSpeedButtons.d.ts.map +0 -1
- package/dist/playback/CR_ViewerPlayback.d.ts +0 -27
- package/dist/playback/CR_ViewerPlayback.d.ts.map +0 -1
- package/dist/playback/PlaybackBar.d.ts +0 -28
- package/dist/playback/PlaybackBar.d.ts.map +0 -1
- package/dist/playback/PlaybackToggleButton.d.ts +0 -10
- package/dist/playback/PlaybackToggleButton.d.ts.map +0 -1
- package/dist/playback/PlaybackViewport.d.ts +0 -30
- package/dist/playback/PlaybackViewport.d.ts.map +0 -1
- package/dist/playback/index.d.ts +0 -5
- package/dist/playback/index.d.ts.map +0 -1
- package/dist/playback/types.d.ts +0 -20
- package/dist/playback/types.d.ts.map +0 -1
- package/dist/recording/PlaybackHandler.d.ts +0 -6
- package/dist/recording/PlaybackHandler.d.ts.map +0 -1
- package/dist/recording/SettingsChangeEmitter.d.ts +0 -3
- package/dist/recording/SettingsChangeEmitter.d.ts.map +0 -1
- package/dist/recording/SnapshotRegistrar.d.ts +0 -7
- package/dist/recording/SnapshotRegistrar.d.ts.map +0 -1
- package/dist/recording/ViewportResizeEmitter.d.ts +0 -7
- package/dist/recording/ViewportResizeEmitter.d.ts.map +0 -1
- package/dist/stores/player/index.d.ts +0 -5
- package/dist/stores/player/index.d.ts.map +0 -1
- package/dist/stores/player/viewerPlayer.context.d.ts +0 -7
- package/dist/stores/player/viewerPlayer.context.d.ts.map +0 -1
- package/dist/stores/player/viewerPlayer.hooks.d.ts +0 -13
- package/dist/stores/player/viewerPlayer.hooks.d.ts.map +0 -1
- package/dist/stores/player/viewerPlayer.provider.d.ts +0 -18
- package/dist/stores/player/viewerPlayer.provider.d.ts.map +0 -1
- package/dist/stores/player/viewerPlayer.store.d.ts +0 -52
- package/dist/stores/player/viewerPlayer.store.d.ts.map +0 -1
- package/dist/stores/recorder/viewerRecorder.context.d.ts +0 -7
- package/dist/stores/recorder/viewerRecorder.context.d.ts.map +0 -1
- package/dist/stores/recorder/viewerRecorder.hooks.d.ts +0 -13
- package/dist/stores/recorder/viewerRecorder.hooks.d.ts.map +0 -1
- package/dist/stores/recorder/viewerRecorder.provider.d.ts.map +0 -1
- package/dist/stores/recorder/viewerRecorder.store.d.ts.map +0 -1
- package/dist/stores/test/tempRecordingStore.d.ts +0 -13
- package/dist/stores/test/tempRecordingStore.d.ts.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";._run_zzb61_3{cursor:pointer}._runWrap_zzb61_7{position:relative;isolation:isolate;z-index:0}._highlight_zzb61_13:before,._highlightleft_zzb61_14:before,._highlightright_zzb61_15:before,._highlightcenter_zzb61_16:before{content:"";position:absolute;z-index:-1;top:-4px;bottom:-4px;background:var(--hl-color, pink);pointer-events:none}._highlight_zzb61_13:before{left:-4px;right:-4px}._highlightleft_zzb61_14:before{left:-4px;right:0}._highlightright_zzb61_15:before{left:0;right:-4px}._highlightcenter_zzb61_16:before{left:0;right:0}._underline_zzb61_48:after,._underlineleft_zzb61_49:after,._underlineright_zzb61_50:after,._underlinecenter_zzb61_51:after{content:"";position:absolute;left:0;right:0;height:var(--ul-thickness, .2em);bottom:calc(-1 * var(--ul-offset, .35em));background:var(--ul-color, red);pointer-events:none}._underline_zzb61_48:after{left:-4px;right:-4px}._underlineleft_zzb61_49:after{left:-4px;right:0}._underlineright_zzb61_50:after{left:0;right:0}._underlinecenter_zzb61_51:after{left:0;right:0}._scroller_kqkmq_3{height:100%;overflow-y:auto;overflow-x:hidden;outline:none;scrollbar-width:none;-ms-overflow-style:none}._scroller_kqkmq_3::-webkit-scrollbar{width:0;height:0;background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-track{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-thumb{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-button,._scroller_kqkmq_3::-webkit-scrollbar-corner{display:none;pointer-events:none}@media(forced-colors:active){._scroller_kqkmq_3{scrollbar-width:auto}}._navBtn_rnisf_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:52px;height:52px;border:none;border-radius:12px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_rnisf_2:hover:not(:disabled){background:#0000000f}._navBtn_rnisf_2:active:not(:disabled){background:#0000001a}._navBtn_rnisf_2:disabled,._navBtn_rnisf_2._disabled_rnisf_25{opacity:.4;cursor:not-allowed;transform:none}._label_rnisf_31{margin-top:4px;font-size:.6rem;font-weight:500;width:52px}._navGroup_rnisf_39{display:flex;gap:8px}._wrap_1pn6r_2{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;justify-content:space-between;padding:12px 16px 20px;box-sizing:border-box;background:#fff;color:#333;transition:opacity .15s ease;opacity:0;pointer-events:none;border-top:1px solid #ddd}._visible_1pn6r_21{opacity:1;pointer-events:auto}._container_1pn6r_27{display:flex;align-items:center;gap:12px;flex-wrap:wrap;width:100%}._leftGroup_1pn6r_36,._rightGroup_1pn6r_37{display:flex;align-items:center;gap:5px}._leftGroup_1pn6r_36{flex:1 1 520px;min-width:200px;justify-content:flex-start}._leftGroup_1pn6r_36 ._leftleftGroup_1pn6r_51,._leftGroup_1pn6r_36 ._leftrightGroup_1pn6r_52{flex:1 1 0;display:flex;justify-content:center;min-width:160px}._rightGroup_1pn6r_37{flex:1 1 420px;min-width:220px;margin-left:auto;justify-content:center;align-items:center}._wrap_1pn6r_2>div:last-child{display:flex;align-items:center;justify-content:space-between;margin-top:8px}._btn_1pn6r_78{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:52px;height:52px;border:none;border-radius:12px;background:#fff;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._btn_1pn6r_78:hover{opacity:.7}._btnForbidden_1pn6r_100{opacity:.4;cursor:not-allowed;background:#f2f2f2!important;border-color:#aaa}._btnActive_1pn6r_107{background:#333;color:#fff}._label_1pn6r_112{margin-top:4px;font-size:.6rem;font-weight:500;width:52px}._group_1pn6r_119{display:inline-flex;align-items:center;gap:6px;background:#ffffff0f;border-radius:6px;padding:4px 8px}._label_1pn6r_112{min-width:50px;text-align:center;font-variant-numeric:tabular-nums}._scrubberWrap_jtztl_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none}._labels_jtztl_8{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_jtztl_8 ._index_jtztl_14{font-variant-numeric:tabular-nums}._controls_jtztl_18{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_jtztl_18 ._percent_jtztl_24{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_jtztl_31{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_jtztl_31:disabled{opacity:.5;cursor:not-allowed}._range_jtztl_45{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_jtztl_45::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_jtztl_45::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_pxoh4_1{float:right;display:flex;flex-direction:column;box-sizing:border-box}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8{box-sizing:border-box;padding:10px;display:flex;gap:7px}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._label_pxoh4_14{font-size:.8rem;display:flex;flex-direction:column;justify-content:center;align-items:center}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._label_pxoh4_14 ._wpmString_pxoh4_21{font-size:.7rem}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24:hover{background:#eee}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24{padding:3px;border-radius:5px;border:1px solid #888;background:none;width:50px;height:50px}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24 img{width:100%}._StepBtn_ua1nh_1{background:none;border:none;font-size:2rem;display:flex;justify-content:center;align-items:center;color:#000}._StepBtn_ua1nh_1:hover{color:#666;filter:brightness(.9);cursor:pointer}._GCPlayBtn_1p162_1{width:var(--btn-size);height:var(--btn-size);border:none;outline:none;position:relative;background-color:var(--btn-bg);transition:background-color .25s ease,transform .1s ease,filter .1s}._GCPlayBtn_1p162_1:hover{opacity:.7;cursor:pointer}._GCPlayBtn_1p162_1:focus{outline:none}._GCPlayBtn_1p162_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease}._GCPlayBtn_1p162_1._playing_1p162_28:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._host_v5qx1_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_v5qx1_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#033233;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:4px solid #033233;box-sizing:border-box}._visible_v5qx1_32{opacity:1;pointer-events:auto}._backBtn_v5qx1_37{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._backBtn_v5qx1_37:hover{background:#0000000d}._backBtn_v5qx1_37:active{background:#0000004d}._title_v5qx1_58{font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_v5qx1_67{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._settingsBtn_v5qx1_67:hover{background:#0000000d}._settingsBtn_v5qx1_67:active{background:#0000004d}._wrap_62su0_7{position:absolute;pointer-events:auto;background:#fff;color:#111;box-shadow:0 -6px 24px #0000001f;padding:20px 0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;overflow-y:auto;left:0;right:0;bottom:0;max-height:70%;border-top:1px solid rgba(0,0,0,.08);border-radius:16px 16px 0 0}._wrapHidden_62su0_29{transform:translateY(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translateY(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}@container viewer (min-aspect-ratio: 1/1){._wrap_62su0_7{left:auto;right:0;top:0;bottom:0;max-height:100%;width:400px;max-width:60%;border-top:none;border-left:1px solid rgba(0,0,0,.08);border-radius:0;box-shadow:-6px 0 24px #0000001f;padding:20px}._wrapHidden_62su0_29{transform:translate(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translate(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}}._scrollArea_62su0_71{width:100%;display:flex;flex-direction:column;max-width:400px;padding:0 20px;gap:10px;box-sizing:border-box}._row_62su0_81{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:45px}._label_62su0_89{width:78px;flex:0 0 78px;font-weight:700}._btn_62su0_95{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:8px 10px;font-size:13px}._btnActive_62su0_106{background:#00000014}._btnSmall_62su0_110{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:4px 8px;font-size:14px;line-height:1}._pill_62su0_122{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;background:#fff;color:#111;border:1px solid rgba(0,0,0,.16);border-radius:999px;padding:8px 12px;font-size:13px}._themeCircle_62su0_133{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;cursor:pointer;transition:all .2s ease;border:1px solid rgba(0,0,0,.15)}._themeCircleActive_62su0_146{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._stepRow_62su0_151{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px}._stepLabel_62su0_159{width:78px;flex:0 0 78px;font-weight:700}._stepValue_62su0_165{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_62su0_172{width:28px;text-align:center}._inlineFlex_62su0_177{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_dbk3n_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;pointer-events:none}._spinner_dbk3n_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_dbk3n_10 linear infinite}@keyframes _spin_dbk3n_10{to{transform:rotate(360deg)}}._Overlay_ybic8_3{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:#11182773;display:flex;align-items:center;justify-content:center;z-index:50}._Dialog_ybic8_15{width:min(760px,90%);max-height:80vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 48px #00000040;padding:20px}._Body_ybic8_25{margin-left:20px;margin-right:20px;display:block}._Header_ybic8_32{display:flex;align-items:center;gap:12px;margin-bottom:12px}._Paging_ybic8_39{font-weight:700;font-size:1rem;color:#333;display:flex;justify-content:center;width:100%}._Remaining_ybic8_48{margin-left:auto;font-weight:700;font-size:1rem;color:#fff}._RemainingDanger_ybic8_55{color:#dc2626}._NextBtn_ybic8_59{padding:10px 16px;border-radius:10px;border:none;background:#2563eb;color:#fff;font-size:1.2rem;font-weight:700;cursor:pointer;width:100%}@keyframes _nextbtn-blink_ybic8_1{0%,49%{transform:none;box-shadow:0 0 #dc262600;outline:0 solid rgba(220,38,38,0);filter:none}50%,to{box-shadow:0 0 0 2px #dc262659,0 6px 14px #dc262640;outline:2px solid rgba(220,38,38,.45)}}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55){animation:_nextbtn-blink_ybic8_1 1s steps(2,start) infinite}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):hover,._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):focus-visible{animation-play-state:running}._CloseBtn_ybic8_96{margin-left:8px;border:none;background:transparent;color:#6b7280;cursor:pointer;font-size:14px}._Title_ybic8_106{font-weight:700;font-size:18px;margin-bottom:8px;color:#111827}._Question_ybic8_113{font-size:1.2rem;color:#111827;font-weight:700;display:flex;justify-content:center;align-items:center}._Score_ybic8_123{display:flex;justify-content:center;align-items:center;margin-bottom:16px}._Image_ybic8_130{width:100%;display:flex;justify-content:center}._Image_ybic8_130 img{width:80%}._Options_ybic8_140{display:grid;gap:8px}._OptionBtn_ybic8_145{text-align:left;padding:12px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer;font-size:1rem;transition:box-shadow .15s ease,border-color .15s ease,background .15s ease;display:flex;justify-content:center;align-items:center}._OptionBtn_ybic8_145:hover{border-color:#cbd5e1;background:#f9fafb}._OptionBtnActive_ybic8_165{border-color:#2563eb;background:#2563eb14;box-shadow:0 4px 10px #2563eb33}._Footer_ybic8_172{display:flex;justify-content:space-between;margin-top:16px;gap:8px}._PrevBtn_ybic8_179{flex:0 0 auto;padding:10px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._PrevBtn_ybic8_179:disabled{cursor:not-allowed;opacity:.6}._OptionBtnCorrect_ybic8_195{border-color:#16a34a!important;box-shadow:0 4px 10px #16a34a33}._Judge_ybic8_201{margin:6px 0 10px;font-weight:700;font-size:1.5rem;padding:4px;width:100%;border-radius:10px;display:flex;justify-content:center;color:#fff}._Judge_ybic8_201._Correct_ybic8_212{background:#16a34a}._Judge_ybic8_201._Incorrect_ybic8_215{background:#dc2626}._ResultHeader_ybic8_220{font-weight:800;font-size:20px;margin-bottom:8px;color:#111827}._ResultText_ybic8_227{font-size:16px;margin-bottom:12px;color:#111827}._ResultActions_ybic8_233{display:flex;justify-content:flex-end;gap:8px}._CloseBtnSoft_ybic8_239{padding:10px 16px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._SummaryGrid_ybic8_249{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:12px 0 16px}._StatCard_ybic8_257{border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 2px 6px #1118270f}._StatLabel_ybic8_265{font-size:12px;color:#6b7280}._StatValue_ybic8_270{font-size:22px;font-weight:800;margin-top:4px;color:#111827}._StatSub_ybic8_277{font-size:12px;color:#6b7280}._SplitGrid_ybic8_282{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._SplitBox_ybic8_289{border:1px dashed #e5e7eb;border-radius:10px;padding:10px 12px}._SplitTitle_ybic8_295{font-size:12px;color:#6b7280}._SplitText_ybic8_300{font-size:16px;font-weight:700;color:#111827;margin-top:2px}._Pairs_ybic8_307{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._PairItem_ybic8_314{border:1px solid #f3f4f6;border-radius:10px;padding:10px 12px;background:#fafafa}._PairLabel_ybic8_321{font-size:12px;color:#6b7280}._PairValue_ybic8_326{font-size:15px;font-weight:700;margin-top:2px;color:#111827}._WrongBox_ybic8_333{margin-top:8px;border-top:1px solid #e5e7eb;padding-top:10px}._WrongTitle_ybic8_339{font-weight:700;font-size:14px;color:#111827;margin-bottom:6px}._WrongList_ybic8_346{list-style:none;padding:0;margin:0}._WrongList_ybic8_346 li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed #f3f4f6}._Badge_ybic8_360{display:inline-block;font-size:12px;padding:2px 6px;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700}._WrongName_ybic8_370{flex:1;color:#111827;font-size:14px}._WrongTime_ybic8_376{font-size:12px;color:#6b7280}._Empty_ybic8_381{color:#6b7280;font-size:13px}._Hint_ybic8_387{margin-top:8px;font-size:12px;color:#6b7280}._handle_1336y_1{position:fixed;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1336y_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1336y_16{border-radius:13px 0 13px 13px}._handleEnd_1336y_21{border-radius:0 13px 13px}._button_onals_1{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1px solid #d1d5db;background:#fff;color:#000;cursor:pointer;transition:background .15s ease}._button_onals_1:hover:not(:disabled){background:#f3f4f6}._button_onals_1:disabled{opacity:.5;cursor:not-allowed}._button_onals_1 svg{width:16px;height:16px}._container_18q02_1{padding:8px 12px;border-bottom:1px solid #e5e7eb;display:flex;flex-direction:column;gap:8px;background:#f9fafb;flex-shrink:0}._topRow_18q02_11{display:flex;align-items:center;gap:8px}._timeDisplay_18q02_17{margin-left:auto;font-size:12px;color:#6b7280}._bottomRow_18q02_23{display:flex;align-items:center;gap:8px}._sliderContainer_18q02_29{flex:1;position:relative;height:20px}._trackBackground_18q02_35{position:absolute;top:50%;left:0;right:0;height:4px;transform:translateY(-50%);background:#d1d5db;border-radius:2px;overflow:hidden}._trackFill_18q02_47{position:absolute;left:0;height:100%;background:#ef4444}._rangeInput_18q02_54{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;cursor:pointer;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}._rangeInput--disabled_18q02_66{cursor:not-allowed}._rangeInput_18q02_54::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;background:#ef4444;border-radius:50%;cursor:pointer;border:2px solid #fff;box-shadow:0 1px 3px #0000004d}._rangeInput_18q02_54::-moz-range-thumb{width:14px;height:14px;background:#ef4444;border-radius:50%;cursor:pointer;border:2px solid #fff;box-shadow:0 1px 3px #0000004d}._viewportInfo_18q02_89{font-size:11px;color:#9ca3af}._outerContainer_77t1u_1{flex:1;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#1f2937;position:relative}._scaleWrapper_77t1u_11{transform-origin:center center}._viewerContainer_77t1u_15{box-shadow:0 4px 24px #0000004d;border-radius:4px;overflow:hidden;position:relative}._eventBlocker_77t1u_22{position:absolute;top:0;left:0;background:transparent}._emptyMessage_77t1u_29{padding:20px;color:#9ca3af}._bufferingOverlay_77t1u_34{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#00000080;z-index:10}._spinner_77t1u_44{width:48px;height:48px;border:4px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:_spin_77t1u_44 1s linear infinite}@keyframes _spin_77t1u_44{to{transform:rotate(360deg)}}._container_1dh6p_1{width:100%;height:100%;position:relative;display:flex;flex-direction:column}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
"use strict";var
|
|
1
|
+
(function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";._run_zzb61_3{cursor:pointer}._runWrap_zzb61_7{position:relative;isolation:isolate;z-index:0}._highlight_zzb61_13:before,._highlightleft_zzb61_14:before,._highlightright_zzb61_15:before,._highlightcenter_zzb61_16:before{content:"";position:absolute;z-index:-1;top:-4px;bottom:-4px;background:var(--hl-color, pink);pointer-events:none}._highlight_zzb61_13:before{left:-4px;right:-4px}._highlightleft_zzb61_14:before{left:-4px;right:0}._highlightright_zzb61_15:before{left:0;right:-4px}._highlightcenter_zzb61_16:before{left:0;right:0}._underline_zzb61_48:after,._underlineleft_zzb61_49:after,._underlineright_zzb61_50:after,._underlinecenter_zzb61_51:after{content:"";position:absolute;left:0;right:0;height:var(--ul-thickness, .2em);bottom:calc(-1 * var(--ul-offset, .35em));background:var(--ul-color, red);pointer-events:none}._underline_zzb61_48:after{left:-4px;right:-4px}._underlineleft_zzb61_49:after{left:-4px;right:0}._underlineright_zzb61_50:after{left:0;right:0}._underlinecenter_zzb61_51:after{left:0;right:0}._scroller_kqkmq_3{height:100%;overflow-y:auto;overflow-x:hidden;outline:none;scrollbar-width:none;-ms-overflow-style:none}._scroller_kqkmq_3::-webkit-scrollbar{width:0;height:0;background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-track{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-thumb{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-button,._scroller_kqkmq_3::-webkit-scrollbar-corner{display:none;pointer-events:none}@media(forced-colors:active){._scroller_kqkmq_3{scrollbar-width:auto}}._navBtn_1fciy_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;flex-shrink:0;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_1fciy_2:hover:not(:disabled){background:#0000000f}._navBtn_1fciy_2:active:not(:disabled){background:#0000001a}._navBtn_1fciy_2:disabled,._navBtn_1fciy_2._disabled_1fciy_26{opacity:.4;cursor:not-allowed;transform:none}._label_1fciy_32{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center}._navGroup_1fciy_40{display:flex;gap:8px}._wrap_1symx_4{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;padding:8px 8px 10px;box-sizing:border-box;background:#fff;color:#333;border-top:1px solid #ddd;transition:opacity .15s ease;opacity:0;pointer-events:none;container-type:inline-size;container-name:bottombar}._visible_1symx_25{opacity:1;pointer-events:auto}._compact_1symx_31{padding:6px 8px 8px}._compact_1symx_31 ._row2_1symx_34{display:none}@container bottombar (min-width: 600px){._compact_1symx_31 ._row2_1symx_34{display:contents}}._controls_1symx_44{display:flex;flex-wrap:wrap;align-items:center;gap:4px}._row1_1symx_52,._row2_1symx_34{display:flex;align-items:center;justify-content:space-between;width:100%;gap:4px}._row2_1symx_34{margin-top:4px}@container bottombar (min-width: 500px){._row1_1symx_52,._row2_1symx_34{display:contents}._controls_1symx_44{flex-wrap:nowrap;justify-content:space-between}._row2_1symx_34{margin-top:0}}._groupExpand_1symx_80,._groupPlayback_1symx_81,._groupSpeed_1symx_82,._groupFeatures_1symx_83,._groupNav_1symx_84{display:flex;align-items:center;flex-shrink:0}._groupExpand_1symx_80{gap:0}._groupPlayback_1symx_81{gap:2px}._groupSpeed_1symx_82{gap:0}._groupFeatures_1symx_83,._groupNav_1symx_84{gap:2px}._btn_1symx_116{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease;flex-shrink:0}._btn_1symx_116:hover{background:#0000000f}._btn_1symx_116:active{background:#0000001f}._btnForbidden_1symx_141{opacity:.4;cursor:not-allowed;background:#f2f2f2!important}._btnActive_1symx_147{background:#333;color:#fff}._btnActive_1symx_147:hover{background:#555}._btnActive_1symx_147:active{background:#666}._label_1symx_158{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center;font-variant-numeric:tabular-nums}._compactBtn_1symx_167{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border:none;border-radius:4px;background:none;color:#000;cursor:pointer;padding:2px;flex-shrink:0}._compactBtn_1symx_167:hover{background:#0000000f}._compactBtn_1symx_167:active{background:#0000001f}._scrubberWrap_uw0cd_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none;margin-bottom:6px}._labels_uw0cd_9{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_uw0cd_9 ._index_uw0cd_15{font-variant-numeric:tabular-nums}._controls_uw0cd_19{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_uw0cd_19 ._percent_uw0cd_25{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_uw0cd_32{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_uw0cd_32:disabled{opacity:.5;cursor:not-allowed}._range_uw0cd_46{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_uw0cd_46::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_uw0cd_46::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_r3byt_1{float:right;box-sizing:border-box;display:flex;flex-direction:column}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7{box-sizing:border-box;padding:2px;display:flex;gap:1px;align-items:center}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._label_r3byt_14{font-size:.55rem;display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:24px}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22{padding:2px;border-radius:4px;border:1px solid #888;background:none;width:34px;height:34px;flex-shrink:0;cursor:pointer;transition:all .15s ease}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:hover{background:#0000000f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:active{background:#0000001f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22 img{width:100%;height:100%;object-fit:contain}._StepBtn_15t0r_1{background:none;border:none;border-radius:8px;font-size:1.6rem;display:flex;justify-content:center;align-items:center;color:#000;flex-shrink:0;width:34px;height:34px;cursor:pointer;transition:all .15s ease}._StepBtn_15t0r_1:hover{background:#0000000f}._StepBtn_15t0r_1:active{background:#0000001f}._GCPlayBtn_n54mc_1{width:var(--btn-size);height:var(--btn-size);box-sizing:border-box;border:none;outline:none;position:relative;background:none;border-radius:8px;transition:all .15s ease;cursor:pointer}._GCPlayBtn_n54mc_1:hover{background:#0000000f}._GCPlayBtn_n54mc_1:active{background:#0000001f}._GCPlayBtn_n54mc_1:focus{outline:none}._GCPlayBtn_n54mc_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease;transform:scale(1.3)}._GCPlayBtn_n54mc_1._playing_n54mc_34:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._host_v5qx1_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_v5qx1_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#033233;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:4px solid #033233;box-sizing:border-box}._visible_v5qx1_32{opacity:1;pointer-events:auto}._backBtn_v5qx1_37{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._backBtn_v5qx1_37:hover{background:#0000000d}._backBtn_v5qx1_37:active{background:#0000004d}._title_v5qx1_58{font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_v5qx1_67{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._settingsBtn_v5qx1_67:hover{background:#0000000d}._settingsBtn_v5qx1_67:active{background:#0000004d}._wrap_62su0_7{position:absolute;pointer-events:auto;background:#fff;color:#111;box-shadow:0 -6px 24px #0000001f;padding:20px 0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;overflow-y:auto;left:0;right:0;bottom:0;max-height:70%;border-top:1px solid rgba(0,0,0,.08);border-radius:16px 16px 0 0}._wrapHidden_62su0_29{transform:translateY(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translateY(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}@container viewer (min-aspect-ratio: 1/1){._wrap_62su0_7{left:auto;right:0;top:0;bottom:0;max-height:100%;width:400px;max-width:60%;border-top:none;border-left:1px solid rgba(0,0,0,.08);border-radius:0;box-shadow:-6px 0 24px #0000001f;padding:20px}._wrapHidden_62su0_29{transform:translate(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translate(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}}._scrollArea_62su0_71{width:100%;display:flex;flex-direction:column;max-width:400px;padding:0 20px;gap:10px;box-sizing:border-box}._row_62su0_81{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:45px}._label_62su0_89{width:78px;flex:0 0 78px;font-weight:700}._btn_62su0_95{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:8px 10px;font-size:13px}._btnActive_62su0_106{background:#00000014}._btnSmall_62su0_110{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:4px 8px;font-size:14px;line-height:1}._pill_62su0_122{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;background:#fff;color:#111;border:1px solid rgba(0,0,0,.16);border-radius:999px;padding:8px 12px;font-size:13px}._themeCircle_62su0_133{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;cursor:pointer;transition:all .2s ease;border:1px solid rgba(0,0,0,.15)}._themeCircleActive_62su0_146{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._stepRow_62su0_151{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px}._stepLabel_62su0_159{width:78px;flex:0 0 78px;font-weight:700}._stepValue_62su0_165{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_62su0_172{width:28px;text-align:center}._inlineFlex_62su0_177{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_dbk3n_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;pointer-events:none}._spinner_dbk3n_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_dbk3n_10 linear infinite}@keyframes _spin_dbk3n_10{to{transform:rotate(360deg)}}._Overlay_ybic8_3{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:#11182773;display:flex;align-items:center;justify-content:center;z-index:50}._Dialog_ybic8_15{width:min(760px,90%);max-height:80vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 48px #00000040;padding:20px}._Body_ybic8_25{margin-left:20px;margin-right:20px;display:block}._Header_ybic8_32{display:flex;align-items:center;gap:12px;margin-bottom:12px}._Paging_ybic8_39{font-weight:700;font-size:1rem;color:#333;display:flex;justify-content:center;width:100%}._Remaining_ybic8_48{margin-left:auto;font-weight:700;font-size:1rem;color:#fff}._RemainingDanger_ybic8_55{color:#dc2626}._NextBtn_ybic8_59{padding:10px 16px;border-radius:10px;border:none;background:#2563eb;color:#fff;font-size:1.2rem;font-weight:700;cursor:pointer;width:100%}@keyframes _nextbtn-blink_ybic8_1{0%,49%{transform:none;box-shadow:0 0 #dc262600;outline:0 solid rgba(220,38,38,0);filter:none}50%,to{box-shadow:0 0 0 2px #dc262659,0 6px 14px #dc262640;outline:2px solid rgba(220,38,38,.45)}}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55){animation:_nextbtn-blink_ybic8_1 1s steps(2,start) infinite}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):hover,._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):focus-visible{animation-play-state:running}._CloseBtn_ybic8_96{margin-left:8px;border:none;background:transparent;color:#6b7280;cursor:pointer;font-size:14px}._Title_ybic8_106{font-weight:700;font-size:18px;margin-bottom:8px;color:#111827}._Question_ybic8_113{font-size:1.2rem;color:#111827;font-weight:700;display:flex;justify-content:center;align-items:center}._Score_ybic8_123{display:flex;justify-content:center;align-items:center;margin-bottom:16px}._Image_ybic8_130{width:100%;display:flex;justify-content:center}._Image_ybic8_130 img{width:80%}._Options_ybic8_140{display:grid;gap:8px}._OptionBtn_ybic8_145{text-align:left;padding:12px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer;font-size:1rem;transition:box-shadow .15s ease,border-color .15s ease,background .15s ease;display:flex;justify-content:center;align-items:center}._OptionBtn_ybic8_145:hover{border-color:#cbd5e1;background:#f9fafb}._OptionBtnActive_ybic8_165{border-color:#2563eb;background:#2563eb14;box-shadow:0 4px 10px #2563eb33}._Footer_ybic8_172{display:flex;justify-content:space-between;margin-top:16px;gap:8px}._PrevBtn_ybic8_179{flex:0 0 auto;padding:10px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._PrevBtn_ybic8_179:disabled{cursor:not-allowed;opacity:.6}._OptionBtnCorrect_ybic8_195{border-color:#16a34a!important;box-shadow:0 4px 10px #16a34a33}._Judge_ybic8_201{margin:6px 0 10px;font-weight:700;font-size:1.5rem;padding:4px;width:100%;border-radius:10px;display:flex;justify-content:center;color:#fff}._Judge_ybic8_201._Correct_ybic8_212{background:#16a34a}._Judge_ybic8_201._Incorrect_ybic8_215{background:#dc2626}._ResultHeader_ybic8_220{font-weight:800;font-size:20px;margin-bottom:8px;color:#111827}._ResultText_ybic8_227{font-size:16px;margin-bottom:12px;color:#111827}._ResultActions_ybic8_233{display:flex;justify-content:flex-end;gap:8px}._CloseBtnSoft_ybic8_239{padding:10px 16px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._SummaryGrid_ybic8_249{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:12px 0 16px}._StatCard_ybic8_257{border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 2px 6px #1118270f}._StatLabel_ybic8_265{font-size:12px;color:#6b7280}._StatValue_ybic8_270{font-size:22px;font-weight:800;margin-top:4px;color:#111827}._StatSub_ybic8_277{font-size:12px;color:#6b7280}._SplitGrid_ybic8_282{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._SplitBox_ybic8_289{border:1px dashed #e5e7eb;border-radius:10px;padding:10px 12px}._SplitTitle_ybic8_295{font-size:12px;color:#6b7280}._SplitText_ybic8_300{font-size:16px;font-weight:700;color:#111827;margin-top:2px}._Pairs_ybic8_307{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._PairItem_ybic8_314{border:1px solid #f3f4f6;border-radius:10px;padding:10px 12px;background:#fafafa}._PairLabel_ybic8_321{font-size:12px;color:#6b7280}._PairValue_ybic8_326{font-size:15px;font-weight:700;margin-top:2px;color:#111827}._WrongBox_ybic8_333{margin-top:8px;border-top:1px solid #e5e7eb;padding-top:10px}._WrongTitle_ybic8_339{font-weight:700;font-size:14px;color:#111827;margin-bottom:6px}._WrongList_ybic8_346{list-style:none;padding:0;margin:0}._WrongList_ybic8_346 li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed #f3f4f6}._Badge_ybic8_360{display:inline-block;font-size:12px;padding:2px 6px;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700}._WrongName_ybic8_370{flex:1;color:#111827;font-size:14px}._WrongTime_ybic8_376{font-size:12px;color:#6b7280}._Empty_ybic8_381{color:#6b7280;font-size:13px}._Hint_ybic8_387{margin-top:8px;font-size:12px;color:#6b7280}._handle_1336y_1{position:fixed;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1336y_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1336y_16{border-radius:13px 0 13px 13px}._handleEnd_1336y_21{border-radius:0 13px 13px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
"use strict";var Es=Object.defineProperty;var js=(e,t,n)=>t in e?Es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wr=(e,t,n)=>js(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),g=require("react"),Os=require("react-dom");function Ps(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const rt=Ps(g),sr=g.createContext(void 0);var Qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yt={exports:{}},Sn={},Xt={exports:{}},yn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* This source code is licensed under the MIT license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
|
-
*/var
|
|
10
|
+
*/var Cr;function Bs(){if(Cr)return yn;Cr=1;var e=g;function t(S,y){return S===y&&(S!==0||1/S===1/y)||S!==S&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(S,y){var b=y(),x=r({inst:{value:b,getSnapshot:y}}),v=x[0].inst,p=x[1];return s(function(){v.value=b,v.getSnapshot=y,l(v)&&p({inst:v})},[S,b,y]),o(function(){return l(v)&&p({inst:v}),S(function(){l(v)&&p({inst:v})})},[S]),i(b),b}function l(S){var y=S.getSnapshot;S=S.value;try{var b=y();return!n(S,b)}catch{return!0}}function c(S,y){return y()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return yn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,yn}var wn={};/**
|
|
11
11
|
* @license React
|
|
12
12
|
* use-sync-external-store-shim.development.js
|
|
13
13
|
*
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
*
|
|
16
16
|
* This source code is licensed under the MIT license found in the
|
|
17
17
|
* LICENSE file in the root directory of this source tree.
|
|
18
|
-
*/var
|
|
18
|
+
*/var Ir;function zs(){return Ir||(Ir=1,process.env.NODE_ENV!=="production"&&(function(){function e(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}function t(b,x){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=x();if(!S){var p=x();s(v,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),S=!0)}p=i({inst:{value:v,getSnapshot:x}});var h=p[0].inst,d=p[1];return l(function(){h.value=v,h.getSnapshot=x,n(h)&&d({inst:h})},[b,v,x]),a(function(){return n(h)&&d({inst:h}),b(function(){n(h)&&d({inst:h})})},[b]),c(v),v}function n(b){var x=b.getSnapshot;b=b.value;try{var v=x();return!s(b,v)}catch{return!0}}function r(b,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=g,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,u=!1,S=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;wn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wn}var kr;function Po(){return kr||(kr=1,process.env.NODE_ENV==="production"?Xt.exports=Bs():Xt.exports=zs()),Xt.exports}/**
|
|
19
19
|
* @license React
|
|
20
20
|
* use-sync-external-store-shim/with-selector.production.js
|
|
21
21
|
*
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*
|
|
24
24
|
* This source code is licensed under the MIT license found in the
|
|
25
25
|
* LICENSE file in the root directory of this source tree.
|
|
26
|
-
*/var
|
|
26
|
+
*/var Rr;function As(){if(Rr)return Sn;Rr=1;var e=g,t=Po();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Sn.useSyncExternalStoreWithSelector=function(c,u,S,y,b){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),b!==void 0&&v.hasValue){var f=v.value;if(b(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return b!==void 0&&b(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,b]);var p=o(c,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},Sn}var Cn={};/**
|
|
27
27
|
* @license React
|
|
28
28
|
* use-sync-external-store-shim/with-selector.development.js
|
|
29
29
|
*
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var _r;function Qs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=f,n=No(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;In.useSyncExternalStoreWithSelector=function(c,d,b,x,p){var v=s(null);if(v.current===null){var S={hasValue:!1,value:null};v.current=S}else S=v.current;v=a(function(){function u(E){if(!w){if(w=!0,C=E,E=x(E),p!==void 0&&S.hasValue){var g=S.value;if(p(g,E))return I=g}return I=E}if(g=I,r(C,E))return g;var y=x(E);return p!==void 0&&p(g,y)?(C=E,g):(C=E,I=y)}var w=!1,C,I,T=b===void 0?null:b;return[function(){return u(d())},T===null?void 0:function(){return u(T())}]},[d,b,x,p]);var h=o(c,v[0],v[1]);return i(function(){S.hasValue=!0,S.value=h},[h]),l(h),h},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),In}var Mr;function Ys(){return Mr||(Mr=1,process.env.NODE_ENV==="production"?en.exports=Ks():en.exports=Qs()),en.exports}var Xs=Ys();const Zs=Ho(Xs),Er=e=>{let t;const n=new Set,r=(c,d)=>{const b=typeof c=="function"?c(t):c;if(!Object.is(b,t)){const x=t;t=d??(typeof b!="object"||b===null)?b:Object.assign({},t,b),n.forEach(p=>p(t,x))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,o,a);return a},yt=(e=>e?Er(e):Er),{useSyncExternalStoreWithSelector:Js}=Zs,ei=e=>e;function Qt(e,t=ei,n){const r=Js(e.subscribe,e.getState,e.getInitialState,t,n);return f.useDebugValue(r),r}function te(e,t){const n=f.useContext(ir);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return Qt(n,e,t)}function Ot(){const e=f.useContext(ir);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const wt=f.createContext(void 0);function ti(){return yt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerRecorder] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerRecorder] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerRecorder] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerRecorder] applySnapshot called but no handler registered")}}))}function ni({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=f.useMemo(()=>ti(),[]);return f.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),f.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),f.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),f.useLayoutEffect(()=>(o&&(o.current={dispatch:i=>{s.getState().dispatch(i)},applySnapshot:i=>{s.getState().applySnapshot(i)}}),()=>{o&&(o.current=null)}),[o,s]),m.jsx(wt.Provider,{value:s,children:e})}function ri({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=f.useRef(null);f.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=f.useCallback(a=>{if(!(r!=null&&r(a.target))&&a.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(a)},n)}},[n,e,r]),i=f.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const an={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},kn=[8,16,24,40,64],Rn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Tn=[4,8,12,16,24],Zn=e=>Math.round(12+(e-1)*(16/11)),oi=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Zn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},_n=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},Fo=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],He={mode:"page",theme:"light",fontFamily:Fo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,audioTargetWpm:200,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,playbackViewportWidth:0,playbackViewportHeight:0};function si(e){const{init:t,recorderStore:n}=e??{};return yt((r,o)=>({...He,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>r({showOverlays:!o().showOverlays}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:He.mode,theme:He.theme,fontFamily:He.fontFamily,fontSizePx:He.fontSizePx,lineHeight:He.lineHeight,marginX:He.marginX,marginY:He.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:He.pointerStyle,pointerColor:He.pointerColor,breakMarks:He.breakMarks,breakGapPx:He.breakGapPx,muteAudio:He.muteAudio,audioSpeed:He.audioSpeed,showPointer:He.showPointer,showSplit:He.showSplit})),maps:{MARGIN_MAP:kn,LINEHEIGHT_MAP:Rn,BREAK_GAP_MAP:Tn,fontSizeFromLevel:Zn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Tn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>_n(o().breakGapPx,Tn),getFontLevel:()=>oi(o().fontSizePx),getLineLevel:()=>_n(o().lineHeight,Rn),getMarginLevel:()=>_n(o().marginX,kn),setFontLevel:s=>r({fontSizePx:Zn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:Rn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=kn[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{r({audioSpeed:s})},setAudioTargetWpm:s=>{r({audioTargetWpm:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioTargetWpm",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i}),setPlaybackViewportSize:(s,i)=>r({playbackViewportWidth:s,playbackViewportHeight:i}),clearPlaybackViewport:()=>r({playbackViewportWidth:0,playbackViewportHeight:0})}))}const gn=0,ht=1,Bt=2,Wo=4;function jr(e){return()=>e}function ii(e){e()}function Vo(e,t){return n=>e(t(n))}function Pr(e,t){return()=>e(t)}function li(e,t){return n=>e(t,n)}function lr(e){return e!==void 0}function ai(...e){return()=>{e.map(ii)}}function zt(){}function mn(e,t){return t(e),e}function ci(e,t){return t(e)}function ke(...e){return e}function Se(e,t){return e(ht,t)}function he(e,t){e(gn,t)}function ar(e){e(Bt)}function Te(e){return e(Wo)}function re(e,t){return Se(e,li(t,gn))}function et(e,t){const n=e(ht,r=>{n(),t(r)});return n}function Or(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Do(e,t){return e===t}function Ie(e=Do){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ce(e){return t=>n=>{e(n)&&t(n)}}function Z(e){return t=>Vo(t,e)}function it(e){return t=>()=>{t(e)}}function N(e,...t){const n=ui(...t);return((r,o)=>{switch(r){case Bt:ar(e);return;case ht:return Se(e,n(o))}})}function lt(e,t){return n=>r=>{n(t=e(t,r))}}function vt(e){return t=>n=>{e>0?e--:t(n)}}function ct(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function ge(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Se(s,l=>{const c=n;n=n|a,t[i]=l,c!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function ui(...e){return t=>e.reduceRight(ci,t)}function di(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case ht:return s?n===s?void 0:(r(),n=s,t=Se(e,s),t):(r(),zt);case Bt:r(),n=null;return}}}function V(e){let t=e;const n=xe();return((r,o)=>{switch(r){case gn:t=o;break;case ht:{o(t);break}case Wo:return t}return n(r,o)})}function Fe(e,t){return mn(V(t),n=>re(e,n))}function xe(){const e=[];return((t,n)=>{switch(t){case gn:e.slice().forEach(r=>{r(n)});return;case Bt:e.splice(0,e.length);return;case ht:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return mn(xe(),t=>re(e,t))}function ve(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:fi(),singleton:n}}const fi=()=>Symbol();function pi(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function je(...e){const t=xe(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);Se(s,l=>{n[i]=l,r=r|a,r===o&&he(t,n)})}),function(s,i){switch(s){case Bt:{ar(t);return}case ht:return r===o&&i(n),Se(t,i)}}}function ae(e,t=Do){return N(e,Ie(t))}function Jn(...e){return function(t,n){switch(t){case Bt:return;case ht:return ai(...e.map(r=>Se(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const hi={0:"debug",3:"error",1:"log",2:"warn"},gi=()=>typeof globalThis>"u"?window:globalThis,gt=ve(()=>{const e=V(3);return{log:V((t,n,r=1)=>{var o;const s=(o=gi().VIRTUOSO_LOG_LEVEL)!=null?o:Te(e);r>=s&&console[hi[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function Ct(e,t,n){return cr(e,t,n).callbackRef}function cr(e,t,n){const r=f.useRef(null);let o=i=>{};const s=f.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function mi(e,t,n,r,o,s,i,a,l){const c=f.useCallback(d=>{const b=bi(d.children,t,a?"offsetWidth":"offsetHeight",o);let x=d.parentElement;for(;!x.dataset.virtuosoScroller;)x=x.parentElement;const p=x.lastElementChild.dataset.viewportType==="window";let v;p&&(v=x.ownerDocument.defaultView);const S=i?a?i.scrollLeft:i.scrollTop:p?a?v.scrollX||v.document.documentElement.scrollLeft:v.scrollY||v.document.documentElement.scrollTop:a?x.scrollLeft:x.scrollTop,h=i?a?i.scrollWidth:i.scrollHeight:p?a?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight:a?x.scrollWidth:x.scrollHeight,u=i?a?i.offsetWidth:i.offsetHeight:p?a?v.innerWidth:v.innerHeight:a?x.offsetWidth:x.offsetHeight;r({scrollHeight:h,scrollTop:Math.max(S,0),viewportHeight:u}),s==null||s(a?Br("column-gap",getComputedStyle(d).columnGap,o):Br("row-gap",getComputedStyle(d).rowGap,o)),b!==null&&e(b)},[e,t,o,s,i,r,a]);return cr(c,n,l)}function bi(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&r("Zero-sized element, this should not happen",{child:a},Ve.ERROR),d===c)continue;const b=s[s.length-1];s.length===0||b.size!==d||b.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function Br(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function $o(e,t,n){const r=f.useRef(null),o=f.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),d=c.width;let b,x;if(t){const p=t.getBoundingClientRect(),v=c.top-p.top;x=p.height-Math.max(0,v),b=v+t.scrollTop}else{const p=i.current.ownerDocument.defaultView;x=p.innerHeight-Math.max(0,c.top),b=c.top+p.scrollY}r.current={offsetTop:b,visibleHeight:x,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=cr(o,!0,n),a=f.useCallback(()=>{o(i.current)},[o,i]);return f.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",a),c==null||c.addEventListener("resize",a),()=>{c==null||c.removeEventListener("scroll",a),c==null||c.removeEventListener("resize",a)}}},[a,t,i]),s}const We=ve(()=>{const e=xe(),t=xe(),n=V(0),r=xe(),o=V(0),s=xe(),i=xe(),a=V(0),l=V(0),c=V(0),d=V(0),b=xe(),x=xe(),p=V(!1),v=V(!1),S=V(!1);return re(N(e,Z(({scrollTop:h})=>h)),t),re(N(e,Z(({scrollHeight:h})=>h)),i),re(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:d,headerHeight:a,horizontalDirection:v,scrollBy:x,scrollContainerState:e,scrollHeight:i,scrollingInProgress:p,scrollTo:b,scrollTop:t,skipAnimationFrameInResizeObserver:S,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Ft={lvl:0};function qo(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function ye(e){return e===Ft}function Wt(e,t){if(!ye(e))return t===e.k?e.v:t<e.k?Wt(e.l,t):Wt(e.r,t)}function tt(e,t,n="k"){if(ye(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=tt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return tt(e.l,t,n)}function qe(e,t,n){return ye(e)?Qo(t,n,1):t===e.k?Oe(e,{k:t,v:n}):t<e.k?zr(Oe(e,{l:qe(e.l,t,n)})):zr(Oe(e,{r:qe(e.r,t,n)}))}function Et(){return Ft}function jt(e,t,n){if(ye(e))return[];const r=tt(e,t)[0];return xi(tr(e,r,n))}function er(e,t){if(ye(e))return Ft;const{k:n,l:r,r:o}=e;if(t===n){if(ye(r))return o;if(ye(o))return r;{const[s,i]=Ko(r);return sn(Oe(e,{k:s,l:Uo(r),v:i}))}}else return t<n?sn(Oe(e,{l:er(r,t)})):sn(Oe(e,{r:er(o,t)}))}function xt(e){return ye(e)?[]:[...xt(e.l),{k:e.k,v:e.v},...xt(e.r)]}function tr(e,t,n){if(ye(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(tr(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(tr(s,t,n))),a}function sn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(Mn(t))return Yo(Oe(e,{lvl:n-1}));if(!ye(t)&&!ye(t.r))return Oe(t.r,{l:Oe(t,{r:t.r.l}),lvl:n,r:Oe(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Mn(e))return nr(Oe(e,{lvl:n-1}));if(!ye(r)&&!ye(r.l)){const o=r.l,s=Mn(o)?r.lvl-1:r.lvl;return Oe(o,{l:Oe(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:nr(Oe(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Oe(e,t){return Qo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Uo(e){return ye(e.r)?e.l:sn(Oe(e,{r:Uo(e.r)}))}function Mn(e){return ye(e)||e.lvl>e.r.lvl}function Ko(e){return ye(e.r)?[e.k,e.v]:Ko(e.r)}function Qo(e,t,n,r=Ft,o=Ft){return{k:e,l:r,lvl:n,r:o,v:t}}function zr(e){return nr(Yo(e))}function Yo(e){const{l:t}=e;return!ye(t)&&t.lvl===e.lvl?Oe(t,{r:Oe(e,{l:t.r})}):e}function nr(e){const{lvl:t,r:n}=e;return!ye(n)&&!ye(n.r)&&n.lvl===t&&n.r.lvl===t?Oe(n,{l:Oe(e,{r:n.l}),lvl:t+1}):e}function xi(e){return qo(e,({k:t,v:n})=>({index:t,value:n}))}function Xo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Vt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ur=ve(()=>({recalcInProgress:V(!1)}),[],{singleton:!0});function Zo(e,t,n){return e[cn(e,t,n)]}function cn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function vi(e,t,n,r){const o=cn(e,t,r),s=cn(e,n,r,o);return e.slice(o,s+1)}function pt(e,t){return Math.round(e.getBoundingClientRect()[t])}function bn(e){return!ye(e.groupOffsetTree)}function dr({index:e},t){return t===e?0:t<e?-1:1}function Si(){return{groupIndices:[],groupOffsetTree:Et(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Et()}}function yi(e,t){let n=ye(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),ye(e)){e=qe(e,0,s);continue}const a=jt(e,i-1,o+1);if(a.some(_i(r)))continue;let l=!1,c=!1;for(const{end:d,start:b,value:x}of a)l?(o>=b||s===x)&&(e=er(e,b)):(c=x!==s,l=!0),d>o&&o>=b&&x!==s&&(e=qe(e,o+1,x));c&&(e=qe(e,i,s))}return[e,n]}function wi(e){return typeof e.groupIndex<"u"}function Ci({offset:e},t){return t===e?0:t<e?-1:1}function Dt(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Zo(t,e,dr),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Jo(e,t){if(!bn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function es(e,t,n){if(wi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Jo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function Ii(e,t,n,r=0){return r>0&&(t=Math.max(t,Zo(e,r,dr).offset)),qo(vi(e,t,n,Ci),Ti)}function ki(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&ye(s)&&t.length===2){const x=t[0].size,p=t[1].size;i=n.reduce((v,S)=>qe(qe(v,S,x),S+1,p),i)}else[i,a]=yi(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:d,offsetTree:b}=rr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((x,p)=>qe(x,p,Dt(p,b,o)),Et()),lastIndex:l,lastOffset:c,lastSize:d,offsetTree:b,sizeTree:i}}function Ri(e){return xt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Ar(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function rr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=cn(o,t-1,dr),a=o[l].offset;const c=tt(n,t-1);s=c[0],i=c[1],o.length&&o[l].size===tt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:d}of jt(n,t,1/0)){const b=c-s,x=b*i+a+b*r;o.push({index:c,offset:x,size:d}),s=c,a=x,i=d}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function Ti(e){return{index:e.index,value:e}}function _i(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const Mi={offsetHeight:"height",offsetWidth:"width"},at=ve(([{log:e},{recalcInProgress:t}])=>{const n=xe(),r=xe(),o=Fe(r,0),s=xe(),i=xe(),a=V(0),l=V([]),c=V(void 0),d=V(void 0),b=V(void 0),x=V(void 0),p=V((g,y)=>pt(g,Mi[y])),v=V(void 0),S=V(0),h=Si(),u=Fe(N(n,ge(l,e,S),lt(ki,h),Ie()),h),w=Fe(N(l,Ie(),lt((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),Z(({prev:g})=>g)),[]);re(N(l,ce(g=>g.length>0),ge(u,S),Z(([g,y,_])=>{const B=g.reduce((R,P,k)=>qe(R,P,Dt(P,y.offsetTree,_)||k),Et());return{...y,groupIndices:g,groupOffsetTree:B}})),u),re(N(r,ge(u),ce(([g,{lastIndex:y}])=>g<y),Z(([g,{lastIndex:y,lastSize:_}])=>[{endIndex:y,size:_,startIndex:g}])),n),re(c,d);const C=Fe(N(c,Z(g=>g===void 0)),!0);re(N(d,ce(g=>g!==void 0&&ye(Te(u).sizeTree)),Z(g=>{const y=Te(b),_=Te(l).length>0;return y?_?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:g,startIndex:1}]:[]:[{endIndex:0,size:g,startIndex:0}]})),n),re(N(x,ce(g=>g!==void 0&&g.length>0&&ye(Te(u).sizeTree)),Z(g=>{const y=[];let _=g[0],B=0;for(let R=1;R<g.length;R++){const P=g[R];P!==_&&(y.push({endIndex:R-1,size:_,startIndex:B}),_=P,B=R)}return y.push({endIndex:g.length-1,size:_,startIndex:B}),y})),n),re(N(l,ge(b,d),ce(([,g,y])=>g!==void 0&&y!==void 0),Z(([g,y,_])=>{const B=[];for(let R=0;R<g.length;R++){const P=g[R],k=g[R+1];B.push({startIndex:P,endIndex:P,size:y}),k!==void 0&&B.push({startIndex:P+1,endIndex:k-1,size:_})}return B})),n);const I=Ue(N(n,ge(u),lt(({sizes:g},[y,_])=>({changed:_!==g,sizes:_}),{changed:!1,sizes:h}),Z(g=>g.changed)));Se(N(a,lt((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),Z(g=>g.diff)),g=>{const{groupIndices:y}=Te(u);if(g>0)he(t,!0),he(s,g+Ar(g,y));else if(g<0){const _=Te(w);_.length>0&&(g-=Ar(-g,_)),he(i,g)}}),Se(N(a,ge(e)),([g,y])=>{g<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ve.ERROR)});const T=Ue(s);re(N(s,ge(u),Z(([g,y])=>{const _=y.groupIndices.length>0,B=[],R=y.lastSize;if(_){const P=Wt(y.sizeTree,0);let k=0,O=0;for(;k<g;){const L=y.groupIndices[O],j=y.groupIndices.length===O+1?1/0:y.groupIndices[O+1]-L-1;B.push({endIndex:L,size:P,startIndex:L}),B.push({endIndex:L+1+j-1,size:R,startIndex:L+1}),O++,k+=j+1}const z=xt(y.sizeTree);return k!==g&&z.shift(),z.reduce((L,{k:j,v:A})=>{let W=L.ranges;return L.prevSize!==0&&(W=[...L.ranges,{endIndex:j+g-1,size:L.prevSize,startIndex:L.prevIndex}]),{prevIndex:j+g,prevSize:A,ranges:W}},{prevIndex:g,prevSize:0,ranges:B}).ranges}return xt(y.sizeTree).reduce((P,{k,v:O})=>({prevIndex:k+g,prevSize:O,ranges:[...P.ranges,{endIndex:k+g-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:R,ranges:[]}).ranges})),n);const E=Ue(N(i,ge(u,S),Z(([g,{offsetTree:y},_])=>{const B=-g;return Dt(B,y,_)})));return re(N(i,ge(u,S),Z(([g,y,_])=>{if(y.groupIndices.length>0){if(ye(y.sizeTree))return y;let B=Et();const R=Te(w);let P=0,k=0,O=0;for(;P<-g;){O=R[k];const z=R[k+1]-O-1;k++,P+=z+1}if(B=xt(y.sizeTree).reduce((z,{k:L,v:j})=>qe(z,Math.max(0,L+g),j),B),P!==-g){const z=Wt(y.sizeTree,O);B=qe(B,0,z);const L=tt(y.sizeTree,-g+1)[1];B=qe(B,1,L)}return{...y,sizeTree:B,...rr(y.offsetTree,0,B,_)}}else{const B=xt(y.sizeTree).reduce((R,{k:P,v:k})=>qe(R,Math.max(0,P+g),k),Et());return{...y,sizeTree:B,...rr(y.offsetTree,0,B,_)}}})),u),{beforeUnshiftWith:T,data:v,defaultItemSize:d,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:b,gap:S,groupIndices:l,heightEstimates:x,itemSize:p,listRefresh:I,shiftWith:i,shiftWithOffset:E,sizeRanges:n,sizes:u,statefulTotalCount:o,totalCount:r,trackItemSizes:C,unshiftWith:s}},ke(gt,ur),{singleton:!0});function Ei(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const ts=ve(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=xe(),i=xe(),a=Ue(N(s,Z(Ei)));return re(N(a,Z(l=>l.totalCount)),n),re(N(a,Z(l=>l.groupIndices)),e),re(N(je(o,t,r),ce(([l,c])=>bn(c)),Z(([l,c,d])=>tt(c.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ie(),Z(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(at,We)),mt=ve(([{log:e}])=>{const t=V(!1),n=Ue(N(t,ce(r=>r),Ie()));return Se(t,r=>{r&&Te(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(gt),{singleton:!0}),ji=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function ns(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!ji)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Yt=ve(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:b},{log:x}])=>{const p=xe(),v=xe(),S=V(0);let h=null,u=null,w=null;function C(){h&&(h(),h=null),w&&(w(),w=null),u&&(clearTimeout(u),u=null),he(l,!1)}return re(N(p,ge(n,b,r,S,a,i,x),ge(e,s,o),Z(([[I,T,E,g,y,_,B,R],P,k,O])=>{const z=ns(I),{align:L,behavior:j,offset:A}=z,W=g-1,U=es(z,T,W);let X=Dt(U,T.offsetTree,P)+_;L==="end"?(X+=k+tt(T.sizeTree,U)[1]-E+O,U===W&&(X+=B)):L==="center"?X+=(k+tt(T.sizeTree,U)[1]-E+O)/2:X-=y,A&&(X+=A);const ie=le=>{C(),le?(R("retrying to scroll to",{location:I},Ve.DEBUG),he(p,I)):(he(v,!0),R("list did not change, scroll successful",{},Ve.DEBUG))};if(C(),j==="smooth"){let le=!1;w=Se(t,me=>{le=le||me}),h=et(d,()=>{ie(le)})}else h=et(N(t,Pi(150)),ie);return u=setTimeout(()=>{C()},1200),he(l,!0),R("scrolling from index to",{behavior:j,index:U,top:X},Ve.DEBUG),{behavior:j,top:X}})),c),{scrollTargetReached:v,scrollToIndex:p,topListHeight:S}},ke(at,We,gt),{singleton:!0});function Pi(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function fr(e,t){e==0?t():requestAnimationFrame(()=>{fr(e-1,t)})}function pr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Xt=ve(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=V(!0),l=V(0),c=V(!0);return re(N(i,ge(l),ce(([d,b])=>!!b),it(!1)),a),re(N(i,ge(l),ce(([d,b])=>!!b),it(!1)),c),Se(N(je(t,i),ge(a,n,e,c),ce(([[,d],b,{sizeTree:x},p,v])=>d&&(!ye(x)||lr(p))&&!b&&!v),ge(l)),([,d])=>{et(o,()=>{he(c,!0)}),fr(4,()=>{et(r,()=>{he(a,!0)}),he(s,d)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},ke(at,We,Yt,mt),{singleton:!0});function rs(e,t){return Math.abs(e-t)<1.01}const $t="up",Ht="down",Oi="none",Bi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},zi=0,Zt=ve(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=V(!1),a=V(!0),l=xe(),c=xe(),d=V(4),b=V(zi),x=Fe(N(Jn(N(ae(o),vt(1),it(!0)),N(ae(o),vt(1),it(!1),Or(100))),Ie()),!1),p=Fe(N(Jn(N(n,it(!0)),N(n,it(!1),Or(200))),Ie()),!1);re(N(je(ae(o),ae(b)),Z(([w,C])=>w<=C),Ie()),a),re(N(a,ct(50)),c);const v=Ue(N(je(r,ae(s),ae(t),ae(e),ae(d)),lt((w,[{scrollHeight:C,scrollTop:I},T,E,g,y])=>{const _=I+T-C>-y,B={scrollHeight:C,scrollTop:I,viewportHeight:T};if(_){let P,k;return I>w.state.scrollTop?(P="SCROLLED_DOWN",k=w.state.scrollTop-I):(P="SIZE_DECREASED",k=w.state.scrollTop-I||w.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:k,state:B}}let R;return B.scrollHeight>w.state.scrollHeight?R="SIZE_INCREASED":T<w.state.viewportHeight?R="VIEWPORT_HEIGHT_DECREASING":I<w.state.scrollTop?R="SCROLLING_UPWARDS":R="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:R,state:B}},Bi),Ie((w,C)=>w&&w.atBottom===C.atBottom))),S=Fe(N(r,lt((w,{scrollHeight:C,scrollTop:I,viewportHeight:T})=>{if(rs(w.scrollHeight,C))return{changed:!1,jump:0,scrollHeight:C,scrollTop:I};{const E=C-(I+T)<1;return w.scrollTop!==I&&E?{changed:!0,jump:w.scrollTop-I,scrollHeight:C,scrollTop:I}:{changed:!0,jump:0,scrollHeight:C,scrollTop:I}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ce(w=>w.changed),Z(w=>w.jump)),0);re(N(v,Z(w=>w.atBottom)),i),re(N(i,ct(50)),l);const h=V(Ht);re(N(r,Z(({scrollTop:w})=>w),Ie(),lt((w,C)=>Te(p)?{direction:w.direction,prevScrollTop:C}:{direction:C<w.prevScrollTop?$t:Ht,prevScrollTop:C},{direction:Ht,prevScrollTop:0}),Z(w=>w.direction)),h),re(N(r,ct(50),it(Oi)),h);const u=V(0);return re(N(x,ce(w=>!w),it(0)),u),re(N(o,ct(100),ge(x),ce(([w,C])=>C),lt(([w,C],[I])=>[C,I],[0,0]),Z(([w,C])=>C-w)),u),{atBottomState:v,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:b,isAtBottom:i,isAtTop:a,isScrolling:x,lastJumpDueToItemResize:S,scrollDirection:h,scrollVelocity:u}},ke(We)),qt="top",Ut="bottom",Lr="none";function Gr(e,t,n){return typeof e=="number"?n===$t&&t===qt||n===Ht&&t===Ut?e:0:n===$t?t===qt?e.main:e.reverse:t===Ut?e.main:e.reverse}function Hr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const hr=ve(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=xe(),i=V(0),a=V(0),l=V(0),c=Fe(N(je(ae(r),ae(o),ae(n),ae(s,Vt),ae(l),ae(i),ae(t),ae(e),ae(a)),Z(([d,b,x,[p,v],S,h,u,w,C])=>{const I=d-w,T=h+u,E=Math.max(x-I,0);let g=Lr;const y=Hr(C,qt),_=Hr(C,Ut);return p-=w,p+=x+u,v+=x+u,v-=w,p>d+T-y&&(g=$t),v<d-E+b+_&&(g=Ht),g!==Lr?[Math.max(I-x-Gr(S,qt,g)-y,0),I-E-u+b+Gr(S,Ut,g)+_]:null}),ce(d=>d!=null),Ie(Vt)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},ke(We),{singleton:!0});function Ai(e,t,n){if(bn(t)){const r=Jo(e,t);return[{index:tt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const En={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function ln(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,d=0;if(e.length>0){c=e[0].offset;const S=e[e.length-1];d=S.offset+S.size}const b=n-i,x=a+b*l+(b-1)*r,p=c,v=x-d;return{bottom:d,firstItemIndex:s,items:Nr(e,o,s),offsetBottom:v,offsetTop:c,top:p,topItems:Nr(t,o,s),topListHeight:t.reduce((S,h)=>h.size+S,0),totalCount:n}}function os(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=pr(t,a),c=Array.from({length:a}).map((d,b)=>({data:s[b+l],index:b+l,offset:0,size:0}));return ln(c,[],a,o,n,r)}function Nr(e,t,n){if(e.length===0)return[];if(!bn(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=jt(t.groupOffsetTree,r,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;c.index===a.start?d={index:l,type:"group"}:d={groupIndex:l,index:c.index-(l+1)+n},s.push({...d,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Fr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const It=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:b},x,{didMount:p},{recalcInProgress:v}])=>{const S=V([]),h=V(0),u=xe(),w=V(0);re(s.topItemsIndexes,S);const C=Fe(N(je(p,v,ae(l,Vt),ae(o),ae(r),ae(c),d,ae(S),ae(t),ae(n),ae(w),e),ce(([g,y,,_,,,,,,,,B])=>{const R=B&&B.length!==_;return g&&!y&&!R}),Z(([,,[g,y],_,B,R,P,k,O,z,L,j])=>{var A,W,U,X;const ie=B,{offsetTree:le,sizeTree:me}=ie,be=Te(h);if(_===0)return{...En,totalCount:_};if(g===0&&y===0)return be===0?{...En,totalCount:_}:os(be,R,B,O,z,j||[]);if(ye(me))return be>0?null:ln(Ai(pr(R,_),ie,j),[],_,z,ie,O);const K=[];if(k.length>0){const $=k[0],Q=k[k.length-1];let D=0;for(const de of jt(me,$,Q)){const J=de.value,ne=Math.max(de.start,$),se=Math.min(de.end,Q);for(let ue=ne;ue<=se;ue++)K.push({data:j==null?void 0:j[ue],index:ue,offset:D,size:J}),D+=J}}if(!P)return ln([],K,_,z,ie,O);const oe=k.length>0?k[k.length-1]+1:0,G=Ii(le,g,y,oe);if(G.length===0)return null;const ee=_-1,M=mn([],$=>{for(const Q of G){const D=Q.value;let de=D.offset,J=Q.start;const ne=D.size;if(D.offset<g){J+=Math.floor((g-D.offset+z)/(ne+z));const ue=J-Q.start;de+=ue*ne+ue*z}J<oe&&(de+=(oe-J)*ne,J=oe);const se=Math.min(Q.end,ee);for(let ue=J;ue<=se&&!(de>=y);ue++)$.push({data:j==null?void 0:j[ue],index:ue,offset:de,size:ne}),de+=ne+z}}),F=Fr(L,qt),H=Fr(L,Ut);if(M.length>0&&(F>0||H>0)){const $=M[0],Q=M[M.length-1];if(F>0&&$.index>oe){const D=Math.min(F,$.index-oe),de=[];let J=$.offset;for(let ne=$.index-1;ne>=$.index-D;ne--){const se=(W=(A=jt(me,ne,ne)[0])==null?void 0:A.value)!=null?W:$.size;J-=se+z,de.unshift({data:j==null?void 0:j[ne],index:ne,offset:J,size:se})}M.unshift(...de)}if(H>0&&Q.index<ee){const D=Math.min(H,ee-Q.index);let de=Q.offset+Q.size+z;for(let J=Q.index+1;J<=Q.index+D;J++){const ne=(X=(U=jt(me,J,J)[0])==null?void 0:U.value)!=null?X:Q.size;M.push({data:j==null?void 0:j[J],index:J,offset:de,size:ne}),de+=ne+z}}}return ln(M,K,_,z,ie,O)}),ce(g=>g!==null),Ie()),En);re(N(e,ce(lr),Z(g=>g==null?void 0:g.length)),o),re(N(C,Z(g=>g.topListHeight)),b),re(b,a),re(N(C,Z(g=>[g.top,g.bottom])),i),re(N(C,Z(g=>g.items)),u);const I=Ue(N(C,ce(({items:g})=>g.length>0),ge(o,e),ce(([{items:g},y])=>g[g.length-1].originalIndex===y-1),Z(([,g,y])=>[g-1,y]),Ie(Vt),Z(([g])=>g))),T=Ue(N(C,ct(200),ce(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),Z(({items:g})=>g[0].index),Ie())),E=Ue(N(C,ce(({items:g})=>g.length>0),Z(({items:g})=>{let y=0,_=g.length-1;for(;g[y].type==="group"&&y<_;)y++;for(;g[_].type==="group"&&_>y;)_--;return{endIndex:g[_].index,startIndex:g[y].index}}),Ie(Xo)));return{endReached:I,initialItemCount:h,itemsRendered:u,listState:C,minOverscanItemCount:w,rangeChanged:E,startReached:T,topItemsIndexes:S,...x}},ke(at,ts,hr,Xt,Yt,Zt,mt,ur),{singleton:!0}),ss=ve(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=xe(),i=Fe(N(je(n,e,r,t,o),Z(([a,l,c,d,b])=>a+l+c+d+b.offsetBottom+b.bottom)),0);return re(ae(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,It),{singleton:!0}),Li=ve(([{viewportHeight:e},{totalListHeight:t}])=>{const n=V(!1),r=Fe(N(je(n,e,t),ce(([o])=>o),Z(([,o,s])=>Math.max(0,o-s)),ct(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,ss),{singleton:!0}),is=ve(()=>({context:V(null)})),Gi=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ls=ve(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const d=xe();return re(N(d,ge(t,l,n,s,o,r,a),ge(e),Z(([[b,x,p,v,S,h,u,w],C])=>{const{align:I,behavior:T,calculateViewLocation:E=Gi,done:g,...y}=b,_=es(b,x,v-1),B=Dt(_,x.offsetTree,C)+S+h,R=B+tt(x.sizeTree,_)[1],P=w+h,k=w+p-u,O=E({itemBottom:R,itemTop:B,locationParams:{align:I,behavior:T,...y},viewportBottom:k,viewportTop:P});return O?g&&et(N(i,ce(z=>!z),vt(Te(i)?1:2)),g):g==null||g(),O}),ce(b=>b!==null)),c),{scrollIntoView:d}},ke(at,We,Yt,It,gt),{singleton:!0});function Wr(e){return e?e==="smooth"?"smooth":"auto":!1}const Hi=(e,t)=>typeof e=="function"?Wr(e(t)):t&&Wr(e),Ni=ve(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:d},{scrollingInProgress:b},{context:x},{scrollIntoView:p}])=>{const v=V(!1),S=xe();let h=null;function u(T){he(i,{align:"end",behavior:T,index:"LAST"})}Se(N(je(N(ae(t),vt(1)),l),ge(ae(v),s,a,b),Z(([[T,E],g,y,_,B])=>{let R=E&&_,P="auto";return R&&(P=Hi(g,y||B),R=R&&!!P),{followOutputBehavior:P,shouldFollow:R,totalCount:T}}),ce(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:E})=>{h&&(h(),h=null),Te(n)?requestAnimationFrame(()=>{Te(d)("following output to ",{totalCount:E},Ve.DEBUG),u(T)}):h=et(e,()=>{Te(d)("following output to ",{totalCount:E},Ve.DEBUG),u(T),h=null})});function w(T){const E=et(o,g=>{T&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!h&&(Te(d)("scrolling to bottom due to increased size",{},Ve.DEBUG),u("auto"))});setTimeout(E,100)}Se(N(je(ae(v),t,c),ce(([T,,E])=>T&&E),lt(({value:T},[,E])=>({refreshed:T===E,value:E}),{refreshed:!1,value:0}),ce(({refreshed:T})=>T),ge(v,t)),([,T])=>{Te(a)&&w(T!==!1)}),Se(S,()=>{w(Te(v)!==!1)}),Se(je(ae(v),o),([T,E])=>{T&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&u("auto")});const C=V(null),I=xe();return re(Jn(N(ae(r),Z(T=>{var E;return(E=T==null?void 0:T.length)!=null?E:0})),N(ae(t))),I),Se(N(je(N(I,vt(1)),l),ge(ae(C),a,b,x),Z(([[T,E],g,y,_,B])=>E&&y&&(g==null?void 0:g({context:B,totalCount:T,scrollingInProgress:_}))),ce(T=>!!T),ct(0)),T=>{h&&(h(),h=null),Te(n)?requestAnimationFrame(()=>{Te(d)("scrolling into view",{}),he(p,T)}):h=et(e,()=>{Te(d)("scrolling into view",{}),he(p,T),h=null})}),{autoscrollToBottom:S,followOutput:v,scrollIntoViewOnChange:C}},ke(at,Zt,Yt,Xt,mt,gt,We,is,ls)),Fi=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(re(N(a,ge(s),ce(([,l])=>l!==0),ge(o,r,t,n,e),Z(([[,l],c,d,b,x,p=[]])=>os(l,c,d,b,x,p))),i),{}),ke(at,Xt,It,mt),{singleton:!0}),Wi=ve(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=V(0);return Se(N(e,ge(r),ce(([,o])=>o!==0),Z(([,o])=>({top:o}))),o=>{et(N(n,vt(1),ce(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{he(t,o)})})}),{initialScrollTop:r}},ke(mt,We,It),{singleton:!0}),as=ve(([{scrollVelocity:e}])=>{const t=V(!1),n=xe(),r=V(!1);return re(N(e,ge(r,t,n),ce(([o,s])=>!!s),Z(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),Ie()),t),Se(N(je(t,e,n),ge(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Zt),{singleton:!0}),gr=ve(([{scrollContainerState:e,scrollTo:t}])=>{const n=xe(),r=xe(),o=xe(),s=V(!1),i=V(void 0);return re(N(je(n,r),Z(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:d}])=>({scrollHeight:a,scrollTop:Math.max(0,l-d),viewportHeight:c}))),e),re(N(t,ge(r),Z(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),Vi=ve(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=xe(),d=V(void 0),b=V(null),x=V(null);return re(a,b),re(l,x),Se(N(c,ge(t,r,i,b,x,n)),([p,v,S,h,u,w,C])=>{const I=Ri(v.sizeTree);h&&u!==null&&w!==null&&(S=u.scrollTop-w.offsetTop),S-=C,p({ranges:I,scrollTop:S})}),re(N(d,ce(lr),Z(Di)),o),re(N(s,ge(d),ce(([,p])=>p!==void 0),Ie(),Z(([,p])=>p.ranges)),e),{getState:c,restoreStateFrom:d}},ke(at,We,Xt,mt,gr));function Di(e){return{align:"start",index:0,offset:e.scrollTop}}const $i=ve(([{topItemsIndexes:e}])=>{const t=V(0);return re(N(t,ce(n=>n>=0),Z(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(It));function cs(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const qi=cs(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Ui=ve(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:d,shiftWithOffset:b,sizes:x},{log:p},{recalcInProgress:v}])=>{const S=Ue(N(l,ge(i),lt(([,u,w,C],[{bottom:I,items:T,offsetBottom:E,totalCount:g},y])=>{const _=I+E;let B=0;return w===g&&u.length>0&&T.length>0&&(T[0].originalIndex===0&&u[0].originalIndex===0||(B=_-C,B!==0&&(B+=y))),[B,T,g,_]},[0,[],0,0]),ce(([u])=>u!==0),ge(r,a,n,o,p,v),ce(([,u,w,C,,,I])=>!I&&!C&&u!==0&&w===$t),Z(([[u],,,,,w])=>(w("Upward scrolling compensation",{amount:u},Ve.DEBUG),u))));function h(u){u>0?(he(t,{behavior:"auto",top:-u}),he(e,0)):(he(e,0),he(t,{behavior:"auto",top:-u}))}return Se(N(S,ge(e,s)),([u,w,C])=>{C&&qi()?he(e,w-u):h(-u)}),Se(N(je(Fe(s,!1),e,v),ce(([u,w,C])=>!u&&!C&&w!==0),Z(([u,w])=>w),ct(1)),h),re(N(b,Z(u=>({top:-u}))),t),Se(N(c,ge(x,d),Z(([u,{groupIndices:w,lastSize:C,sizeTree:I},T])=>{function E(g){return g*(C+T)}if(w.length===0)return E(u);{let g=0;const y=Wt(I,0);let _=0,B=0;for(;_<u;){_++,g+=y;let R=w.length===B+1?1/0:w[B+1]-w[B]-1;_+R>u&&(g-=y,R=u-_+1),_+=R,g+=E(R),B++}return g}})),u=>{he(e,u),requestAnimationFrame(()=>{he(t,{top:u}),requestAnimationFrame(()=>{he(e,0),he(v,!1)})})}),{deviation:e}},ke(We,Zt,It,at,gt,ur)),Ki=ve(([e,t,n,r,o,s,i,a,l,c,d])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...d}),ke(hr,Fi,mt,as,ss,Wi,Li,gr,ls,gt,is)),us=ve(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:d,statefulTotalCount:b,totalCount:x,trackItemSizes:p},{initialItemFinalLocationReached:v,initialTopMostItemIndex:S,scrolledToInitialItem:h},u,w,C,I,{scrollToIndex:T},E,{topItemCount:g},{groupCounts:y},_])=>{const{listState:B,minOverscanItemCount:R,topItemsIndexes:P,rangeChanged:k,...O}=I;return re(k,_.scrollSeekRangeChanged),re(N(_.windowViewportRect,Z(z=>z.visibleHeight)),u.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:a,initialItemFinalLocationReached:v,initialTopMostItemIndex:S,scrolledToInitialItem:h,sizeRanges:c,topItemCount:g,topItemsIndexes:P,totalCount:x,...C,groupIndices:i,itemSize:l,listState:B,minOverscanItemCount:R,scrollToIndex:T,statefulTotalCount:b,trackItemSizes:p,rangeChanged:k,...O,..._,...u,sizes:d,...w}},ke(at,Xt,We,Vi,Ni,It,Yt,Ui,$i,ts,Ki));function Qi(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const nn=typeof document<"u"?f.useLayoutEffect:f.useEffect;function ds(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=f.createContext({});function l(h,u){h.propsReady&&he(h.propsReady,!1);for(const w of r){const C=h[t.required[w]];he(C,u[w])}for(const w of o)if(w in u){const C=h[t.optional[w]];he(C,u[w])}h.propsReady&&he(h.propsReady,!0)}function c(h){return s.reduce((u,w)=>(u[w]=C=>{const I=h[t.methods[w]];he(I,C)},u),{})}function d(h){return i.reduce((u,w)=>(u[w]=di(h[t.events[w]]),u),{})}const b=f.forwardRef((h,u)=>{const{children:w,...C}=h,[I]=f.useState(()=>mn(pi(e),g=>{l(g,C)})),[T]=f.useState(Pr(d,I));nn(()=>{for(const g of i)g in C&&Se(T[g],C[g]);return()=>{Object.values(T).map(ar)}},[C,T,I]),nn(()=>{l(I,C)}),f.useImperativeHandle(u,jr(c(I)));const E=n;return m.jsx(a.Provider,{value:I,children:n?m.jsx(E,{...Qi([...r,...o,...i],C),children:w}):w})}),x=h=>{const u=f.useContext(a);return f.useCallback(w=>{he(u[h],w)},[u,h])},p=h=>{const u=f.useContext(a)[h],w=f.useCallback(C=>Se(u,C),[u]);return f.useSyncExternalStore(w,()=>Te(u),()=>Te(u))},v=h=>{const u=f.useContext(a)[h],[w,C]=f.useState(Pr(Te,u));return nn(()=>Se(u,I=>{I!==w&&C(jr(I))}),[u,w]),w},S=f.version.startsWith("18")?p:v;return{Component:b,useEmitter:(h,u)=>{const w=f.useContext(a)[h];nn(()=>Se(w,u),[u,w])},useEmitterValue:S,usePublisher:x}}const fs=f.createContext(void 0),ps=f.createContext(void 0),hs=typeof document<"u"?f.useLayoutEffect:f.useEffect;function jn(e){return"self"in e}function Yi(e){return"body"in e}function gs(e,t,n,r=zt,o,s){const i=f.useRef(null),a=f.useRef(null),l=f.useRef(null),c=f.useCallback(x=>{let p,v,S;const h=x.target;if(Yi(h)||jn(h)){const w=jn(h)?h:h.defaultView;S=s?w.scrollX:w.scrollY,p=s?w.document.documentElement.scrollWidth:w.document.documentElement.scrollHeight,v=s?w.innerWidth:w.innerHeight}else S=s?h.scrollLeft:h.scrollTop,p=s?h.scrollWidth:h.scrollHeight,v=s?h.offsetWidth:h.offsetHeight;const u=()=>{e({scrollHeight:p,scrollTop:Math.max(S,0),viewportHeight:v})};x.suppressFlushSync?u():Ds.flushSync(u),a.current!==null&&(S===a.current||S<=0||S===p-v)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);f.useEffect(()=>{const x=o||i.current;return r(o||i.current),c({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",c,{passive:!0}),()=>{r(null),x.removeEventListener("scroll",c)}},[i,c,n,r,o]);function d(x){const p=i.current;if(!p||(s?"offsetWidth"in p&&p.offsetWidth===0:"offsetHeight"in p&&p.offsetHeight===0))return;const v=x.behavior==="smooth";let S,h,u;jn(p)?(h=Math.max(pt(p.document.documentElement,s?"width":"height"),s?p.document.documentElement.scrollWidth:p.document.documentElement.scrollHeight),S=s?p.innerWidth:p.innerHeight,u=s?window.scrollX:window.scrollY):(h=p[s?"scrollWidth":"scrollHeight"],S=pt(p,s?"width":"height"),u=p[s?"scrollLeft":"scrollTop"]);const w=h-S;if(x.top=Math.ceil(Math.max(Math.min(w,x.top),0)),rs(S,h)||x.top===u){e({scrollHeight:h,scrollTop:u,viewportHeight:S}),v&&t(!0);return}v?(a.current=x.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(x={behavior:x.behavior,left:x.top}),p.scrollTo(x)}function b(x){s&&(x={behavior:x.behavior,left:x.top}),i.current.scrollBy(x)}return{scrollByCallback:b,scrollerRef:i,scrollToCallback:d}}const Pn="-webkit-sticky",Vr="sticky",mr=cs(()=>{if(typeof document>"u")return Vr;const e=document.createElement("div");return e.style.position=Pn,e.style.position===Pn?Pn:Vr});function br(e){return e}const Xi=ve(()=>{const e=V(a=>`Item ${a}`),t=V(a=>`Group ${a}`),n=V({}),r=V(br),o=V("div"),s=V(zt),i=(a,l=null)=>Fe(N(n,Z(c=>c[a]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Zi=ve(([e,t])=>({...e,...t}),ke(us,Xi)),Ji=({height:e})=>m.jsx("div",{style:{height:e}}),el={overflowAnchor:"none",position:mr(),zIndex:1},ms={overflowAnchor:"none"},tl={...ms,display:"inline-block",height:"100%"},Dr=f.memo(function({showTopList:e=!1}){const t=fe("listState"),n=Ke("sizeRanges"),r=fe("useWindowScroll"),o=fe("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),a=o||r?s:i,l=fe("itemContent"),c=fe("context"),d=fe("groupContent"),b=fe("trackItemSizes"),x=fe("itemSize"),p=fe("log"),v=Ke("gap"),S=fe("horizontalDirection"),{callbackRef:h}=mi(n,x,b,e?zt:a,p,v,o,S,fe("skipAnimationFrameInResizeObserver")),[u,w]=f.useState(0);xr("deviation",O=>{u!==O&&w(O)});const C=fe("EmptyPlaceholder"),I=fe("ScrollSeekPlaceholder")||Ji,T=fe("ListComponent"),E=fe("ItemComponent"),g=fe("GroupComponent"),y=fe("computeItemKey"),_=fe("isSeeking"),B=fe("groupIndices").length>0,R=fe("alignToBottom"),P=fe("initialItemFinalLocationReached"),k=e?{}:{boxSizing:"border-box",...S?{display:"inline-block",height:"100%",marginLeft:u!==0?u:R?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:u!==0?u:R?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&C?m.jsx(C,{...Ne(C,c)}):m.jsx(T,{...Ne(T,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:h,style:k,children:(e?t.topItems:t.items).map(O=>{const z=O.originalIndex,L=y(z+t.firstItemIndex,O.data,c);return _?f.createElement(I,{...Ne(I,c),height:O.size,index:O.index,key:L,type:O.type||"item",...O.type==="group"?{}:{groupIndex:O.groupIndex}}):O.type==="group"?f.createElement(g,{...Ne(g,c),"data-index":z,"data-item-index":O.index,"data-known-size":O.size,key:L,style:el},d(O.index,c)):f.createElement(E,{...Ne(E,c),...sl(E,O.data),"data-index":z,"data-item-group-index":O.groupIndex,"data-item-index":O.index,"data-known-size":O.size,key:L,style:S?tl:ms},B?l(O.index,O.groupIndex,O.data,c):l(O.index,O.data,c))})})}),nl={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},rl={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),ol={position:mr(),top:0,width:"100%",zIndex:1};function Ne(e,t){if(typeof e!="string")return{context:t}}function sl(e,t){return{item:typeof e=="string"?void 0:t}}const il=f.memo(function(){const e=fe("HeaderComponent"),t=Ke("headerHeight"),n=fe("HeaderFooterTag"),r=Ct(f.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),ll=f.memo(function(){const e=fe("FooterComponent"),t=Ke("footerHeight"),n=fe("HeaderFooterTag"),r=Ct(f.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null});function bs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return f.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=t("scrollerRef"),b=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:p,scrollToCallback:v}=gs(a,c,l,d,void 0,b);return e("scrollTo",v),e("scrollBy",x),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:p,style:{...b?rl:nl,...o},tabIndex:0,...i,...Ne(l,s),children:r})})}function xs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return f.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=t("totalListHeight"),b=t("deviation"),x=t("customScrollParent"),p=f.useRef(null),v=t("scrollerRef"),{scrollByCallback:S,scrollerRef:h,scrollToCallback:u}=gs(a,c,l,v,x);return hs(()=>{var w;return h.current=x||((w=p.current)==null?void 0:w.ownerDocument.defaultView),()=>{h.current=null}},[h,x]),e("windowScrollTo",u),e("scrollBy",S),m.jsx(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+b}:{}},...i,...Ne(l,s),children:r})})}const al=({children:e})=>{const t=f.useContext(fs),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=fe("alignToBottom"),s=fe("horizontalDirection"),i=f.useMemo(()=>Vo(n,l=>pt(l,s?"width":"height")),[n,s]),a=Ct(i,!0,fe("skipAnimationFrameInResizeObserver"));return f.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:xn(o),children:e})},cl=({children:e})=>{const t=f.useContext(fs),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=fe("customScrollParent"),s=$o(n,o,fe("skipAnimationFrameInResizeObserver")),i=fe("alignToBottom");return f.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),m.jsx("div",{"data-viewport-type":"window",ref:s,style:xn(i),children:e})},ul=({children:e})=>{const t=fe("TopItemListComponent")||"div",n=fe("headerHeight"),r={...ol,marginTop:`${n}px`},o=fe("context");return m.jsx(t,{style:r,...Ne(t,o),children:e})},dl=f.memo(function(e){const t=fe("useWindowScroll"),n=fe("topItemsIndexes").length>0,r=fe("customScrollParent"),o=fe("context");return m.jsxs(r||t?hl:pl,{...e,context:o,children:[n&&m.jsx(ul,{children:m.jsx(Dr,{showTopList:!0})}),m.jsxs(r||t?cl:al,{children:[m.jsx(il,{}),m.jsx(Dr,{}),m.jsx(ll,{})]})]})}),{Component:fl,useEmitter:xr,useEmitterValue:fe,usePublisher:Ke}=ds(Zi,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},dl),pl=bs({useEmitter:xr,useEmitterValue:fe,usePublisher:Ke}),hl=xs({useEmitter:xr,useEmitterValue:fe,usePublisher:Ke}),gl=fl,ml=ve(()=>{const e=V(c=>m.jsxs("td",{children:["Item $",c]})),t=V(null),n=V(c=>m.jsxs("td",{colSpan:1e3,children:["Group ",c]})),r=V(null),o=V(null),s=V({}),i=V(br),a=V(zt),l=(c,d=null)=>Fe(N(s,Z(b=>b[c]),Ie()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(us,ml);mr();const $r={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},bl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:qr,floor:un,max:Nt,min:On,round:Ur}=Math;function Kr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function xl(e){return{...bl,items:e}}function rn(e,t){return e&&e.width===t.width&&e.height===t.height}function vl(e,t){return e&&e.column===t.column&&e.row===t.row}const Sl=ve(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:b},x,p,{didMount:v,propsReady:S},{customScrollParent:h,useWindowScroll:u,windowScrollContainerState:w,windowScrollTo:C,windowViewportRect:I},T])=>{const E=V(0),g=V(0),y=V($r),_=V({height:0,width:0}),B=V({height:0,width:0}),R=xe(),P=xe(),k=V(0),O=V(null),z=V({column:0,row:0}),L=xe(),j=xe(),A=V(!1),W=V(0),U=V(!0),X=V(!1),ie=V(!1);Se(N(v,ge(W),ce(([G,ee])=>!!ee)),()=>{he(U,!1)}),Se(N(je(v,U,B,_,W,X),ce(([G,ee,M,F,,H])=>G&&!ee&&M.height!==0&&F.height!==0&&!H)),([,,,,G])=>{he(X,!0),fr(1,()=>{he(R,G)}),et(N(c),()=>{he(t,[0,0]),he(U,!0)})}),re(N(j,ce(G=>G!=null&&G.scrollTop>0),it(0)),g),Se(N(v,ge(j),ce(([,G])=>G!=null)),([,G])=>{G&&(he(_,G.viewport),he(B,G.item),he(z,G.gap),G.scrollTop>0&&(he(A,!0),et(N(c,vt(1)),ee=>{he(A,!1)}),he(l,{top:G.scrollTop})))}),re(N(_,Z(({height:G})=>G)),b),re(N(je(ae(_,rn),ae(B,rn),ae(z,(G,ee)=>G&&G.column===ee.column&&G.row===ee.row),ae(c)),Z(([G,ee,M,F])=>({gap:M,item:ee,scrollTop:F,viewport:G}))),L),re(N(je(ae(E),r,ae(z,vl),ae(B,rn),ae(_,rn),ae(O),ae(g),ae(A),ae(U),ae(W)),ce(([,,,,,,,G])=>!G),Z(([G,[ee,M],F,H,$,Q,D,,de,J])=>{const{column:ne,row:se}=F,{height:ue,width:Ce}=H,{width:ze}=$;if(D===0&&(G===0||ze===0))return $r;if(Ce===0){const q=pr(J,G),Ee=q+Math.max(D-1,0);return xl(Kr(q,Ee,Q))}const Be=vs(ze,Ce,ne);let Ae,Ge;de?ee===0&&M===0&&D>0?(Ae=0,Ge=D-1):(Ae=Be*un((ee+se)/(ue+se)),Ge=Be*qr((M+se)/(ue+se))-1,Ge=On(G-1,Nt(Ge,Be-1)),Ae=On(Ge,Nt(0,Ae))):(Ae=0,Ge=-1);const De=Kr(Ae,Ge,Q),{bottom:Me,top:$e}=Qr($,F,H,De),Xe=qr(G/Be),kt=Xe*ue+(Xe-1)*se-Me;return{bottom:Me,itemHeight:ue,items:De,itemWidth:Ce,offsetBottom:kt,offsetTop:$e,top:$e}})),y),re(N(O,ce(G=>G!==null),Z(G=>G.length)),E),re(N(je(_,B,y,z),ce(([G,ee,{items:M}])=>M.length>0&&ee.height!==0&&G.height!==0),Z(([G,ee,{items:M},F])=>{const{bottom:H,top:$}=Qr(G,F,ee,M);return[$,H]}),Ie(Vt)),t);const le=V(!1);re(N(c,ge(le),Z(([G,ee])=>ee||G!==0)),le);const me=Ue(N(je(y,E),ce(([{items:G}])=>G.length>0),ge(le),ce(([[G,ee],M])=>{const F=G.items[G.items.length-1].index===ee-1;return(M||G.bottom>0&&G.itemHeight>0&&G.offsetBottom===0&&G.items.length===ee)&&F}),Z(([[,G]])=>G-1),Ie())),be=Ue(N(ae(y),ce(({items:G})=>G.length>0&&G[0].index===0),it(0),Ie())),K=Ue(N(ae(y),ge(A),ce(([{items:G},ee])=>G.length>0&&!ee),Z(([{items:G}])=>({endIndex:G[G.length-1].index,startIndex:G[0].index})),Ie(Xo),ct(0)));re(K,p.scrollSeekRangeChanged),re(N(R,ge(_,B,E,z),Z(([G,ee,M,F,H])=>{const $=ns(G),{align:Q,behavior:D,offset:de}=$;let J=$.index;J==="LAST"&&(J=F-1),J=Nt(0,J,On(F-1,J));let ne=or(ee,H,M,J);return Q==="end"?ne=Ur(ne-ee.height+M.height):Q==="center"&&(ne=Ur(ne-ee.height/2+M.height/2)),de&&(ne+=de),{behavior:D,top:ne}})),l);const oe=Fe(N(y,Z(G=>G.offsetBottom+G.bottom)),0);return re(N(I,Z(G=>({height:G.visibleHeight,width:G.visibleWidth}))),_),{customScrollParent:h,data:O,deviation:k,footerHeight:o,gap:z,headerHeight:s,increaseViewportBy:e,initialItemCount:g,itemDimensions:B,overscan:n,restoreStateFrom:j,scrollBy:i,scrollContainerState:a,scrollHeight:P,scrollTo:l,scrollToIndex:R,scrollTop:c,smoothScrollTargetReached:d,totalCount:E,useWindowScroll:u,viewportDimensions:_,windowScrollContainerState:w,windowScrollTo:C,windowViewportRect:I,...p,gridState:y,horizontalDirection:ie,initialTopMostItemIndex:W,totalListHeight:oe,...x,endReached:me,propsReady:S,rangeChanged:K,startReached:be,stateChanged:L,stateRestoreInProgress:A,...T}},ke(hr,We,Zt,as,mt,gr,gt));function vs(e,t,n){return Nt(1,un((e+n)/(un(t)+n)))}function Qr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=or(e,t,n,r[0].index);return{bottom:or(e,t,n,r[r.length-1].index)+o,top:s}}function or(e,t,n,r){const o=vs(e.width,n.width,t.column),s=un(r/o),i=s*n.height+Nt(0,s-1)*t.row;return i>0?i+t.row:i}const yl=ve(()=>{const e=V(b=>`Item ${b}`),t=V({}),n=V(null),r=V("virtuoso-grid-item"),o=V("virtuoso-grid-list"),s=V(br),i=V("div"),a=V(zt),l=(b,x=null)=>Fe(N(t,Z(p=>p[b]),Ie()),x),c=V(!1),d=V(!1);return re(ae(d),c),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),wl=ve(([e,t])=>({...e,...t}),ke(Sl,yl)),Cl=f.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Qe("scrollHeight"),a=Re("ItemComponent"),l=Re("ListComponent"),c=Re("ScrollSeekPlaceholder"),d=Re("context"),b=Qe("itemDimensions"),x=Qe("gap"),p=Re("log"),v=Re("stateRestoreInProgress"),S=Qe("reportReadyState"),h=Ct(f.useMemo(()=>u=>{const w=u.parentElement.parentElement.scrollHeight;i(w);const C=u.firstChild;if(C){const{height:I,width:T}=C.getBoundingClientRect();b({height:I,width:T})}x({column:Yr("column-gap",getComputedStyle(u).columnGap,p),row:Yr("row-gap",getComputedStyle(u).rowGap,p)})},[i,b,x,p]),!0,!1);return hs(()=>{e.itemHeight>0&&e.itemWidth>0&&S(!0)},[e]),v?null:m.jsx(l,{className:t,ref:h,...Ne(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(u=>{const w=o(u.index,u.data,d);return s?m.jsx(c,{...Ne(c,d),height:e.itemHeight,index:u.index,width:e.itemWidth},w):f.createElement(a,{...Ne(a,d),className:n,"data-index":u.index,key:w},r(u.index,u.data,d))})})}),Il=f.memo(function(){const e=Re("HeaderComponent"),t=Qe("headerHeight"),n=Re("headerFooterTag"),r=Ct(f.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),kl=f.memo(function(){const e=Re("FooterComponent"),t=Qe("footerHeight"),n=Re("headerFooterTag"),r=Ct(f.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),Rl=({children:e})=>{const t=f.useContext(ps),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=Ct(f.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return f.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),m.jsx("div",{ref:o,style:xn(!1),children:e})},Tl=({children:e})=>{const t=f.useContext(ps),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Re("customScrollParent"),s=$o(n,o,!1);return f.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),m.jsx("div",{ref:s,style:xn(!1),children:e})},_l=f.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?El:Ml,o=n||t?Tl:Rl,s=Re("context");return m.jsx(r,{...e,...Ne(r,s),children:m.jsxs(o,{children:[m.jsx(Il,{}),m.jsx(Cl,{}),m.jsx(kl,{})]})})}),{useEmitter:Ss,useEmitterValue:Re,usePublisher:Qe}=ds(wl,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},_l),Ml=bs({useEmitter:Ss,useEmitterValue:Re,usePublisher:Qe}),El=xs({useEmitter:Ss,useEmitterValue:Re,usePublisher:Qe});function Yr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const vn=f.createContext(void 0);function we(e,t){const n=f.useContext(vn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return Qt(n,e,t)}function Xr(){const e=f.useContext(vn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const vr=f.createContext(void 0);function St(){const e=f.useContext(vr);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function Y(e,t){const n=f.useContext(vr);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return Qt(n,o=>e(o.progress),t)}const jl="_run_zzb61_3",Pl="_runWrap_zzb61_7",Ol="_highlight_zzb61_13",Bl="_highlightleft_zzb61_14",zl="_highlightright_zzb61_15",Al="_highlightcenter_zzb61_16",Ll="_underline_zzb61_48",Gl="_underlineleft_zzb61_49",Hl="_underlineright_zzb61_50",Nl="_underlinecenter_zzb61_51",st={run:jl,runWrap:Pl,highlight:Ol,highlightleft:Bl,highlightright:zl,highlightcenter:Al,underline:Ll,underlineleft:Gl,underlineright:Hl,underlinecenter:Nl},Zr=e=>Symbol.iterator in e,Jr=e=>"entries"in e,eo=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},Fl=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function Wl(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Zr(e)&&Zr(t)?Jr(e)&&Jr(t)?eo(e,t):Fl(e,t):eo({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Kt(e){const t=f.useRef(void 0);return n=>{const r=e(n);return Wl(t.current,r)?t.current:t.current=r}}function Vl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function Dl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const $l=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),ys=f.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=we(y=>y.setClipIndex),i=we(y=>y.seek),a=Y(y=>y.setCurrentGlobalRunIndex),l=Y(y=>y.rangeStartGI),c=Y(y=>y.rangeEndGI),d=Y(y=>y.setRange),b=l!=null&&c!=null,x=f.useCallback(y=>{var L;const _=(L=y.target)==null?void 0:L.closest("[data-g]");if(!_)return;const B=Number(_.dataset.g),R=B-r;if(R<0||R>=t.length)return;const P=t[R],k=P.text??"";if(!k.trim()||!/[가-힣a-zA-Z0-9]/.test(k))return;a(B,"program");const O=P.audioChunkIndex,z=P.audioTimeMs;O!=null&&z!=null&&(s(O),i(z))},[t,r,i,s,a]),p=f.useRef(null),v=f.useRef(!1),S=f.useCallback(y=>{var P;const _=(P=y.target)==null?void 0:P.closest("[data-g]");if(!_)return;const B=Number(_.dataset.g),R=B-r;R<0||R>=t.length||(v.current=!1,p.current&&(window.clearTimeout(p.current),p.current=null),p.current=window.setTimeout(()=>{d(B,B),v.current=!0,p.current=null},800))},[t,r,d]),h=f.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),u=f.useCallback(()=>{h()},[h]),w=h,C=h,I=Y(y=>y.clearRange),T=f.useCallback(y=>{var R;if(v.current){v.current=!1;return}const _=(R=y.target)==null?void 0:R.closest("[data-g]");if(!_)return;const B=Number(_.dataset.g);isNaN(B)||b&&l!=null&&c!=null&&(I(),y.stopPropagation())},[b,l,c,I]),E=o,g=r+t.length-1;return m.jsx("span",{onClick:T,onDoubleClick:x,onPointerDown:S,onPointerUp:u,onPointerCancel:w,onPointerLeave:C,children:E.map((y,_)=>m.jsx(Ul,{ns:n,group:y,runs:t,paraLastG:g,rangeStartGI:l,rangeEndGI:c},`${n}/grp:${_}-${y.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),ql=f.memo(function(){const t=f.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=te(Kt(t));return n.showSplit?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&m.jsx("span",{children:" / "}),m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),Ul=f.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=f.useCallback(h=>{const u=h.currentGlobalRunIndex;return u!=null&&u>=n.startG&&u<=n.endG},[n]),l=Y(Kt(a)),c=f.useCallback(h=>l?{showPointer:h.showPointer,pointerStyle:h.pointerStyle,pointerColor:h.pointerColor}:$l,[l]),d=te(Kt(c)),b=n.r0??0,x=n.len??Math.max(0,n.endG-n.startG+1),p=l&&d.showPointer&&d.pointerStyle!=="underline",v=l&&d.showPointer&&d.pointerStyle==="underline",S=p||v?{"--hl-color":d.pointerColor,"--ul-color":d.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:x}).map((h,u)=>{const C=r[b+u],I=n.startG+u,T=`${t}/run:${I}`,E=!!C.split&&I!==o;let g=`${st.runWrap}`;return p&&(x===1?g+=` ${st.highlight}`:u===0?g+=` ${st.highlightleft}`:u+1===x?g+=` ${st.highlightright}`:g+=` ${st.highlightcenter}`),v&&(x===1?g+=` ${st.underline}`:u===0?g+=` ${st.underlineleft}`:u+1===x?g+=` ${st.underlineright}`:g+=` ${st.underlinecenter}`),m.jsxs(f.Fragment,{children:[m.jsx("span",{className:g,style:S,children:m.jsx(Kl,{gi:n.startG,g:I,run:C,active:l,pointerCfg:d,isInRange:s!=null&&i!=null&&I>=s&&I<=i})}),E&&m.jsx(ql,{})]},T)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Kl=f.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=f.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const c=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=c;const d=c.startsWith("#")?Vl(c):Dl(c);d&&(.299*d.r+.587*d.g+.114*d.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:st.run,style:a,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Ql({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var c;const i=e.list?e.list.level*24:0,a=((c=e.list)==null?void 0:c.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??a;return m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?m.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,m.jsx(ys,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Yl=f.memo(Ql,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Xl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return no(e,!1);case"upperalpha":case"upperlatin":return no(e,!0);case"lowerroman":return to(e,!1);case"upperroman":return to(e,!0);case"decimalenclosedcircle":return Zl(e);default:return String(e)}}function Zl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function to(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function no(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function Sr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function yr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Xl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Jl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function ea(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function ta(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const na="_scroller_kqkmq_3",ra={scroller:na},oa=f.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${ra.scroller}${t?" "+t:""}`,style:n,...r})});function At(){const e=f.useContext(wt);if(!e)throw new Error("useViewerRecorderStoreApi must be used inside <ViewerRecorderProvider>");return e}const sr=e=>/[가-힣a-zA-Z0-9]/.test(e),sa=e=>((e==null?void 0:e.textContent)??"").trim(),dn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function ia(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,a=1/0,l=1/0,c=-1,d=1/0,b=1/0;const x=e.querySelectorAll("[data-g]");for(let p=0;p<x.length;p++){const v=x[p];if(!v||!v.isConnected)continue;const S=sa(v);if(!S||!sr(S))continue;const h=v.getBoundingClientRect();if(h.height<=r||h.width<=r||h.bottom<=o.top||h.top>=o.bottom)continue;if(h.top<s){const C=Math.abs(h.top-s);(C<d||C===d&&(h.top<b||c!==-1&&Number(v.dataset.g)<c))&&(d=C,c=Number(v.dataset.g),b=h.top);continue}const u=Number(v.dataset.g);if(Number.isNaN(u))continue;h.top<l-n?(l=h.top,a=h.top,i=u):h.top<=l+n&&(h.top<a||h.top===a&&(i===-1||u<i))&&(a=h.top,i=u);const w=Math.abs(h.top-s);(w<d||w===d&&(h.top<b||c!==-1&&u<c))&&(d=w,c=u,b=h.top)}return i!==-1?i:c}const ws=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=dn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=dn(e,t)}return s},ro=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of o){const l=a.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const c=Number(a.dataset.g);Number.isNaN(c)||(c<s&&(s=c),c>i&&(i=c))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},la=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=dn(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),a=s.height*n,l=i.top-(s.top+a);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function aa(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Bn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!la(e,t,{topPaddingRatio:n,behavior:r}))return!1;await aa(e,o);const i=dn(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,d=a.top+c,b=l.top-d;return Math.abs(b)<=1},ft=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),wr=f.createContext(null);function Cs(){const e=f.useContext(wr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Ze(e,t){const n=f.useContext(wr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return Qt(n,e,t)}const Is=()=>{const e=Y(n=>n.section),t=e.quiz;if(t&&t.length){const n=Cs();return m.jsxs("button",{onClick:()=>{n.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",t.length,")"]})}else return null},ca="_navBtn_rnisf_2",ua="_disabled_rnisf_25",da="_label_rnisf_31",Pt={navBtn:ca,disabled:ua,label:da};var ks={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},oo=f.createContext&&f.createContext(ks),fa=["attr","size","title"];function pa(e,t){if(e==null)return{};var n=ha(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function ha(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function fn(){return fn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},fn.apply(this,arguments)}function so(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function pn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?so(Object(n),!0).forEach(function(r){ga(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):so(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ga(e,t,n){return t=ma(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ma(e){var t=ba(e,"string");return typeof t=="symbol"?t:t+""}function ba(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rs(e){return e&&e.map((t,n)=>f.createElement(t.tag,pn({key:n},t.attr),Rs(t.child)))}function Ye(e){return t=>f.createElement(xa,fn({attr:pn({},e.attr)},t),Rs(e.child))}function xa(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=pa(e,fa),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),f.createElement("svg",fn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:pn(pn({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&f.createElement("title",null,s),e.children)};return oo!==void 0?f.createElement(oo.Consumer,null,n=>t(n)):t(ks)}function io(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function lo(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const va=({isIcon:e=!0})=>{const t=Y(i=>i.isCanPrev),n=Y(i=>i.onSectionNav),r=!t,o=f.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Pt.navBtn} ${r?Pt.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(io,{size:18}),m.jsx("span",{className:Pt.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(io,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},hn=({isIcon:e=!0})=>{const t=Y(i=>i.isCanNext),n=Y(i=>i.onSectionNav),r=!t,o=f.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Pt.navBtn} ${r?Pt.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(lo,{size:18}),m.jsx("span",{className:Pt.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(lo,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function Ts(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function Sa({section:e,blocks:t,nsPrefix:n}){const r=f.useMemo(()=>{const y=[],_=Sr();return t.forEach((B,R)=>{B.type==="paragraph"&&(y[R]=yr(B,_))}),y},[t]),o=Y(y=>{var _;return((_=y.layout)==null?void 0:_.prefix)??[]}),s=Y(y=>{var _;return((_=y.derivedNav)==null?void 0:_.splitGroupsPerBlock)??[]}),i=te(y=>y.marginX),a=te(y=>y.viewportHeight),l=te(y=>y.playbackViewportHeight),c=l>0?l:a,d=f.useRef({start:0,end:0}),b=f.useCallback(y=>{const _=t[y],B=`${n}blk-${_.id}`;if(_.type==="image"){const{src:k,alt:O,width:z,height:L}=_,j=z&&L?`${z} / ${L}`:"4 / 3",A=y>=d.current.start&&y<=d.current.end,W=c>80?Math.floor((c-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:W,aspectRatio:j},children:m.jsx("img",{src:k,alt:O||"",loading:A?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),O&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:O})]})}const R=r[y]??void 0,P=s[y];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Yl,{block:_,computedMarker:R,ns:B,baseIndex:o[y],sectionId:e.section_id,preGroups:P})})},[t,r,o,n,e,s,c]),x=f.useRef(null),p=f.useCallback(y=>{x.current=y},[]),v=f.useMemo(()=>f.memo(y=>{const{style:_,children:B,...R}=y;return m.jsx("div",{...R,style:_,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:B})})}),[i]),S=f.useRef(null),h=f.useMemo(()=>t.map(y=>y.id),[t]),u=f.useCallback(()=>{const y=e.quiz,_=Math.max(80,Math.floor(c*.5));return y&&y.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(Is,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(hn,{isIcon:!1})}),m.jsx("div",{style:{height:_,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(hn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,c]),w=f.useMemo(()=>({Item:v,Header:()=>m.jsx("div",{style:{height:40}}),Footer:u,Scroller:oa}),[u,v]),C=f.useCallback(y=>h[y],[h]),I=St(),[T]=f.useState(()=>I.getState().progress.currentGlobalRunIndex??0),E=f.useMemo(()=>{if(!o.length)return 0;const y=o[o.length-1],_=Math.max(0,Math.min(T,y));return Ts(o,_)},[o,T]);console.log("SectionRenderVirtuoso확인");const g=St();return f.useEffect(()=>{const y=x.current;y&&(console.log("@@@@@@@@@@@@@@@@"),(async()=>{const _=g.getState().progress.currentGlobalRunIndex,B=g.getState().progress.setSectionLoading;console.log("giFromStore",_);const R=_!=null&&_>=0?_:0;await ws(y,R),await ft(),await ft(),await ft(),await ft(),console.log("첫랜더끝"),B(!1)})())},[x,g]),m.jsxs(m.Fragment,{children:[m.jsx(gl,{ref:S,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:C,totalCount:t.length,itemContent:b,initialTopMostItemIndex:E,increaseViewportBy:{top:200,bottom:200},components:w,scrollerRef:p}),m.jsx(ya,{scrollContainerRef:x,virtRef:S,prefix:o})]})}const ya=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=Y(k=>k.setCurrentGlobalRunIndex),o=Y(k=>k.registerSectionScrollApi),s=Y(k=>k.currentGlobalRunIndex),i=we(k=>k.scrollLock),a=we(k=>k.syncToGI),l=At(),c=f.useRef(!1),d=f.useRef(null),b=f.useRef(null),x=f.useRef(null),p=f.useRef(-1),v=f.useCallback(()=>{if(i)return;d.current=null;const k=b.current;if(!k)return;const O=ia(k,5);O!==-1&&O!==p.current&&(p.current=O,a(O),r(O,"scroll"))},[i,a,r]),S=f.useCallback(k=>{b.current=k,d.current==null&&(d.current=requestAnimationFrame(v))},[v]),h=f.useCallback(k=>{b.current=k,x.current!=null&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{x.current=null,v();const O=p.current;if(O===-1)return;const z=k.scrollTop,L=k.scrollHeight-k.clientHeight,j=L>0?z/L:0;let A=0;const W=k.querySelector(`[data-g="${O}"]`);if(W){const U=k.getBoundingClientRect();A=(W.getBoundingClientRect().top-U.top)/U.height}l.getState().emit({type:"scroll",payload:{scrollTop:z,scrollRatio:j,anchorGI:O,anchorOffsetRatio:A}})},100)},[v,l]),u=f.useRef(!1),w=f.useCallback(k=>{i||c.current&&(u.current||(S(k),h(k)))},[i,S,h]),C=f.useRef(void 0),I=f.useRef(void 0),T=f.useRef(void 0),E=f.useRef(void 0);f.useEffect(()=>{const k=e.current;if(k)return C.current=()=>{c.current=!0},I.current=()=>{c.current=!0},T.current=()=>{c.current=!0},E.current=()=>w(k),k.addEventListener("wheel",C.current,{passive:!0}),k.addEventListener("touchmove",I.current,{passive:!0}),window.addEventListener("keydown",T.current,{passive:!0}),k.addEventListener("scroll",E.current,{passive:!0}),()=>{k.removeEventListener("wheel",C.current),k.removeEventListener("touchmove",I.current),window.removeEventListener("keydown",T.current),k.removeEventListener("scroll",E.current),d.current!=null&&cancelAnimationFrame(d.current),x.current!=null&&(clearTimeout(x.current),x.current=null)}},[w,e]),f.useEffect(()=>{const k=e.current;if(!k||!i)return;const O=A=>{A.preventDefault(),A.stopPropagation(),c.current=!1},z=A=>{A.preventDefault(),A.stopPropagation(),c.current=!1},L=A=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),c.current=!1)},j={overscrollBehavior:k.style.overscrollBehavior,touchAction:k.style.touchAction};return k.style.overscrollBehavior="contain",k.style.touchAction="none",k.addEventListener("wheel",O,{passive:!1}),k.addEventListener("touchmove",z,{passive:!1}),window.addEventListener("keydown",L,{passive:!1}),()=>{k.removeEventListener("wheel",O),k.removeEventListener("touchmove",z),window.removeEventListener("keydown",L),k.style.overscrollBehavior=j.overscrollBehavior,k.style.touchAction=j.touchAction}},[i,e]);const g=f.useRef({first:-1,last:-1}),y=f.useRef(!1),_=f.useCallback(()=>{const k=e.current;if(!k)return;const O=ro(k),z=(O==null?void 0:O.first)??-1,L=(O==null?void 0:O.last)??-1;g.current={first:z,last:L}},[e]),B=f.useRef(!1),R=f.useCallback(()=>{const k=e.current;if(!k||B.current)return;B.current=!0;const O=Math.min(k.scrollTop+Math.floor(k.clientHeight*.6),k.scrollHeight-k.clientHeight);requestAnimationFrame(()=>{k.scrollTo({top:O,behavior:"instant"})})},[e]);f.useEffect(()=>{!y.current&&i&&(B.current=!1,_()),y.current=i},[i,_]),f.useEffect(()=>{if(i!==!0)return;const k=e.current;if(!k)return;const{first:O,last:z}=g.current;if(O===-1||z===-1){R();return}if(k.scrollTop<=1){(async()=>{try{u.current=!0,await Bn(k,s,{behavior:"smooth",topPaddingRatio:.2})}finally{u.current=!1}_()})();return}if(s<O||s>z){async function j(){if(!k)return;const A=k.scrollTop<=1?0:.2;return await Bn(k,s,{behavior:"smooth",topPaddingRatio:A})}j().then(A=>{A?_():R()})}},[i,s,R,_,e]);const P=f.useCallback(()=>{const k=e.current;if(!k)return;function O(K,oe,G=.2,ee=.8){const M=K.querySelector(`[data-g="${oe}"]`);if(!M)return!1;const F=K.getBoundingClientRect(),H=M.getBoundingClientRect();if(H.height<=0||F.height<=0)return!1;const $=(H.top+H.height/2-F.top)/F.height;return $>=G&&$<=ee}const z=K=>K==="instant"?"auto":K,L=K=>{const oe=k.scrollTop,G=k.scrollHeight-k.clientHeight,ee=G>0?oe/G:0;let M=0;const F=k.querySelector(`[data-g="${K}"]`);if(F){const H=k.getBoundingClientRect();M=(F.getBoundingClientRect().top-H.top)/H.height}l.getState().emit({type:"scroll",payload:{scrollTop:oe,scrollRatio:ee,anchorGI:K,anchorOffsetRatio:M}})},j=async(K,oe="smooth")=>{var ee;const G=Ts(n,K);(ee=t.current)==null||ee.scrollToIndex({index:G,align:"start",behavior:z(oe)}),await ws(k,K)},A=()=>new Promise(K=>requestAnimationFrame(()=>K())),W=async K=>{if(O(k,K,.1,.7))return L(K),!0;u.current=!0;const oe=k.querySelector(`[data-g="${K}"]`),G=k.getBoundingClientRect();let ee=k.scrollTop<=1?0:.1;if(oe){const F=oe.getBoundingClientRect();ee=((F.top+F.height/2-G.top)/G.height>.5,.15)}const M=!!oe;return M?(await Bn(k,K,{behavior:"smooth",topPaddingRatio:ee}),await A()):M||await j(K,"auto"),u.current=!1,L(K),O(k,K,.1,.7)},U=async K=>W(K);return{ensureVisibleGI:W,scrollToGI:U,getVisibleRange:()=>ro(k),getScrollTop:()=>k.scrollTop,setScrollTop:K=>{k.scrollTop=K},getAnchorOffsetRatio:K=>{const oe=k.querySelector(`[data-g="${K}"]`);if(!oe)return 0;const G=oe.getBoundingClientRect(),ee=k.getBoundingClientRect();return(G.top-ee.top)/ee.height},scrollToGIAtOffset:async(K,oe)=>{await U(K),await new Promise(Q=>setTimeout(Q,50));const G=k.querySelector(`[data-g="${K}"]`);if(!G)return;const ee=G.getBoundingClientRect(),M=k.getBoundingClientRect(),F=ee.top-M.top,H=oe*M.height,$=F-H;k.scrollTop=k.scrollTop+$}}},[e,t,n,l]);return f.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(P()),()=>o(void 0)),[P,o]),null};function wa(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function Ca(){const e=Y(v=>v.section),t=te(v=>v.theme),n=te(v=>v.fontFamily),r=te(v=>v.fontSizePx),o=te(v=>v.lineHeight),s=an[t],{blocks:i,nsPrefix:a}=f.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=Ot(),c=f.useCallback(()=>{const{isSettingsOpen:v,setSettingsOpen:S,toggleOverlays:h}=l.getState();v?S(!1):h()},[l]),{onClick:d,onDoubleClick:b}=ri({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:wa}),x=f.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitOverflowScrolling:"touch"}),[n,s.bg,s.fg,r,o]),p=f.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:d,onDoubleClick:b,style:x,children:m.jsx("div",{style:p,children:m.jsx(Sa,{section:e,blocks:i,nsPrefix:a})})})}function Ia(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function ka(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function Ra(e){return Ye({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function Ta(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function _a(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const Ma="_wrap_1pn6r_2",Ea="_visible_1pn6r_21",ja="_container_1pn6r_27",Pa="_leftGroup_1pn6r_36",Oa="_rightGroup_1pn6r_37",Ba="_leftleftGroup_1pn6r_51",za="_leftrightGroup_1pn6r_52",Aa="_btn_1pn6r_78",La="_btnForbidden_1pn6r_100",Ga="_btnActive_1pn6r_107",Ha="_label_1pn6r_112",Le={wrap:Ma,visible:Ea,container:ja,leftGroup:Pa,rightGroup:Oa,leftleftGroup:Ba,leftrightGroup:za,btn:Aa,btnForbidden:La,btnActive:Ga,label:Ha},Na=f.memo(function(){const t=f.useRef(null),n=f.useContext(wt),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=we(R=>R.status),s=we(R=>R.currentTimeMs),i=we(R=>R.currentClip),a=we(R=>R.clips),l=we(R=>R.playbackKind),c=te(R=>R.audioTargetWpm),d=te(R=>R.setAudioSpeed),b=te(R=>R.muteAudio),x=te(R=>R.audioSpeed),p=we(R=>R.getClipSrc),v=we(R=>R._onTime),S=we(R=>R._onEnded),h=we(R=>R._onError),u=Y(R=>R.setCurrentGlobalRunIndex),w=Y(R=>R.getSectionScrollApi),C=Y(R=>R.snapToReadable),I=Y(R=>R.edgeReadable),T=f.useRef(null),E=f.useRef(null),g=f.useRef(!1),y=f.useRef(null);f.useEffect(()=>{var k,O;const R=((O=(k=a==null?void 0:a[i])==null?void 0:k.meta)==null?void 0:O.wpm)??200,P=(c||200)/R;d(P)},[a,i,c,d]),f.useEffect(()=>{l==="real"&&(g.current=!0)},[l]);const _=f.useMemo(()=>{const R=p(i);if(!R)return null;try{return new URL(R,window.location.href).href}catch{return R}},[i,p]);f.useEffect(()=>{g.current=!0},[_]),f.useEffect(()=>{const R=t.current;if(!R)return;const P=()=>{if(R.paused||R.ended)return;const z=R.currentTime*1e3;g.current&&z===0||(z>0&&(g.current=!1),v(z))},k=()=>{var L,j;S();const z=I(1);typeof z=="number"&&z>=0&&(u(z,"audio"),(j=(L=w())==null?void 0:L.ensureVisibleGI)==null||j.call(L,z))},O=z=>{const L=z.currentTarget;console.warn("Audio error",{networkState:L.networkState,readyState:L.readyState}),h()};return R.addEventListener("timeupdate",P),R.addEventListener("ended",k),R.addEventListener("error",O),()=>{R.removeEventListener("timeupdate",P),R.removeEventListener("ended",k),R.removeEventListener("error",O)}},[v,S,h,I,u,w]),f.useEffect(()=>{if(r)return;const R=t.current;if(!R)return;if(!_){try{R.pause()}catch(z){console.log("pause error",z)}E.current=null;return}const P=R.currentSrc||R.src||null,k=!P||P!==_;if(k){try{R.pause()}catch(z){console.log("pause error",z)}R.src=_;try{R.load()}catch(z){console.log("load error",z)}E.current=_}R.muted=!!b,R.volume=1,R.playbackRate=typeof x=="number"?x:1;const O=async()=>{k&&await new Promise(z=>{let L=!1;const j=()=>{L||(L=!0,R.removeEventListener("loadedmetadata",j),R.removeEventListener("canplay",j),z())};R.addEventListener("loadedmetadata",j),R.addEventListener("canplay",j),R.readyState>=1&&j()});try{await R.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{R.pause()}catch(z){console.log("pause error",z)}},[_,b,o,x,r]),f.useEffect(()=>{if(r)return;const R=t.current;if(!R||l!=="real")return;const P=s/1e3;if(Number.isFinite(P)){if(R.readyState<1){T.current=s;const k=()=>{if(T.current!=null){const O=T.current/1e3;try{R.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}T.current=null}R.removeEventListener("loadedmetadata",k),R.removeEventListener("canplay",k)};R.addEventListener("loadedmetadata",k),R.addEventListener("canplay",k);return}if(Math.abs(R.currentTime-P)>.2)try{R.currentTime=P}catch(k){console.log("currentTime보정오류",k)}}},[s,l,r]);const B=we(R=>R.getGIFromCT);return f.useEffect(()=>{var k,O;if(r||l!=="real"||o!=="playing"&&o!=="loading")return;const R=B(i,s);if(R<0)return;const P=C(R);P!==y.current&&(y.current=P,u(P,"audio"),P%5===0&&((O=(k=w())==null?void 0:k.ensureVisibleGI)==null||O.call(k,P)))},[o,i,s,l,B,C,u,w,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Fa(){return m.jsx(Na,{})}const Wa="_scrubberWrap_jtztl_2",Va="_labels_jtztl_8",Da="_index_jtztl_14",$a="_controls_jtztl_18",qa="_percent_jtztl_24",Ua="_range_jtztl_45",Rt={scrubberWrap:Wa,labels:Va,index:Da,controls:$a,percent:qa,range:Ua};function Ka(){const e=Y(I=>I.currentGlobalRunIndex),t=Y(I=>I.totalRuns),n=Y(I=>I.setCurrentGlobalRunIndex),r=Y(I=>I.getSectionScrollApi),o=Y(I=>I.giToPercentTotal),s=Y(I=>I.percentToGITotal),i=Y(I=>I.snapToReadable),a=we(I=>I.scrollLock),l=we(I=>I.pause),c=we(I=>I.play),d=we(I=>I.syncToGI),[b,x]=f.useState(()=>o(e||0));f.useEffect(()=>{x(o(e||0))},[e,o]);const p=f.useRef(!1),v=f.useMemo(()=>Math.max(0,Math.min(e??0,Math.max(0,(t??1)-1)))+1,[e,t]),S=f.useCallback(()=>{a&&(l(),p.current=!0)},[a,l]),h=f.useCallback(I=>{x(Number(I.currentTarget.value))},[]),u=f.useCallback(async()=>{const I=s(b),T=i(I);l(),n(T,"scrubber-commit"),d(T);const E=r();E!=null&&E.ensureVisibleGI&&await E.ensureVisibleGI(T),p.current&&(p.current=!1,c())},[b,s,i,l,n,d,r,c]),w=f.useMemo(()=>({"--pct":`${b}%`}),[b]),C=f.useMemo(()=>Math.round(b),[b]);return m.jsxs("div",{className:Rt.scrubberWrap,children:[m.jsx("div",{className:Rt.labels,children:m.jsxs("span",{className:Rt.index,children:[v," / ",t||0]})}),m.jsxs("div",{className:Rt.controls,children:[m.jsx("input",{type:"range",className:Rt.range,min:0,max:100,step:.5,value:b,style:w,onMouseDown:S,onTouchStart:S,onChange:h,onMouseUp:()=>{u()},onTouchEnd:()=>{u()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void u():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:Rt.percent,children:[C,"%"]})]})]})}const Qa=f.memo(Ka),Ya=e=>Math.max(50,Math.min(500,e)),Xa=f.memo(function(){const t=f.useContext(wt),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=we(y=>y.playbackKind),o=we(y=>y.status),s=we(y=>y.fake),i=te(y=>y.audioTargetWpm),a=we(y=>y.pause),l=Y(y=>y.totalRuns),c=Y(y=>y.currentGlobalRunIndex),d=Y(y=>y.setCurrentGlobalRunIndex),b=Y(y=>y.getSectionScrollApi),x=Y(y=>y.nextReadableFrom),p=Y(y=>y.edgeReadable),v=f.useRef(null),S=f.useRef(null),h=f.useRef(0),u=f.useRef(-1),w=!n&&r==="fake"&&o==="playing",C=Math.max(1,(s==null?void 0:s.totalWords)??1),I=f.useMemo(()=>{const y=Ya(i||200);return C/y*6e4},[C,i]),T=f.useMemo(()=>!l||l<=1||I<=0?0:(l-1)/I,[l,I]);f.useEffect(()=>{if(!w)return;const y=Math.max(0,Math.min(c??0,Math.max(0,(l??1)-1)));h.current=y,u.current=y,S.current=null},[w,c,l]);const E=f.useRef(-1);f.useEffect(()=>{if(!l){E.current=-1;return}const y=p(1);E.current=y??-1},[p,l]);const g=f.useCallback(y=>{(async()=>{var L,j;if(!w){v.current=null;return}if(!l||l<=1||T<=0){v.current=null;return}const _=S.current;S.current=y;const B=_==null?0:Math.max(0,y-_),R=l-1;h.current=Math.min(R,h.current+T*B);const P=Math.floor(h.current),k=b(),O=x(P,1);if(O==null){const A=E.current>=0?E.current:P;A!==u.current&&(u.current=A,d(A,"audio"),await((L=k==null?void 0:k.ensureVisibleGI)==null?void 0:L.call(k,A))),a(),v.current=null;return}const z=O;z!==u.current&&(u.current=z,d(z,"audio"),z%5===0&&await((j=k==null?void 0:k.ensureVisibleGI)==null?void 0:j.call(k,z))),v.current=requestAnimationFrame(g)})().catch(console.error)},[w,l,T,x,d,b,a]);return f.useEffect(()=>(w?v.current==null&&(v.current=requestAnimationFrame(g)):(v.current&&(cancelAnimationFrame(v.current),v.current=null),S.current=null),()=>{v.current&&(cancelAnimationFrame(v.current),v.current=null)}),[w,g]),null}),Za=f.memo(function(){return m.jsx(Xa,{})}),Ja="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",ec="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",tc="_WPMSpeedButtonsWrap_pxoh4_1",nc="_btnWrap_pxoh4_8",rc="_label_pxoh4_14",oc="_wpmString_pxoh4_21",sc="_iconBtn_pxoh4_24",Tt={WPMSpeedButtonsWrap:tc,btnWrap:nc,label:rc,wpmString:oc,iconBtn:sc},ao=5,co=350,ic=40,lc=.85,ac=e=>Math.max(50,Math.min(500,e)),cc=f.memo(function(){const t=te(b=>b.audioTargetWpm);te(b=>b.audioSpeed);const n=te(b=>b.setAudioTargetWpm),r=f.useRef(t);f.useEffect(()=>{r.current=t},[t]);const o=f.useRef(null),s=f.useRef(co),i=f.useRef(null),a=f.useCallback(b=>{const x=r.current,p=b==="inc"?ao:-ao,v=ac(x+p);return v===x?!1:(n(v),r.current=v,!0)},[n]),l=f.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=f.useCallback(()=>{i.current&&(s.current=Math.max(ic,Math.floor(s.current*lc)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),d=f.useCallback(b=>{if(i.current)return;i.current=b,s.current=co,a(b)&&c();const p=()=>l();window.addEventListener("mouseup",p,{once:!0}),window.addEventListener("touchend",p,{once:!0})},[c,a,l]);return f.useEffect(()=>l,[l]),m.jsx("div",{onMouseLeave:l,className:Tt.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Tt.btnWrap,children:[m.jsxs("button",{className:Tt.iconBtn,type:"button",title:"WPM 느리게",onMouseDown:()=>d("dec"),onTouchStart:b=>{b.preventDefault(),d("dec")},onMouseUp:l,children:[m.jsx("img",{src:Ja})," "]}),m.jsxs("div",{className:Tt.label,children:[m.jsx("div",{children:t}),m.jsx("div",{className:Tt.wpmString,children:"WPM"})]}),m.jsx("button",{className:Tt.iconBtn,type:"button",title:"WPM 빠르게",onMouseDown:()=>d("inc"),onTouchStart:b=>{b.preventDefault(),d("inc")},onMouseUp:l,children:m.jsx("img",{src:ec})})]})})}),uc="_StepBtn_ua1nh_1",dc={StepBtn:uc};function fc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function pc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function uo({direction:e}){const t=Y(x=>x.currentGlobalRunIndex),n=Y(x=>x.totalRuns),r=Y(x=>x.hasReadableInDir),o=Y(x=>x.computeStepTarget),s=Y(x=>x.giToPercentTotal),i=Y(x=>x.setCurrentGlobalRunIndex),a=we(x=>x.syncToGI),l=Y(x=>x.getSectionScrollApi),c=f.useCallback(async x=>{var S,h;const p=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),v=o(p,x);i(v,"scrubber-step"),a(v),await((h=(S=l())==null?void 0:S.ensureVisibleGI)==null?void 0:h.call(S,v))},[t,n,o,i,s,a,l]),d=f.useMemo(()=>{const x=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),p=!n||!r(x,1),v=!n||!r(x,-1);return e==="left"?v:p},[e,n,t]),b=f.useCallback(()=>{c(e==="left"?-1:1)},[e,c]);return m.jsx("button",{className:dc.StepBtn,type:"button",onClick:b,disabled:d,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(fc,{}):m.jsx(pc,{})})}const hc="_GCPlayBtn_1p162_1",gc="_playing_1p162_28",fo={GCPlayBtn:hc,playing:gc},mc=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${fo.GCPlayBtn} ${r?fo.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function bc(){const e=te(C=>C.showOverlays),t=Y(C=>C.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=te(C=>C.muteAudio),s=te(C=>C.showPointer),i=te(C=>C.showSplit),a=te(C=>C.toggleMuteAudio),l=te(C=>C.toggleShowPointer),c=te(C=>C.toggleShowSplit),d=Xr(),b=St();f.useEffect(()=>{const C=d.getState(),{syncToGI:I,useFake:T,useReal:E}=C,g=C.playbackKind,y=b.getState().progress.currentGlobalRunIndex??0;if(!r){g!=="fake"&&T();return}o?g!=="fake"&&(console.log("이부분일까?"),T()):g!=="real"&&(I(y),E())},[r,o,b,d]);const x=we(C=>C.play),p=we(C=>C.pause),v=we(C=>C.status),S=f.useCallback(C=>{C.stopPropagation(),v==="playing"||v==="loading"?p():x()},[v,x,p]),h=Xr(),u=St(),w=f.useCallback(async C=>{var L,j;if(C.stopPropagation(),v==="playing"||v==="loading"){p();return}const{progress:I}=u.getState(),{currentGlobalRunIndex:T,snapToReadable:E,edgeReadable:g,setCurrentGlobalRunIndex:y,getSectionScrollApi:_}=I,B=h.getState(),R=B.currentClip,P=_==null?void 0:_(),k=typeof T=="number"?T:0,O=typeof E=="function"?E(k):k,z=typeof g=="function"?g(1):null;if(z!=null&&O>=z){y==null||y(z,"audio"),await((L=P==null?void 0:P.ensureVisibleGI)==null?void 0:L.call(P,z)),B.syncToGI(z);return}y==null||y(O,"audio"),await((j=P==null?void 0:P.ensureVisibleGI)==null?void 0:j.call(P,O)),B.syncToGI(O),x(R)},[v,p,x,h,u]);return m.jsxs("div",{className:`${Le.wrap} ${e?Le.visible:""}`,onClick:C=>{C.stopPropagation()},onTouchStart:C=>{C.stopPropagation()},children:[m.jsx(Qa,{}),r&&!o?m.jsx(Fa,{}):m.jsx(Za,{}),m.jsxs("div",{className:Le.container,children:[m.jsxs("div",{className:Le.leftGroup,children:[m.jsxs("div",{className:Le.leftleftGroup,children:[m.jsx(uo,{direction:"left"}),m.jsx(mc,{isPlaying:v==="playing",onClick:o?w:S,title:v==="playing"?"일시정지":"재생"}),m.jsx(uo,{direction:"right"})]}),m.jsx("div",{className:Le.leftrightGroup,children:m.jsx(cc,{})})]}),m.jsxs("div",{className:Le.rightGroup,children:[r&&m.jsxs("button",{type:"button",onClick:C=>{C.stopPropagation(),a()},className:`${Le.btn} ${o?"":Le.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(Ia,{size:18}):m.jsx(ka,{size:18}),m.jsx("span",{className:Le.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:C=>{C.stopPropagation(),l()},className:`${Le.btn} ${s?Le.btnActive:""}`,title:"포인터 표시",children:[m.jsx(Ra,{size:18}),m.jsx("span",{className:Le.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:C=>{C.stopPropagation(),n&&c()},disabled:!n,className:`${Le.btn} ${i?Le.btnActive:""} ${n?"":Le.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(Ta,{size:18}),m.jsx("span",{className:Le.label,children:"끊어읽기"})]}),m.jsx(va,{}),m.jsx(hn,{})]})]})]})}const xc=f.memo(bc);function vc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const Sc="_host_v5qx1_3",yc="_topbar_v5qx1_11",wc="_visible_v5qx1_32",Cc="_backBtn_v5qx1_37",Ic="_title_v5qx1_58",kc="_settingsBtn_v5qx1_67",_t={host:Sc,topbar:yc,visible:wc,backBtn:Cc,title:Ic,settingsBtn:kc};function Rc(){const e=te(l=>l.showOverlays),t=Y(l=>l.onViewerClose),r=Y(l=>l.section).ast.title,o=te(l=>l.setSettingsOpen),s=te(l=>l.setShowOverlays),i=f.useCallback(()=>{t==null||t()},[t]),a=f.useCallback(()=>{o(!0),s(!1)},[o,s]);return m.jsx("div",{className:_t.host,children:m.jsxs("div",{className:`${_t.topbar} ${e?_t.visible:""}`,children:[m.jsx("button",{type:"button",className:_t.backBtn,onClick:i,"aria-label":"뒤로가기",children:m.jsx(_a,{size:28})}),m.jsx("div",{className:_t.title,children:m.jsx("span",{className:"truncate",children:r||"섹션 없음"})}),m.jsx("button",{type:"button",className:_t.settingsBtn,onClick:a,"aria-label":"뷰어 설정",children:m.jsx(vc,{size:28})})]})})}const Tc=f.memo(Rc),_c="_wrap_62su0_7",Mc="_wrapHidden_62su0_29",Ec="_wrapVisible_62su0_35",jc="_scrollArea_62su0_71",Pc="_row_62su0_81",Oc="_label_62su0_89",Bc="_btn_62su0_95",zc="_btnActive_62su0_106",Ac="_btnSmall_62su0_110",Lc="_pill_62su0_122",Gc="_themeCircle_62su0_133",Hc="_themeCircleActive_62su0_146",Nc="_stepRow_62su0_151",Fc="_stepLabel_62su0_159",Wc="_levelBox_62su0_172",Vc="_inlineFlex_62su0_177",_e={wrap:_c,wrapHidden:Mc,wrapVisible:Ec,scrollArea:jc,row:Pc,label:Oc,btn:Bc,btnActive:zc,btnSmall:Ac,pill:Lc,themeCircle:Gc,themeCircleActive:Hc,stepRow:Nc,stepLabel:Fc,levelBox:Wc,inlineFlex:Vc};function Dc({visible:e}){const t=te(g=>g.mode),n=te(g=>g.setMode),r=te(g=>g.theme),o=te(g=>g.setTheme),s=te(g=>g.fontFamily),i=te(g=>g.setFontFamily),a=te(g=>g.resetToDefaults),l=te(g=>g.getFontLevel()),c=te(g=>g.getLineLevel()),d=te(g=>g.getMarginLevel()),b=te(g=>g.setFontLevel),x=te(g=>g.setLineLevel),p=te(g=>g.setMarginLevel),v=te(g=>g.pointerStyle),S=te(g=>g.setPointerStyle),h=te(g=>g.pointerColor),u=te(g=>g.setPointerColor),w=te(g=>g.breakMarks),C=te(g=>g.toggleBreakMark),I=te(g=>g.getBreakGapLevel()),T=te(g=>g.setBreakGapLevel),E=`${_e.wrap} ${e?_e.wrapVisible:_e.wrapHidden}`;return m.jsxs("div",{className:E,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:_e.scrollArea,children:[m.jsx(Gt,{label:"열람방식",children:m.jsxs("div",{className:_e.inlineFlex,children:[m.jsx(Mt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(Mt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(Gt,{label:"테마",children:m.jsx("div",{className:_e.inlineFlex,children:Object.keys(an).map(g=>{const y=g,_=an[y];return m.jsx("button",{type:"button",onClick:()=>o(y),className:`${_e.themeCircle} ${r===g?_e.themeCircleActive:""}`,style:{background:_.bg,color:_.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),m.jsx(Gt,{label:"글꼴",children:m.jsx("div",{className:_e.inlineFlex,children:Fo.map(g=>m.jsx(Mt,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),m.jsx(on,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>b(Math.max(1,l-1)),onInc:()=>b(Math.min(12,l+1))}),m.jsx(on,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>x(Math.max(1,c-1)),onInc:()=>x(Math.min(7,c+1))}),m.jsx(on,{label:"여백",level:d,min:1,max:5,onDec:()=>p(Math.max(1,d-1)),onInc:()=>p(Math.min(5,d+1))}),m.jsx(Gt,{label:"포인터",children:m.jsxs("div",{className:_e.inlineFlex,children:[m.jsx(Mt,{active:v==="highlight",onClick:()=>S("highlight"),children:"형광펜"}),m.jsx(Mt,{active:v==="underline",onClick:()=>S("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:h,onChange:g=>u(g.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(Gt,{label:"끊기표시",children:m.jsx("div",{className:_e.inlineFlex,children:m.jsx(Mt,{active:w.slash,onClick:()=>C("slash"),children:"슬래쉬"})})}),m.jsx(on,{label:"끊기간격",level:I,min:1,max:5,onDec:()=>T(Math.max(1,I-1)),onInc:()=>T(Math.min(5,I+1))})]}),m.jsx("div",{className:_e.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:_e.pill,children:"보기 설정 초기화"})})]})}function Gt({label:e,children:t}){return m.jsxs("div",{className:_e.row,children:[m.jsx("label",{className:_e.label,children:e}),t]})}function Mt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${_e.btn} ${e?_e.btnActive:""}`,children:r})}function on({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,a=t>=r;return m.jsxs("div",{className:_e.stepRow,children:[m.jsx("label",{className:_e.stepLabel,children:e}),m.jsxs("div",{className:_e.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:_e.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:_e.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:a,className:_e.btnSmall,"aria-label":"증가",children:"+"})]})]})}const $c=f.memo(function(){const t=te(i=>i.showOverlays),n=te(i=>i.isSettingsOpen),r=Y(i=>i.rangeStartGI),o=Y(i=>i.rangeEndGI);return r!=null&&o!=null?null:m.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[m.jsx(Tc,{}),m.jsx(xc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Dc,{visible:!t&&n})})]})}),qc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const d=(l==null?void 0:l.equalityFn)||Object.is;let b=i(r.getState());c=x=>{const p=i(x);if(!d(b,p)){const v=b;a(b=p,v)}},l!=null&&l.fireImmediately&&a(b,b)}return o(c)}),e(t,n,r)},Uc=qc;function Kc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Qc(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function Yc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Qc((r==null?void 0:r.text)??"");return t}function Xc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=p=>{if(!n)return null;const{g2ct:v}=n;if(!v)return null;const S=v[p];if(S)return{clip:S.clip,t:S.t};for(let h=1;h<=100&&p-h>=0;h++){const u=v[p-h];if(u)return{clip:u.clip,t:u.t}}for(let h=1;h<=100;h++){const u=v[p+h];if(u)return{clip:u.clip,t:u.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Yc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const p=o(e.initialIndex);p&&(i=p.clip,a=p.t,r=void 0)}const c=s.length>0,d=c?"paused":"idle",b=c?"real":"fake",x=c?null:{totalWords:l};return yt(Uc((p,v)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:d,scrollLock:!1,playbackKind:b,fake:x,useFake:()=>p(S=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:S.status==="playing"})),useReal:()=>p(S=>({playbackKind:"real",fake:{totalWords:l},scrollLock:S.status==="playing"})),injectMap:S=>{if(n=S,typeof r=="number"){const h=o(r);h&&p(u=>({currentClip:Math.max(0,Math.min(h.clip,Math.max(0,u.clips.length-1))),currentTimeMs:Math.max(0,h.t)})),r=void 0}},setClipAndMs:(S,h)=>p(u=>{const w=Math.max(0,u.clips.length-1);return{currentClip:Math.max(0,Math.min(S,w)),currentTimeMs:Math.max(0,h),status:u.status,scrollLock:u.scrollLock}}),setClips:S=>p(h=>{const u=Array.isArray(S)?S:[],w=u.length>0;return{clips:u,currentClip:0,currentTimeMs:0,status:w?"paused":"idle",playbackKind:w?"real":"fake",fake:w?null:h.fake??{totalWords:l},scrollLock:!1}}),clear:()=>p(S=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:S.fake??{totalWords:l},scrollLock:!1})),play:(S,h)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),p(u=>{if(u.playbackKind==="fake")return{status:"playing",scrollLock:!0};const w=typeof S=="number"?S:u.currentClip,C=typeof h=="number"?h:u.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(w,Math.max(0,u.clips.length-1))),currentTimeMs:C,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),p({status:"paused",scrollLock:!1})},seek:S=>p(h=>({currentTimeMs:Math.max(0,S),status:h.status})),stop:()=>p({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>p(S=>{if(S.playbackKind==="fake")return S;const h=Math.max(0,S.clips.length-1);return{currentClip:Math.min(S.currentClip+1,h),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>p(S=>S.playbackKind==="fake"?S:{currentClip:Math.max(0,S.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:S=>p(h=>h.playbackKind==="fake"||S<0||S>=h.clips.length?h:{currentClip:S,currentTimeMs:0}),getClipSrc:S=>{const h=v();if(!h.clips.length)return null;const u=typeof S=="number"?S:h.currentClip;return Kc(h.clips[u])},getGIFromCT:(S,h)=>{if(!n)return-1;const u=n.byClip[S];if(!u||u.length===0)return-1;let w=0,C=u.length-1,I=0;for(;w<=C;){const T=w+C>>1;u[T].t<=h?(I=T,w=T+1):C=T-1}return u[Math.max(0,Math.min(I,u.length-1))].g},getCTFromGI:S=>{if(!n)return null;const{g2ct:h}=n;if(!h)return null;let u=h[S];if(!u){let w=S-1;const C=Math.max(0,S-100);for(;w>=C;){if(h[w]){u=h[w];break}w--}if(!u){let I=S+1;const T=S+100;for(;h[I]==null&&I<=T;)I++;h[I]&&(u=h[I])}}return u?{clip:u.clip,timeMs:u.t}:null},getMetaByGI:S=>{const h=v().getCTFromGI(S);return h?{clipIndex:h.clip,timeMs:h.timeMs}:null},syncToGI:S=>{const h=v().getMetaByGI(S);h&&v().setClipAndMs(h.clipIndex,h.timeMs)},_onTime:S=>p({currentTimeMs:S,status:"playing",scrollLock:!0}),_onEnded:()=>p(S=>{if(S.playbackKind==="fake")return{status:"ended",scrollLock:!1};const h=Math.max(0,S.clips.length-1);return S.currentClip>=h?{status:"ended",scrollLock:!1}:{currentClip:Math.min(S.currentClip+1,h),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>p({status:"error",scrollLock:!1}),_setStatusOnly:S=>p({status:S})})))}function Zc({children:e,initialState:t}){const n=f.useContext(wt)??void 0,r=f.useMemo(()=>Xc({...t,recorderStore:n}),[t,n]);return m.jsx(vn.Provider,{value:r,children:e})}function Jc(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const a of r){if((a==null?void 0:a.type)==="image")continue;const l=(a==null?void 0:a.runs)??[];for(let c=0;c<l.length;c++){const d=l[c],b=o+c;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:b}),n[b]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function eu(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function tu(e){const t=Jl(e),n=ea(t),r=t.reduce((d,b)=>d+(b||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],a=[];return e.forEach((d,b)=>{var h;if(d.type!=="paragraph")return;const x=n[b]??0,p=d.runs??[];for(let u=0;u<p.length;u++){const w=((h=p[u])==null?void 0:h.text)||"";sr(w)&&(s[x+u]=1)}const S=ta(p,x).map(u=>{var T;const w=u.startG-x,C=u.endG-u.startG+1;let I=-1;for(let E=0;E<C;E++){const g=((T=p[w+E])==null?void 0:T.text)??"";if(sr(g)){I=u.startG+E;break}}return{startG:u.startG,endG:u.endG,r0:w,len:C,firstReadableGI:I,splitIndex:u.splitIndex}});a[b]=S;for(const u of S){const w=i.length;for(let C=u.startG;C<=u.endG;C++)o[C]=w;i.push(u)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function nu(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:c}=e,d=a.totalRuns??0,b=typeof l=="number"?l:d>0?0:-1,x=b>=0?eu(i.readableGi,b,d):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:x,lastUpdateBy:"program",totalRuns:d,pageIndex:0,sectionLoading:!0,_loadingStartTime:c,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function ru(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:c,layout:d}=tu(l),b=Date.now(),x=nu({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:c,layout:d,initialIndex:n,mountTime:b});return a&&(a.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},b),a.getState().emit({type:"loading_start",payload:{}},b)),yt((p,v)=>{const S=j=>{p(A=>A.progress._scrollApi===j?A:{progress:{...A.progress,_scrollApi:j}})},h=()=>v().progress._scrollApi,u=j=>{p(A=>{const W=A.progress;if(W.totalRuns===j)return A;const U=W.currentGlobalRunIndex<0&&j>0;return{progress:{...W,totalRuns:j,currentGlobalRunIndex:U?0:W.currentGlobalRunIndex,lastUpdateBy:U?"program":W.lastUpdateBy}}})},w=(j,A="program")=>{const W=v().progress.currentGlobalRunIndex,U=v().progress,X=U.totalRuns>0?Math.max(-1,Math.min(j,U.totalRuns-1)):j;W===X&&U.lastUpdateBy===A||(p(ie=>({progress:{...ie.progress,currentGlobalRunIndex:X,lastUpdateBy:A}})),W!==X&&a&&a.getState().emit({type:"global_index_change",payload:{globalIndex:X}}))},C=j=>{const{sectionLoading:A,_loadingStartTime:W}=v().progress;if(A===j)return;const U=Date.now();if(j)p(X=>({progress:{...X.progress,sectionLoading:!0,_loadingStartTime:U}})),a&&a.getState().emit({type:"loading_start",payload:{}});else{const ie=(W?U-W:0)/1e3;p(le=>({progress:{...le.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:ie}})}},I=j=>{p(A=>({progress:{...A.progress,pageIndex:j}}))},T=(j,A)=>{p(W=>({progress:{...W.progress,rangeStartGI:Math.min(j,A),rangeEndGI:Math.max(j,A)}}))},E=()=>{p(j=>({progress:{...j.progress,rangeStartGI:null,rangeEndGI:null}}))},g=j=>{const{rangeStartGI:A,rangeEndGI:W}=v().progress;A==null||W==null||(j<A?p(U=>({progress:{...U.progress,rangeStartGI:j}})):j>W?p(U=>({progress:{...U.progress,rangeEndGI:j}})):E())},y=()=>{var me;const{rangeStartGI:j,rangeEndGI:A,section:W,layout:U}=v().progress;if(j==null||A==null||!U)return"";const X=((me=W.ast)==null?void 0:me.blocks)??[],ie=U.prefix,le=[];for(let be=0;be<X.length;be++){const K=X[be];if(K.type!=="paragraph")continue;const oe=K.runs??[],G=ie[be]??0;for(let ee=0;ee<oe.length;ee++){const M=G+ee;M>=j&&M<=A&&le.push(oe[ee].text??"")}}return le.join("")},_=j=>{const{totalRuns:A,derivedNav:W}=v().progress,U=W==null?void 0:W.readableGi;if(!U||A<=0)return j;const X=A,ie=Math.max(0,Math.min(j,X-1));if(U[ie])return ie;let le=ie-1,me=ie+1;for(;le>=0||me<X;){if(me<X&&U[me])return me;if(le>=0&&U[le])return le;me+=1,le-=1}return ie},B=(j,A)=>{const{totalRuns:W,derivedNav:U}=v().progress,X=U==null?void 0:U.readableGi;if(!X||W<=0)return null;if(A>0){for(let ie=Math.min(Math.max(j,0),W-1);ie<W;ie+=1)if(X[ie])return ie}else for(let ie=Math.min(Math.max(j,0),W-1);ie>=0;ie-=1)if(X[ie])return ie;return null},R=j=>{const{totalRuns:A,derivedNav:W}=v().progress,U=W==null?void 0:W.readableGi;if(!U||A<=0)return null;if(j>0){for(let X=A-1;X>=0;X-=1)if(U[X])return X}else for(let X=0;X<A;X+=1)if(U[X])return X;return null};return{progress:{...x,registerSectionScrollApi:S,getSectionScrollApi:h,setTotalRuns:u,setCurrentGlobalRunIndex:w,setSectionLoading:C,setPageIndex:I,setRange:T,clearRange:E,extendRange:g,getRangeText:y,snapToReadable:_,nextReadableFrom:B,edgeReadable:R,hasReadableInDir:(j,A)=>B(j+(A>0?1:-1),A)!=null,computeStepTarget:(j,A)=>{const{totalRuns:W,derivedNav:U}=v().progress;if(!W||W<=0)return j;const X=(U==null?void 0:U.groups)??[],ie=U==null?void 0:U.giToGroupIdx;if(!X.length||!ie){const G=W-1;return _(Math.max(0,Math.min(j+A,G)))}let le=ie[j]??-1;if(le<0||le>=X.length)for(let oe=0;oe<X.length;oe+=1){const G=X[oe];if(j>=G.startG&&j<=G.endG){le=oe;break}}if(le<0||le>=X.length)return R(A)??_(j);const me=oe=>oe>=0&&oe<X.length&&(X[oe].firstReadableGI??-1)>=0;let be=le+A;for(;be>=0&&be<X.length&&!me(be);)be+=A;if(be<0||be>=X.length)return R(A)??_(j+A);const K=X[be].firstReadableGI;return K>=0?K:_(j+A)},giToPercentTotal:j=>{const A=v().progress.totalRuns;return!A||A<=1?0:Math.max(0,Math.min(j,A-1))/(A-1)*100},percentToGITotal:j=>{const A=v().progress.totalRuns;if(!A||A<=1)return 0;const W=Math.max(0,Math.min(j,100)),U=Math.round(W/100*(A-1));return Math.max(0,Math.min(U,A-1))}}}})}function ou({children:e,initialState:t}){const n=f.useContext(wt),r=f.useMemo(()=>ru({...t,recorderStore:n}),[t,n]);return m.jsx(vr.Provider,{value:r,children:e})}function su({children:e,initialState:t}){const n=f.useContext(wt)??void 0,r=f.useMemo(()=>si({init:t,recorderStore:n}),[]);return m.jsx(ir.Provider,{value:r,children:e})}const iu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=Y(I=>I.section),o=f.useMemo(()=>{var I;return((I=r.ast)==null?void 0:I.blocks)??[]},[r]),s=te(I=>I.marginX),i=te(I=>I.lineHeight),a=te(I=>I.fontSizePx),l=te(I=>I.fontFamily),c=te(I=>I.viewportHeight),d=te(I=>I.playbackViewportHeight),b=d>0?d:c,x=Y(I=>{var T;return((T=I.layout)==null?void 0:T.prefix)??[]}),p=Y(I=>{var T;return((T=I.derivedNav)==null?void 0:T.splitGroupsPerBlock)??[]}),v=e[t],S=f.useMemo(()=>{const I=[];return o.forEach((T,E)=>{(T.type==="paragraph"||T.type==="image")&&I.push(E)}),I},[o]),h=f.useMemo(()=>{if(!v)return[];const I=[];for(let T=v.startBlock;T<=v.endBlock;T++){const E=S[T];E!=null&&I.push(E)}return I},[v,S]),u=f.useMemo(()=>{const I=[];for(const T of h){const E=o[T];(E==null?void 0:E.type)==="paragraph"&&I.push({b:E,originalBlockIndex:T})}return I},[h,o]),w=f.useMemo(()=>{const I=[],T=Sr();return u.forEach((E,g)=>{I[g]=yr(E.b,T)}),I},[u]),C=(I,T,E)=>{if(!I||I.length===0)return[];const g=[];for(const y of I){const _=y.startG,B=y.endG;if(B<T||_>E)continue;const R=Math.max(_,T),P=Math.min(B,E),k=R-_|0,O=Math.max(0,P-R+1);if(O<=0)continue;const z=(y.r0??0)+k;g.push({...y,startG:R,endG:P,r0:z,len:O})}return g};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:a,lineHeight:i,boxSizing:"border-box"},children:m.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[m.jsx("div",{style:{height:40}}),m.jsx("div",{style:{flex:1,overflow:"hidden"},children:h.map((I,T)=>{var ee;const E=o[I],g=T===0,y=T===h.length-1,_={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},B=`sec-${r.section_id}/blk-${E.id??I}`;if(E.type==="image"){const{src:M,alt:F,width:H,height:$}=E,Q=H&&$?`${H} / ${$}`:"4 / 3",D=b>80?Math.floor((b-80)*.6):void 0;return m.jsx("div",{style:_,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:D,aspectRatio:Q},children:m.jsx("img",{src:M,alt:F||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),F&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:F})]})},B)}const R=E,P=u.findIndex(M=>M.originalBlockIndex===I),k=P>=0?w[P]:void 0,O=R.runs??[],z=O.length;let L=0,j=Math.max(0,z-1);g&&v.startOffsetInBlock!=null&&(L=Math.min(Math.max(0,v.startOffsetInBlock),j)),y&&v.endOffsetInBlock!=null&&(j=Math.max(L,Math.min(v.endOffsetInBlock,j)));const A=L>0,W=x[I]??0,U=p[I]??[],X=W+L,ie=W+j;let le=C(U,X,ie);const me=W+L;le=le.map(M=>{const F=Math.max(0,(M.startG??X)-me),H=M.len??Math.max(1,(M.endG??ie)-(M.startG??X)+1);return{...M,r0:F,len:H}});const be=L<=j?O.slice(L,j+1):[],K=R.list?R.list.level*24:0,oe=((ee=R.list)==null?void 0:ee.kind)==="bullet"?R.list.glyph??"•":void 0,G=A?void 0:k??oe;return m.jsx("div",{style:_,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:K,textAlign:R.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[R.list&&G?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:G||""}):null,m.jsx(ys,{preGroups:le,runs:be,ns:B,baseIndex:me,sectionId:String(r.section_id)})]})},B)})})]})})},po=.5;function lu(e,t){const n=f.useRef(null),r=f.useRef(null),o=f.useRef(!1);f.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const c=l[0],{width:d,height:b}=c.contentRect,x=r.current;if(!x){r.current={w:d,h:b};return}Math.abs(x.w-d)<po&&Math.abs(x.h-b)<po||(r.current={w:d,h:b},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const a=()=>s();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function au(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,horizontalThreshold:i=120,verticalTolerance:a=40,velocityThreshold:l=.6,singleDelayMs:c=250,doubleClickWindowMs:d=300,suppressAfterSwipeMs:b=250,onDragMove:x,onDragEnd:p,pageTransitionThreshold:v}=e,S=v??i,h=Math.min(20,i),u=rt.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),w=()=>{u.current.singleTimer!=null&&(window.clearTimeout(u.current.singleTimer),u.current.singleTimer=null)},C=()=>{var k;const P=((k=document==null?void 0:document.body)==null?void 0:k.style)??null;P&&u.current.prevUserSelect!=null&&(P.userSelect=u.current.prevUserSelect,u.current.prevUserSelect=null),u.current.capturedEl&&u.current.pid!=null&&typeof u.current.capturedEl.hasPointerCapture=="function"&&u.current.capturedEl.hasPointerCapture(u.current.pid)&&u.current.capturedEl.releasePointerCapture(u.current.pid),u.current.capturedEl=null},I=rt.useCallback(P=>{s!=null&&s(P.target)||(u.current.pid=P.pointerId,u.current.startX=P.clientX,u.current.startY=P.clientY,u.current.startT=P.timeStamp,u.current.swiping=!1,u.current.canceledClick=!1,u.current.capturedEl=P.currentTarget)},[s]),T=rt.useCallback(P=>{var j;if(u.current.pid==null||P.pointerId!==u.current.pid)return;const k=P.clientX-u.current.startX,O=P.clientY-u.current.startY,z=Math.abs(k),L=Math.abs(O);if(!u.current.swiping){if(z>=h&&L<=a&&z>L){u.current.swiping=!0,u.current.canceledClick=!0;const A=u.current.capturedEl;if(A&&typeof A.setPointerCapture=="function")try{A.setPointerCapture(P.pointerId)}catch{}const W=((j=document==null?void 0:document.body)==null?void 0:j.style)??null;W&&(u.current.prevUserSelect=W.userSelect??null,W.userSelect="none"),P.preventDefault()}return}x==null||x(k),P.preventDefault()},[a,x]),E=rt.useCallback(P=>{if(u.current.pid==null||P.pointerId!==u.current.pid)return;const k=P.timeStamp-u.current.startT,O=P.clientX-u.current.startX;if(u.current.swiping){const z=Math.abs(O)/Math.max(1,k);Math.abs(O)>=S||z>=l?O<0?n():t():p==null||p(),u.current.lastSwipeAt=P.timeStamp}else P.timeStamp-u.current.lastUpT;C(),u.current.lastUpT=P.timeStamp,u.current.pid=null,u.current.swiping=!1},[S,l,n,t,d,p]),g=rt.useCallback(()=>{u.current.swiping&&(p==null||p()),C(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[p]),y=rt.useCallback(P=>{var k,O;(O=(k=u.current.capturedEl)==null?void 0:k.hasPointerCapture)!=null&&O.call(k,P.pointerId)||u.current.pid!=null&&u.current.swiping&&(p==null||p(),C(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1)},[p]),_=rt.useCallback(()=>{u.current.pid!=null&&u.current.swiping&&(p==null||p()),C(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[p]),B=rt.useCallback(P=>{if(!(s!=null&&s(P.target))&&!(P.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}r&&u.current.singleTimer==null&&(u.current.singleTimer=window.setTimeout(()=>{u.current.singleTimer=null,r(P)},c))}},[r,s,c,b]),R=rt.useCallback(P=>{if(!(s!=null&&s(P.target))&&!(P.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}w(),o==null||o(P)}},[o,s,b]);return rt.useEffect(()=>()=>{w(),C()},[]),{onPointerDown:I,onPointerMove:T,onPointerUp:E,onPointerCancel:g,onPointerLeave:y,onLostPointerCapture:_,onClick:B,onDoubleClick:R}}var zn,ho;function _s(){if(ho)return zn;ho=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return zn=e,zn}var An,go;function cu(){if(go)return An;go=1;var e=typeof Jt=="object"&&Jt&&Jt.Object===Object&&Jt;return An=e,An}var Ln,mo;function Ms(){if(mo)return Ln;mo=1;var e=cu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return Ln=n,Ln}var Gn,bo;function uu(){if(bo)return Gn;bo=1;var e=Ms(),t=function(){return e.Date.now()};return Gn=t,Gn}var Hn,xo;function du(){if(xo)return Hn;xo=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Hn=t,Hn}var Nn,vo;function fu(){if(vo)return Nn;vo=1;var e=du(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Nn=n,Nn}var Fn,So;function Es(){if(So)return Fn;So=1;var e=Ms(),t=e.Symbol;return Fn=t,Fn}var Wn,yo;function pu(){if(yo)return Wn;yo=1;var e=Es(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var a=n.call(i,o),l=i[o];try{i[o]=void 0;var c=!0}catch{}var d=r.call(i);return c&&(a?i[o]=l:delete i[o]),d}return Wn=s,Wn}var Vn,wo;function hu(){if(wo)return Vn;wo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Vn=n,Vn}var Dn,Co;function gu(){if(Co)return Dn;Co=1;var e=Es(),t=pu(),n=hu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(a){return a==null?a===void 0?o:r:s&&s in Object(a)?t(a):n(a)}return Dn=i,Dn}var $n,Io;function mu(){if(Io)return $n;Io=1;function e(t){return t!=null&&typeof t=="object"}return $n=e,$n}var qn,ko;function bu(){if(ko)return qn;ko=1;var e=gu(),t=mu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return qn=r,qn}var Un,Ro;function xu(){if(Ro)return Un;Ro=1;var e=fu(),t=_s(),n=bu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=t(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var b=s.test(c);return b||i.test(c)?a(c.slice(2),b?2:8):o.test(c)?r:+c}return Un=l,Un}var Kn,To;function vu(){if(To)return Kn;To=1;var e=_s(),t=uu(),n=xu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var d,b,x,p,v,S,h=0,u=!1,w=!1,C=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(u=!!c.leading,w="maxWait"in c,x=w?o(n(c.maxWait)||0,l):x,C="trailing"in c?!!c.trailing:C);function I(k){var O=d,z=b;return d=b=void 0,h=k,p=a.apply(z,O),p}function T(k){return h=k,v=setTimeout(y,l),u?I(k):p}function E(k){var O=k-S,z=k-h,L=l-O;return w?s(L,x-z):L}function g(k){var O=k-S,z=k-h;return S===void 0||O>=l||O<0||w&&z>=x}function y(){var k=t();if(g(k))return _(k);v=setTimeout(y,E(k))}function _(k){return v=void 0,C&&d?I(k):(d=b=void 0,p)}function B(){v!==void 0&&clearTimeout(v),h=0,d=S=b=v=void 0}function R(){return v===void 0?p:_(t())}function P(){var k=t(),O=g(k);if(d=arguments,b=this,S=k,O){if(v===void 0)return T(S);if(w)return clearTimeout(v),v=setTimeout(y,l),I(S)}return v===void 0&&(v=setTimeout(y,l)),p}return P.cancel=B,P.flush=R,P}return Kn=i,Kn}var Su=vu();const yu=Ho(Su);function wu(e,t=200,n,r){const o=f.useRef(e),s=f.useRef(n);f.useEffect(()=>{o.current=e},[e]),f.useEffect(()=>{s.current=n},[n]);const i=f.useMemo(()=>{const a=yu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var d;(d=s.current)==null||d.call(s),a(...c)});return l.cancel=a.cancel.bind(a),l.flush=a.flush.bind(a),l},[t,r==null?void 0:r.leading,r==null?void 0:r.trailing,r==null?void 0:r.maxWait]);return f.useEffect(()=>()=>i.cancel(),[i]),i}let js=0;class Ps extends Error{constructor(){super("calcPages canceled due to a newer invocation");Cr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const Je=e=>{if(e!==js)throw new Ps},Qn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},_o=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const a=s.getClientRects(),l=a.length?a[a.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},Cu=(e,t)=>{if(t<16)return async(r=24)=>{Je(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(Je(e),await new Promise(o=>requestAnimationFrame(()=>o())),Je(e))}};async function Iu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:d=0,showSlash:b,paragraphMarkers:x,playbackScale:p=1,viewportHeight:v=0}){var h,u,w;const S=++js;Je(S);try{const C=Math.abs(p-1)>.001,I=1/p;C&&(t.style.transform=`scale(${I})`,t.style.transformOrigin="top left");const T=Math.max(0,e.offsetWidth||0),E=Math.max(0,Math.min(T,o));t.style.maxWidth=`${E}px`,Je(S);let g=Math.round(n.offsetHeight||0);g||(g=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",p.toFixed(4),C?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",T),console.log("[calcPages] pageBoxWidth:",E),console.log("[calcPages] maxPageHeight:",g),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const y=1.5,_=(M,F)=>F+M<=g-y,B=getComputedStyle(e),R={letterSpacing:B.letterSpacing,wordSpacing:B.wordSpacing,fontKerning:B.fontKerning||"normal",fontVariantLigatures:B.fontVariantLigatures||"normal",textTransform:B.textTransform||"none",direction:B.direction||"ltr",wordBreak:B.wordBreak||"keep-all",overflowWrap:B.overflowWrap||B.wordWrap||"break-word",hyphens:B.hyphens||"manual"},P=M=>{M.style.letterSpacing=R.letterSpacing||"",M.style.wordSpacing=R.wordSpacing||"",M.style.fontKerning=R.fontKerning||"",M.style.fontVariantLigatures=R.fontVariantLigatures||"",M.style.textTransform=R.textTransform||"",M.style.direction=R.direction||"",M.style.wordBreak=R.wordBreak||"",M.style.wordWrap=R.overflowWrap||"",M.style.overflowWrap=R.overflowWrap||"",M.style.hyphens=R.hyphens||""},k=E,O=Math.max(0,k-2*(s||0));n.innerHTML="";const z=document.createElement("div");z.style.boxSizing="border-box",z.style.width=`${k}px`,z.style.maxWidth=`${k}px`,z.style.margin="0 auto",z.style.display="flex",n.appendChild(z);const L=document.createElement("div");L.style.boxSizing="border-box",L.style.paddingRight=`${s}px`,L.style.paddingLeft=`${s}px`,L.style.width=`${k}px`,L.style.maxWidth=`${k}px`,L.style.margin="0 auto",L.style.display="flex",L.style.justifyContent="center",L.style.height="auto",z.appendChild(L);const j=new Map,A={},W=Cu(S,r.length),U=(M,F)=>{const H=document.createElement("p");return H.style.margin="8px 0",H.style.paddingLeft=F?`${F}px`:"0",H.style.textAlign=M.textAlign??"start",H.style.whiteSpace="pre-wrap",H.style.lineHeight=String(l),H.style.fontSize=`${a}px`,H.style.boxSizing="border-box",H.style.fontFamily=i??"",H.style.width="100%",P(H),H},X=(M,F)=>{const H=F??[],$=document.createDocumentFragment();for(let Q=0;Q<H.length;Q++){const D=H[Q],de=document.createElement("span");de.dataset.runbox=String(Q),de.style.whiteSpace="pre-wrap";const J=document.createElement("span");if(J.dataset.run=String(Q),J.textContent=(D==null?void 0:D.text)??"",J.style.whiteSpace="pre-wrap",D!=null&&D.bold&&(J.style.fontWeight="700"),D!=null&&D.italic&&(J.style.fontStyle="italic"),D!=null&&D.underline&&(J.style.textDecoration="underline"),de.appendChild(J),c&&(D!=null&&D.split)&&Q!==H.length-1){const ne=Math.max(0,(d??0)/2),se=document.createElement("span");se.style.display="inline-block",se.style.width=`${ne}px`;const ue=document.createElement("span");if(ue.style.display="inline-block",ue.style.width=`${ne}px`,de.appendChild(se),b){const Ce=document.createElement("span");Ce.textContent=" / ",de.appendChild(Ce)}de.appendChild(ue)}$.appendChild(de)}M.appendChild($)},ie=v>80?Math.floor((v-80)*.6):void 0,le=M=>{const F=M!=null&&M.width&&(M!=null&&M.height)?`${M.width} / ${M.height}`:"4 / 3",H=document.createElement("div");H.style.margin="12px 0",H.style.textAlign="center",H.style.width=`${O}px`;const $=document.createElement("div");$.style.position="relative",$.style.width="100%",ie&&($.style.maxHeight=`${ie}px`),$.style.aspectRatio=F;const Q=document.createElement("div");if(Q.style.position="absolute",Q.style.inset="0",Q.style.width="100%",Q.style.height="100%",$.appendChild(Q),H.appendChild($),M!=null&&M.alt){const D=document.createElement("div");D.style.fontSize="12px",D.style.color="#6B7280",D.style.marginTop="4px",D.textContent=String(M.alt),P(D),H.appendChild(D)}return H};for(let M=0;M<r.length;M++){Je(S);const F=r[M];if(L.dataset.block=String(M),L.innerHTML="",F.kind==="image"){const ue=F.block,Ce=le(ue);L.appendChild(Ce);const ze=Ce.getBoundingClientRect(),{mt:Be,mb:Ae}=Qn(Ce);A[M]={contentH:Math.ceil(ze.height),mt:Be,mb:Ae},await W(24);continue}const H=F.block,$=H.list?(H.list.level??0)*24:0,Q=F.paraIndex??0,D=x[Q]??(((h=H.list)==null?void 0:h.kind)==="bullet"?((u=H.list)==null?void 0:u.glyph)??"•":void 0);if(!!(H.list&&D)){const ue=U(H,$);ue.dataset.variant="with";const Ce=U(H,$);Ce.dataset.variant="no";const ze=document.createElement("span");ze.textContent=`${D} `,ze.style.minWidth="16px",ze.style.display="inline-block",ze.style.whiteSpace="nowrap",ze.style.userSelect="none",ue.appendChild(ze),X(ue,H.runs),X(Ce,H.runs);const Be=document.createDocumentFragment();Be.appendChild(ue),Be.appendChild(Ce),L.appendChild(Be)}else{const ue=U(H,$);ue.dataset.variant="with",X(ue,H.runs),L.appendChild(ue)}const J=L.querySelector('p[data-variant="with"]'),ne=L.querySelector('p[data-variant="no"]'),se=ne??J;if(J&&se){const ue=_o(J),Ce=_o(se),{mt:ze,mb:Be}=Qn(J),{mt:Ae,mb:Ge}=Qn(se),De=((w=H.runs)==null?void 0:w.length)??0,Me=ne?Ce:ue,$e=ne?Ae:ze,Xe=ne?Ge:Be;if(M<3){const kt=J.getBoundingClientRect().height;console.log(`[calcPages] para ${M}: height=${kt.toFixed(2)}, lastBottom=[${ue.slice(-3).map(q=>q.toFixed(1)).join(",")}], runs=${De}`)}j.set(M,{runsLen:De,lastBottomWith:ue,lastBottomNo:Me,mtWith:ze,mbWith:Be,mtNo:$e,mbNo:Xe})}await W(24)}Je(S),L.innerHTML="";const me=(M,F,H,$)=>{if(F>H)return{top:0,content:0,mb:0};const Q=$?M.lastBottomNo:M.lastBottomWith,D=$?M.mtNo:M.mtWith,de=$?M.mbNo:M.mbWith,J=$?0:D,ne=F>0?Q[F-1]??0:0,se=Math.max(0,(Q[H]??0)-ne);return{top:J,content:se,mb:de}},be=[];let K=0,oe,G=null,ee=null;for(;K<r.length;){Je(S);const M=K;let F=0,H=0,$=oe;$!=null&&G===K&&ee!=null&&($=Math.max($,ee+1));let Q=-1,D;for(;K<r.length;){if(Je(S),r[K].kind==="image"){const Me=A[K]??{contentH:0,mt:0,mb:0},Xe=(F===0?Me.mt:H+Me.mt)+Me.contentH;if(_(Xe,F)){F+=Xe,Q=K,D=void 0,H=Me.mb,K+=1,oe=void 0,G=null,ee=null;continue}if(F===0){be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{}}),K+=1,oe=void 0,G=null,ee=null,H=0;break}break}const J=j.get(K),ne=J.runsLen,se=K===M&&$!=null?$:0;if(se>=ne){K+=1,oe=void 0,G=null,ee=null;continue}const ue=se>0,Ce=me(J,se,ne-1,ue),Be=(F===0?Ce.top:H+Ce.top)+Ce.content;if(_(Be,F)){F+=Be,Q=K,D=ne-1,H=Ce.mb,K+=1,oe=void 0,G=null,ee=null;continue}let Ae=se,Ge=ne-1,De=se-1;for(;Ae<=Ge;){Je(S);const Me=Ae+Ge>>1,$e=me(J,se,Me,ue),Xe=(F===0?$e.top:H+$e.top)+$e.content;_(Xe,F)?(De=Me,Ae=Me+1):Ge=Me-1}if(De>=se){be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:De}),oe=De+1,G=K,ee=De,H=0;break}if(F>0){be.push({startBlock:M,endBlock:Q>=0?Q:Math.min(K-1,r.length-1),...$!=null?{startOffsetInBlock:$}:{},...D!=null?{endOffsetInBlock:D}:{}}),H=0;break}else{const Me=se;be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:Me}),oe=Me+1,G=K,ee=Me,H=0;break}}(be.length===0||be[be.length-1].startBlock!==M)&&be.push({startBlock:M,endBlock:Q>=0?Q:Math.min(K-1,r.length-1),...$!=null?{startOffsetInBlock:$}:{},...D!=null?{endOffsetInBlock:D}:{}})}return z.remove(),C&&(t.style.transform="",t.style.transformOrigin=""),Je(S),{pages:be,pageByRunIndex:null}}catch(C){throw(C==null?void 0:C.name)==="CalcPagesCanceled",C}}function Mo(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const a=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+a}return null}function ku(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let a=i.startBlock;a<=i.endBlock;a++){const l=n[a];if(!l||l.kind!=="paragraph")continue;const c=((o=l.block.runs)==null?void 0:o.length)??0;if(!c)continue;let d=0,b=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,b))),a===i.endBlock&&i.endOffsetInBlock!=null&&(b=Math.max(d,Math.min(i.endOffsetInBlock,b)));const x=r[l.originalIndex]??0,p=x+d,v=x+b;if(e>=p&&e<=v)return s}}return-1}function Ru(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function Tu(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function _u(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function Mu(){var kt;const e=Y(q=>q.section),t=Y(q=>q.sectionLoading),n=Y(q=>q.rangeStartGI),r=Y(q=>q.rangeEndGI),o=n!=null&&r!=null,s=At(),i=te(q=>q.theme),a=an[i],l=te(q=>q.fontFamily),c=te(q=>q.fontSizePx),d=te(q=>q.lineHeight),b=te(q=>q.marginX),x=te(q=>q.viewportHeight),p=te(q=>q.playbackViewportHeight),v=p>0?p:x,S=860,h=f.useRef(null),{items:u}=f.useMemo(()=>{var q;return _u(((q=e==null?void 0:e.ast)==null?void 0:q.blocks)??[])},[e]),w=f.useMemo(()=>{const q=[],Ee=Sr();return u.forEach(Pe=>{if(Pe.kind==="paragraph"){const bt=Pe.paraIndex;q[bt]=yr(Pe.block,Ee)}}),q},[u]),[C,I]=f.useState({pages:[],pageByRunIndex:null}),T=Y(q=>q.pageIndex),E=Y(q=>q.setPageIndex),g=f.useRef(0),y=f.useRef(null),[_,B]=f.useState(!1),[R,P]=f.useState(null),[k,O]=f.useState(!1),z=f.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:c,lineHeight:d,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,c,d]),{showSplit:L,breakGapPx:j,slash:A}=te(Kt(q=>{var Ee;return{showSplit:q.showSplit,breakGapPx:q.breakGapPx??0,slash:((Ee=q.breakMarks)==null?void 0:Ee.slash)??!1}})),W=St();f.useEffect(()=>{C&&C.pages.length&&(console.log("그래서 총 페이지",C.pages.length),(async()=>{const q=W.getState().progress.setSectionLoading;await ft(),await ft(),await ft(),await ft(),console.log("recalc종료"),q(!1)})())},[C]);const U=f.useCallback(()=>{console.log("@@@@@@recalc호출");const q=h.current,Ee=de.current,Pe=J.current;if(console.log("showSplit",L),!q||!Ee||!Pe||u.length===0){I({pages:[],pageByRunIndex:null}),E(0);return}(async()=>{const bt=performance.now();try{const nt=s.getState().playbackScale,{pages:Lt,pageByRunIndex:Ns}=await Iu({viewHost:q,measureRoot:Ee,contentArea:Pe,items:u,cfgMaxWidth:S,marginX:b,fontFamily:l,fontSizePx:c,lineHeight:d,showSplit:L,breakGapPx:j,showSlash:A,paragraphMarkers:w,playbackScale:nt,viewportHeight:v}),Fs=performance.now();console.log(`✅ calcPages 완료: ${(Fs-bt).toFixed(1)} ms (${Lt.length} pages)`),I({pages:Lt,pageByRunIndex:Ns}),E(0)}catch(nt){if(nt instanceof Ps){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",nt)}})()},[e,u,S,b,l,c,d,L,j,A,w,s,v]),X=Y(q=>q.setCurrentGlobalRunIndex);Y(q=>q.totalRuns);const ie=Y(q=>{var Ee;return((Ee=q.layout)==null?void 0:Ee.prefix)??[]}),le=f.useCallback(q=>{const Ee=C.pages.length+1,Pe=T+q;if(Pe<0||Pe>=Ee)return;const bt=T===C.pages.length;if(Pe===C.pages.length){E(Pe);return}if(bt&&q===-1){const Lt=Mo(C.pages[Pe],u,ie);Lt!=null&&X(Lt,"scrubber-step"),E(Pe);return}const nt=Mo(C.pages[Pe],u,ie);nt!=null?X(nt,"scrubber-step"):E(Pe)},[T,C.pages,u,ie,X,E]),me=f.useCallback(()=>{_||g.current!==0?(P("prev"),B(!1)):le(-1)},[_,le]),be=f.useCallback(()=>{_||g.current!==0?(P("next"),B(!1)):le(1)},[_,le]),K=Ot(),oe=f.useCallback(()=>{const{isSettingsOpen:q,setSettingsOpen:Ee,toggleOverlays:Pe}=K.getState();q?Ee(!1):Pe()},[K]),G=C.pages.length+1,ee=((kt=h.current)==null?void 0:kt.clientWidth)||400,M=f.useCallback(q=>{var nt;const Ee=y.current;if(!Ee)return;const Pe=((nt=h.current)==null?void 0:nt.clientWidth)||1,bt=q/Pe*33.333;Ee.style.transform=`translate3d(${-33.333+bt}%, 0, 0)`},[]),F=f.useCallback(q=>{T===0&&q>0||T>=G-1&&q<0||(g.current=q,M(q),_||B(!0))},[T,G,M,_]),H=f.useCallback(()=>{g.current=0,B(!1);const q=y.current;q&&(q.style.transition="transform 250ms ease-out",q.style.transform="translate3d(-33.333%, 0, 0)")},[]),$=f.useCallback(q=>{if(q.target!==q.currentTarget||q.propertyName!=="transform")return;const Ee=R;O(!0),P(null),g.current=0,Ee==="prev"?le(-1):Ee==="next"&&le(1)},[R,le]);f.useLayoutEffect(()=>{k&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{O(!1)})})},[k]);const Q=f.useCallback(q=>o||Tu(q)?!0:Ru(q),[o]),D=au({onPrev:me,onNext:be,onSingle:oe,onDouble:()=>{},shouldIgnoreTarget:Q,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:F,onDragEnd:H,pageTransitionThreshold:ee*.5}),de=f.useRef(null),J=f.useRef(null),ne=f.useCallback(()=>{const q=W.getState().progress.setSectionLoading;q(!0)},[W]),se=wu(U,200,ne,{trailing:!0,leading:!1,maxWait:1e3}),ue=f.useRef("");f.useEffect(()=>{if(v<=0)return;const q=`${l}|${c}|${d}|${b}|${L}|${j}|${A}|${v}|${e==null?void 0:e.section_id}`;ue.current!==q&&(ue.current=q,se.cancel(),ne(),U())},[se,U,ne,l,c,d,b,L,j,A,v,e==null?void 0:e.section_id]),lu([h],se);const Ce=Y(q=>q.registerSectionScrollApi);f.useEffect(()=>(Ce({ensureVisibleGI:async()=>!0,scrollToGI:async()=>!0,getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:async()=>{},stepPage:le}),()=>Ce(void 0)),[Ce,le]);const ze=e.quiz&&e.quiz.length>0,Be=C.pages.length>0&&T===C.pages.length,Ae=T>0?T-1:null,Ge=T<G-1?T+1:null,De=f.useMemo(()=>R==="prev"?"translate3d(0%, 0, 0)":R==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[R]),Me=q=>t?null:q===C.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[ze&&m.jsx(Is,{}),m.jsx(hn,{isIcon:!1})]}):m.jsx(iu,{pages:C.pages,pageIndex:q,maxWidth:S}),$e={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Xe=!k&&(!_||R!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:h,style:{...z,touchAction:"pan-y"},...D,children:[m.jsxs("div",{ref:y,style:{display:"flex",width:"300%",height:"100%",transform:De,transition:Xe?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:R?$:void 0,children:[m.jsx("div",{style:$e,children:Ae!==null&&Me(Ae)}),m.jsx("div",{style:$e,children:Me(T)}),m.jsx("div",{style:$e,children:Ge!==null&&Me(Ge)})]}),m.jsx("div",{ref:de,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:S,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:l,fontSize:c,lineHeight:d,pointerEvents:"none",background:"pink"},children:m.jsxs("div",{style:{width:"100%",maxWidth:S,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[m.jsx("div",{style:{height:40,background:"blue"}}),m.jsx("div",{ref:J,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(Eu,{pages:C.pages,items:u,onGotoPage:E,currentPageIndex:T,isOnExtraPage:Be})]})}const Eu=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=Y(c=>c.currentGlobalRunIndex),i=Y(c=>c.lastUpdateBy),a=Y(c=>{var d;return((d=c.layout)==null?void 0:d.prefix)??[]}),l=f.useRef(null);return f.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const c=ku(s,e,t,a);c>=0&&c!==r&&n(c)},[s,e,t,a,n,r,o,i]),m.jsx(m.Fragment,{})},ju="_wrapper_dbk3n_1",Pu="_spinner_dbk3n_10",Eo={wrapper:ju,spinner:Pu};function Ou({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${Eo.wrapper}`,children:m.jsx("div",{className:Eo.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Bu(){const e=Y(Kt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(Ou,{})})}const zu="_Overlay_ybic8_3",Au="_Dialog_ybic8_15",Lu="_Body_ybic8_25",Gu="_Header_ybic8_32",Hu="_Paging_ybic8_39",Nu="_Remaining_ybic8_48",Fu="_RemainingDanger_ybic8_55",Wu="_NextBtn_ybic8_59",Vu="_CloseBtn_ybic8_96",Du="_Question_ybic8_113",$u="_Score_ybic8_123",qu="_Image_ybic8_130",Uu="_Options_ybic8_140",Ku="_OptionBtn_ybic8_145",Qu="_OptionBtnActive_ybic8_165",Yu="_Footer_ybic8_172",Xu="_OptionBtnCorrect_ybic8_195",Zu="_Judge_ybic8_201",Ju="_Correct_ybic8_212",ed="_Incorrect_ybic8_215",td="_ResultHeader_ybic8_220",nd="_ResultActions_ybic8_233",rd="_CloseBtnSoft_ybic8_239",od="_SummaryGrid_ybic8_249",sd="_StatCard_ybic8_257",id="_StatLabel_ybic8_265",ld="_StatValue_ybic8_270",ad="_StatSub_ybic8_277",pe={Overlay:zu,Dialog:Au,Body:Lu,Header:Gu,Paging:Hu,Remaining:Nu,RemainingDanger:Fu,NextBtn:Wu,CloseBtn:Vu,Question:Du,Score:$u,Image:qu,Options:Uu,OptionBtn:Ku,OptionBtnActive:Qu,Footer:Yu,OptionBtnCorrect:Xu,Judge:Zu,Correct:Ju,Incorrect:ed,ResultHeader:td,ResultActions:nd,CloseBtnSoft:rd,SummaryGrid:od,StatCard:sd,StatLabel:id,StatValue:ld,StatSub:ad};function cd(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Os(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function ud(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const dd=f.memo(function(){const t=Ze(h=>h.phase),n=Ze(h=>h.quizzes),r=Ze(h=>h.order),o=Ze(h=>h.currentIndex),s=Ze(h=>h.answers),i=Ze(h=>h.correctCount),a=Ze(h=>h.remainingSec),l=Ze(h=>h.uiReveal),c=Ze(h=>h.startedAt),d=Ze(h=>h.finishedAt),b=Ze(h=>h.perQ),x=Cs();f.useEffect(()=>{if(t==="idle"||t!=="doing"||a==null)return;const h=window.setInterval(()=>x.getState().tick(),1e3);return()=>window.clearInterval(h)},[t,a,x]);const p=t==="doing"?n[r[o]]:void 0,v=t==="doing"&&p?s[p.qid]??[]:[],S=f.useMemo(()=>{if(t==="idle"||t!=="finished")return;const h=r.map(j=>n[j]),u=h.length,w=h.reduce((j,A)=>j+(A.score??0),0),C=h.reduce((j,A)=>{const W=b[A.qid];return j+(W!=null&&W.isCorrect?A.score??0:0)},0),I=h.map(j=>b[j.qid]).filter(j=>!!j),T=typeof c=="number"&&typeof d=="number"?Math.max(0,d-c):I.reduce((j,A)=>j+(A.ms??0),0),E=u>0?Math.round(T/u):0,g=[...I].sort((j,A)=>j.ms-A.ms),y=g[0],_=g[g.length-1],B=I.filter(j=>!j.multi),R=I.filter(j=>j.multi),P=B.filter(j=>j.isCorrect).length,k=R.filter(j=>j.isCorrect).length,O=I.filter(j=>j.timedOut).length,z=I.filter(j=>j.revealed).length,L=I.filter(j=>!j.isCorrect).sort((j,A)=>A.ms-j.ms).slice(0,3);return{total:u,correct:i,rate:u?Math.round(i/u*100):0,timeMsTotal:T,avgMs:E,totalScore:w,gainedScore:C,fastest:y,slowest:_,singles:{total:B.length,correct:P},multis:{total:R.length,correct:k},timedOut:O,revealed:z,wrongTop3:L}},[t,r,n,b,c,d,i]);return t==="idle"?null:m.jsx("div",{className:pe.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:pe.Dialog,children:t==="doing"&&p?m.jsx(fd,{q:p,index:o,total:r.length,selected:v,uiReveal:l,onSelect:h=>{if(l)return;const u=x.getState();Os(p)?u.selectToggle(h):u.selectSingle(h)},onBeforeNext:()=>x.getState().setReveal(!0),onNext:()=>x.getState().afterRevealNext(),remainingSec:a,onClose:()=>x.getState().close()}):m.jsx(pd,{total:r.length,correct:i,summary:S,onClose:()=>x.getState().close()})})})});function fd(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:d}=e,b=Os(t),x=f.useMemo(()=>{const h=t.options.map((u,w)=>({opt:u,i:w}));for(let u=h.length-1;u>0;u--){const w=Math.floor(Math.random()*(u+1));[h[u],h[w]]=[h[w],h[u]]}return h},[t.qid]),p=f.useMemo(()=>cd(t),[t]),v=f.useMemo(()=>ud(t),[t]),S=f.useMemo(()=>{const h=[...o].sort((u,w)=>u-w);if(h.length!==v.length)return!1;for(let u=0;u<h.length;u++)if(h[u]!==v[u])return!1;return!0},[o,v]);return m.jsxs("div",{className:pe.Body,children:[m.jsxs("div",{className:pe.Header,children:[m.jsx("div",{className:pe.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:d,className:pe.CloseBtn,children:"X"})]}),m.jsx("div",{className:pe.Question,children:t.question}),m.jsx("div",{className:pe.Score,children:` (${t.score}점${b?" ,모두선택":""})`}),m.jsx("div",{className:`${pe.Judge}${s?S?` ${pe.Correct}`:` ${pe.Incorrect}`:""}`,"aria-live":"polite",children:s?S?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:pe.Image,children:p&&m.jsx("img",{src:p,alt:""})}),m.jsx("div",{className:pe.Options,children:x.map(({opt:h,i:u})=>{const w=o.includes(u),C=v.includes(u),I=[pe.OptionBtn,w?pe.OptionBtnActive:"",s&&C?pe.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(u),className:I,disabled:s,children:h},u)})}),m.jsx("div",{className:pe.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:pe.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:a,className:`${pe.NextBtn}`,children:["Submit",typeof c=="number"&&m.jsx("span",{className:`${pe.Remaining} ${c<=5?pe.RemainingDanger:""}`,children:` (${c} s )`})]})})]})}function jo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function pd(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return m.jsxs("div",{className:pe.Body,children:[m.jsx("div",{className:pe.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:pe.SummaryGrid,role:"list",children:[m.jsxs("div",{className:pe.StatCard,role:"listitem",children:[m.jsx("div",{className:pe.StatLabel,children:"정답률"}),m.jsxs("div",{className:pe.StatValue,children:[s,"%"]}),m.jsx("div",{className:pe.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:pe.StatCard,role:"listitem",children:[m.jsx("div",{className:pe.StatLabel,children:"총 점수"}),m.jsx("div",{className:pe.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:pe.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:pe.StatCard,role:"listitem",children:[m.jsx("div",{className:pe.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:pe.StatValue,children:jo(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:pe.StatSub,children:`평균 ${jo(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:pe.StatCard,role:"listitem",children:[m.jsx("div",{className:pe.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:pe.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:pe.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:pe.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:pe.CloseBtnSoft,children:"닫기"})})]})}function hd(e){return e.map((t,n)=>n)}function gd(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Yn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Xn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function Po(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:hd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function md(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Po(e);return yt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Po(i);o(a)},openFromSection:i=>{i&&s().hydrateFromSection(i);const a=s();if(!a.quizzes.length)return;const l=a.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid,d=a.answers[c]??[],b=d.includes(i)?d.filter(x=>x!==i):[...d,i].sort((x,p)=>x-p);o({answers:{...a.answers,[c]:b}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[c]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],c=l.qid,d=(i.answers[c]??[]).slice().sort((h,u)=>h-u),b=Xn(l),x=gd(d,b),p=i.questionStartedAt?Date.now()-i.questionStartedAt:0,v=i.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:d,correctIdxes:b,isCorrect:x,ms:p,revealed:(v==null?void 0:v.revealed)??!1,timedOut:(v==null?void 0:v.timedOut)??!1};if(o({correctCount:i.correctCount+(x?1:0),perQ:{...i.perQ,[c]:S}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const h=i.currentIndex+1;o({currentIndex:h,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[h]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const a=s();if(a.phase==="doing"){if(i){const l=a.quizzes[a.order[a.currentIndex]],c=l.qid,d=a.perQ[c],b={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Xn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...a.perQ,[c]:b}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const a=i.currentIndex+1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const a=i.currentIndex-1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const a=i.remainingSec-1;if(a<=0){const l=i.quizzes[i.order[i.currentIndex]],c=l.qid,d=i.perQ[c],b={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Yn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Xn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:b}})}else o({remainingSec:a})}}))}function bd({children:e,initialState:t}){const n=f.useMemo(()=>md(t.section),[t]),r=f.useRef(t.onQuizComplete);return f.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),f.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const a=r.current;if(!a)return;const{sectionId:l,quizzes:c,order:d,perQ:b,startedAt:x,finishedAt:p}=s,v=d.map(E=>c[E]),S=v.length,h=v.filter(E=>{var g;return(g=b[E.qid])==null?void 0:g.isCorrect}).length,u=v.reduce((E,g)=>E+(g.score??0),0),w=v.reduce((E,g)=>{const y=b[g.qid];return E+(y!=null&&y.isCorrect?g.score??0:0)},0),C=typeof x=="number"&&typeof p=="number"?Math.max(0,p-x):0,I=v.map(E=>{const g=b[E.qid];return{qid:E.qid,index:E.index,question:E.question,score:E.score??0,isCorrect:(g==null?void 0:g.isCorrect)??!1,selected:(g==null?void 0:g.selected)??[],correctIdxes:(g==null?void 0:g.correctIdxes)??[],ms:(g==null?void 0:g.ms)??0,timedOut:(g==null?void 0:g.timedOut)??!1}}),T={sectionId:l??"",total:S,correct:h,rate:S>0?Math.round(h/S*100):0,totalScore:u,gainedScore:w,timeMsTotal:C,perQuestion:I};a(T)}});return()=>o()},[n]),m.jsx(wr.Provider,{value:n,children:e})}function xd({containerRef:e}){const t=At(),n=Ot();return f.useEffect(()=>{const r=e.current;if(!r)return;let o=r.clientWidth,s=r.clientHeight;n.getState().setViewportSize(o,s);const i=new ResizeObserver(()=>{const a=r.clientWidth,l=r.clientHeight;(a!==o||l!==s)&&(o=a,s=l,n.getState().setViewportSize(a,l),t.getState().emit({type:"viewport_resize",payload:{width:a,height:l}}))});return i.observe(r),()=>{i.disconnect()}},[t,n,e]),null}const vd=e=>e;function Sd(e,t=vd){const n=f.useSyncExternalStore(e.subscribe,f.useCallback(()=>t(e.getState()),[e,t]),f.useCallback(()=>t(e.getInitialState()),[e,t]));return f.useDebugValue(n),n}const Oo=e=>{const t=yt(e),n=r=>Sd(t,r);return Object.assign(n,t),n},yd=(e=>e?Oo(e):Oo),Bo=yd(e=>({_snapshotGetter:null,registerSnapshotGetter:t=>{e({_snapshotGetter:t})},unregisterSnapshotGetter:()=>{e({_snapshotGetter:null})}}));function wd({containerRef:e}){const t=Ot(),n=St(),r=At();return f.useEffect(()=>{if(!!!r.getState().emitCallback)return;const s=()=>{var h,u,w,C,I;const i=t.getState(),{progress:a}=n.getState(),l=(h=e.current)==null?void 0:h.getBoundingClientRect(),c=(l==null?void 0:l.width)??0,d=(l==null?void 0:l.height)??0,b=(u=a.getSectionScrollApi)==null?void 0:u.call(a),x=((w=b==null?void 0:b.getScrollTop)==null?void 0:w.call(b))??0,p=(C=b==null?void 0:b.getVisibleRange)==null?void 0:C.call(b),v=(p==null?void 0:p.first)??a.currentGlobalRunIndex,S=((I=b==null?void 0:b.getAnchorOffsetRatio)==null?void 0:I.call(b,v))??0;return{viewerState:{mode:i.mode,theme:i.theme,fontFamily:i.fontFamily,fontSizePx:i.fontSizePx,lineHeight:i.lineHeight,marginX:i.marginX,marginY:i.marginY,pointerStyle:i.pointerStyle,pointerColor:i.pointerColor,breakMarks:i.breakMarks,breakGapPx:i.breakGapPx,muteAudio:i.muteAudio,audioSpeed:i.audioSpeed,audioTargetWpm:i.audioTargetWpm,showPointer:i.showPointer,showSplit:i.showSplit,showOverlays:i.showOverlays,isSettingsOpen:i.isSettingsOpen,viewportWidth:i.viewportWidth,viewportHeight:i.viewportHeight,playbackViewportWidth:i.playbackViewportWidth,playbackViewportHeight:i.playbackViewportHeight},globalIndex:a.currentGlobalRunIndex,scrollY:x,anchorGI:v,anchorOffsetRatio:S,sectionId:a.sectionId,viewportWidth:c,viewportHeight:d}};return Bo.getState().registerSnapshotGetter(s),()=>{Bo.getState().unregisterSnapshotGetter()}},[r,t,n,e]),null}function Cd(){const e=At(),t=Ot(),n=St(),r=f.useContext(vn),o=f.useCallback(l=>{const{viewerState:c}=l;if(c){c.mode&&t.getState().setMode(c.mode);const{mode:b,...x}=c;t.setState(x)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(c==null?void 0:c.mode)==="scroll"||!(c!=null&&c.mode)){const b=n.getState().progress.getSectionScrollApi();if(b){if(l.scrollY===0)b.setScrollTop(0);else if(b.scrollToGIAtOffset){const x=l.anchorGI??l.globalIndex;if(typeof x=="number"){const p=l.anchorOffsetRatio??0;b.scrollToGIAtOffset(x,p)}}}}},[t,n]),s=f.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:c}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(c,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:b,anchorOffsetRatio:x}=l.payload,p=n.getState().progress.getSectionScrollApi();p&&(d===0?p.setScrollTop(0):p.scrollToGIAtOffset&&typeof b=="number"&&p.scrollToGIAtOffset(b,x));break}case"settings_change":{const{key:c,value:d}=l.payload,b=t.getState();c in b&&typeof b[c]!="function"&&t.setState({[c]:d});break}case"mode_change":{const{mode:c}=l.payload;t.getState().setMode(c);break}case"audio_control":{if(!r)break;const{action:c}=l.payload;switch(c){case"play":r.getState()._setStatusOnly("playing");break;case"pause":r.getState()._setStatusOnly("paused");break;case"stop":r.getState()._setStatusOnly("idle");break}break}case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[PlaybackHandler] 미처리 이벤트:",l.type)}},[n,t,r]),i=f.useCallback(()=>{e.getState().setDispatchHandler(s),e.getState().setApplySnapshotHandler(o)},[e,s,o]),a=f.useCallback(()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)},[e]);return f.useEffect(()=>{if(e.getState().isPlaybackMode)return i(),()=>a()},[e,i,a]),f.useEffect(()=>e.subscribe((c,d)=>{c.isPlaybackMode&&!d.isPlaybackMode?i():!c.isPlaybackMode&&d.isPlaybackMode&&a()}),[e,i,a]),null}const zo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","audioTargetWpm","showPointer","showSplit","showOverlays","isSettingsOpen"];function Id(){const e=At(),t=Ot(),n=f.useRef(null);return f.useEffect(()=>{const r=t.getState();n.current={};for(const s of zo)n.current[s]=r[s];const o=t.subscribe(s=>{const i=n.current;if(i)for(const a of zo){const l=i[a],c=s[a];l!==c&&(a==="mode"?e.getState().emit({type:"mode_change",payload:{mode:c}}):e.getState().emit({type:"settings_change",payload:{key:a,value:c}}),i[a]=c)}});return()=>{o(),n.current=null}},[e,t]),null}const kd=({onTranslate:e})=>{const t=Y(d=>d.rangeStartGI),n=Y(d=>d.rangeEndGI),r=Y(d=>d.getRangeText),o=Y(d=>d.clearRange),s=t!=null&&n!=null,[i,a]=f.useState(null);f.useEffect(()=>{if(!s)return;const d=()=>{o()};return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[s,o]),f.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const d=()=>{const b=document.querySelector(`[data-g="${n}"]`);if(!b){a({x:window.innerWidth/2,y:80});return}const x=b.getBoundingClientRect(),p=document.querySelector(`[data-g="${t}"]`),v=p==null?void 0:p.getBoundingClientRect();let S=x.left+x.width/2;v&&(S=(v.left+x.right)/2);const h=160,u=50,w=16,C=12,I=Math.max(w+h/2,Math.min(S,window.innerWidth-w-h/2)),T=((v==null?void 0:v.top)??x.top)-u-C;let E=T;T<w&&(E=x.bottom+C),a({x:I,y:E})};return d(),window.addEventListener("scroll",d,!0),()=>window.removeEventListener("scroll",d,!0)},[s,t,n]);const l=f.useCallback(async()=>{const d=r();if(d)try{await navigator.clipboard.writeText(d)}catch(b){console.error("복사 실패:",b)}o()},[r,o]),c=f.useCallback(()=>{const d=r();d&&e&&e(d)},[r,e]);return!s||!i?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"fixed",left:i.x,top:i.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[m.jsx("button",{onClick:l,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:c,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},Rd="_handleStart_1336y_16 _handle_1336y_1",Td="_handleEnd_1336y_21 _handle_1336y_1",Ao={handleStart:Rd,handleEnd:Td},_d=()=>{const e=Y(S=>S.rangeStartGI),t=Y(S=>S.rangeEndGI),n=Y(S=>S.setRange),r=e!=null&&t!=null,[o,s]=f.useState(null),[i,a]=f.useState(null),l=f.useRef(null),c=f.useRef(null);f.useEffect(()=>{if(!r||e==null||t==null){s(null),a(null);return}const S=()=>{const h=document.querySelector(`[data-g="${e}"]`),u=document.querySelector(`[data-g="${t}"]`);if(h){const w=h.getBoundingClientRect();s({x:w.left,y:w.bottom})}else s(null);if(u){const w=u.getBoundingClientRect();a({x:w.right,y:w.bottom})}else a(null)};return S(),window.addEventListener("scroll",S,!0),window.addEventListener("resize",S),()=>{window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S)}},[r,e,t]);const d=f.useCallback((S,h)=>{var w;const u=document.elementsFromPoint(S,h);for(const C of u){const I=(w=C.getAttribute)==null?void 0:w.call(C,"data-g");if(I!=null)return parseInt(I,10)}return null},[]),b=f.useCallback(S=>h=>{h.preventDefault(),h.stopPropagation(),l.current=S,c.current=S==="start"?e:t,h.target.setPointerCapture(h.pointerId)},[e,t]),x=f.useCallback(S=>{if(!l.current||e==null||t==null)return;const h=d(S.clientX,S.clientY);h!=null&&(l.current==="start"?h<=t?n(h,t):(n(t,h),l.current="end"):h>=e?n(e,h):(n(h,e),l.current="start"))},[e,t,n,d]),p=f.useCallback(S=>{l.current=null,c.current=null,S.target.releasePointerCapture(S.pointerId)},[]);return r?m.jsxs(m.Fragment,{children:[o&&m.jsx("div",{className:Ao.handleStart,"data-range-handle":"start",style:{left:o.x-26,top:o.y},onPointerDown:b("start"),onPointerMove:x,onPointerUp:p,onPointerCancel:p}),i&&m.jsx("div",{className:Ao.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:b("end"),onPointerMove:x,onPointerUp:p,onPointerCancel:p})]}):null};function Md(){const e=Y(o=>o.rangeStartGI),t=Y(o=>o.rangeEndGI),n=Y(o=>o.clearRange),r=e!=null&&t!=null;return f.useEffect(()=>{if(!r)return;const o=s=>{var a;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(a=i.closest("[data-g]"))==null?void 0:a.getAttribute("data-g");if(l){const c=parseInt(l,10),d=Math.min(e,t),b=Math.max(e,t);if(c>=d&&c<=b)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Ed=({isOpen:e,onClose:t,text:n})=>e?m.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:10001},onClick:t,children:m.jsxs("div",{style:{position:"relative",backgroundColor:"#fff",borderRadius:12,padding:"24px 32px",minWidth:280,maxWidth:"80%",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)"},onClick:r=>r.stopPropagation(),children:[m.jsx("button",{onClick:t,style:{position:"absolute",top:12,right:12,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:20,color:"#666"},"aria-label":"닫기",children:"✕"}),m.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:18,fontWeight:600,color:"#333"},children:"번역"}),m.jsx("p",{style:{margin:0,fontSize:16,color:"#666",textAlign:"center",padding:"16px 0"},children:"준비중입니다"}),n&&m.jsxs("div",{style:{marginTop:16,padding:12,backgroundColor:"#f5f5f5",borderRadius:8,fontSize:14,color:"#888",maxHeight:100,overflow:"auto"},children:[m.jsx("span",{style:{fontWeight:500},children:"선택된 텍스트: "}),n]})]})}):null,jd=(e,t,n)=>Math.min(n,Math.max(t,e));function Bs({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:c,isPlaybackMode:d=!1,playbackScale:b}){const x=String((e==null?void 0:e.section_id)??"0"),p=f.useMemo(()=>{var C,I;const u=((C=e==null?void 0:e.ast)==null?void 0:C.blocks)??[];let w=0;for(const T of u)(T==null?void 0:T.type)!=="image"&&(w+=((I=T==null?void 0:T.runs)==null?void 0:I.length)??0);return w},[e]),v=f.useMemo(()=>typeof n=="number"?jd(n,p>0?0:-1,Math.max(p-1,-1)):(p>0,0),[n,p]),S=f.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=f.useMemo(()=>{const u=(e==null?void 0:e.audios)??[],w=u.length>0?Jc(e):void 0;return{clips:u,map:w,initialIndex:v,section:e}},[e,v]);return m.jsx(ni,{onViewerEvent:l,isPlaybackMode:d,playbackScale:b,viewerRef:c,children:m.jsx(su,{initialState:t,children:m.jsx(ou,{initialState:S,children:m.jsx(Zc,{initialState:h,children:m.jsx(bd,{initialState:{section:e,onQuizComplete:a},children:m.jsx(Pd,{})},x)},x)},x)})})}function Pd(){const e=te(d=>d.mode),t=f.useRef(null),[n,r]=f.useState(!1),[o,s]=f.useState(),i=f.useCallback(d=>{s(d),r(!0)},[]),a=f.useCallback(()=>{r(!1),s(void 0)},[]),l=d=>{d.preventDefault()},c=d=>{d.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:l,onDragStart:c,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(Ca,{}):m.jsx(Mu,{}),m.jsx($c,{}),m.jsx(dd,{}),m.jsx(Bu,{}),m.jsx(kd,{onTranslate:i}),m.jsx(_d,{}),m.jsx(Md,{}),m.jsx(Ed,{isOpen:n,onClose:a,text:o}),m.jsx(wd,{containerRef:t}),m.jsx(xd,{containerRef:t}),m.jsx(Id,{}),m.jsx(Cd,{})]})}function Od(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M5.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75A.75.75 0 0 0 7.25 3h-1.5ZM12.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75a.75.75 0 0 0-.75-.75h-1.5Z"},child:[]}]})(e)}function Bd(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M6.3 2.84A1.5 1.5 0 0 0 4 4.11v11.78a1.5 1.5 0 0 0 2.3 1.27l9.344-5.891a1.5 1.5 0 0 0 0-2.538L6.3 2.841Z"},child:[]}]})(e)}const zd="_button_onals_1",Ad={button:zd};function Ld({playbackState:e,disabled:t,onClick:n}){return m.jsx("button",{onClick:n,disabled:t,className:Ad.button,title:e==="playing"?"일시정지":e==="paused"?"재개":"재생",children:e==="playing"?m.jsx(Od,{}):m.jsx(Bd,{})})}const Gd=f.memo(Ld),Hd="_container_18q02_1",Nd="_topRow_18q02_11",Fd="_timeDisplay_18q02_17",Wd="_bottomRow_18q02_23",Vd="_sliderContainer_18q02_29",Dd="_trackBackground_18q02_35",$d="_trackFill_18q02_47",qd="_rangeInput_18q02_54",Ud="_viewportInfo_18q02_89",ot={container:Hd,topRow:Nd,timeDisplay:Fd,bottomRow:Wd,sliderContainer:Vd,trackBackground:Dd,trackFill:$d,rangeInput:qd,"rangeInput--disabled":"_rangeInput--disabled_18q02_66",viewportInfo:Ud};function Kd({playbackState:e,disabled:t,elapsedTime:n,totalDuration:r,viewport:o,onTogglePlay:s,onSeekStart:i,onSeekChange:a,onSeekEnd:l}){const c=b=>{a(parseFloat(b.target.value))},d=[ot.rangeInput,t&&ot["rangeInput--disabled"]].filter(Boolean).join(" ");return m.jsxs("div",{className:ot.container,children:[m.jsxs("div",{className:ot.topRow,children:[m.jsx(Gd,{playbackState:e,disabled:t,onClick:s}),m.jsxs("span",{className:ot.viewportInfo,children:["해상도: ",o.width.toFixed(0)," × ",o.height.toFixed(0)]}),m.jsxs("span",{className:ot.timeDisplay,children:[n.toFixed(1),"s / ",r.toFixed(1),"s"]})]}),m.jsx("div",{className:ot.bottomRow,children:m.jsxs("div",{className:ot.sliderContainer,children:[m.jsx("div",{className:ot.trackBackground,children:m.jsx("div",{className:ot.trackFill,style:{width:`${n/r*100}%`}})}),m.jsx("input",{type:"range",min:0,max:r,step:.01,value:n,onMouseDown:i,onTouchStart:i,onChange:c,onMouseUp:l,onTouchEnd:l,disabled:t,className:d})]})})]})}const zs=f.memo(Kd),Qd="_outerContainer_77t1u_1",Yd="_scaleWrapper_77t1u_11",Xd="_viewerContainer_77t1u_15",Zd="_eventBlocker_77t1u_22",Jd="_emptyMessage_77t1u_29",e0="_bufferingOverlay_77t1u_34",t0="_spinner_77t1u_44",ut={outerContainer:Qd,scaleWrapper:Yd,viewerContainer:Xd,eventBlocker:Zd,emptyMessage:Jd,bufferingOverlay:e0,spinner:t0},n0=f.memo(Bs),Lo=24;function r0({isBuffering:e,isEmpty:t,currentViewport:n,initialSnapshot:r,section:o,sectionSummaries:s,onSectionChange:i,viewerRef:a,onContainerResize:l,onScaleChange:c}){const d=f.useRef(null),[b,x]=f.useState({width:0,height:0});f.useEffect(()=>{const h=d.current;if(!h)return;const u=()=>{const C={width:h.clientWidth,height:h.clientHeight};x(C),l==null||l(C)};u();const w=new ResizeObserver(u);return w.observe(h),()=>w.disconnect()},[l]);const p=f.useMemo(()=>n.width>0&&n.height>0?n:{width:r.viewportWidth||400,height:r.viewportHeight||600},[n,r]),v=f.useMemo(()=>{if(b.width===0||b.height===0)return 1;const h=(b.width-Lo*2)/p.width,u=(b.height-Lo*2)/p.height;return Math.min(h,u,1)},[b,p]);f.useEffect(()=>{c==null||c(v)},[v,c]);const S=b.width>0&&b.height>0;return m.jsxs("div",{ref:d,className:ut.outerContainer,children:[!t&&S?m.jsx("div",{className:ut.scaleWrapper,style:{transform:`scale(${v})`},children:m.jsxs("div",{className:ut.viewerContainer,style:{width:p.width,height:p.height},children:[m.jsx(n0,{section:o,initialProgressRunIndex:r.globalIndex,initialViewerState:{...r.viewerState,playbackViewportWidth:p.width,playbackViewportHeight:p.height},isPlaybackMode:!0,playbackScale:v,viewerRef:a}),m.jsx("canvas",{className:ut.eventBlocker,style:{width:p.width,height:p.height}})]})}):t?m.jsx("div",{className:ut.emptyMessage,children:"녹화된 데이터가 없습니다."}):m.jsx("div",{className:ut.emptyMessage,children:"로딩 중..."}),e&&m.jsx("div",{className:ut.bufferingOverlay,children:m.jsx("div",{className:ut.spinner})})]})}const As=f.memo(r0),Sn=f.createContext(void 0);function dt(e,t){const n=f.useContext(Sn);if(!n)throw new Error("useViewerPlayerStore must be used inside <ViewerPlayerProvider>");return Qt(n,e,t)}function Ls(){const e=f.useContext(Sn);if(!e)throw new Error("useViewerPlayerStoreApi must be used inside <ViewerPlayerProvider>");return e}const Go={width:0,height:0};function Gs(){return yt((e,t)=>({meta:null,playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:Go,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0,setMeta:n=>e({meta:n}),setPlaybackState:n=>e({playbackState:n}),setIsBuffering:n=>e({isBuffering:n}),setElapsedTime:n=>e({elapsedTime:n}),setCurrentViewport:n=>e({currentViewport:n}),setViewportScale:n=>e({viewportScale:n}),setCurrentSection:n=>e({currentSection:n}),addLoadedChunk:n=>{const{loadedChunks:r}=t(),o=new Set(r);o.add(n),e({loadedChunks:o})},removeLoadedChunks:n=>{const{loadedChunks:r}=t(),o=new Set(r);for(const s of n)o.delete(s);e({loadedChunks:o})},setLoadedChunks:n=>e({loadedChunks:n}),setCurrentChunkIndex:n=>e({currentChunkIndex:n}),reset:n=>{e({playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:n??Go,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0})}}))}function Hs({children:e,meta:t,initialSection:n,initialViewport:r}){const o=f.useMemo(()=>Gs(),[]);return f.useLayoutEffect(()=>{o.getState().setMeta(t??null)},[t,o]),f.useLayoutEffect(()=>{n&&o.getState().setCurrentSection(n)},[n,o]),f.useLayoutEffect(()=>{r&&o.getState().setCurrentViewport(r)},[r,o]),m.jsx(Sn.Provider,{value:o,children:e})}const o0="_container_1dh6p_1",s0={container:o0},i0=100;function l0(e){const{meta:t,initialSection:n}=e,r={width:t.initialSnapshot.viewportWidth,height:t.initialSnapshot.viewportHeight};return m.jsx(Hs,{meta:t,initialSection:n,initialViewport:r,children:m.jsx(a0,{...e})})}function a0({meta:e,getChunk:t,availableChunks:n,initialStartTime:r=0,initialSection:o,sectionsMap:s,sectionSummaries:i=[],onSectionChange:a,onChunksEvicted:l}){const{totalDuration:c,chunkCount:d,chunkDuration:b,initialSnapshot:x}=e,p=Ls(),v=dt(M=>M.playbackState),S=dt(M=>M.isBuffering),h=dt(M=>M.elapsedTime),u=dt(M=>M.currentViewport);dt(M=>M.viewportScale);const w=dt(M=>M.currentSection);dt(M=>M.loadedChunks);const C=f.useMemo(()=>d===0?0:Math.min(Math.floor(r/b),d-1),[r,b,d]),I=f.useRef(0),T=f.useRef(0),E=f.useRef(0),g=f.useRef(null),y=f.useRef(0),_=f.useRef(0),B=f.useRef(0),R=f.useRef(!1),P=f.useRef(null),k=f.useRef(new Map),O=f.useRef(new Set),z=f.useRef(null);f.useMemo(()=>{if(d===0)return 0;const M=Math.floor(h/b);return Math.min(M,d-1)},[h,b,d]);const L=`${c}-${d}-${x.globalIndex}`,j=f.useRef(L);f.useEffect(()=>{L!==j.current&&(j.current=L,g.current&&(cancelAnimationFrame(g.current),g.current=null),p.getState().reset({width:x.viewportWidth,height:x.viewportHeight}),p.getState().setCurrentSection(o),I.current=0,T.current=0,P.current=null,k.current.clear(),O.current.clear(),E.current=0,y.current=0,_.current=0,B.current=0,R.current=!1)},[L,x,o,p]);const A=f.useCallback(M=>{var $;const F=p.getState(),H=F.currentSection;if(M.type==="viewport_resize"){const{width:Q,height:D}=M.payload;F.setCurrentViewport({width:Q,height:D})}else if(M.type==="section_change"||M.type==="render_start"){const{sectionId:Q}=M.payload,D=s.get(Q);D&&H&&D.section_id!==H.section_id&&(console.log(`[CR_ViewerPlayback] 섹션 변경 (${M.type}): ${Q}`),F.setCurrentSection(D),a==null||a(Q))}($=z.current)==null||$.dispatch(M)},[s,a,p]),W=f.useCallback(async M=>{if(M<0||M>=d)return null;const F=k.current.get(M);if(F)return F;if(O.current.has(M)){for(;O.current.has(M);)await new Promise(H=>setTimeout(H,10));return k.current.get(M)??null}O.current.add(M);try{const H=await t(M);k.current.set(M,H);const $=[];for(const D of k.current.keys())(D<M-1||D>M+2)&&(k.current.delete(D),$.push(D));const Q=p.getState();return Q.addLoadedChunk(M),$.length>0&&(Q.removeLoadedChunks($),l==null||l($)),H}catch(H){return console.error(`[PlaybackContainer] 청크 ${M} 로드 실패:`,H),null}finally{O.current.delete(M)}},[d,t,l,p]),U=f.useCallback(M=>{const F=M+1;F<d&&!k.current.has(F)&&W(F)},[d,W]),X=f.useRef(!0);f.useEffect(()=>{if(!X.current||d===0)return;X.current=!1;const M=p.getState();I.current=r,y.current=r,_.current=C,M.setElapsedTime(r);let F=!1;return(async()=>{const $=C+1,Q=[W(C)];$<d&&Q.push(W($));const[D]=await Promise.all(Q);F||!D||(P.current=D,M.setCurrentViewport({width:D.snapshot.viewportWidth,height:D.snapshot.viewportHeight}),setTimeout(()=>{var ne;if(F)return;const de=s.get(D.snapshot.sectionId);de&&M.setCurrentSection(de),(ne=z.current)==null||ne.applySnapshot(D.snapshot);let J=0;for(let se=0;se<D.events.length;se++){const ue=D.events[se];if(ue.relTime<=r)A(ue),J=se+1;else break}B.current=J},50))})(),()=>{F=!0}},[d,W,C,r,s,A,p]);const ie=f.useCallback(async M=>{const F=p.getState(),H=Math.min(Math.floor(M/b),d-1),$=H+1,Q=[W(H)];$<d&&Q.push(W($));const[D]=await Promise.all(Q);D&&(P.current=D,F.setCurrentViewport({width:D.snapshot.viewportWidth,height:D.snapshot.viewportHeight}),setTimeout(()=>{var ne;const de=s.get(D.snapshot.sectionId);de&&F.setCurrentSection(de),(ne=z.current)==null||ne.applySnapshot(D.snapshot);let J=0;for(let se=0;se<D.events.length;se++){const ue=D.events[se];if(ue.relTime<=M)A(ue),J=se+1;else break}_.current=H,B.current=J},0))},[b,d,W,s,A,p]),le=f.useCallback(async M=>{const F=p.getState(),H=Math.max(0,Math.min(M,c));F.setIsBuffering(!0),g.current&&(cancelAnimationFrame(g.current),g.current=null),I.current=H,F.setElapsedTime(H),y.current=H,await ie(H),F.setIsBuffering(!1)},[c,ie,p]),me=f.useCallback(()=>{const M=p.getState(),F=performance.now(),H=(F-E.current)/1e3;I.current=H,F-T.current>=i0&&(T.current=F,M.setElapsedTime(H));const $=P.current;if(!$){M.setIsBuffering(!0);const J=_.current;W(J).then(ne=>{ne?(P.current=ne,p.getState().setIsBuffering(!1),g.current=requestAnimationFrame(me)):(p.getState().setIsBuffering(!1),p.getState().setPlaybackState("paused"))});return}const Q=_.current,D=$.events;let de=B.current;for(;de<D.length;){const J=D[de];if(J.relTime<=H)A(J),de++;else break}if(B.current=de,H>=$.endTime)if(Q<d-1){const J=Q+1;_.current=J,B.current=0;const ne=k.current.get(J);ne?(P.current=ne,M.setCurrentViewport({width:ne.snapshot.viewportWidth,height:ne.snapshot.viewportHeight}),U(J),g.current=requestAnimationFrame(me)):(M.setIsBuffering(!0),W(J).then(se=>{se?(P.current=se,p.getState().setCurrentViewport({width:se.snapshot.viewportWidth,height:se.snapshot.viewportHeight}),p.getState().setIsBuffering(!1),U(J),g.current=requestAnimationFrame(me)):(p.getState().setIsBuffering(!1),p.getState().setPlaybackState("paused"))}));return}else{M.setPlaybackState("paused"),M.setElapsedTime(c),y.current=c;return}g.current=requestAnimationFrame(me)},[d,c,W,U,A,p]),be=f.useCallback(async()=>{var H;if(d===0)return;const M=p.getState(),F=M.playbackState;if(F==="playing")g.current&&(cancelAnimationFrame(g.current),g.current=null),y.current=I.current,M.setElapsedTime(I.current),M.setPlaybackState("paused");else{const $=()=>{p.getState().setPlaybackState("playing"),g.current=requestAnimationFrame(me)};if(F==="paused")if(I.current>=c-.01){E.current=performance.now(),_.current=0,B.current=0,I.current=0,M.setElapsedTime(0),y.current=0,M.setCurrentViewport({width:x.viewportWidth,height:x.viewportHeight}),M.setIsBuffering(!0);const Q=await W(0);p.getState().setIsBuffering(!1),Q&&(P.current=Q,(H=z.current)==null||H.applySnapshot(Q.snapshot),U(0),setTimeout($,100))}else E.current=performance.now()-y.current*1e3,$();else E.current=performance.now()-I.current*1e3,U(_.current),$()}},[d,c,x,me,W,U,p]),K=f.useRef(null),oe=f.useCallback(()=>{R.current=p.getState().playbackState==="playing",g.current&&(cancelAnimationFrame(g.current),g.current=null)},[p]),G=f.useCallback(M=>{const F=Math.max(0,Math.min(M,c));K.current=F,I.current=F,p.getState().setElapsedTime(F),y.current=F},[c,p]),ee=f.useCallback(async()=>{const M=K.current;K.current=null,M!==null&&await le(M),R.current?setTimeout(()=>{E.current=performance.now()-y.current*1e3,g.current=requestAnimationFrame(me)},100):p.getState().playbackState==="idle"&&p.getState().setPlaybackState("paused"),R.current=!1},[le,me,p]);return f.useEffect(()=>()=>{g.current&&cancelAnimationFrame(g.current)},[]),w?m.jsxs("div",{className:s0.container,children:[m.jsx(zs,{playbackState:v,disabled:d===0,elapsedTime:h,totalDuration:c,viewport:{width:u.width,height:u.height},onTogglePlay:be,onSeekStart:oe,onSeekChange:G,onSeekEnd:ee}),m.jsx(As,{isBuffering:S,isEmpty:d===0,currentViewport:u,initialSnapshot:x,section:w,sectionSummaries:i,onSectionChange:a,viewerRef:z,onScaleChange:p.getState().setViewportScale})]}):null}exports.CRViewer=Bs;exports.CR_ViewerPlayback=l0;exports.PlaybackBar=zs;exports.PlaybackViewport=As;exports.ViewerPlayerContext=Sn;exports.ViewerPlayerProvider=Hs;exports.createViewerPlayerStore=Gs;exports.useViewerPlayerStore=dt;exports.useViewerPlayerStoreApi=Ls;
|
|
34
|
+
*/var Tr;function Ls(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(c,u,S,y,b){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),b!==void 0&&v.hasValue){var f=v.value;if(b(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return b!==void 0&&b(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,b]);var p=o(c,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Cn}var _r;function Gs(){return _r||(_r=1,process.env.NODE_ENV==="production"?Yt.exports=As():Yt.exports=Ls()),Yt.exports}var Hs=Gs();const Ns=Oo(Hs),Mr=e=>{let t;const n=new Set,r=(c,u)=>{const S=typeof c=="function"?c(t):c;if(!Object.is(S,t)){const y=t;t=u??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(b=>b(t,y))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,o,a);return a},Vt=(e=>e?Mr(e):Mr),{useSyncExternalStoreWithSelector:Fs}=Ns,Ws=e=>e;function fn(e,t=Ws,n){const r=Fs(e.subscribe,e.getState,e.getInitialState,t,n);return g.useDebugValue(r),r}function X(e,t){const n=g.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return fn(n,e,t)}function pn(){const e=g.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const bt=g.createContext(void 0),Bo=g.createContext(void 0);function Ds(){return Vt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] applySnapshot called but no handler registered")}}))}function Vs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=g.useMemo(()=>Ds(),[]);return g.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),g.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),m.jsx(bt.Provider,{value:s,children:m.jsx(Bo.Provider,{value:o,children:e})})}function $s({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=g.useRef(null);g.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=g.useCallback(a=>{if(!(r!=null&&r(a.target))&&a.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(a)},n)}},[n,e,r]),i=g.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const rn={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},In=[8,16,24,40,64],kn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Rn=[4,8,12,16,24],Xn=e=>Math.round(12+(e-1)*(16/11)),qs=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Xn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Tn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},zo=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],Ge={mode:"page",theme:"light",fontFamily:zo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,overlayCompactMode:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,isDev:!1};function Us(e){const{init:t,recorderStore:n}=e??{};return Vt((r,o)=>({...Ge,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{const s=!o().showOverlays;r({showOverlays:s,...s&&{overlayCompactMode:!0}})},setOverlayCompactMode:s=>r({overlayCompactMode:s}),toggleOverlayCompactMode:()=>r({overlayCompactMode:!o().overlayCompactMode}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:Ge.mode,theme:Ge.theme,fontFamily:Ge.fontFamily,fontSizePx:Ge.fontSizePx,lineHeight:Ge.lineHeight,marginX:Ge.marginX,marginY:Ge.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:Ge.pointerStyle,pointerColor:Ge.pointerColor,breakMarks:Ge.breakMarks,breakGapPx:Ge.breakGapPx,muteAudio:Ge.muteAudio,audioSpeed:Ge.audioSpeed,showPointer:Ge.showPointer,showSplit:Ge.showSplit})),maps:{MARGIN_MAP:In,LINEHEIGHT_MAP:kn,BREAK_GAP_MAP:Rn,fontSizeFromLevel:Xn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Rn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Tn(o().breakGapPx,Rn),getFontLevel:()=>qs(o().fontSizePx),getLineLevel:()=>Tn(o().lineHeight,kn),getMarginLevel:()=>Tn(o().marginX,In),setFontLevel:s=>r({fontSizePx:Xn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:kn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=In[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{const i=Math.max(.3,Math.min(2,s));r({audioSpeed:i}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:i}})},incAudioSpeed:()=>{const s=Math.min(2,Math.round((o().audioSpeed+.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},decAudioSpeed:()=>{const s=Math.max(.3,Math.round((o().audioSpeed-.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i})}))}const hn=0,dt=1,Et=2,Ao=4;function Er(e){return()=>e}function Ks(e){e()}function Lo(e,t){return n=>e(t(n))}function jr(e,t){return()=>e(t)}function Qs(e,t){return n=>e(t,n)}function ir(e){return e!==void 0}function Ys(...e){return()=>{e.map(Ks)}}function jt(){}function gn(e,t){return t(e),e}function Xs(e,t){return t(e)}function ke(...e){return e}function ve(e,t){return e(dt,t)}function de(e,t){e(hn,t)}function lr(e){e(Et)}function Te(e){return e(Ao)}function J(e,t){return ve(e,Qs(t,hn))}function tt(e,t){const n=e(dt,r=>{n(),t(r)});return n}function Or(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Go(e,t){return e===t}function Ie(e=Go){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function K(e){return t=>Lo(t,e)}function st(e){return t=>()=>{t(e)}}function L(e,...t){const n=Zs(...t);return((r,o)=>{switch(r){case Et:lr(e);return;case dt:return ve(e,n(o))}})}function it(e,t){return n=>r=>{n(t=e(t,r))}}function xt(e){return t=>n=>{e>0?e--:t(n)}}function at(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function fe(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{const c=n;n=n|a,t[i]=l,c!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function Zs(...e){return t=>e.reduceRight(Xs,t)}function Js(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case dt:return s?n===s?void 0:(r(),n=s,t=ve(e,s),t):(r(),jt);case Et:r(),n=null;return}}}function N(e){let t=e;const n=ge();return((r,o)=>{switch(r){case hn:t=o;break;case dt:{o(t);break}case Ao:return t}return n(r,o)})}function Ne(e,t){return gn(N(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case hn:e.slice().forEach(r=>{r(n)});return;case Et:e.splice(0,e.length);return;case dt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return gn(ge(),t=>J(e,t))}function be(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ei(),singleton:n}}const ei=()=>Symbol();function ti(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function Pe(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{n[i]=l,r=r|a,r===o&&de(t,n)})}),function(s,i){switch(s){case Et:{lr(t);return}case dt:return r===o&&i(n),ve(t,i)}}}function se(e,t=Go){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case Et:return;case dt:return Ys(...e.map(r=>ve(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const ni={0:"debug",3:"error",1:"log",2:"warn"},ri=()=>typeof globalThis>"u"?window:globalThis,ft=be(()=>{const e=N(3);return{log:N((t,n,r=1)=>{var o;const s=(o=ri().VIRTUOSO_LOG_LEVEL)!=null?o:Te(e);r>=s&&console[ni[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function vt(e,t,n){return ar(e,t,n).callbackRef}function ar(e,t,n){const r=g.useRef(null);let o=i=>{};const s=g.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function oi(e,t,n,r,o,s,i,a,l){const c=g.useCallback(u=>{const S=si(u.children,t,a?"offsetWidth":"offsetHeight",o);let y=u.parentElement;for(;!y.dataset.virtuosoScroller;)y=y.parentElement;const b=y.lastElementChild.dataset.viewportType==="window";let x;b&&(x=y.ownerDocument.defaultView);const v=i?a?i.scrollLeft:i.scrollTop:b?a?x.scrollX||x.document.documentElement.scrollLeft:x.scrollY||x.document.documentElement.scrollTop:a?y.scrollLeft:y.scrollTop,p=i?a?i.scrollWidth:i.scrollHeight:b?a?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight:a?y.scrollWidth:y.scrollHeight,h=i?a?i.offsetWidth:i.offsetHeight:b?a?x.innerWidth:x.innerHeight:a?y.offsetWidth:y.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(v,0),viewportHeight:h}),s==null||s(a?Pr("column-gap",getComputedStyle(u).columnGap,o):Pr("row-gap",getComputedStyle(u).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,a]);return ar(c,n,l)}function si(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),u=t(a,n);if(u===0&&r("Zero-sized element, this should not happen",{child:a},Ve.ERROR),u===c)continue;const S=s[s.length-1];s.length===0||S.size!==u||S.endIndex!==l-1?s.push({endIndex:l,size:u,startIndex:l}):s[s.length-1].endIndex++}return s}function Pr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ho(e,t,n){const r=g.useRef(null),o=g.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),u=c.width;let S,y;if(t){const b=t.getBoundingClientRect(),x=c.top-b.top;y=b.height-Math.max(0,x),S=x+t.scrollTop}else{const b=i.current.ownerDocument.defaultView;y=b.innerHeight-Math.max(0,c.top),S=c.top+b.scrollY}r.current={offsetTop:S,visibleHeight:y,visibleWidth:u},e(r.current)},[e,t]),{callbackRef:s,ref:i}=ar(o,!0,n),a=g.useCallback(()=>{o(i.current)},[o,i]);return g.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",a),c==null||c.addEventListener("resize",a),()=>{c==null||c.removeEventListener("scroll",a),c==null||c.removeEventListener("resize",a)}}},[a,t,i]),s}const We=be(()=>{const e=ge(),t=ge(),n=N(0),r=ge(),o=N(0),s=ge(),i=ge(),a=N(0),l=N(0),c=N(0),u=N(0),S=ge(),y=ge(),b=N(!1),x=N(!1),v=N(!1);return J(L(e,K(({scrollTop:p})=>p)),t),J(L(e,K(({scrollHeight:p})=>p)),i),J(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:a,horizontalDirection:x,scrollBy:y,scrollContainerState:e,scrollHeight:i,scrollingInProgress:b,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),At={lvl:0};function No(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function Se(e){return e===At}function Lt(e,t){if(!Se(e))return t===e.k?e.v:t<e.k?Lt(e.l,t):Lt(e.r,t)}function nt(e,t,n="k"){if(Se(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=nt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return nt(e.l,t,n)}function qe(e,t,n){return Se(e)?Do(t,n,1):t===e.k?ze(e,{k:t,v:n}):t<e.k?Br(ze(e,{l:qe(e.l,t,n)})):Br(ze(e,{r:qe(e.r,t,n)}))}function Rt(){return At}function Tt(e,t,n){if(Se(e))return[];const r=nt(e,t)[0];return ii(er(e,r,n))}function Jn(e,t){if(Se(e))return At;const{k:n,l:r,r:o}=e;if(t===n){if(Se(r))return o;if(Se(o))return r;{const[s,i]=Wo(r);return tn(ze(e,{k:s,l:Fo(r),v:i}))}}else return t<n?tn(ze(e,{l:Jn(r,t)})):tn(ze(e,{r:Jn(o,t)}))}function mt(e){return Se(e)?[]:[...mt(e.l),{k:e.k,v:e.v},...mt(e.r)]}function er(e,t,n){if(Se(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(er(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(er(s,t,n))),a}function tn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(_n(t))return Vo(ze(e,{lvl:n-1}));if(!Se(t)&&!Se(t.r))return ze(t.r,{l:ze(t,{r:t.r.l}),lvl:n,r:ze(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(ze(e,{lvl:n-1}));if(!Se(r)&&!Se(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return ze(o,{l:ze(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(ze(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ze(e,t){return Do(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Fo(e){return Se(e.r)?e.l:tn(ze(e,{r:Fo(e.r)}))}function _n(e){return Se(e)||e.lvl>e.r.lvl}function Wo(e){return Se(e.r)?[e.k,e.v]:Wo(e.r)}function Do(e,t,n,r=At,o=At){return{k:e,l:r,lvl:n,r:o,v:t}}function Br(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!Se(t)&&t.lvl===e.lvl?ze(t,{r:ze(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!Se(n)&&!Se(n.r)&&n.lvl===t&&n.r.lvl===t?ze(n,{l:ze(e,{r:n.l}),lvl:t+1}):e}function ii(e){return No(e,({k:t,v:n})=>({index:t,value:n}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Gt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const cr=be(()=>({recalcInProgress:N(!1)}),[],{singleton:!0});function qo(e,t,n){return e[on(e,t,n)]}function on(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function li(e,t,n,r){const o=on(e,t,r),s=on(e,n,r,o);return e.slice(o,s+1)}function ut(e,t){return Math.round(e.getBoundingClientRect()[t])}function mn(e){return!Se(e.groupOffsetTree)}function ur({index:e},t){return t===e?0:t<e?-1:1}function ai(){return{groupIndices:[],groupOffsetTree:Rt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Rt()}}function ci(e,t){let n=Se(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),Se(e)){e=qe(e,0,s);continue}const a=Tt(e,i-1,o+1);if(a.some(mi(r)))continue;let l=!1,c=!1;for(const{end:u,start:S,value:y}of a)l?(o>=S||s===y)&&(e=Jn(e,S)):(c=y!==s,l=!0),u>o&&o>=S&&y!==s&&(e=qe(e,o+1,y));c&&(e=qe(e,i,s))}return[e,n]}function ui(e){return typeof e.groupIndex<"u"}function di({offset:e},t){return t===e?0:t<e?-1:1}function Ht(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=qo(t,e,ur),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Uo(e,t){if(!mn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Ko(e,t,n){if(ui(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Uo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function fi(e,t,n,r=0){return r>0&&(t=Math.max(t,qo(e,r,ur).offset)),No(li(e,t,n,di),gi)}function pi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&Se(s)&&t.length===2){const y=t[0].size,b=t[1].size;i=n.reduce((x,v)=>qe(qe(x,v,y),v+1,b),i)}else[i,a]=ci(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S}=nr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((y,b)=>qe(y,b,Ht(b,S,o)),Rt()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S,sizeTree:i}}function hi(e){return mt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function zr(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=on(o,t-1,ur),a=o[l].offset;const c=nt(n,t-1);s=c[0],i=c[1],o.length&&o[l].size===nt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:u}of Tt(n,t,1/0)){const S=c-s,y=S*i+a+S*r;o.push({index:c,offset:y,size:u}),s=c,a=y,i=u}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function gi(e){return{index:e.index,value:e}}function mi(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const xi={offsetHeight:"height",offsetWidth:"width"},lt=be(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Ne(r,0),s=ge(),i=ge(),a=N(0),l=N([]),c=N(void 0),u=N(void 0),S=N(void 0),y=N(void 0),b=N((f,w)=>ut(f,xi[w])),x=N(void 0),v=N(0),p=ai(),h=Ne(L(n,fe(l,e,v),it(pi,p),Ie()),p),d=Ne(L(l,Ie(),it((f,w)=>({current:w,prev:f.current}),{current:[],prev:[]}),K(({prev:f})=>f)),[]);J(L(l,ie(f=>f.length>0),fe(h,v),K(([f,w,T])=>{const j=f.reduce((O,z,C)=>qe(O,z,Ht(z,w.offsetTree,T)||C),Rt());return{...w,groupIndices:f,groupOffsetTree:j}})),h),J(L(r,fe(h),ie(([f,{lastIndex:w}])=>f<w),K(([f,{lastIndex:w,lastSize:T}])=>[{endIndex:w,size:T,startIndex:f}])),n),J(c,u);const k=Ne(L(c,K(f=>f===void 0)),!0);J(L(u,ie(f=>f!==void 0&&Se(Te(h).sizeTree)),K(f=>{const w=Te(S),T=Te(l).length>0;return w?T?[{endIndex:0,size:w,startIndex:0},{endIndex:1,size:f,startIndex:1}]:[]:[{endIndex:0,size:f,startIndex:0}]})),n),J(L(y,ie(f=>f!==void 0&&f.length>0&&Se(Te(h).sizeTree)),K(f=>{const w=[];let T=f[0],j=0;for(let O=1;O<f.length;O++){const z=f[O];z!==T&&(w.push({endIndex:O-1,size:T,startIndex:j}),T=z,j=O)}return w.push({endIndex:f.length-1,size:T,startIndex:j}),w})),n),J(L(l,fe(S,u),ie(([,f,w])=>f!==void 0&&w!==void 0),K(([f,w,T])=>{const j=[];for(let O=0;O<f.length;O++){const z=f[O],C=f[O+1];j.push({startIndex:z,endIndex:z,size:w}),C!==void 0&&j.push({startIndex:z+1,endIndex:C-1,size:T})}return j})),n);const _=Ue(L(n,fe(h),it(({sizes:f},[w,T])=>({changed:T!==f,sizes:T}),{changed:!1,sizes:p}),K(f=>f.changed)));ve(L(a,it((f,w)=>({diff:f.prev-w,prev:w}),{diff:0,prev:0}),K(f=>f.diff)),f=>{const{groupIndices:w}=Te(h);if(f>0)de(t,!0),de(s,f+zr(f,w));else if(f<0){const T=Te(d);T.length>0&&(f-=zr(-f,T)),de(i,f)}}),ve(L(a,fe(e)),([f,w])=>{f<0&&w("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ve.ERROR)});const I=Ue(s);J(L(s,fe(h),K(([f,w])=>{const T=w.groupIndices.length>0,j=[],O=w.lastSize;if(T){const z=Lt(w.sizeTree,0);let C=0,M=0;for(;C<f;){const H=w.groupIndices[M],E=w.groupIndices.length===M+1?1/0:w.groupIndices[M+1]-H-1;j.push({endIndex:H,size:z,startIndex:H}),j.push({endIndex:H+1+E-1,size:O,startIndex:H+1}),M++,C+=E+1}const A=mt(w.sizeTree);return C!==f&&A.shift(),A.reduce((H,{k:E,v:P})=>{let F=H.ranges;return H.prevSize!==0&&(F=[...H.ranges,{endIndex:E+f-1,size:H.prevSize,startIndex:H.prevIndex}]),{prevIndex:E+f,prevSize:P,ranges:F}},{prevIndex:f,prevSize:0,ranges:j}).ranges}return mt(w.sizeTree).reduce((z,{k:C,v:M})=>({prevIndex:C+f,prevSize:M,ranges:[...z.ranges,{endIndex:C+f-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const R=Ue(L(i,fe(h,v),K(([f,{offsetTree:w},T])=>{const j=-f;return Ht(j,w,T)})));return J(L(i,fe(h,v),K(([f,w,T])=>{if(w.groupIndices.length>0){if(Se(w.sizeTree))return w;let j=Rt();const O=Te(d);let z=0,C=0,M=0;for(;z<-f;){M=O[C];const A=O[C+1]-M-1;C++,z+=A+1}if(j=mt(w.sizeTree).reduce((A,{k:H,v:E})=>qe(A,Math.max(0,H+f),E),j),z!==-f){const A=Lt(w.sizeTree,M);j=qe(j,0,A);const H=nt(w.sizeTree,-f+1)[1];j=qe(j,1,H)}return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}else{const j=mt(w.sizeTree).reduce((O,{k:z,v:C})=>qe(O,Math.max(0,z+f),C),Rt());return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}})),h),{beforeUnshiftWith:I,data:x,defaultItemSize:u,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:S,gap:v,groupIndices:l,heightEstimates:y,itemSize:b,listRefresh:_,shiftWith:i,shiftWithOffset:R,sizeRanges:n,sizes:h,statefulTotalCount:o,totalCount:r,trackItemSizes:k,unshiftWith:s}},ke(ft,cr),{singleton:!0});function bi(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Qo=be(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),a=Ue(L(s,K(bi)));return J(L(a,K(l=>l.totalCount)),n),J(L(a,K(l=>l.groupIndices)),e),J(L(Pe(o,t,r),ie(([l,c])=>mn(c)),K(([l,c,u])=>nt(c.groupOffsetTree,Math.max(l-u,0),"v")[0]),Ie(),K(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(lt,We)),pt=be(([{log:e}])=>{const t=N(!1),n=Ue(L(t,ie(r=>r),Ie()));return ve(t,r=>{r&&Te(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(ft),{singleton:!0}),vi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Yo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!vi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const $t=be(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:S},{log:y}])=>{const b=ge(),x=ge(),v=N(0);let p=null,h=null,d=null;function k(){p&&(p(),p=null),d&&(d(),d=null),h&&(clearTimeout(h),h=null),de(l,!1)}return J(L(b,fe(n,S,r,v,a,i,y),fe(e,s,o),K(([[_,I,R,f,w,T,j,O],z,C,M])=>{const A=Yo(_),{align:H,behavior:E,offset:P}=A,F=f-1,V=Ko(A,I,F);let Q=Ht(V,I.offsetTree,z)+T;H==="end"?(Q+=C+nt(I.sizeTree,V)[1]-R+M,V===F&&(Q+=j)):H==="center"?Q+=(C+nt(I.sizeTree,V)[1]-R+M)/2:Q-=w,P&&(Q+=P);const te=pe=>{k(),pe?(O("retrying to scroll to",{location:_},Ve.DEBUG),de(b,_)):(de(x,!0),O("list did not change, scroll successful",{},Ve.DEBUG))};if(k(),E==="smooth"){let pe=!1;d=ve(t,ye=>{pe=pe||ye}),p=tt(u,()=>{te(pe)})}else p=tt(L(t,Si(150)),te);return h=setTimeout(()=>{k()},1200),de(l,!0),O("scrolling from index to",{behavior:E,index:V,top:Q},Ve.DEBUG),{behavior:E,top:Q}})),c),{scrollTargetReached:x,scrollToIndex:b,topListHeight:v}},ke(lt,We,ft),{singleton:!0});function Si(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function dr(e,t){e==0?t():requestAnimationFrame(()=>{dr(e-1,t)})}function fr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const qt=be(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=N(!0),l=N(0),c=N(!0);return J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),a),J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),c),ve(L(Pe(t,i),fe(a,n,e,c),ie(([[,u],S,{sizeTree:y},b,x])=>u&&(!Se(y)||ir(b))&&!S&&!x),fe(l)),([,u])=>{tt(o,()=>{de(c,!0)}),dr(4,()=>{tt(r,()=>{de(a,!0)}),de(s,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},ke(lt,We,$t,pt),{singleton:!0});function Xo(e,t){return Math.abs(e-t)<1.01}const Nt="up",Bt="down",yi="none",wi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ci=0,Ut=be(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=N(!1),a=N(!0),l=ge(),c=ge(),u=N(4),S=N(Ci),y=Ne(L(Zn(L(se(o),xt(1),st(!0)),L(se(o),xt(1),st(!1),Or(100))),Ie()),!1),b=Ne(L(Zn(L(n,st(!0)),L(n,st(!1),Or(200))),Ie()),!1);J(L(Pe(se(o),se(S)),K(([d,k])=>d<=k),Ie()),a),J(L(a,at(50)),c);const x=Ue(L(Pe(r,se(s),se(t),se(e),se(u)),it((d,[{scrollHeight:k,scrollTop:_},I,R,f,w])=>{const T=_+I-k>-w,j={scrollHeight:k,scrollTop:_,viewportHeight:I};if(T){let z,C;return _>d.state.scrollTop?(z="SCROLLED_DOWN",C=d.state.scrollTop-_):(z="SIZE_DECREASED",C=d.state.scrollTop-_||d.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:C,state:j}}let O;return j.scrollHeight>d.state.scrollHeight?O="SIZE_INCREASED":I<d.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":_<d.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:j}},wi),Ie((d,k)=>d&&d.atBottom===k.atBottom))),v=Ne(L(r,it((d,{scrollHeight:k,scrollTop:_,viewportHeight:I})=>{if(Xo(d.scrollHeight,k))return{changed:!1,jump:0,scrollHeight:k,scrollTop:_};{const R=k-(_+I)<1;return d.scrollTop!==_&&R?{changed:!0,jump:d.scrollTop-_,scrollHeight:k,scrollTop:_}:{changed:!0,jump:0,scrollHeight:k,scrollTop:_}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(d=>d.changed),K(d=>d.jump)),0);J(L(x,K(d=>d.atBottom)),i),J(L(i,at(50)),l);const p=N(Bt);J(L(r,K(({scrollTop:d})=>d),Ie(),it((d,k)=>Te(b)?{direction:d.direction,prevScrollTop:k}:{direction:k<d.prevScrollTop?Nt:Bt,prevScrollTop:k},{direction:Bt,prevScrollTop:0}),K(d=>d.direction)),p),J(L(r,at(50),st(yi)),p);const h=N(0);return J(L(y,ie(d=>!d),st(0)),h),J(L(o,at(100),fe(y),ie(([d,k])=>k),it(([d,k],[_])=>[k,_],[0,0]),K(([d,k])=>k-d)),h),{atBottomState:x,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:S,isAtBottom:i,isAtTop:a,isScrolling:y,lastJumpDueToItemResize:v,scrollDirection:p,scrollVelocity:h}},ke(We)),Ft="top",Wt="bottom",Ar="none";function Lr(e,t,n){return typeof e=="number"?n===Nt&&t===Ft||n===Bt&&t===Wt?e:0:n===Nt?t===Ft?e.main:e.reverse:t===Wt?e.main:e.reverse}function Gr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const pr=be(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=N(0),a=N(0),l=N(0),c=Ne(L(Pe(se(r),se(o),se(n),se(s,Gt),se(l),se(i),se(t),se(e),se(a)),K(([u,S,y,[b,x],v,p,h,d,k])=>{const _=u-d,I=p+h,R=Math.max(y-_,0);let f=Ar;const w=Gr(k,Ft),T=Gr(k,Wt);return b-=d,b+=y+h,x+=y+h,x-=d,b>u+I-w&&(f=Nt),x<u-R+S+T&&(f=Bt),f!==Ar?[Math.max(_-y-Lr(v,Ft,f)-w,0),_-R-h+S+Lr(v,Wt,f)+T]:null}),ie(u=>u!=null),Ie(Gt)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},ke(We),{singleton:!0});function Ii(e,t,n){if(mn(t)){const r=Uo(e,t);return[{index:nt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Mn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function nn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,u=0;if(e.length>0){c=e[0].offset;const v=e[e.length-1];u=v.offset+v.size}const S=n-i,y=a+S*l+(S-1)*r,b=c,x=y-u;return{bottom:u,firstItemIndex:s,items:Hr(e,o,s),offsetBottom:x,offsetTop:c,top:b,topItems:Hr(t,o,s),topListHeight:t.reduce((v,p)=>p.size+v,0),totalCount:n}}function Zo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const u of n.groupIndices){if(u-i>=e)break;i++}const a=e+i,l=fr(t,a),c=Array.from({length:a}).map((u,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return nn(c,[],a,o,n,r)}function Hr(e,t,n){if(e.length===0)return[];if(!mn(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Tt(t.groupOffsetTree,r,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let u;c.index===a.start?u={index:l,type:"group"}:u={groupIndex:l,index:c.index-(l+1)+n},s.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Nr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const St=be(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:S},y,{didMount:b},{recalcInProgress:x}])=>{const v=N([]),p=N(0),h=ge(),d=N(0);J(s.topItemsIndexes,v);const k=Ne(L(Pe(b,x,se(l,Gt),se(o),se(r),se(c),u,se(v),se(t),se(n),se(d),e),ie(([f,w,,T,,,,,,,,j])=>{const O=j&&j.length!==T;return f&&!w&&!O}),K(([,,[f,w],T,j,O,z,C,M,A,H,E])=>{var P,F,V,Q;const te=j,{offsetTree:pe,sizeTree:ye}=te,me=Te(p);if(T===0)return{...Mn,totalCount:T};if(f===0&&w===0)return me===0?{...Mn,totalCount:T}:Zo(me,O,j,M,A,E||[]);if(Se(ye))return me>0?null:nn(Ii(fr(O,T),te,E),[],T,A,te,M);const q=[];if(C.length>0){const Y=C[0],re=C[C.length-1];let ee=0;for(const xe of Tt(ye,Y,re)){const oe=xe.value,le=Math.max(xe.start,Y),he=Math.min(xe.end,re);for(let ue=le;ue<=he;ue++)q.push({data:E==null?void 0:E[ue],index:ue,offset:ee,size:oe}),ee+=oe}}if(!z)return nn([],q,T,A,te,M);const ne=C.length>0?C[C.length-1]+1:0,B=fi(pe,f,w,ne);if(B.length===0)return null;const U=T-1,G=gn([],Y=>{for(const re of B){const ee=re.value;let xe=ee.offset,oe=re.start;const le=ee.size;if(ee.offset<f){oe+=Math.floor((f-ee.offset+A)/(le+A));const ue=oe-re.start;xe+=ue*le+ue*A}oe<ne&&(xe+=(ne-oe)*le,oe=ne);const he=Math.min(re.end,U);for(let ue=oe;ue<=he&&!(xe>=w);ue++)Y.push({data:E==null?void 0:E[ue],index:ue,offset:xe,size:le}),xe+=le+A}}),Z=Nr(H,Ft),D=Nr(H,Wt);if(G.length>0&&(Z>0||D>0)){const Y=G[0],re=G[G.length-1];if(Z>0&&Y.index>ne){const ee=Math.min(Z,Y.index-ne),xe=[];let oe=Y.offset;for(let le=Y.index-1;le>=Y.index-ee;le--){const he=(F=(P=Tt(ye,le,le)[0])==null?void 0:P.value)!=null?F:Y.size;oe-=he+A,xe.unshift({data:E==null?void 0:E[le],index:le,offset:oe,size:he})}G.unshift(...xe)}if(D>0&&re.index<U){const ee=Math.min(D,U-re.index);let xe=re.offset+re.size+A;for(let oe=re.index+1;oe<=re.index+ee;oe++){const le=(Q=(V=Tt(ye,oe,oe)[0])==null?void 0:V.value)!=null?Q:re.size;G.push({data:E==null?void 0:E[oe],index:oe,offset:xe,size:le}),xe+=le+A}}}return nn(G,q,T,A,te,M)}),ie(f=>f!==null),Ie()),Mn);J(L(e,ie(ir),K(f=>f==null?void 0:f.length)),o),J(L(k,K(f=>f.topListHeight)),S),J(S,a),J(L(k,K(f=>[f.top,f.bottom])),i),J(L(k,K(f=>f.items)),h);const _=Ue(L(k,ie(({items:f})=>f.length>0),fe(o,e),ie(([{items:f},w])=>f[f.length-1].originalIndex===w-1),K(([,f,w])=>[f-1,w]),Ie(Gt),K(([f])=>f))),I=Ue(L(k,at(200),ie(({items:f,topItems:w})=>f.length>0&&f[0].originalIndex===w.length),K(({items:f})=>f[0].index),Ie())),R=Ue(L(k,ie(({items:f})=>f.length>0),K(({items:f})=>{let w=0,T=f.length-1;for(;f[w].type==="group"&&w<T;)w++;for(;f[T].type==="group"&&T>w;)T--;return{endIndex:f[T].index,startIndex:f[w].index}}),Ie($o)));return{endReached:_,initialItemCount:p,itemsRendered:h,listState:k,minOverscanItemCount:d,rangeChanged:R,startReached:I,topItemsIndexes:v,...y}},ke(lt,Qo,pr,qt,$t,Ut,pt,cr),{singleton:!0}),Jo=be(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Ne(L(Pe(n,e,r,t,o),K(([a,l,c,u,S])=>a+l+c+u+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,St),{singleton:!0}),ki=be(([{viewportHeight:e},{totalListHeight:t}])=>{const n=N(!1),r=Ne(L(Pe(n,e,t),ie(([o])=>o),K(([,o,s])=>Math.max(0,o-s)),at(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,Jo),{singleton:!0}),es=be(()=>({context:N(null)})),Ri=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ts=be(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const u=ge();return J(L(u,fe(t,l,n,s,o,r,a),fe(e),K(([[S,y,b,x,v,p,h,d],k])=>{const{align:_,behavior:I,calculateViewLocation:R=Ri,done:f,...w}=S,T=Ko(S,y,x-1),j=Ht(T,y.offsetTree,k)+v+p,O=j+nt(y.sizeTree,T)[1],z=d+p,C=d+b-h,M=R({itemBottom:O,itemTop:j,locationParams:{align:_,behavior:I,...w},viewportBottom:C,viewportTop:z});return M?f&&tt(L(i,ie(A=>!A),xt(Te(i)?1:2)),f):f==null||f(),M}),ie(S=>S!==null)),c),{scrollIntoView:u}},ke(lt,We,$t,St,ft),{singleton:!0});function Fr(e){return e?e==="smooth"?"smooth":"auto":!1}const Ti=(e,t)=>typeof e=="function"?Fr(e(t)):t&&Fr(e),_i=be(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:u},{scrollingInProgress:S},{context:y},{scrollIntoView:b}])=>{const x=N(!1),v=ge();let p=null;function h(I){de(i,{align:"end",behavior:I,index:"LAST"})}ve(L(Pe(L(se(t),xt(1)),l),fe(se(x),s,a,S),K(([[I,R],f,w,T,j])=>{let O=R&&T,z="auto";return O&&(z=Ti(f,w||j),O=O&&!!z),{followOutputBehavior:z,shouldFollow:O,totalCount:I}}),ie(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:R})=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I)}):p=tt(e,()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I),p=null})});function d(I){const R=tt(o,f=>{I&&!f.atBottom&&f.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Te(u)("scrolling to bottom due to increased size",{},Ve.DEBUG),h("auto"))});setTimeout(R,100)}ve(L(Pe(se(x),t,c),ie(([I,,R])=>I&&R),it(({value:I},[,R])=>({refreshed:I===R,value:R}),{refreshed:!1,value:0}),ie(({refreshed:I})=>I),fe(x,t)),([,I])=>{Te(a)&&d(I!==!1)}),ve(v,()=>{d(Te(x)!==!1)}),ve(Pe(se(x),o),([I,R])=>{I&&!R.atBottom&&R.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")});const k=N(null),_=ge();return J(Zn(L(se(r),K(I=>{var R;return(R=I==null?void 0:I.length)!=null?R:0})),L(se(t))),_),ve(L(Pe(L(_,xt(1)),l),fe(se(k),a,S,y),K(([[I,R],f,w,T,j])=>R&&w&&(f==null?void 0:f({context:j,totalCount:I,scrollingInProgress:T}))),ie(I=>!!I),at(0)),I=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("scrolling into view",{}),de(b,I)}):p=tt(e,()=>{Te(u)("scrolling into view",{}),de(b,I),p=null})}),{autoscrollToBottom:v,followOutput:x,scrollIntoViewOnChange:k}},ke(lt,Ut,$t,qt,pt,ft,We,es,ts)),Mi=be(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(J(L(a,fe(s),ie(([,l])=>l!==0),fe(o,r,t,n,e),K(([[,l],c,u,S,y,b=[]])=>Zo(l,c,u,S,y,b))),i),{}),ke(lt,qt,St,pt),{singleton:!0}),Ei=be(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=N(0);return ve(L(e,fe(r),ie(([,o])=>o!==0),K(([,o])=>({top:o}))),o=>{tt(L(n,xt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{de(t,o)})})}),{initialScrollTop:r}},ke(pt,We,St),{singleton:!0}),ns=be(([{scrollVelocity:e}])=>{const t=N(!1),n=ge(),r=N(!1);return J(L(e,fe(r,t,n),ie(([o,s])=>!!s),K(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),Ie()),t),ve(L(Pe(t,e,n),fe(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Ut),{singleton:!0}),hr=be(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=N(!1),i=N(void 0);return J(L(Pe(n,r),K(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:a,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),J(L(t,fe(r),K(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),ji=be(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=ge(),u=N(void 0),S=N(null),y=N(null);return J(a,S),J(l,y),ve(L(c,fe(t,r,i,S,y,n)),([b,x,v,p,h,d,k])=>{const _=hi(x.sizeTree);p&&h!==null&&d!==null&&(v=h.scrollTop-d.offsetTop),v-=k,b({ranges:_,scrollTop:v})}),J(L(u,ie(ir),K(Oi)),o),J(L(s,fe(u),ie(([,b])=>b!==void 0),Ie(),K(([,b])=>b.ranges)),e),{getState:c,restoreStateFrom:u}},ke(lt,We,qt,pt,hr));function Oi(e){return{align:"start",index:0,offset:e.scrollTop}}const Pi=be(([{topItemsIndexes:e}])=>{const t=N(0);return J(L(t,ie(n=>n>=0),K(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(St));function rs(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Bi=rs(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),zi=be(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:S,sizes:y},{log:b},{recalcInProgress:x}])=>{const v=Ue(L(l,fe(i),it(([,h,d,k],[{bottom:_,items:I,offsetBottom:R,totalCount:f},w])=>{const T=_+R;let j=0;return d===f&&h.length>0&&I.length>0&&(I[0].originalIndex===0&&h[0].originalIndex===0||(j=T-k,j!==0&&(j+=w))),[j,I,f,T]},[0,[],0,0]),ie(([h])=>h!==0),fe(r,a,n,o,b,x),ie(([,h,d,k,,,_])=>!_&&!k&&h!==0&&d===Nt),K(([[h],,,,,d])=>(d("Upward scrolling compensation",{amount:h},Ve.DEBUG),h))));function p(h){h>0?(de(t,{behavior:"auto",top:-h}),de(e,0)):(de(e,0),de(t,{behavior:"auto",top:-h}))}return ve(L(v,fe(e,s)),([h,d,k])=>{k&&Bi()?de(e,d-h):p(-h)}),ve(L(Pe(Ne(s,!1),e,x),ie(([h,d,k])=>!h&&!k&&d!==0),K(([h,d])=>d),at(1)),p),J(L(S,K(h=>({top:-h}))),t),ve(L(c,fe(y,u),K(([h,{groupIndices:d,lastSize:k,sizeTree:_},I])=>{function R(f){return f*(k+I)}if(d.length===0)return R(h);{let f=0;const w=Lt(_,0);let T=0,j=0;for(;T<h;){T++,f+=w;let O=d.length===j+1?1/0:d[j+1]-d[j]-1;T+O>h&&(f-=w,O=h-T+1),T+=O,f+=R(O),j++}return f}})),h=>{de(e,h),requestAnimationFrame(()=>{de(t,{top:h}),requestAnimationFrame(()=>{de(e,0),de(x,!1)})})}),{deviation:e}},ke(We,Ut,St,lt,ft,cr)),Ai=be(([e,t,n,r,o,s,i,a,l,c,u])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...u}),ke(pr,Mi,pt,ns,Jo,Ei,ki,hr,ts,ft,es)),os=be(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:u,statefulTotalCount:S,totalCount:y,trackItemSizes:b},{initialItemFinalLocationReached:x,initialTopMostItemIndex:v,scrolledToInitialItem:p},h,d,k,_,{scrollToIndex:I},R,{topItemCount:f},{groupCounts:w},T])=>{const{listState:j,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:C,...M}=_;return J(C,T.scrollSeekRangeChanged),J(L(T.windowViewportRect,K(A=>A.visibleHeight)),h.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:w,heightEstimates:a,initialItemFinalLocationReached:x,initialTopMostItemIndex:v,scrolledToInitialItem:p,sizeRanges:c,topItemCount:f,topItemsIndexes:z,totalCount:y,...k,groupIndices:i,itemSize:l,listState:j,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:S,trackItemSizes:b,rangeChanged:C,...M,...T,...h,sizes:u,...d}},ke(lt,qt,We,ji,_i,St,$t,zi,Pi,Qo,Ai));function Li(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const Zt=typeof document<"u"?g.useLayoutEffect:g.useEffect;function ss(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=g.createContext({});function l(p,h){p.propsReady&&de(p.propsReady,!1);for(const d of r){const k=p[t.required[d]];de(k,h[d])}for(const d of o)if(d in h){const k=p[t.optional[d]];de(k,h[d])}p.propsReady&&de(p.propsReady,!0)}function c(p){return s.reduce((h,d)=>(h[d]=k=>{const _=p[t.methods[d]];de(_,k)},h),{})}function u(p){return i.reduce((h,d)=>(h[d]=Js(p[t.events[d]]),h),{})}const S=g.forwardRef((p,h)=>{const{children:d,...k}=p,[_]=g.useState(()=>gn(ti(e),f=>{l(f,k)})),[I]=g.useState(jr(u,_));Zt(()=>{for(const f of i)f in k&&ve(I[f],k[f]);return()=>{Object.values(I).map(lr)}},[k,I,_]),Zt(()=>{l(_,k)}),g.useImperativeHandle(h,Er(c(_)));const R=n;return m.jsx(a.Provider,{value:_,children:n?m.jsx(R,{...Li([...r,...o,...i],k),children:d}):d})}),y=p=>{const h=g.useContext(a);return g.useCallback(d=>{de(h[p],d)},[h,p])},b=p=>{const h=g.useContext(a)[p],d=g.useCallback(k=>ve(h,k),[h]);return g.useSyncExternalStore(d,()=>Te(h),()=>Te(h))},x=p=>{const h=g.useContext(a)[p],[d,k]=g.useState(jr(Te,h));return Zt(()=>ve(h,_=>{_!==d&&k(Er(_))}),[h,d]),d},v=g.version.startsWith("18")?b:x;return{Component:S,useEmitter:(p,h)=>{const d=g.useContext(a)[p];Zt(()=>ve(d,h),[h,d])},useEmitterValue:v,usePublisher:y}}const is=g.createContext(void 0),ls=g.createContext(void 0),as=typeof document<"u"?g.useLayoutEffect:g.useEffect;function En(e){return"self"in e}function Gi(e){return"body"in e}function cs(e,t,n,r=jt,o,s){const i=g.useRef(null),a=g.useRef(null),l=g.useRef(null),c=g.useCallback(y=>{let b,x,v;const p=y.target;if(Gi(p)||En(p)){const d=En(p)?p:p.defaultView;v=s?d.scrollX:d.scrollY,b=s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight,x=s?d.innerWidth:d.innerHeight}else v=s?p.scrollLeft:p.scrollTop,b=s?p.scrollWidth:p.scrollHeight,x=s?p.offsetWidth:p.offsetHeight;const h=()=>{e({scrollHeight:b,scrollTop:Math.max(v,0),viewportHeight:x})};y.suppressFlushSync?h():Os.flushSync(h),a.current!==null&&(v===a.current||v<=0||v===b-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);g.useEffect(()=>{const y=o||i.current;return r(o||i.current),c({suppressFlushSync:!0,target:y}),y.addEventListener("scroll",c,{passive:!0}),()=>{r(null),y.removeEventListener("scroll",c)}},[i,c,n,r,o]);function u(y){const b=i.current;if(!b||(s?"offsetWidth"in b&&b.offsetWidth===0:"offsetHeight"in b&&b.offsetHeight===0))return;const x=y.behavior==="smooth";let v,p,h;En(b)?(p=Math.max(ut(b.document.documentElement,s?"width":"height"),s?b.document.documentElement.scrollWidth:b.document.documentElement.scrollHeight),v=s?b.innerWidth:b.innerHeight,h=s?window.scrollX:window.scrollY):(p=b[s?"scrollWidth":"scrollHeight"],v=ut(b,s?"width":"height"),h=b[s?"scrollLeft":"scrollTop"]);const d=p-v;if(y.top=Math.ceil(Math.max(Math.min(d,y.top),0)),Xo(v,p)||y.top===h){e({scrollHeight:p,scrollTop:h,viewportHeight:v}),x&&t(!0);return}x?(a.current=y.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(y={behavior:y.behavior,left:y.top}),b.scrollTo(y)}function S(y){s&&(y={behavior:y.behavior,left:y.top}),i.current.scrollBy(y)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:u}}const jn="-webkit-sticky",Wr="sticky",gr=rs(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Wr});function mr(e){return e}const Hi=be(()=>{const e=N(a=>`Item ${a}`),t=N(a=>`Group ${a}`),n=N({}),r=N(mr),o=N("div"),s=N(jt),i=(a,l=null)=>Ne(L(n,K(c=>c[a]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Ni=be(([e,t])=>({...e,...t}),ke(os,Hi)),Fi=({height:e})=>m.jsx("div",{style:{height:e}}),Wi={overflowAnchor:"none",position:gr(),zIndex:1},us={overflowAnchor:"none"},Di={...us,display:"inline-block",height:"100%"},Dr=g.memo(function({showTopList:e=!1}){const t=ae("listState"),n=Ke("sizeRanges"),r=ae("useWindowScroll"),o=ae("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),a=o||r?s:i,l=ae("itemContent"),c=ae("context"),u=ae("groupContent"),S=ae("trackItemSizes"),y=ae("itemSize"),b=ae("log"),x=Ke("gap"),v=ae("horizontalDirection"),{callbackRef:p}=oi(n,y,S,e?jt:a,b,x,o,v,ae("skipAnimationFrameInResizeObserver")),[h,d]=g.useState(0);xr("deviation",M=>{h!==M&&d(M)});const k=ae("EmptyPlaceholder"),_=ae("ScrollSeekPlaceholder")||Fi,I=ae("ListComponent"),R=ae("ItemComponent"),f=ae("GroupComponent"),w=ae("computeItemKey"),T=ae("isSeeking"),j=ae("groupIndices").length>0,O=ae("alignToBottom"),z=ae("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:h!==0?h:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:h!==0?h:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...z?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k?m.jsx(k,{...He(k,c)}):m.jsx(I,{...He(I,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:C,children:(e?t.topItems:t.items).map(M=>{const A=M.originalIndex,H=w(A+t.firstItemIndex,M.data,c);return T?g.createElement(_,{...He(_,c),height:M.size,index:M.index,key:H,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?g.createElement(f,{...He(f,c),"data-index":A,"data-item-index":M.index,"data-known-size":M.size,key:H,style:Wi},u(M.index,c)):g.createElement(R,{...He(R,c),...Ui(R,M.data),"data-index":A,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:H,style:v?Di:us},j?l(M.index,M.groupIndex,M.data,c):l(M.index,M.data,c))})})}),Vi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},$i={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),qi={position:gr(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function Ui(e,t){return{item:typeof e=="string"?void 0:t}}const Ki=g.memo(function(){const e=ae("HeaderComponent"),t=Ke("headerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Qi=g.memo(function(){const e=ae("FooterComponent"),t=Ke("footerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null});function ds({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:y,scrollerRef:b,scrollToCallback:x}=cs(a,c,l,u,void 0,S);return e("scrollTo",x),e("scrollBy",y),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:b,style:{...S?$i:Vi,...o},tabIndex:0,...i,...He(l,s),children:r})})}function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("totalListHeight"),S=t("deviation"),y=t("customScrollParent"),b=g.useRef(null),x=t("scrollerRef"),{scrollByCallback:v,scrollerRef:p,scrollToCallback:h}=cs(a,c,l,x,y);return as(()=>{var d;return p.current=y||((d=b.current)==null?void 0:d.ownerDocument.defaultView),()=>{p.current=null}},[p,y]),e("windowScrollTo",h),e("scrollBy",v),m.jsx(l,{ref:b,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...u!==0?{height:u+S}:{}},...i,...He(l,s),children:r})})}const Yi=({children:e})=>{const t=g.useContext(is),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=ae("alignToBottom"),s=ae("horizontalDirection"),i=g.useMemo(()=>Lo(n,l=>ut(l,s?"width":"height")),[n,s]),a=vt(i,!0,ae("skipAnimationFrameInResizeObserver"));return g.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:xn(o),children:e})},Xi=({children:e})=>{const t=g.useContext(is),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=ae("customScrollParent"),s=Ho(n,o,ae("skipAnimationFrameInResizeObserver")),i=ae("alignToBottom");return g.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),m.jsx("div",{"data-viewport-type":"window",ref:s,style:xn(i),children:e})},Zi=({children:e})=>{const t=ae("TopItemListComponent")||"div",n=ae("headerHeight"),r={...qi,marginTop:`${n}px`},o=ae("context");return m.jsx(t,{style:r,...He(t,o),children:e})},Ji=g.memo(function(e){const t=ae("useWindowScroll"),n=ae("topItemsIndexes").length>0,r=ae("customScrollParent"),o=ae("context");return m.jsxs(r||t?nl:tl,{...e,context:o,children:[n&&m.jsx(Zi,{children:m.jsx(Dr,{showTopList:!0})}),m.jsxs(r||t?Xi:Yi,{children:[m.jsx(Ki,{}),m.jsx(Dr,{}),m.jsx(Qi,{})]})]})}),{Component:el,useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}=ss(Ni,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ji),tl=ds({useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}),nl=fs({useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}),rl=el,ol=be(()=>{const e=N(c=>m.jsxs("td",{children:["Item $",c]})),t=N(null),n=N(c=>m.jsxs("td",{colSpan:1e3,children:["Group ",c]})),r=N(null),o=N(null),s=N({}),i=N(mr),a=N(jt),l=(c,u=null)=>Ne(L(s,K(S=>S[c]),Ie()),u);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(os,ol);gr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},sl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:$r,floor:sn,max:zt,min:On,round:qr}=Math;function Ur(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function il(e){return{...sl,items:e}}function Jt(e,t){return e&&e.width===t.width&&e.height===t.height}function ll(e,t){return e&&e.column===t.column&&e.row===t.row}const al=be(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:S},y,b,{didMount:x,propsReady:v},{customScrollParent:p,useWindowScroll:h,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_},I])=>{const R=N(0),f=N(0),w=N(Vr),T=N({height:0,width:0}),j=N({height:0,width:0}),O=ge(),z=ge(),C=N(0),M=N(null),A=N({column:0,row:0}),H=ge(),E=ge(),P=N(!1),F=N(0),V=N(!0),Q=N(!1),te=N(!1);ve(L(x,fe(F),ie(([B,U])=>!!U)),()=>{de(V,!1)}),ve(L(Pe(x,V,j,T,F,Q),ie(([B,U,G,Z,,D])=>B&&!U&&G.height!==0&&Z.height!==0&&!D)),([,,,,B])=>{de(Q,!0),dr(1,()=>{de(O,B)}),tt(L(c),()=>{de(t,[0,0]),de(V,!0)})}),J(L(E,ie(B=>B!=null&&B.scrollTop>0),st(0)),f),ve(L(x,fe(E),ie(([,B])=>B!=null)),([,B])=>{B&&(de(T,B.viewport),de(j,B.item),de(A,B.gap),B.scrollTop>0&&(de(P,!0),tt(L(c,xt(1)),U=>{de(P,!1)}),de(l,{top:B.scrollTop})))}),J(L(T,K(({height:B})=>B)),S),J(L(Pe(se(T,Jt),se(j,Jt),se(A,(B,U)=>B&&B.column===U.column&&B.row===U.row),se(c)),K(([B,U,G,Z])=>({gap:G,item:U,scrollTop:Z,viewport:B}))),H),J(L(Pe(se(R),r,se(A,ll),se(j,Jt),se(T,Jt),se(M),se(f),se(P),se(V),se(F)),ie(([,,,,,,,B])=>!B),K(([B,[U,G],Z,D,Y,re,ee,,xe,oe])=>{const{column:le,row:he}=Z,{height:ue,width:Ce}=D,{width:Ae}=Y;if(ee===0&&(B===0||Ae===0))return Vr;if(Ce===0){const yt=fr(oe,B),Kt=yt+Math.max(ee-1,0);return il(Ur(yt,Kt,re))}const Oe=ps(Ae,Ce,le);let Le,Fe;xe?U===0&&G===0&&ee>0?(Le=0,Fe=ee-1):(Le=Oe*sn((U+he)/(ue+he)),Fe=Oe*$r((G+he)/(ue+he))-1,Fe=On(B-1,zt(Fe,Oe-1)),Le=On(Fe,zt(0,Le))):(Le=0,Fe=-1);const De=Ur(Le,Fe,re),{bottom:je,top:Xe}=Kr(Y,Z,D,De),$e=$r(B/Oe),ht=$e*ue+($e-1)*he-je;return{bottom:je,itemHeight:ue,items:De,itemWidth:Ce,offsetBottom:ht,offsetTop:Xe,top:Xe}})),w),J(L(M,ie(B=>B!==null),K(B=>B.length)),R),J(L(Pe(T,j,w,A),ie(([B,U,{items:G}])=>G.length>0&&U.height!==0&&B.height!==0),K(([B,U,{items:G},Z])=>{const{bottom:D,top:Y}=Kr(B,Z,U,G);return[Y,D]}),Ie(Gt)),t);const pe=N(!1);J(L(c,fe(pe),K(([B,U])=>U||B!==0)),pe);const ye=Ue(L(Pe(w,R),ie(([{items:B}])=>B.length>0),fe(pe),ie(([[B,U],G])=>{const Z=B.items[B.items.length-1].index===U-1;return(G||B.bottom>0&&B.itemHeight>0&&B.offsetBottom===0&&B.items.length===U)&&Z}),K(([[,B]])=>B-1),Ie())),me=Ue(L(se(w),ie(({items:B})=>B.length>0&&B[0].index===0),st(0),Ie())),q=Ue(L(se(w),fe(P),ie(([{items:B},U])=>B.length>0&&!U),K(([{items:B}])=>({endIndex:B[B.length-1].index,startIndex:B[0].index})),Ie($o),at(0)));J(q,b.scrollSeekRangeChanged),J(L(O,fe(T,j,R,A),K(([B,U,G,Z,D])=>{const Y=Yo(B),{align:re,behavior:ee,offset:xe}=Y;let oe=Y.index;oe==="LAST"&&(oe=Z-1),oe=zt(0,oe,On(Z-1,oe));let le=rr(U,D,G,oe);return re==="end"?le=qr(le-U.height+G.height):re==="center"&&(le=qr(le-U.height/2+G.height/2)),xe&&(le+=xe),{behavior:ee,top:le}})),l);const ne=Ne(L(w,K(B=>B.offsetBottom+B.bottom)),0);return J(L(_,K(B=>({height:B.visibleHeight,width:B.visibleWidth}))),T),{customScrollParent:p,data:M,deviation:C,footerHeight:o,gap:A,headerHeight:s,increaseViewportBy:e,initialItemCount:f,itemDimensions:j,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:a,scrollHeight:z,scrollTo:l,scrollToIndex:O,scrollTop:c,smoothScrollTargetReached:u,totalCount:R,useWindowScroll:h,viewportDimensions:T,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_,...b,gridState:w,horizontalDirection:te,initialTopMostItemIndex:F,totalListHeight:ne,...y,endReached:ye,propsReady:v,rangeChanged:q,startReached:me,stateChanged:H,stateRestoreInProgress:P,...I}},ke(pr,We,Ut,ns,pt,hr,ft));function ps(e,t,n){return zt(1,sn((e+n)/(sn(t)+n)))}function Kr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=rr(e,t,n,r[0].index);return{bottom:rr(e,t,n,r[r.length-1].index)+o,top:s}}function rr(e,t,n,r){const o=ps(e.width,n.width,t.column),s=sn(r/o),i=s*n.height+zt(0,s-1)*t.row;return i>0?i+t.row:i}const cl=be(()=>{const e=N(S=>`Item ${S}`),t=N({}),n=N(null),r=N("virtuoso-grid-item"),o=N("virtuoso-grid-list"),s=N(mr),i=N("div"),a=N(jt),l=(S,y=null)=>Ne(L(t,K(b=>b[S]),Ie()),y),c=N(!1),u=N(!1);return J(se(u),c),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),ul=be(([e,t])=>({...e,...t}),ke(al,cl)),dl=g.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Qe("scrollHeight"),a=Re("ItemComponent"),l=Re("ListComponent"),c=Re("ScrollSeekPlaceholder"),u=Re("context"),S=Qe("itemDimensions"),y=Qe("gap"),b=Re("log"),x=Re("stateRestoreInProgress"),v=Qe("reportReadyState"),p=vt(g.useMemo(()=>h=>{const d=h.parentElement.parentElement.scrollHeight;i(d);const k=h.firstChild;if(k){const{height:_,width:I}=k.getBoundingClientRect();S({height:_,width:I})}y({column:Qr("column-gap",getComputedStyle(h).columnGap,b),row:Qr("row-gap",getComputedStyle(h).rowGap,b)})},[i,S,y,b]),!0,!1);return as(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),x?null:m.jsx(l,{className:t,ref:p,...He(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(h=>{const d=o(h.index,h.data,u);return s?m.jsx(c,{...He(c,u),height:e.itemHeight,index:h.index,width:e.itemWidth},d):g.createElement(a,{...He(a,u),className:n,"data-index":h.index,key:d},r(h.index,h.data,u))})})}),fl=g.memo(function(){const e=Re("HeaderComponent"),t=Qe("headerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),pl=g.memo(function(){const e=Re("FooterComponent"),t=Qe("footerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),hl=({children:e})=>{const t=g.useContext(ls),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=vt(g.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return g.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),m.jsx("div",{ref:o,style:xn(!1),children:e})},gl=({children:e})=>{const t=g.useContext(ls),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Re("customScrollParent"),s=Ho(n,o,!1);return g.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),m.jsx("div",{ref:s,style:xn(!1),children:e})},ml=g.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?bl:xl,o=n||t?gl:hl,s=Re("context");return m.jsx(r,{...e,...He(r,s),children:m.jsxs(o,{children:[m.jsx(fl,{}),m.jsx(dl,{}),m.jsx(pl,{})]})})}),{useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}=ss(ul,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},ml),xl=ds({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}),bl=fs({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe});function Qr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const bn=g.createContext(void 0);function we(e,t){const n=g.useContext(bn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return fn(n,e,t)}function ln(){const e=g.useContext(bn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const br=g.createContext(void 0);function Mt(){const e=g.useContext(br);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function $(e,t){const n=g.useContext(br);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return fn(n,o=>e(o.progress),t)}const vl="_run_zzb61_3",Sl="_runWrap_zzb61_7",yl="_highlight_zzb61_13",wl="_highlightleft_zzb61_14",Cl="_highlightright_zzb61_15",Il="_highlightcenter_zzb61_16",kl="_underline_zzb61_48",Rl="_underlineleft_zzb61_49",Tl="_underlineright_zzb61_50",_l="_underlinecenter_zzb61_51",ot={run:vl,runWrap:Sl,highlight:yl,highlightleft:wl,highlightright:Cl,highlightcenter:Il,underline:kl,underlineleft:Rl,underlineright:Tl,underlinecenter:_l},Yr=e=>Symbol.iterator in e,Xr=e=>"entries"in e,Zr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},Ml=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function El(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Yr(e)&&Yr(t)?Xr(e)&&Xr(t)?Zr(e,t):Ml(e,t):Zr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Dt(e){const t=g.useRef(void 0);return n=>{const r=e(n);return El(t.current,r)?t.current:t.current=r}}function jl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function Ol(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Pl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),gs=g.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=we(T=>T.setClipIndex),i=we(T=>T.seek),a=$(T=>T.setCurrentGlobalRunIndex),l=ln(),c=$(T=>T.rangeStartGI),u=$(T=>T.rangeEndGI),S=$(T=>T.setRange),y=c!=null&&u!=null,b=g.useCallback(T=>{var E;const j=(E=T.target)==null?void 0:E.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;if(z<0||z>=t.length)return;const C=t[z],M=C.text??"";if(!M.trim()||!/[가-힣a-zA-Z0-9]/.test(M))return;a(O,"program");const A=C.audioChunkIndex,H=C.audioTimeMs;A!=null&&H!=null&&(s(A),i(H))},[t,r,i,s,a]),x=g.useRef(null),v=g.useRef(!1),p=g.useCallback(T=>{var C;const j=(C=T.target)==null?void 0:C.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;z<0||z>=t.length||(v.current=!1,x.current&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(O,O),v.current=!0,x.current=null)},800))},[t,r,S,l]),h=g.useCallback(()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},[]),d=g.useCallback(()=>{h()},[h]),k=h,_=h,I=$(T=>T.clearRange),R=g.useCallback(T=>{var z;if(v.current){v.current=!1;return}const j=(z=T.target)==null?void 0:z.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g);isNaN(O)||y&&c!=null&&u!=null&&(I(),T.stopPropagation())},[y,c,u,I]),f=o,w=r+t.length-1;return m.jsx("span",{onClick:R,onDoubleClick:b,onPointerDown:p,onPointerUp:d,onPointerCancel:k,onPointerLeave:_,children:f.map((T,j)=>m.jsx(zl,{ns:n,group:T,runs:t,paraLastG:w,rangeStartGI:c,rangeEndGI:u},`${n}/grp:${j}-${T.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Bl=g.memo(function(){const t=g.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=X(Dt(t));return n.showSplit?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&m.jsx("span",{children:" / "}),m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),zl=g.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=g.useCallback(p=>{const h=p.currentGlobalRunIndex;return h!=null&&h>=n.startG&&h<=n.endG},[n]),l=$(Dt(a)),c=g.useCallback(p=>l?{showPointer:p.showPointer,pointerStyle:p.pointerStyle,pointerColor:p.pointerColor}:Pl,[l]),u=X(Dt(c)),S=n.r0??0,y=n.len??Math.max(0,n.endG-n.startG+1),b=l&&u.showPointer&&u.pointerStyle!=="underline",x=l&&u.showPointer&&u.pointerStyle==="underline",v=b||x?{"--hl-color":u.pointerColor,"--ul-color":u.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:y}).map((p,h)=>{const k=r[S+h],_=n.startG+h,I=`${t}/run:${_}`,R=!!k.split&&_!==o;let f=`${ot.runWrap}`;return b&&(y===1?f+=` ${ot.highlight}`:h===0?f+=` ${ot.highlightleft}`:h+1===y?f+=` ${ot.highlightright}`:f+=` ${ot.highlightcenter}`),x&&(y===1?f+=` ${ot.underline}`:h===0?f+=` ${ot.underlineleft}`:h+1===y?f+=` ${ot.underlineright}`:f+=` ${ot.underlinecenter}`),m.jsxs(g.Fragment,{children:[m.jsx("span",{className:f,style:v,children:m.jsx(Al,{gi:n.startG,g:_,run:k,active:l,pointerCfg:u,isInRange:s!=null&&i!=null&&_>=s&&_<=i})}),R&&m.jsx(Bl,{})]},I)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Al=g.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=g.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const c=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=c;const u=c.startsWith("#")?jl(c):Ol(c);u&&(.299*u.r+.587*u.g+.114*u.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:ot.run,style:a,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Ll({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var c;const i=e.list?e.list.level*24:0,a=((c=e.list)==null?void 0:c.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??a;return m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?m.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,m.jsx(gs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Gl=g.memo(Ll,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Hl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return eo(e,!1);case"upperalpha":case"upperlatin":return eo(e,!0);case"lowerroman":return Jr(e,!1);case"upperroman":return Jr(e,!0);case"decimalenclosedcircle":return Nl(e);default:return String(e)}}function Nl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function Jr(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function eo(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function vr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function Sr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Hl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Fl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Wl(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Dl(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const Vl="_scroller_kqkmq_3",$l={scroller:Vl},ql=g.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${$l.scroller}${t?" "+t:""}`,style:n,...r})});function vn(){const e=g.useContext(bt);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const or=e=>/[가-힣a-zA-Z0-9]/.test(e),Ul=e=>((e==null?void 0:e.textContent)??"").trim(),an=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Kl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,a=1/0,l=1/0,c=-1,u=1/0,S=1/0;const y=e.querySelectorAll("[data-g]");for(let b=0;b<y.length;b++){const x=y[b];if(!x||!x.isConnected)continue;const v=Ul(x);if(!v||!or(v))continue;const p=x.getBoundingClientRect();if(p.height<=r||p.width<=r||p.bottom<=o.top||p.top>=o.bottom)continue;if(p.top<s){const k=Math.abs(p.top-s);(k<u||k===u&&(p.top<S||c!==-1&&Number(x.dataset.g)<c))&&(u=k,c=Number(x.dataset.g),S=p.top);continue}const h=Number(x.dataset.g);if(Number.isNaN(h))continue;p.top<l-n?(l=p.top,a=p.top,i=h):p.top<=l+n&&(p.top<a||p.top===a&&(i===-1||h<i))&&(a=p.top,i=h);const d=Math.abs(p.top-s);(d<u||d===u&&(p.top<S||c!==-1&&h<c))&&(u=d,c=h,S=p.top)}return i!==-1?i:c}const ms=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=an(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=an(e,t)}return s},to=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of o){const l=a.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const c=Number(a.dataset.g);Number.isNaN(c)||(c<s&&(s=c),c>i&&(i=c))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Ql=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=an(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),a=s.height*n,l=i.top-(s.top+a);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Yl(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Pn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!Ql(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Yl(e,o);const i=an(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,u=a.top+c,S=l.top-u;return Math.abs(S)<=1},ct=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=g.createContext(null);function xs(){const e=g.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Je(e,t){const n=g.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return fn(n,e,t)}const bs=()=>{const e=$(r=>r.section),t=xs(),n=e.quiz;return!n||!n.length?null:m.jsxs("button",{onClick:()=>{t.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",n.length,")"]})},Xl="_navBtn_1fciy_2",Zl="_disabled_1fciy_26",Jl="_label_1fciy_32",_t={navBtn:Xl,disabled:Zl,label:Jl};var vs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},no=g.createContext&&g.createContext(vs),ea=["attr","size","title"];function ta(e,t){if(e==null)return{};var n=na(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function na(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cn(){return cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cn.apply(this,arguments)}function ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(n),!0).forEach(function(r){ra(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ro(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ra(e,t,n){return t=oa(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(e){var t=sa(e,"string");return typeof t=="symbol"?t:t+""}function sa(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ss(e){return e&&e.map((t,n)=>g.createElement(t.tag,un({key:n},t.attr),Ss(t.child)))}function Ye(e){return t=>g.createElement(ia,cn({attr:un({},e.attr)},t),Ss(e.child))}function ia(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ta(e,ea),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),g.createElement("svg",cn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:un(un({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&g.createElement("title",null,s),e.children)};return no!==void 0?g.createElement(no.Consumer,null,n=>t(n)):t(vs)}function oo(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function so(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const la=({isIcon:e=!0})=>{const t=$(i=>i.isCanPrev),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(oo,{size:18}),m.jsx("span",{className:_t.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(oo,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},dn=({isIcon:e=!0})=>{const t=$(i=>i.isCanNext),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(so,{size:18}),m.jsx("span",{className:_t.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(so,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ys(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function aa({section:e,blocks:t,nsPrefix:n}){const r=g.useMemo(()=>{const R=[],f=vr();return t.forEach((w,T)=>{w.type==="paragraph"&&(R[T]=Sr(w,f))}),R},[t]),o=$(R=>{var f;return((f=R.layout)==null?void 0:f.prefix)??[]}),s=$(R=>{var f;return((f=R.derivedNav)==null?void 0:f.splitGroupsPerBlock)??[]}),i=X(R=>R.marginX),a=X(R=>R.viewportHeight),l=g.useRef({start:0,end:0}),c=g.useCallback(R=>{const f=t[R],w=`${n}blk-${f.id}`;if(f.type==="image"){const{src:O,alt:z,width:C,height:M}=f,A=C&&M?`${C} / ${M}`:"4 / 3",H=R>=l.current.start&&R<=l.current.end,E=a>80?Math.floor((a-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:E,aspectRatio:A},children:m.jsx("img",{src:O,alt:z||"",loading:H?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),z&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:z})]})}const T=r[R]??void 0,j=s[R];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Gl,{block:f,computedMarker:T,ns:w,baseIndex:o[R],sectionId:e.section_id,preGroups:j})})},[t,r,o,n,e,s,a]),u=g.useRef(null),S=g.useCallback(R=>{u.current=R},[]),y=g.useMemo(()=>g.memo(R=>{const{style:f,children:w,...T}=R;return m.jsx("div",{...T,style:f,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:w})})}),[i]),b=g.useRef(null),x=g.useMemo(()=>t.map(R=>R.id),[t]),v=g.useCallback(()=>{const R=e.quiz,f=Math.max(80,Math.floor(a*.5));return R&&R.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(bs,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:f,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,a]),p=g.useMemo(()=>({Item:y,Header:()=>m.jsx("div",{style:{height:40}}),Footer:v,Scroller:ql}),[v,y]),h=g.useCallback(R=>x[R],[x]),d=Mt(),[k]=g.useState(()=>d.getState().progress.currentGlobalRunIndex??0),_=g.useMemo(()=>{if(!o.length)return 0;const R=o[o.length-1],f=Math.max(0,Math.min(k,R));return ys(o,f)},[o,k]);console.log("SectionRenderVirtuoso확인");const I=Mt();return g.useEffect(()=>{const R=u.current;R&&(console.log("@@@@@@@@@@@@@@@@"),(async()=>{const f=I.getState().progress.currentGlobalRunIndex,w=I.getState().progress.setSectionLoading;console.log("giFromStore",f);const T=f!=null&&f>=0?f:0;await ms(R,T),await ct(),await ct(),await ct(),await ct(),console.log("첫랜더끝"),w(!1)})())},[u,I]),m.jsxs(m.Fragment,{children:[m.jsx(rl,{ref:b,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:h,totalCount:t.length,itemContent:c,initialTopMostItemIndex:_,increaseViewportBy:{top:200,bottom:200},components:p,scrollerRef:S}),m.jsx(ca,{scrollContainerRef:u,virtRef:b,prefix:o})]})}const ca=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=$(C=>C.setCurrentGlobalRunIndex),o=$(C=>C.registerSectionScrollApi),s=$(C=>C.currentGlobalRunIndex),i=we(C=>C.scrollLock),a=we(C=>C.syncToGI),l=vn(),c=g.useRef(!1),u=g.useRef(null),S=g.useRef(null),y=g.useRef(null),b=g.useRef(-1),x=g.useCallback(()=>{if(i)return;u.current=null;const C=S.current;if(!C)return;const M=Kl(C,5);M!==-1&&M!==b.current&&(b.current=M,a(M),r(M,"scroll"))},[i,a,r]),v=g.useCallback(C=>{S.current=C,u.current==null&&(u.current=requestAnimationFrame(x))},[x]),p=g.useCallback(C=>{S.current=C,y.current!=null&&(window.clearTimeout(y.current),y.current=null),y.current=window.setTimeout(()=>{y.current=null,x();const M=b.current;if(M===-1)return;const A=C.scrollTop,H=C.scrollHeight-C.clientHeight,E=H>0?A/H:0;let P=0;const F=C.querySelector(`[data-g="${M}"]`);if(F){const V=C.getBoundingClientRect();P=(F.getBoundingClientRect().top-V.top)/V.height}l.getState().emit({type:"scroll",payload:{scrollTop:A,scrollRatio:E,anchorGI:M,anchorOffsetRatio:P}})},100)},[x,l]),h=g.useRef(!1),d=g.useCallback(C=>{i||c.current&&(h.current||(v(C),p(C)))},[i,v,p]),k=g.useRef(void 0),_=g.useRef(void 0),I=g.useRef(void 0),R=g.useRef(void 0);g.useEffect(()=>{const C=e.current;if(C)return k.current=()=>{c.current=!0},_.current=()=>{c.current=!0},I.current=()=>{c.current=!0},R.current=()=>d(C),C.addEventListener("wheel",k.current,{passive:!0}),C.addEventListener("touchmove",_.current,{passive:!0}),window.addEventListener("keydown",I.current,{passive:!0}),C.addEventListener("scroll",R.current,{passive:!0}),()=>{C.removeEventListener("wheel",k.current),C.removeEventListener("touchmove",_.current),window.removeEventListener("keydown",I.current),C.removeEventListener("scroll",R.current),u.current!=null&&cancelAnimationFrame(u.current),y.current!=null&&(clearTimeout(y.current),y.current=null)}},[d,e]),g.useEffect(()=>{const C=e.current;if(!C||!i)return;const M=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},A=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},H=P=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(P.key)&&(P.preventDefault(),P.stopPropagation(),c.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",M,{passive:!1}),C.addEventListener("touchmove",A,{passive:!1}),window.addEventListener("keydown",H,{passive:!1}),()=>{C.removeEventListener("wheel",M),C.removeEventListener("touchmove",A),window.removeEventListener("keydown",H),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const f=g.useRef({first:-1,last:-1}),w=g.useRef(!1),T=g.useCallback(()=>{const C=e.current;if(!C)return;const M=to(C),A=(M==null?void 0:M.first)??-1,H=(M==null?void 0:M.last)??-1;f.current={first:A,last:H}},[e]),j=g.useRef(!1),O=g.useCallback(()=>{const C=e.current;if(!C||j.current)return;j.current=!0;const M=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:M,behavior:"instant"})})},[e]);g.useEffect(()=>{!w.current&&i&&(j.current=!1,T()),w.current=i},[i,T]),g.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:M,last:A}=f.current;if(M===-1||A===-1){O();return}if(C.scrollTop<=1){(async()=>{try{h.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{h.current=!1}T()})();return}if(s<M||s>A){async function E(){if(!C)return;const P=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:P})}E().then(P=>{P?T():O()})}},[i,s,O,T,e]);const z=g.useCallback(()=>{const C=e.current;if(!C)return;function M(q,ne,B=.2,U=.8){const G=q.querySelector(`[data-g="${ne}"]`);if(!G)return!1;const Z=q.getBoundingClientRect(),D=G.getBoundingClientRect();if(D.height<=0||Z.height<=0)return!1;const Y=(D.top+D.height/2-Z.top)/Z.height;return Y>=B&&Y<=U}const A=q=>q==="instant"?"auto":q,H=q=>{const ne=C.scrollTop,B=C.scrollHeight-C.clientHeight,U=B>0?ne/B:0;let G=0;const Z=C.querySelector(`[data-g="${q}"]`);if(Z){const D=C.getBoundingClientRect();G=(Z.getBoundingClientRect().top-D.top)/D.height}l.getState().emit({type:"scroll",payload:{scrollTop:ne,scrollRatio:U,anchorGI:q,anchorOffsetRatio:G}})},E=async(q,ne="smooth")=>{var U;const B=ys(n,q);(U=t.current)==null||U.scrollToIndex({index:B,align:"start",behavior:A(ne)}),await ms(C,q)},P=()=>new Promise(q=>requestAnimationFrame(()=>q())),F=async q=>{if(M(C,q,.1,.7))return H(q),!0;h.current=!0;const ne=C.querySelector(`[data-g="${q}"]`),B=C.getBoundingClientRect();let U=C.scrollTop<=1?0:.1;if(ne){const Z=ne.getBoundingClientRect();U=((Z.top+Z.height/2-B.top)/B.height>.5,.15)}const G=!!ne;return G?(await Pn(C,q,{behavior:"smooth",topPaddingRatio:U}),await P()):G||await E(q,"auto"),h.current=!1,H(q),M(C,q,.1,.7)},V=async q=>F(q);return{ensureVisibleGI:F,scrollToGI:V,getVisibleRange:()=>to(C),getScrollTop:()=>C.scrollTop,setScrollTop:q=>{C.scrollTop=q},getAnchorOffsetRatio:q=>{const ne=C.querySelector(`[data-g="${q}"]`);if(!ne)return 0;const B=ne.getBoundingClientRect(),U=C.getBoundingClientRect();return(B.top-U.top)/U.height},scrollToGIAtOffset:async(q,ne)=>{await V(q),await new Promise(re=>setTimeout(re,50));const B=C.querySelector(`[data-g="${q}"]`);if(!B)return;const U=B.getBoundingClientRect(),G=C.getBoundingClientRect(),Z=U.top-G.top,D=ne*G.height,Y=Z-D;C.scrollTop=C.scrollTop+Y}}},[e,t,n,l]);return g.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(z()),()=>o(void 0)),[z,o]),null};function ua(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function da(){const e=$(x=>x.section),t=X(x=>x.theme),n=X(x=>x.fontFamily),r=X(x=>x.fontSizePx),o=X(x=>x.lineHeight),s=rn[t],{blocks:i,nsPrefix:a}=g.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=pn(),c=g.useCallback(()=>{const{isSettingsOpen:x,setSettingsOpen:v,toggleOverlays:p}=l.getState();x?v(!1):p()},[l]),{onClick:u,onDoubleClick:S}=$s({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:ua}),y=g.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitOverflowScrolling:"touch"}),[n,s.bg,s.fg,r,o]),b=g.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:u,onDoubleClick:S,style:y,children:m.jsx("div",{style:b,children:m.jsx(aa,{section:e,blocks:i,nsPrefix:a})})})}function fa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function pa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function ha(e){return Ye({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function ga(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function ma(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const xa="_wrap_1symx_4",ba="_visible_1symx_25",va="_compact_1symx_31",Sa="_row2_1symx_34",ya="_controls_1symx_44",wa="_row1_1symx_52",Ca="_groupExpand_1symx_80",Ia="_groupPlayback_1symx_81",ka="_groupSpeed_1symx_82",Ra="_groupFeatures_1symx_83",Ta="_groupNav_1symx_84",_a="_btn_1symx_116",Ma="_btnForbidden_1symx_141",Ea="_btnActive_1symx_147",ja="_label_1symx_158",Oa="_compactBtn_1symx_167",Ee={wrap:xa,visible:ba,compact:va,row2:Sa,controls:ya,row1:wa,groupExpand:Ca,groupPlayback:Ia,groupSpeed:ka,groupFeatures:Ra,groupNav:Ta,btn:_a,btnForbidden:Ma,btnActive:Ea,label:ja,compactBtn:Oa},Pa=g.memo(function(){const t=g.useRef(null),n=g.useContext(bt),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=we(w=>w.status),s=we(w=>w.currentTimeMs),i=we(w=>w.currentClip),a=we(w=>w.playbackKind),l=X(w=>w.muteAudio),c=X(w=>w.audioSpeed),u=we(w=>w.getClipSrc),S=we(w=>w._onTime),y=we(w=>w._onEnded),b=we(w=>w._onError),x=$(w=>w.setCurrentGlobalRunIndex),v=$(w=>w.getSectionScrollApi),p=$(w=>w.snapToReadable),h=$(w=>w.edgeReadable),d=g.useRef(null),k=g.useRef(null),_=g.useRef(!1),I=g.useRef(null);g.useEffect(()=>{a==="real"&&(_.current=!0)},[a]);const R=g.useMemo(()=>{const w=u(i);if(!w)return null;try{return new URL(w,window.location.href).href}catch{return w}},[i,u]);g.useEffect(()=>{_.current=!0},[R]),g.useEffect(()=>{const w=t.current;if(!w)return;const T=()=>{if(w.paused||w.ended)return;const z=w.currentTime*1e3;_.current&&z===0||(z>0&&(_.current=!1),S(z))},j=()=>{var C,M;y();const z=h(1);typeof z=="number"&&z>=0&&(x(z,"audio"),(M=(C=v())==null?void 0:C.ensureVisibleGI)==null||M.call(C,z))},O=z=>{const C=z.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),b()};return w.addEventListener("timeupdate",T),w.addEventListener("ended",j),w.addEventListener("error",O),()=>{w.removeEventListener("timeupdate",T),w.removeEventListener("ended",j),w.removeEventListener("error",O)}},[S,y,b,h,x,v]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w)return;if(!R){try{w.pause()}catch(z){console.log("pause error",z)}k.current=null;return}const T=w.currentSrc||w.src||null,j=!T||T!==R;if(j){try{w.pause()}catch(z){console.log("pause error",z)}w.src=R;try{w.load()}catch(z){console.log("load error",z)}k.current=R}w.muted=!!l,w.volume=1,w.playbackRate=typeof c=="number"?c:1;const O=async()=>{j&&await new Promise(z=>{let C=!1;const M=()=>{C||(C=!0,w.removeEventListener("loadedmetadata",M),w.removeEventListener("canplay",M),z())};w.addEventListener("loadedmetadata",M),w.addEventListener("canplay",M),w.readyState>=1&&M()});try{await w.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{w.pause()}catch(z){console.log("pause error",z)}},[R,l,o,c,r]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w||a!=="real")return;const T=s/1e3;if(Number.isFinite(T)){if(w.readyState<1){d.current=s;const j=()=>{if(d.current!=null){const O=d.current/1e3;try{w.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}d.current=null}w.removeEventListener("loadedmetadata",j),w.removeEventListener("canplay",j)};w.addEventListener("loadedmetadata",j),w.addEventListener("canplay",j);return}if(Math.abs(w.currentTime-T)>.2)try{w.currentTime=T}catch(j){console.log("currentTime보정오류",j)}}},[s,a,r]);const f=we(w=>w.getGIFromCT);return g.useEffect(()=>{var j,O;if(r||a!=="real"||o!=="playing"&&o!=="loading")return;const w=f(i,s);if(w<0)return;const T=p(w);T!==I.current&&(I.current=T,x(T,"audio"),T%5===0&&((O=(j=v())==null?void 0:j.ensureVisibleGI)==null||O.call(j,T)))},[o,i,s,a,f,p,x,v,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Ba(){return m.jsx(Pa,{})}const za="_scrubberWrap_uw0cd_2",Aa="_labels_uw0cd_9",La="_index_uw0cd_15",Ga="_controls_uw0cd_19",Ha="_percent_uw0cd_25",Na="_range_uw0cd_46",Ct={scrubberWrap:za,labels:Aa,index:La,controls:Ga,percent:Ha,range:Na};function Fa(){const e=X(I=>I.isDev),t=$(I=>I.currentGlobalRunIndex),n=$(I=>I.totalRuns),r=$(I=>I.setCurrentGlobalRunIndex),o=$(I=>I.getSectionScrollApi),s=$(I=>I.giToPercentTotal),i=$(I=>I.percentToGITotal),a=$(I=>I.snapToReadable),l=we(I=>I.scrollLock),c=we(I=>I.pause),u=we(I=>I.play),S=we(I=>I.syncToGI),[y,b]=g.useState(()=>s(t||0));g.useEffect(()=>{b(s(t||0))},[t,s]);const x=g.useRef(!1),v=g.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),p=g.useCallback(()=>{l&&(c(),x.current=!0)},[l,c]),h=g.useCallback(I=>{b(Number(I.currentTarget.value))},[]),d=g.useCallback(async()=>{const I=i(y),R=a(I);c(),r(R,"scrubber-commit"),S(R);const f=o();f!=null&&f.ensureVisibleGI&&await f.ensureVisibleGI(R),x.current&&(x.current=!1,u())},[y,i,a,c,r,S,o,u]),k=g.useMemo(()=>({"--pct":`${y}%`}),[y]),_=g.useMemo(()=>Math.round(y),[y]);return m.jsxs("div",{className:Ct.scrubberWrap,children:[e&&m.jsx("div",{className:Ct.labels,children:m.jsxs("span",{className:Ct.index,children:[v," / ",n||0]})}),m.jsxs("div",{className:Ct.controls,children:[m.jsx("input",{type:"range",className:Ct.range,min:0,max:100,step:.5,value:y,style:k,onMouseDown:p,onTouchStart:p,onChange:h,onMouseUp:()=>{d()},onTouchEnd:()=>{d()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void d():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:Ct.percent,children:[_,"%"]})]})]})}const Wa=g.memo(Fa),Da=g.memo(function(){const t=g.useContext(bt),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=we(w=>w.playbackKind),o=we(w=>w.status),s=we(w=>w.fake),i=X(w=>w.audioSpeed),a=we(w=>w.pause),l=$(w=>w.totalRuns),c=$(w=>w.currentGlobalRunIndex),u=$(w=>w.setCurrentGlobalRunIndex),S=$(w=>w.getSectionScrollApi),y=$(w=>w.nextReadableFrom),b=$(w=>w.edgeReadable),x=g.useRef(null),v=g.useRef(null),p=g.useRef(0),h=g.useRef(-1),d=!n&&r==="fake"&&o==="playing",k=Math.max(1,(s==null?void 0:s.totalWords)??1),_=g.useMemo(()=>{const w=200*i;return k/w*6e4},[k,i]),I=g.useMemo(()=>!l||l<=1||_<=0?0:(l-1)/_,[l,_]);g.useEffect(()=>{if(!d)return;const w=Math.max(0,Math.min(c??0,Math.max(0,(l??1)-1)));p.current=w,h.current=w,v.current=null},[d,c,l]);const R=g.useRef(-1);g.useEffect(()=>{if(!l){R.current=-1;return}const w=b(1);R.current=w??-1},[b,l]);const f=g.useCallback(w=>{(async()=>{var H,E;if(!d){x.current=null;return}if(!l||l<=1||I<=0){x.current=null;return}const T=v.current;v.current=w;const j=T==null?0:Math.max(0,w-T),O=l-1;p.current=Math.min(O,p.current+I*j);const z=Math.floor(p.current),C=S(),M=y(z,1);if(M==null){const P=R.current>=0?R.current:z;P!==h.current&&(h.current=P,u(P,"audio"),await((H=C==null?void 0:C.ensureVisibleGI)==null?void 0:H.call(C,P))),a(),x.current=null;return}const A=M;A!==h.current&&(h.current=A,u(A,"audio"),A%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,A))),x.current=requestAnimationFrame(f)})().catch(console.error)},[d,l,I,y,u,S,a]);return g.useEffect(()=>(d?x.current==null&&(x.current=requestAnimationFrame(f)):(x.current&&(cancelAnimationFrame(x.current),x.current=null),v.current=null),()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[d,f]),null}),Va=g.memo(function(){return m.jsx(Da,{})}),$a="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Ua="_WPMSpeedButtonsWrap_r3byt_1",Ka="_btnWrap_r3byt_7",Qa="_label_r3byt_14",Ya="_iconBtn_r3byt_22",Ot={WPMSpeedButtonsWrap:Ua,btnWrap:Ka,label:Qa,iconBtn:Ya},io=350,Xa=40,Za=.85,Ja=g.memo(function(){const t=X(y=>y.audioSpeed),n=X(y=>y.incAudioSpeed),r=X(y=>y.decAudioSpeed),o=g.useRef(null),s=g.useRef(io),i=g.useRef(null),a=g.useCallback(y=>{const b=t;if(y==="inc"){if(b>=2)return!1;n()}else{if(b<=.3)return!1;r()}return!0},[t,n,r]),l=g.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=g.useCallback(()=>{i.current&&(s.current=Math.max(Xa,Math.floor(s.current*Za)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),u=g.useCallback(y=>{if(i.current)return;i.current=y,s.current=io,a(y)&&c();const x=()=>l();window.addEventListener("mouseup",x,{once:!0}),window.addEventListener("touchend",x,{once:!0})},[c,a,l]);g.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return m.jsx("div",{onMouseLeave:l,className:Ot.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Ot.btnWrap,children:[m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>u("dec"),onTouchStart:y=>{y.preventDefault(),u("dec")},onMouseUp:l,children:m.jsx("img",{src:$a,alt:"느리게"})}),m.jsx("div",{className:Ot.label,style:{minWidth:"44px",textAlign:"center"},children:m.jsx("div",{children:S})}),m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>u("inc"),onTouchStart:y=>{y.preventDefault(),u("inc")},onMouseUp:l,children:m.jsx("img",{src:qa,alt:"빠르게"})})]})})}),ec="_StepBtn_15t0r_1",tc={StepBtn:ec};function nc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function rc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function lo({direction:e}){const t=$(S=>S.currentGlobalRunIndex),n=$(S=>S.totalRuns),r=$(S=>S.hasReadableInDir),o=$(S=>S.computeStepTarget),s=$(S=>S.setCurrentGlobalRunIndex),i=we(S=>S.syncToGI),a=$(S=>S.getSectionScrollApi),l=g.useCallback(async S=>{var x,v;const y=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),b=o(y,S);s(b,"scrubber-step"),i(b),await((v=(x=a())==null?void 0:x.ensureVisibleGI)==null?void 0:v.call(x,b))},[t,n,o,s,i,a]),c=g.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),y=!n||!r(S,1),b=!n||!r(S,-1);return e==="left"?b:y},[e,n,t,r]),u=g.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return m.jsx("button",{className:tc.StepBtn,type:"button",onClick:u,disabled:c,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(nc,{}):m.jsx(rc,{})})}const oc="_GCPlayBtn_n54mc_1",sc="_playing_n54mc_34",ao={GCPlayBtn:oc,playing:sc},ic=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${ao.GCPlayBtn} ${r?ao.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function lc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}function ac(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(e)}function cc(){const e=X(I=>I.showOverlays),t=$(I=>I.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=X(I=>I.muteAudio),s=X(I=>I.showPointer),i=X(I=>I.showSplit),a=X(I=>I.toggleMuteAudio),l=X(I=>I.toggleShowPointer),c=X(I=>I.toggleShowSplit),u=X(I=>I.overlayCompactMode),S=X(I=>I.toggleOverlayCompactMode),y=ln(),b=Mt();g.useEffect(()=>{const I=y.getState(),{syncToGI:R,useFake:f,useReal:w}=I,T=I.playbackKind,j=b.getState().progress.currentGlobalRunIndex??0;if(!r){T!=="fake"&&f();return}o?T!=="fake"&&(console.log("이부분일까?"),f()):T!=="real"&&(R(j),w())},[r,o,b,y]);const x=we(I=>I.play),v=we(I=>I.pause),p=we(I=>I.status),h=g.useCallback(I=>{I.stopPropagation(),p==="playing"||p==="loading"?v():x()},[p,x,v]),d=ln(),k=Mt(),_=g.useCallback(async I=>{var P,F;if(I.stopPropagation(),p==="playing"||p==="loading"){v();return}const{progress:R}=k.getState(),{currentGlobalRunIndex:f,snapToReadable:w,edgeReadable:T,setCurrentGlobalRunIndex:j,getSectionScrollApi:O}=R,z=d.getState(),C=z.currentClip,M=O==null?void 0:O(),A=typeof f=="number"?f:0,H=typeof w=="function"?w(A):A,E=typeof T=="function"?T(1):null;if(E!=null&&H>=E){j==null||j(E,"audio"),await((P=M==null?void 0:M.ensureVisibleGI)==null?void 0:P.call(M,E)),z.syncToGI(E);return}j==null||j(H,"audio"),await((F=M==null?void 0:M.ensureVisibleGI)==null?void 0:F.call(M,H)),z.syncToGI(H),x(C)},[p,v,x,d,k]);return m.jsxs("div",{className:`${Ee.wrap} ${e?Ee.visible:""} ${u?Ee.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!u&&m.jsx(Wa,{}),m.jsx("div",{style:u?{display:"none"}:void 0,children:r&&!o?m.jsx(Ba,{}):m.jsx(Va,{})}),m.jsxs("div",{className:Ee.controls,children:[m.jsxs("div",{className:Ee.row1,children:[m.jsx("div",{className:Ee.groupExpand,children:m.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:Ee.compactBtn,title:u?"오버레이 확대":"오버레이 축소",children:u?m.jsx(ac,{size:24}):m.jsx(lc,{size:24})})}),m.jsxs("div",{className:Ee.groupPlayback,children:[m.jsx(lo,{direction:"left"}),m.jsx(ic,{size:34,isPlaying:p==="playing",onClick:o?_:h,title:p==="playing"?"일시정지":"재생"}),m.jsx(lo,{direction:"right"})]}),m.jsx("div",{className:Ee.groupSpeed,children:m.jsx(Ja,{})})]}),m.jsxs("div",{className:Ee.row2,children:[m.jsxs("div",{className:Ee.groupFeatures,children:[r&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},className:`${Ee.btn} ${o?"":Ee.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(fa,{size:18}):m.jsx(pa,{size:18}),m.jsx("span",{className:Ee.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${Ee.btn} ${s?Ee.btnActive:""}`,title:"포인터 표시",children:[m.jsx(ha,{size:18}),m.jsx("span",{className:Ee.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},disabled:!n,className:`${Ee.btn} ${i?Ee.btnActive:""} ${n?"":Ee.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ga,{size:18}),m.jsx("span",{className:Ee.label,children:"끊어읽기"})]})]}),m.jsxs("div",{className:Ee.groupNav,children:[m.jsx(la,{}),m.jsx(dn,{})]})]})]})]})}const uc=g.memo(cc);function dc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const fc="_host_v5qx1_3",pc="_topbar_v5qx1_11",hc="_visible_v5qx1_32",gc="_backBtn_v5qx1_37",mc="_title_v5qx1_58",xc="_settingsBtn_v5qx1_67",It={host:fc,topbar:pc,visible:hc,backBtn:gc,title:mc,settingsBtn:xc};function bc(){const e=X(c=>c.showOverlays),t=X(c=>c.overlayCompactMode),n=$(c=>c.onViewerClose),o=$(c=>c.section).ast.title,s=X(c=>c.setSettingsOpen),i=X(c=>c.setShowOverlays),a=g.useCallback(()=>{n==null||n()},[n]),l=g.useCallback(()=>{s(!0),i(!1)},[s,i]);return m.jsx("div",{className:It.host,children:m.jsxs("div",{className:`${It.topbar} ${e&&!t?It.visible:""}`,children:[m.jsx("button",{type:"button",className:It.backBtn,onClick:a,"aria-label":"뒤로가기",children:m.jsx(ma,{size:28})}),m.jsx("div",{className:It.title,children:m.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),m.jsx("button",{type:"button",className:It.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:m.jsx(dc,{size:28})})]})})}const vc=g.memo(bc),Sc="_wrap_62su0_7",yc="_wrapHidden_62su0_29",wc="_wrapVisible_62su0_35",Cc="_scrollArea_62su0_71",Ic="_row_62su0_81",kc="_label_62su0_89",Rc="_btn_62su0_95",Tc="_btnActive_62su0_106",_c="_btnSmall_62su0_110",Mc="_pill_62su0_122",Ec="_themeCircle_62su0_133",jc="_themeCircleActive_62su0_146",Oc="_stepRow_62su0_151",Pc="_stepLabel_62su0_159",Bc="_levelBox_62su0_172",zc="_inlineFlex_62su0_177",Me={wrap:Sc,wrapHidden:yc,wrapVisible:wc,scrollArea:Cc,row:Ic,label:kc,btn:Rc,btnActive:Tc,btnSmall:_c,pill:Mc,themeCircle:Ec,themeCircleActive:jc,stepRow:Oc,stepLabel:Pc,levelBox:Bc,inlineFlex:zc};function Ac({visible:e}){const t=X(f=>f.mode),n=X(f=>f.setMode),r=X(f=>f.theme),o=X(f=>f.setTheme),s=X(f=>f.fontFamily),i=X(f=>f.setFontFamily),a=X(f=>f.resetToDefaults),l=X(f=>f.getFontLevel()),c=X(f=>f.getLineLevel()),u=X(f=>f.getMarginLevel()),S=X(f=>f.setFontLevel),y=X(f=>f.setLineLevel),b=X(f=>f.setMarginLevel),x=X(f=>f.pointerStyle),v=X(f=>f.setPointerStyle),p=X(f=>f.pointerColor),h=X(f=>f.setPointerColor),d=X(f=>f.breakMarks),k=X(f=>f.toggleBreakMark),_=X(f=>f.getBreakGapLevel()),I=X(f=>f.setBreakGapLevel),R=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return m.jsxs("div",{className:R,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Me.scrollArea,children:[m.jsx(Pt,{label:"열람방식",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(kt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(Pt,{label:"테마",children:m.jsx("div",{className:Me.inlineFlex,children:Object.keys(rn).map(f=>{const w=f,T=rn[w];return m.jsx("button",{type:"button",onClick:()=>o(w),className:`${Me.themeCircle} ${r===f?Me.themeCircleActive:""}`,style:{background:T.bg,color:T.fg,fontFamily:s},title:String(f),"aria-label":`테마: ${String(f)}`,children:"A"},`${f}_tc_button`)})})}),m.jsx(Pt,{label:"글꼴",children:m.jsx("div",{className:Me.inlineFlex,children:zo.map(f=>m.jsx(kt,{active:s===f.value,onClick:()=>i(f.value),title:f.value,children:f.label},f.label))})}),m.jsx(en,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),m.jsx(en,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>y(Math.max(1,c-1)),onInc:()=>y(Math.min(7,c+1))}),m.jsx(en,{label:"여백",level:u,min:1,max:5,onDec:()=>b(Math.max(1,u-1)),onInc:()=>b(Math.min(5,u+1))}),m.jsx(Pt,{label:"포인터",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:x==="highlight",onClick:()=>v("highlight"),children:"형광펜"}),m.jsx(kt,{active:x==="underline",onClick:()=>v("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:p,onChange:f=>h(f.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(Pt,{label:"끊기표시",children:m.jsx("div",{className:Me.inlineFlex,children:m.jsx(kt,{active:d.slash,onClick:()=>k("slash"),children:"슬래쉬"})})}),m.jsx(en,{label:"끊기간격",level:_,min:1,max:5,onDec:()=>I(Math.max(1,_-1)),onInc:()=>I(Math.min(5,_+1))})]}),m.jsx("div",{className:Me.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:Me.pill,children:"보기 설정 초기화"})})]})}function Pt({label:e,children:t}){return m.jsxs("div",{className:Me.row,children:[m.jsx("label",{className:Me.label,children:e}),t]})}function kt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${Me.btn} ${e?Me.btnActive:""}`,children:r})}function en({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,a=t>=r;return m.jsxs("div",{className:Me.stepRow,children:[m.jsx("label",{className:Me.stepLabel,children:e}),m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:Me.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:Me.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:a,className:Me.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Lc=g.memo(function(){const t=X(i=>i.showOverlays),n=X(i=>i.isSettingsOpen),r=$(i=>i.rangeStartGI),o=$(i=>i.rangeEndGI);return r!=null&&o!=null?null:m.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[m.jsx(vc,{}),m.jsx(uc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Ac,{visible:!t&&n})})]})}),Gc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());c=y=>{const b=i(y);if(!u(S,b)){const x=S;a(S=b,x)}},l!=null&&l.fireImmediately&&a(S,S)}return o(c)}),e(t,n,r)},Hc=Gc;function Nc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Fc(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function Wc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Fc((r==null?void 0:r.text)??"");return t}function Dc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=b=>{if(!n)return null;const{g2ct:x}=n;if(!x)return null;const v=x[b];if(v)return{clip:v.clip,t:v.t};for(let p=1;p<=100&&b-p>=0;p++){const h=x[b-p];if(h)return{clip:h.clip,t:h.t}}for(let p=1;p<=100;p++){const h=x[b+p];if(h)return{clip:h.clip,t:h.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Wc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const b=o(e.initialIndex);b&&(i=b.clip,a=b.t,r=void 0)}const c=s.length>0,u=c?"paused":"idle",S=c?"real":"fake",y=c?null:{totalWords:l};return Vt(Hc((b,x)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:u,scrollLock:!1,playbackKind:S,fake:y,useFake:()=>b(v=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:v.status==="playing"})),useReal:()=>b(v=>({playbackKind:"real",fake:{totalWords:l},scrollLock:v.status==="playing"})),injectMap:v=>{if(n=v,typeof r=="number"){const p=o(r);p&&b(h=>({currentClip:Math.max(0,Math.min(p.clip,Math.max(0,h.clips.length-1))),currentTimeMs:Math.max(0,p.t)})),r=void 0}},setClipAndMs:(v,p)=>b(h=>{const d=Math.max(0,h.clips.length-1);return{currentClip:Math.max(0,Math.min(v,d)),currentTimeMs:Math.max(0,p),status:h.status,scrollLock:h.scrollLock}}),setClips:v=>b(p=>{const h=Array.isArray(v)?v:[],d=h.length>0;return{clips:h,currentClip:0,currentTimeMs:0,status:d?"paused":"idle",playbackKind:d?"real":"fake",fake:d?null:p.fake??{totalWords:l},scrollLock:!1}}),clear:()=>b(v=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:v.fake??{totalWords:l},scrollLock:!1})),play:(v,p)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),b(h=>{if(h.playbackKind==="fake")return{status:"playing",scrollLock:!0};const d=typeof v=="number"?v:h.currentClip,k=typeof p=="number"?p:h.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(d,Math.max(0,h.clips.length-1))),currentTimeMs:k,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),b({status:"paused",scrollLock:!1})},seek:v=>b(p=>({currentTimeMs:Math.max(0,v),status:p.status})),stop:()=>b({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>b(v=>{if(v.playbackKind==="fake")return v;const p=Math.max(0,v.clips.length-1);return{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>b(v=>v.playbackKind==="fake"?v:{currentClip:Math.max(0,v.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:v=>b(p=>p.playbackKind==="fake"||v<0||v>=p.clips.length?p:{currentClip:v,currentTimeMs:0}),getClipSrc:v=>{const p=x();if(!p.clips.length)return null;const h=typeof v=="number"?v:p.currentClip;return Nc(p.clips[h])},getGIFromCT:(v,p)=>{if(!n)return-1;const h=n.byClip[v];if(!h||h.length===0)return-1;let d=0,k=h.length-1,_=0;for(;d<=k;){const I=d+k>>1;h[I].t<=p?(_=I,d=I+1):k=I-1}return h[Math.max(0,Math.min(_,h.length-1))].g},getCTFromGI:v=>{if(!n)return null;const{g2ct:p}=n;if(!p)return null;let h=p[v];if(!h){let d=v-1;const k=Math.max(0,v-100);for(;d>=k;){if(p[d]){h=p[d];break}d--}if(!h){let _=v+1;const I=v+100;for(;p[_]==null&&_<=I;)_++;p[_]&&(h=p[_])}}return h?{clip:h.clip,timeMs:h.t}:null},getMetaByGI:v=>{const p=x().getCTFromGI(v);return p?{clipIndex:p.clip,timeMs:p.timeMs}:null},syncToGI:v=>{const p=x().getMetaByGI(v);p&&x().setClipAndMs(p.clipIndex,p.timeMs)},_onTime:v=>b({currentTimeMs:v,status:"playing",scrollLock:!0}),_onEnded:()=>b(v=>{if(v.playbackKind==="fake")return{status:"ended",scrollLock:!1};const p=Math.max(0,v.clips.length-1);return v.currentClip>=p?{status:"ended",scrollLock:!1}:{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>b({status:"error",scrollLock:!1}),_setStatusOnly:v=>b({status:v})})))}function Vc({children:e,initialState:t}){const n=g.useContext(bt)??void 0,r=g.useMemo(()=>Dc({...t,recorderStore:n}),[t,n]);return m.jsx(bn.Provider,{value:r,children:e})}function $c(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const a of r){if((a==null?void 0:a.type)==="image")continue;const l=(a==null?void 0:a.runs)??[];for(let c=0;c<l.length;c++){const u=l[c],S=o+c;u.audioChunkIndex!=null&&u.audioTimeMs!=null&&((t[i=u.audioChunkIndex]||(t[i]=[])).push({t:u.audioTimeMs,g:S}),n[S]={clip:u.audioChunkIndex,t:u.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function qc(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function Uc(e){const t=Fl(e),n=Wl(t),r=t.reduce((u,S)=>u+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],a=[];return e.forEach((u,S)=>{var p;if(u.type!=="paragraph")return;const y=n[S]??0,b=u.runs??[];for(let h=0;h<b.length;h++){const d=((p=b[h])==null?void 0:p.text)||"";or(d)&&(s[y+h]=1)}const v=Dl(b,y).map(h=>{var I;const d=h.startG-y,k=h.endG-h.startG+1;let _=-1;for(let R=0;R<k;R++){const f=((I=b[d+R])==null?void 0:I.text)??"";if(or(f)){_=h.startG+R;break}}return{startG:h.startG,endG:h.endG,r0:d,len:k,firstReadableGI:_,splitIndex:h.splitIndex}});a[S]=v;for(const h of v){const d=i.length;for(let k=h.startG;k<=h.endG;k++)o[k]=d;i.push(h)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function Kc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:c}=e,u=a.totalRuns??0,S=typeof l=="number"?l:u>0?0:-1,y=S>=0?qc(i.readableGi,S,u):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:y,lastUpdateBy:"program",totalRuns:u,pageIndex:0,sectionLoading:!0,_loadingStartTime:c,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function Qc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:c,layout:u}=Uc(l),S=Date.now(),y=Kc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:c,layout:u,initialIndex:n,mountTime:S});return a&&(a.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),a.getState().emit({type:"loading_start",payload:{}},S)),Vt((b,x)=>{const v=E=>{b(P=>P.progress._scrollApi===E?P:{progress:{...P.progress,_scrollApi:E}})},p=()=>x().progress._scrollApi,h=E=>{b(P=>{const F=P.progress;if(F.totalRuns===E)return P;const V=F.currentGlobalRunIndex<0&&E>0;return{progress:{...F,totalRuns:E,currentGlobalRunIndex:V?0:F.currentGlobalRunIndex,lastUpdateBy:V?"program":F.lastUpdateBy}}})},d=(E,P="program")=>{const F=x().progress.currentGlobalRunIndex,V=x().progress,Q=V.totalRuns>0?Math.max(-1,Math.min(E,V.totalRuns-1)):E;F===Q&&V.lastUpdateBy===P||(b(te=>({progress:{...te.progress,currentGlobalRunIndex:Q,lastUpdateBy:P}})),F!==Q&&a&&a.getState().emit({type:"global_index_change",payload:{globalIndex:Q}}))},k=E=>{const{sectionLoading:P,_loadingStartTime:F}=x().progress;if(P===E)return;const V=Date.now();if(E)b(Q=>({progress:{...Q.progress,sectionLoading:!0,_loadingStartTime:V}})),a&&a.getState().emit({type:"loading_start",payload:{}});else{const te=(F?V-F:0)/1e3;b(pe=>({progress:{...pe.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:te}})}},_=E=>{b(P=>({progress:{...P.progress,pageIndex:E}}))},I=(E,P)=>{b(F=>({progress:{...F.progress,rangeStartGI:Math.min(E,P),rangeEndGI:Math.max(E,P)}}))},R=()=>{b(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}}))},f=E=>{const{rangeStartGI:P,rangeEndGI:F}=x().progress;P==null||F==null||(E<P?b(V=>({progress:{...V.progress,rangeStartGI:E}})):E>F?b(V=>({progress:{...V.progress,rangeEndGI:E}})):R())},w=()=>{var ye;const{rangeStartGI:E,rangeEndGI:P,section:F,layout:V}=x().progress;if(E==null||P==null||!V)return"";const Q=((ye=F.ast)==null?void 0:ye.blocks)??[],te=V.prefix,pe=[];for(let me=0;me<Q.length;me++){const q=Q[me];if(q.type!=="paragraph")continue;const ne=q.runs??[],B=te[me]??0;for(let U=0;U<ne.length;U++){const G=B+U;G>=E&&G<=P&&pe.push(ne[U].text??"")}}return pe.join("")},T=E=>{const{totalRuns:P,derivedNav:F}=x().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return E;const Q=P,te=Math.max(0,Math.min(E,Q-1));if(V[te])return te;let pe=te-1,ye=te+1;for(;pe>=0||ye<Q;){if(ye<Q&&V[ye])return ye;if(pe>=0&&V[pe])return pe;ye+=1,pe-=1}return te},j=(E,P)=>{const{totalRuns:F,derivedNav:V}=x().progress,Q=V==null?void 0:V.readableGi;if(!Q||F<=0)return null;if(P>0){for(let te=Math.min(Math.max(E,0),F-1);te<F;te+=1)if(Q[te])return te}else for(let te=Math.min(Math.max(E,0),F-1);te>=0;te-=1)if(Q[te])return te;return null},O=E=>{const{totalRuns:P,derivedNav:F}=x().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return null;if(E>0){for(let Q=P-1;Q>=0;Q-=1)if(V[Q])return Q}else for(let Q=0;Q<P;Q+=1)if(V[Q])return Q;return null};return{progress:{...y,registerSectionScrollApi:v,getSectionScrollApi:p,setTotalRuns:h,setCurrentGlobalRunIndex:d,setSectionLoading:k,setPageIndex:_,setRange:I,clearRange:R,extendRange:f,getRangeText:w,snapToReadable:T,nextReadableFrom:j,edgeReadable:O,hasReadableInDir:(E,P)=>j(E+(P>0?1:-1),P)!=null,computeStepTarget:(E,P)=>{const{totalRuns:F,derivedNav:V}=x().progress;if(!F||F<=0)return E;const Q=(V==null?void 0:V.groups)??[],te=V==null?void 0:V.giToGroupIdx;if(!Q.length||!te){const B=F-1;return T(Math.max(0,Math.min(E+P,B)))}let pe=te[E]??-1;if(pe<0||pe>=Q.length)for(let ne=0;ne<Q.length;ne+=1){const B=Q[ne];if(E>=B.startG&&E<=B.endG){pe=ne;break}}if(pe<0||pe>=Q.length)return O(P)??T(E);const ye=ne=>ne>=0&&ne<Q.length&&(Q[ne].firstReadableGI??-1)>=0;let me=pe+P;for(;me>=0&&me<Q.length&&!ye(me);)me+=P;if(me<0||me>=Q.length)return O(P)??T(E+P);const q=Q[me].firstReadableGI;return q>=0?q:T(E+P)},giToPercentTotal:E=>{const P=x().progress.totalRuns;return!P||P<=1?0:Math.max(0,Math.min(E,P-1))/(P-1)*100},percentToGITotal:E=>{const P=x().progress.totalRuns;if(!P||P<=1)return 0;const F=Math.max(0,Math.min(E,100)),V=Math.round(F/100*(P-1));return Math.max(0,Math.min(V,P-1))}}}})}function Yc({children:e,initialState:t}){const n=g.useContext(bt),r=g.useMemo(()=>Qc({...t,recorderStore:n}),[t,n]);return m.jsx(br.Provider,{value:r,children:e})}function Xc({children:e,initialState:t}){const n=g.useContext(bt)??void 0,r=g.useRef(Us({init:t,recorderStore:n}));return m.jsx(sr.Provider,{value:r.current,children:e})}const Zc=({pages:e,pageIndex:t,maxWidth:n})=>{const r=$(d=>d.section),o=g.useMemo(()=>{var d;return((d=r.ast)==null?void 0:d.blocks)??[]},[r]),s=X(d=>d.marginX),i=X(d=>d.lineHeight),a=X(d=>d.fontSizePx),l=X(d=>d.fontFamily),c=X(d=>d.viewportHeight),u=$(d=>{var k;return((k=d.layout)==null?void 0:k.prefix)??[]}),S=$(d=>{var k;return((k=d.derivedNav)==null?void 0:k.splitGroupsPerBlock)??[]}),y=e[t],b=g.useMemo(()=>{const d=[];return o.forEach((k,_)=>{(k.type==="paragraph"||k.type==="image")&&d.push(_)}),d},[o]),x=g.useMemo(()=>{if(!y)return[];const d=[];for(let k=y.startBlock;k<=y.endBlock;k++){const _=b[k];_!=null&&d.push(_)}return d},[y,b]),v=g.useMemo(()=>{const d=[];for(const k of x){const _=o[k];(_==null?void 0:_.type)==="paragraph"&&d.push({b:_,originalBlockIndex:k})}return d},[x,o]),p=g.useMemo(()=>{const d=[],k=vr();return v.forEach((_,I)=>{d[I]=Sr(_.b,k)}),d},[v]),h=(d,k,_)=>{if(!d||d.length===0)return[];const I=[];for(const R of d){const f=R.startG,w=R.endG;if(w<k||f>_)continue;const T=Math.max(f,k),j=Math.min(w,_),O=T-f|0,z=Math.max(0,j-T+1);if(z<=0)continue;const C=(R.r0??0)+O;I.push({...R,startG:T,endG:j,r0:C,len:z})}return I};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:a,lineHeight:i,boxSizing:"border-box"},children:m.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[m.jsx("div",{style:{height:40}}),m.jsx("div",{style:{flex:1,overflow:"hidden"},children:x.map((d,k)=>{var ne;const _=o[d],I=k===0,R=k===x.length-1,f={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},w=`sec-${r.section_id}/blk-${_.id??d}`;if(_.type==="image"){const{src:B,alt:U,width:G,height:Z}=_,D=G&&Z?`${G} / ${Z}`:"4 / 3",Y=c>80?Math.floor((c-80)*.6):void 0;return m.jsx("div",{style:f,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:Y,aspectRatio:D},children:m.jsx("img",{src:B,alt:U||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),U&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:U})]})},w)}const T=_,j=v.findIndex(B=>B.originalBlockIndex===d),O=j>=0?p[j]:void 0,z=T.runs??[],C=z.length;let M=0,A=Math.max(0,C-1);I&&y.startOffsetInBlock!=null&&(M=Math.min(Math.max(0,y.startOffsetInBlock),A)),R&&y.endOffsetInBlock!=null&&(A=Math.max(M,Math.min(y.endOffsetInBlock,A)));const H=M>0,E=u[d]??0,P=S[d]??[],F=E+M,V=E+A;let Q=h(P,F,V);const te=E+M;Q=Q.map(B=>{const U=Math.max(0,(B.startG??F)-te),G=B.len??Math.max(1,(B.endG??V)-(B.startG??F)+1);return{...B,r0:U,len:G}});const pe=M<=A?z.slice(M,A+1):[],ye=T.list?T.list.level*24:0,me=((ne=T.list)==null?void 0:ne.kind)==="bullet"?T.list.glyph??"•":void 0,q=H?void 0:O??me;return m.jsx("div",{style:f,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:T.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[T.list&&q?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:q||""}):null,m.jsx(gs,{preGroups:Q,runs:pe,ns:w,baseIndex:te,sectionId:String(r.section_id)})]})},w)})})]})})},co=.5;function Jc(e,t){const n=g.useRef(null),r=g.useRef(null),o=g.useRef(!1);g.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const c=l[0],{width:u,height:S}=c.contentRect,y=r.current;if(!y){r.current={w:u,h:S};return}Math.abs(y.w-u)<co&&Math.abs(y.h-S)<co||(r.current={w:u,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const a=()=>s();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function eu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:a=120,verticalTolerance:l=40,velocityThreshold:c=.6,singleDelayMs:u=250,doubleClickWindowMs:S=300,suppressAfterSwipeMs:y=250,onDragMove:b,onDragEnd:x,pageTransitionThreshold:v}=e,p=v??a,h=Math.min(20,a),d=rt.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),k=()=>{d.current.singleTimer!=null&&(window.clearTimeout(d.current.singleTimer),d.current.singleTimer=null)},_=()=>{var M;const C=((M=document==null?void 0:document.body)==null?void 0:M.style)??null;C&&d.current.prevUserSelect!=null&&(C.userSelect=d.current.prevUserSelect,d.current.prevUserSelect=null),d.current.capturedEl&&d.current.pid!=null&&typeof d.current.capturedEl.hasPointerCapture=="function"&&d.current.capturedEl.hasPointerCapture(d.current.pid)&&d.current.capturedEl.releasePointerCapture(d.current.pid),d.current.capturedEl=null},I=rt.useCallback(C=>{const M=i??s;M!=null&&M(C.target)||(d.current.pid=C.pointerId,d.current.startX=C.clientX,d.current.startY=C.clientY,d.current.startT=C.timeStamp,d.current.swiping=!1,d.current.canceledClick=!1,d.current.capturedEl=C.currentTarget)},[i,s]),R=rt.useCallback(C=>{var P;if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.clientX-d.current.startX,A=C.clientY-d.current.startY,H=Math.abs(M),E=Math.abs(A);if(!d.current.swiping){if(H>=h&&E<=l&&H>E){d.current.swiping=!0,d.current.canceledClick=!0;const F=d.current.capturedEl;if(F&&typeof F.setPointerCapture=="function")try{F.setPointerCapture(C.pointerId)}catch{}const V=((P=document==null?void 0:document.body)==null?void 0:P.style)??null;V&&(d.current.prevUserSelect=V.userSelect??null,V.userSelect="none"),C.preventDefault()}return}b==null||b(M),C.preventDefault()},[l,b,h]),f=rt.useCallback(C=>{if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.timeStamp-d.current.startT,A=C.clientX-d.current.startX;if(d.current.swiping){const H=Math.abs(A)/Math.max(1,M);Math.abs(A)>=p||H>=c?A<0?n():t():x==null||x(),d.current.lastSwipeAt=C.timeStamp}else C.timeStamp-d.current.lastUpT;_(),d.current.lastUpT=C.timeStamp,d.current.pid=null,d.current.swiping=!1},[p,c,n,t,S,x]),w=rt.useCallback(()=>{d.current.swiping&&(x==null||x()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[x]),T=rt.useCallback(C=>{var M,A;(A=(M=d.current.capturedEl)==null?void 0:M.hasPointerCapture)!=null&&A.call(M,C.pointerId)||d.current.pid!=null&&d.current.swiping&&(x==null||x(),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1)},[x]),j=rt.useCallback(()=>{d.current.pid!=null&&d.current.swiping&&(x==null||x()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[x]),O=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}r&&d.current.singleTimer==null&&(d.current.singleTimer=window.setTimeout(()=>{d.current.singleTimer=null,r(C)},u))}},[r,s,u,y]),z=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}k(),o==null||o(C)}},[o,s,y]);return rt.useEffect(()=>()=>{k(),_()},[]),{onPointerDown:I,onPointerMove:R,onPointerUp:f,onPointerCancel:w,onPointerLeave:T,onLostPointerCapture:j,onClick:O,onDoubleClick:z}}var Bn,uo;function ws(){if(uo)return Bn;uo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,fo;function tu(){if(fo)return zn;fo=1;var e=typeof Qt=="object"&&Qt&&Qt.Object===Object&&Qt;return zn=e,zn}var An,po;function Cs(){if(po)return An;po=1;var e=tu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,ho;function nu(){if(ho)return Ln;ho=1;var e=Cs(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,go;function ru(){if(go)return Gn;go=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gn=t,Gn}var Hn,mo;function ou(){if(mo)return Hn;mo=1;var e=ru(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,xo;function Is(){if(xo)return Nn;xo=1;var e=Cs(),t=e.Symbol;return Nn=t,Nn}var Fn,bo;function su(){if(bo)return Fn;bo=1;var e=Is(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var a=n.call(i,o),l=i[o];try{i[o]=void 0;var c=!0}catch{}var u=r.call(i);return c&&(a?i[o]=l:delete i[o]),u}return Fn=s,Fn}var Wn,vo;function iu(){if(vo)return Wn;vo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Wn=n,Wn}var Dn,So;function lu(){if(So)return Dn;So=1;var e=Is(),t=su(),n=iu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(a){return a==null?a===void 0?o:r:s&&s in Object(a)?t(a):n(a)}return Dn=i,Dn}var Vn,yo;function au(){if(yo)return Vn;yo=1;function e(t){return t!=null&&typeof t=="object"}return Vn=e,Vn}var $n,wo;function cu(){if(wo)return $n;wo=1;var e=lu(),t=au(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return $n=r,$n}var qn,Co;function uu(){if(Co)return qn;Co=1;var e=ou(),t=ws(),n=cu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=e(c);var S=s.test(c);return S||i.test(c)?a(c.slice(2),S?2:8):o.test(c)?r:+c}return qn=l,qn}var Un,Io;function du(){if(Io)return Un;Io=1;var e=ws(),t=nu(),n=uu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var u,S,y,b,x,v,p=0,h=!1,d=!1,k=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(h=!!c.leading,d="maxWait"in c,y=d?o(n(c.maxWait)||0,l):y,k="trailing"in c?!!c.trailing:k);function _(C){var M=u,A=S;return u=S=void 0,p=C,b=a.apply(A,M),b}function I(C){return p=C,x=setTimeout(w,l),h?_(C):b}function R(C){var M=C-v,A=C-p,H=l-M;return d?s(H,y-A):H}function f(C){var M=C-v,A=C-p;return v===void 0||M>=l||M<0||d&&A>=y}function w(){var C=t();if(f(C))return T(C);x=setTimeout(w,R(C))}function T(C){return x=void 0,k&&u?_(C):(u=S=void 0,b)}function j(){x!==void 0&&clearTimeout(x),p=0,u=v=S=x=void 0}function O(){return x===void 0?b:T(t())}function z(){var C=t(),M=f(C);if(u=arguments,S=this,v=C,M){if(x===void 0)return I(v);if(d)return clearTimeout(x),x=setTimeout(w,l),_(v)}return x===void 0&&(x=setTimeout(w,l)),b}return z.cancel=j,z.flush=O,z}return Un=i,Un}var fu=du();const pu=Oo(fu);function hu(e,t=200,n,r){const o=g.useRef(e),s=g.useRef(n);g.useEffect(()=>{o.current=e},[e]),g.useEffect(()=>{s.current=n},[n]);const i=g.useMemo(()=>{const a=pu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var u;(u=s.current)==null||u.call(s),a(...c)});return l.cancel=a.cancel.bind(a),l.flush=a.flush.bind(a),l},[t,r]);return g.useEffect(()=>()=>i.cancel(),[i]),i}let ks=0;class Rs extends Error{constructor(){super("calcPages canceled due to a newer invocation");wr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const et=e=>{if(e!==ks)throw new Rs},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},ko=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const a=s.getClientRects(),l=a.length?a[a.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},gu=(e,t)=>{if(t<16)return async(r=24)=>{et(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(et(e),await new Promise(o=>requestAnimationFrame(()=>o())),et(e))}};async function mu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:u=0,showSlash:S,paragraphMarkers:y,playbackScale:b=1,viewportHeight:x=0}){var p,h,d;const v=++ks;et(v);try{const k=Math.abs(b-1)>.001,_=1/b;k&&(t.style.transform=`scale(${_})`,t.style.transformOrigin="top left");const I=Math.max(0,e.offsetWidth||0),R=Math.max(0,Math.min(I,o));t.style.maxWidth=`${R}px`,et(v);let f=Math.round(n.offsetHeight||0);f||(f=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",b.toFixed(4),k?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",I),console.log("[calcPages] pageBoxWidth:",R),console.log("[calcPages] maxPageHeight:",f),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const w=1.5,T=(G,Z)=>Z+G<=f-w,j=getComputedStyle(e),O={letterSpacing:j.letterSpacing,wordSpacing:j.wordSpacing,fontKerning:j.fontKerning||"normal",fontVariantLigatures:j.fontVariantLigatures||"normal",textTransform:j.textTransform||"none",direction:j.direction||"ltr",wordBreak:j.wordBreak||"keep-all",overflowWrap:j.overflowWrap||j.wordWrap||"break-word",hyphens:j.hyphens||"manual"},z=G=>{G.style.letterSpacing=O.letterSpacing||"",G.style.wordSpacing=O.wordSpacing||"",G.style.fontKerning=O.fontKerning||"",G.style.fontVariantLigatures=O.fontVariantLigatures||"",G.style.textTransform=O.textTransform||"",G.style.direction=O.direction||"",G.style.wordBreak=O.wordBreak||"",G.style.wordWrap=O.overflowWrap||"",G.style.overflowWrap=O.overflowWrap||"",G.style.hyphens=O.hyphens||""},C=R,M=Math.max(0,C-2*(s||0));n.innerHTML="";const A=document.createElement("div");A.style.boxSizing="border-box",A.style.width=`${C}px`,A.style.maxWidth=`${C}px`,A.style.margin="0 auto",A.style.display="flex",n.appendChild(A);const H=document.createElement("div");H.style.boxSizing="border-box",H.style.paddingRight=`${s}px`,H.style.paddingLeft=`${s}px`,H.style.width=`${C}px`,H.style.maxWidth=`${C}px`,H.style.margin="0 auto",H.style.display="flex",H.style.justifyContent="center",H.style.height="auto",A.appendChild(H);const E=new Map,P={},F=gu(v,r.length),V=(G,Z)=>{const D=document.createElement("p");return D.style.margin="8px 0",D.style.paddingLeft=Z?`${Z}px`:"0",D.style.textAlign=G.textAlign??"start",D.style.whiteSpace="pre-wrap",D.style.lineHeight=String(l),D.style.fontSize=`${a}px`,D.style.boxSizing="border-box",D.style.fontFamily=i??"",D.style.width="100%",z(D),D},Q=(G,Z)=>{const D=Z??[],Y=document.createDocumentFragment();for(let re=0;re<D.length;re++){const ee=D[re],xe=document.createElement("span");xe.dataset.runbox=String(re),xe.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(ee==null?void 0:ee.text)??"",oe.style.whiteSpace="pre-wrap",ee!=null&&ee.bold&&(oe.style.fontWeight="700"),ee!=null&&ee.italic&&(oe.style.fontStyle="italic"),ee!=null&&ee.underline&&(oe.style.textDecoration="underline"),xe.appendChild(oe),c&&(ee!=null&&ee.split)&&re!==D.length-1){const le=Math.max(0,(u??0)/2),he=document.createElement("span");he.style.display="inline-block",he.style.width=`${le}px`;const ue=document.createElement("span");if(ue.style.display="inline-block",ue.style.width=`${le}px`,xe.appendChild(he),S){const Ce=document.createElement("span");Ce.textContent=" / ",xe.appendChild(Ce)}xe.appendChild(ue)}Y.appendChild(xe)}G.appendChild(Y)},te=x>80?Math.floor((x-80)*.6):void 0,pe=G=>{const Z=G!=null&&G.width&&(G!=null&&G.height)?`${G.width} / ${G.height}`:"4 / 3",D=document.createElement("div");D.style.margin="12px 0",D.style.textAlign="center",D.style.width=`${M}px`;const Y=document.createElement("div");Y.style.position="relative",Y.style.width="100%",te&&(Y.style.maxHeight=`${te}px`),Y.style.aspectRatio=Z;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",Y.appendChild(re),D.appendChild(Y),G!=null&&G.alt){const ee=document.createElement("div");ee.style.fontSize="12px",ee.style.color="#6B7280",ee.style.marginTop="4px",ee.textContent=String(G.alt),z(ee),D.appendChild(ee)}return D};for(let G=0;G<r.length;G++){et(v);const Z=r[G];if(H.dataset.block=String(G),H.innerHTML="",Z.kind==="image"){const ue=Z.block,Ce=pe(ue);H.appendChild(Ce);const Ae=Ce.getBoundingClientRect(),{mt:Oe,mb:Le}=Kn(Ce);P[G]={contentH:Math.ceil(Ae.height),mt:Oe,mb:Le},await F(24);continue}const D=Z.block,Y=D.list?(D.list.level??0)*24:0,re=Z.paraIndex??0,ee=y[re]??(((p=D.list)==null?void 0:p.kind)==="bullet"?((h=D.list)==null?void 0:h.glyph)??"•":void 0);if(!!(D.list&&ee)){const ue=V(D,Y);ue.dataset.variant="with";const Ce=V(D,Y);Ce.dataset.variant="no";const Ae=document.createElement("span");Ae.textContent=`${ee} `,Ae.style.minWidth="16px",Ae.style.display="inline-block",Ae.style.whiteSpace="nowrap",Ae.style.userSelect="none",ue.appendChild(Ae),Q(ue,D.runs),Q(Ce,D.runs);const Oe=document.createDocumentFragment();Oe.appendChild(ue),Oe.appendChild(Ce),H.appendChild(Oe)}else{const ue=V(D,Y);ue.dataset.variant="with",Q(ue,D.runs),H.appendChild(ue)}const oe=H.querySelector('p[data-variant="with"]'),le=H.querySelector('p[data-variant="no"]'),he=le??oe;if(oe&&he){const ue=ko(oe),Ce=ko(he),{mt:Ae,mb:Oe}=Kn(oe),{mt:Le,mb:Fe}=Kn(he),De=((d=D.runs)==null?void 0:d.length)??0,je=le?Ce:ue,Xe=le?Le:Ae,$e=le?Fe:Oe;if(G<3){const ht=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${G}: height=${ht.toFixed(2)}, lastBottom=[${ue.slice(-3).map(yt=>yt.toFixed(1)).join(",")}], runs=${De}`)}E.set(G,{runsLen:De,lastBottomWith:ue,lastBottomNo:je,mtWith:Ae,mbWith:Oe,mtNo:Xe,mbNo:$e})}await F(24)}et(v),H.innerHTML="";const ye=(G,Z,D,Y)=>{if(Z>D)return{top:0,content:0,mb:0};const re=Y?G.lastBottomNo:G.lastBottomWith,ee=Y?G.mtNo:G.mtWith,xe=Y?G.mbNo:G.mbWith,oe=Y?0:ee,le=Z>0?re[Z-1]??0:0,he=Math.max(0,(re[D]??0)-le);return{top:oe,content:he,mb:xe}},me=[];let q=0,ne,B=null,U=null;for(;q<r.length;){et(v);const G=q;let Z=0,D=0,Y=ne;Y!=null&&B===q&&U!=null&&(Y=Math.max(Y,U+1));let re=-1,ee;for(;q<r.length;){if(et(v),r[q].kind==="image"){const je=P[q]??{contentH:0,mt:0,mb:0},$e=(Z===0?je.mt:D+je.mt)+je.contentH;if(T($e,Z)){Z+=$e,re=q,ee=void 0,D=je.mb,q+=1,ne=void 0,B=null,U=null;continue}if(Z===0){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{}}),q+=1,ne=void 0,B=null,U=null,D=0;break}break}const oe=E.get(q),le=oe.runsLen,he=q===G&&Y!=null?Y:0;if(he>=le){q+=1,ne=void 0,B=null,U=null;continue}const ue=he>0,Ce=ye(oe,he,le-1,ue),Oe=(Z===0?Ce.top:D+Ce.top)+Ce.content;if(T(Oe,Z)){Z+=Oe,re=q,ee=le-1,D=Ce.mb,q+=1,ne=void 0,B=null,U=null;continue}let Le=he,Fe=le-1,De=he-1;for(;Le<=Fe;){et(v);const je=Le+Fe>>1,Xe=ye(oe,he,je,ue),$e=(Z===0?Xe.top:D+Xe.top)+Xe.content;T($e,Z)?(De=je,Le=je+1):Fe=je-1}if(De>=he){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:De}),ne=De+1,B=q,U=De,D=0;break}if(Z>0){me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}}),D=0;break}else{const je=he;me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:je}),ne=je+1,B=q,U=je,D=0;break}}(me.length===0||me[me.length-1].startBlock!==G)&&me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}})}return A.remove(),k&&(t.style.transform="",t.style.transformOrigin=""),et(v),{pages:me,pageByRunIndex:null}}catch(k){throw console.error(k),k}}function Ro(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const a=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+a}return null}function xu(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let a=i.startBlock;a<=i.endBlock;a++){const l=n[a];if(!l||l.kind!=="paragraph")continue;const c=((o=l.block.runs)==null?void 0:o.length)??0;if(!c)continue;let u=0,S=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(u=Math.max(0,Math.min(i.startOffsetInBlock,S))),a===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(u,Math.min(i.endOffsetInBlock,S)));const y=r[l.originalIndex]??0,b=y+u,x=y+S;if(e>=b&&e<=x)return s}}return-1}function bu(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function vu(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function Su(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function yu(){var Kt;const e=$(W=>W.section),t=$(W=>W.sectionLoading),n=$(W=>W.rangeStartGI),r=$(W=>W.rangeEndGI),o=n!=null&&r!=null,s=vn(),i=X(W=>W.theme),a=rn[i],l=X(W=>W.fontFamily),c=X(W=>W.fontSizePx),u=X(W=>W.lineHeight),S=X(W=>W.marginX),y=X(W=>W.viewportHeight),b=860,x=g.useRef(null),{items:v}=g.useMemo(()=>{var W;return Su(((W=e==null?void 0:e.ast)==null?void 0:W.blocks)??[])},[e]),p=g.useMemo(()=>{const W=[],_e=vr();return v.forEach(Be=>{if(Be.kind==="paragraph"){const gt=Be.paraIndex;W[gt]=Sr(Be.block,_e)}}),W},[v]),[h,d]=g.useState({pages:[],pageByRunIndex:null}),k=$(W=>W.pageIndex),_=$(W=>W.setPageIndex),I=g.useRef(0),R=g.useRef(null),[f,w]=g.useState(!1),[T,j]=g.useState(null),[O,z]=g.useState(!1),C=g.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:c,lineHeight:u,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,c,u]),{showSplit:M,breakGapPx:A,slash:H}=X(Dt(W=>{var _e;return{showSplit:W.showSplit,breakGapPx:W.breakGapPx??0,slash:((_e=W.breakMarks)==null?void 0:_e.slash)??!1}})),E=Mt();g.useEffect(()=>{h&&h.pages.length&&(console.log("그래서 총 페이지",h.pages.length),(async()=>{const W=E.getState().progress.setSectionLoading;await ct(),await ct(),await ct(),await ct(),console.log("recalc종료"),W(!1)})())},[h,E]);const P=g.useCallback(()=>{console.log("@@@@@@recalc호출");const W=x.current,_e=oe.current,Be=le.current;if(console.log("showSplit",M),!W||!_e||!Be||v.length===0){d({pages:[],pageByRunIndex:null}),_(0);return}(async()=>{const gt=performance.now();try{const Ze=s.getState().playbackScale,{pages:wt,pageByRunIndex:_s}=await mu({viewHost:W,measureRoot:_e,contentArea:Be,items:v,cfgMaxWidth:b,marginX:S,fontFamily:l,fontSizePx:c,lineHeight:u,showSplit:M,breakGapPx:A,showSlash:H,paragraphMarkers:p,playbackScale:Ze,viewportHeight:y}),Ms=performance.now();console.log(`✅ calcPages 완료: ${(Ms-gt).toFixed(1)} ms (${wt.length} pages)`),d({pages:wt,pageByRunIndex:_s}),_(0)}catch(Ze){if(Ze instanceof Rs){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Ze)}})()},[_,v,b,S,l,c,u,M,A,H,p,s,y]),F=$(W=>W.setCurrentGlobalRunIndex),V=$(W=>{var _e;return((_e=W.layout)==null?void 0:_e.prefix)??[]}),Q=we(W=>W.syncToGI),te=g.useCallback(W=>{const _e=h.pages.length+1,Be=k+W;if(Be<0||Be>=_e)return;const gt=k===h.pages.length;if(Be===h.pages.length){_(Be);return}if(gt&&W===-1){const wt=Ro(h.pages[Be],v,V);wt!=null&&(F(wt,"scrubber-step"),Q(wt)),_(Be);return}const Ze=Ro(h.pages[Be],v,V);Ze!=null?(F(Ze,"scrubber-step"),Q(Ze)):_(Be)},[k,h.pages,v,V,F,_,Q]),pe=g.useCallback(()=>{f||I.current!==0?(j("prev"),w(!1)):te(-1)},[f,te]),ye=g.useCallback(()=>{f||I.current!==0?(j("next"),w(!1)):te(1)},[f,te]),me=pn(),q=g.useCallback(()=>{const{isSettingsOpen:W,setSettingsOpen:_e,toggleOverlays:Be}=me.getState();W?_e(!1):Be()},[me]),ne=h.pages.length+1,B=((Kt=x.current)==null?void 0:Kt.clientWidth)||400,U=g.useCallback(W=>{var Ze;const _e=R.current;if(!_e)return;const Be=((Ze=x.current)==null?void 0:Ze.clientWidth)||1,gt=W/Be*33.333;_e.style.transform=`translate3d(${-33.333+gt}%, 0, 0)`},[]),G=g.useCallback(W=>{k===0&&W>0||k>=ne-1&&W<0||(I.current=W,U(W),f||w(!0))},[k,ne,U,f]),Z=g.useCallback(()=>{I.current=0,w(!1);const W=R.current;W&&(W.style.transition="transform 250ms ease-out",W.style.transform="translate3d(-33.333%, 0, 0)")},[]),D=g.useCallback(W=>{if(W.target!==W.currentTarget||W.propertyName!=="transform")return;const _e=T;z(!0),j(null),I.current=0,_e==="prev"?te(-1):_e==="next"&&te(1)},[T,te]);g.useLayoutEffect(()=>{O&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{z(!1)})})},[O]);const Y=ln(),re=g.useCallback(W=>o||vu(W)?!0:bu(W),[o]),ee=g.useCallback(W=>{const _e=Y.getState().status;return _e==="playing"||_e==="loading"?!0:re(W)},[Y,re]),xe=eu({onPrev:pe,onNext:ye,onSingle:q,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:ee,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:G,onDragEnd:Z,pageTransitionThreshold:B*.5}),oe=g.useRef(null),le=g.useRef(null),he=g.useCallback(()=>{const W=E.getState().progress.setSectionLoading;W(!0)},[E]),ue=g.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Ce=hu(P,200,he,ue),Ae=g.useRef("");g.useEffect(()=>{if(y<=0)return;const W=`${l}|${c}|${u}|${S}|${M}|${A}|${H}|${y}|${e==null?void 0:e.section_id}`;Ae.current!==W&&(Ae.current=W,console.log("debounceRecalc 취소"),Ce.cancel(),he(),P())},[Ce,P,he,l,c,u,S,M,A,H,y,e==null?void 0:e.section_id]),Jc([x],Ce);const Oe=$(W=>W.registerSectionScrollApi);g.useEffect(()=>(Oe({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:te}),()=>Oe(void 0)),[Oe,te]);const Le=e.quiz&&e.quiz.length>0,Fe=h.pages.length>0&&k===h.pages.length,De=k>0?k-1:null,je=k<ne-1?k+1:null,Xe=g.useMemo(()=>T==="prev"?"translate3d(0%, 0, 0)":T==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[T]),$e=W=>t?null:W===h.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Le&&m.jsx(bs,{}),m.jsx(dn,{isIcon:!1})]}):m.jsx(Zc,{pages:h.pages,pageIndex:W,maxWidth:b}),ht={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},yt=!O&&(!f||T!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:x,style:{...C,touchAction:"pan-y"},...xe,children:[m.jsxs("div",{ref:R,style:{display:"flex",width:"300%",height:"100%",transform:Xe,transition:yt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:T?D:void 0,children:[m.jsx("div",{style:ht,children:De!==null&&$e(De)}),m.jsx("div",{style:ht,children:$e(k)}),m.jsx("div",{style:ht,children:je!==null&&$e(je)})]}),m.jsx("div",{ref:oe,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:b,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:l,fontSize:c,lineHeight:u,pointerEvents:"none",background:"pink"},children:m.jsxs("div",{style:{width:"100%",maxWidth:b,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[m.jsx("div",{style:{height:40,background:"blue"}}),m.jsx("div",{ref:le,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(wu,{pages:h.pages,items:v,onGotoPage:_,currentPageIndex:k,isOnExtraPage:Fe})]})}const wu=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=$(c=>c.currentGlobalRunIndex),i=$(c=>c.lastUpdateBy),a=$(c=>{var u;return((u=c.layout)==null?void 0:u.prefix)??[]}),l=g.useRef(null);return g.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const c=xu(s,e,t,a);c>=0&&c!==r&&n(c)},[s,e,t,a,n,r,o,i]),m.jsx(m.Fragment,{})},Cu="_wrapper_dbk3n_1",Iu="_spinner_dbk3n_10",To={wrapper:Cu,spinner:Iu};function ku({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${To.wrapper}`,children:m.jsx("div",{className:To.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Ru(){const e=$(Dt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(ku,{})})}const Tu="_Overlay_ybic8_3",_u="_Dialog_ybic8_15",Mu="_Body_ybic8_25",Eu="_Header_ybic8_32",ju="_Paging_ybic8_39",Ou="_Remaining_ybic8_48",Pu="_RemainingDanger_ybic8_55",Bu="_NextBtn_ybic8_59",zu="_CloseBtn_ybic8_96",Au="_Question_ybic8_113",Lu="_Score_ybic8_123",Gu="_Image_ybic8_130",Hu="_Options_ybic8_140",Nu="_OptionBtn_ybic8_145",Fu="_OptionBtnActive_ybic8_165",Wu="_Footer_ybic8_172",Du="_OptionBtnCorrect_ybic8_195",Vu="_Judge_ybic8_201",$u="_Correct_ybic8_212",qu="_Incorrect_ybic8_215",Uu="_ResultHeader_ybic8_220",Ku="_ResultActions_ybic8_233",Qu="_CloseBtnSoft_ybic8_239",Yu="_SummaryGrid_ybic8_249",Xu="_StatCard_ybic8_257",Zu="_StatLabel_ybic8_265",Ju="_StatValue_ybic8_270",ed="_StatSub_ybic8_277",ce={Overlay:Tu,Dialog:_u,Body:Mu,Header:Eu,Paging:ju,Remaining:Ou,RemainingDanger:Pu,NextBtn:Bu,CloseBtn:zu,Question:Au,Score:Lu,Image:Gu,Options:Hu,OptionBtn:Nu,OptionBtnActive:Fu,Footer:Wu,OptionBtnCorrect:Du,Judge:Vu,Correct:$u,Incorrect:qu,ResultHeader:Uu,ResultActions:Ku,CloseBtnSoft:Qu,SummaryGrid:Yu,StatCard:Xu,StatLabel:Zu,StatValue:Ju,StatSub:ed};function td(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Ts(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function nd(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const rd=g.memo(function(){const t=Je(p=>p.phase),n=Je(p=>p.quizzes),r=Je(p=>p.order),o=Je(p=>p.currentIndex),s=Je(p=>p.answers),i=Je(p=>p.correctCount),a=Je(p=>p.remainingSec),l=Je(p=>p.uiReveal),c=Je(p=>p.startedAt),u=Je(p=>p.finishedAt),S=Je(p=>p.perQ),y=xs();g.useEffect(()=>{if(t==="idle"||t!=="doing"||a==null)return;const p=window.setInterval(()=>y.getState().tick(),1e3);return()=>window.clearInterval(p)},[t,a,y]);const b=t==="doing"?n[r[o]]:void 0,x=t==="doing"&&b?s[b.qid]??[]:[],v=g.useMemo(()=>{if(t==="idle"||t!=="finished")return;const p=r.map(E=>n[E]),h=p.length,d=p.reduce((E,P)=>E+(P.score??0),0),k=p.reduce((E,P)=>{const F=S[P.qid];return E+(F!=null&&F.isCorrect?P.score??0:0)},0),_=p.map(E=>S[E.qid]).filter(E=>!!E),I=typeof c=="number"&&typeof u=="number"?Math.max(0,u-c):_.reduce((E,P)=>E+(P.ms??0),0),R=h>0?Math.round(I/h):0,f=[..._].sort((E,P)=>E.ms-P.ms),w=f[0],T=f[f.length-1],j=_.filter(E=>!E.multi),O=_.filter(E=>E.multi),z=j.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,M=_.filter(E=>E.timedOut).length,A=_.filter(E=>E.revealed).length,H=_.filter(E=>!E.isCorrect).sort((E,P)=>P.ms-E.ms).slice(0,3);return{total:h,correct:i,rate:h?Math.round(i/h*100):0,timeMsTotal:I,avgMs:R,totalScore:d,gainedScore:k,fastest:w,slowest:T,singles:{total:j.length,correct:z},multis:{total:O.length,correct:C},timedOut:M,revealed:A,wrongTop3:H}},[t,r,n,S,c,u,i]);return t==="idle"?null:m.jsx("div",{className:ce.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:ce.Dialog,children:t==="doing"&&b?m.jsx(od,{q:b,index:o,total:r.length,selected:x,uiReveal:l,onSelect:p=>{if(l)return;const h=y.getState();Ts(b)?h.selectToggle(p):h.selectSingle(p)},onBeforeNext:()=>y.getState().setReveal(!0),onNext:()=>y.getState().afterRevealNext(),remainingSec:a,onClose:()=>y.getState().close()}):m.jsx(sd,{total:r.length,correct:i,summary:v,onClose:()=>y.getState().close()})})})});function od(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:u}=e,S=Ts(t),y=g.useMemo(()=>{const p=t.options.map((h,d)=>({opt:h,i:d}));for(let h=p.length-1;h>0;h--){const d=Math.floor(Math.random()*(h+1));[p[h],p[d]]=[p[d],p[h]]}return p},[t.options]),b=g.useMemo(()=>td(t),[t]),x=g.useMemo(()=>nd(t),[t]),v=g.useMemo(()=>{const p=[...o].sort((h,d)=>h-d);if(p.length!==x.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==x[h])return!1;return!0},[o,x]);return m.jsxs("div",{className:ce.Body,children:[m.jsxs("div",{className:ce.Header,children:[m.jsx("div",{className:ce.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:u,className:ce.CloseBtn,children:"X"})]}),m.jsx("div",{className:ce.Question,children:t.question}),m.jsx("div",{className:ce.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),m.jsx("div",{className:`${ce.Judge}${s?v?` ${ce.Correct}`:` ${ce.Incorrect}`:""}`,"aria-live":"polite",children:s?v?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:ce.Image,children:b&&m.jsx("img",{src:b,alt:""})}),m.jsx("div",{className:ce.Options,children:y.map(({opt:p,i:h})=>{const d=o.includes(h),k=x.includes(h),_=[ce.OptionBtn,d?ce.OptionBtnActive:"",s&&k?ce.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(h),className:_,disabled:s,children:p},h)})}),m.jsx("div",{className:ce.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:ce.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:a,className:`${ce.NextBtn}`,children:["Submit",typeof c=="number"&&m.jsx("span",{className:`${ce.Remaining} ${c<=5?ce.RemainingDanger:""}`,children:` (${c} s )`})]})})]})}function _o(e){return e==null?"-":`${Math.round(e/1e3)}s`}function sd(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return m.jsxs("div",{className:ce.Body,children:[m.jsx("div",{className:ce.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:ce.SummaryGrid,role:"list",children:[m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"정답률"}),m.jsxs("div",{className:ce.StatValue,children:[s,"%"]}),m.jsx("div",{className:ce.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 점수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:ce.StatValue,children:_o(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:ce.StatSub,children:`평균 ${_o(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:ce.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:ce.CloseBtnSoft,children:"닫기"})})]})}function id(e){return e.map((t,n)=>n)}function ld(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Yn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function Mo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:id(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function ad(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Mo(e);return Vt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Mo(i);o(a)},openFromSection:i=>{i&&s().hydrateFromSection(i);const a=s();if(!a.quizzes.length)return;const l=a.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid,u=a.answers[c]??[],S=u.includes(i)?u.filter(y=>y!==i):[...u,i].sort((y,b)=>y-b);o({answers:{...a.answers,[c]:S}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[c]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],c=l.qid,u=(i.answers[c]??[]).slice().sort((p,h)=>p-h),S=Yn(l),y=ld(u,S),b=i.questionStartedAt?Date.now()-i.questionStartedAt:0,x=i.perQ[c],v={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:u,correctIdxes:S,isCorrect:y,ms:b,revealed:(x==null?void 0:x.revealed)??!1,timedOut:(x==null?void 0:x.timedOut)??!1};if(o({correctCount:i.correctCount+(y?1:0),perQ:{...i.perQ,[c]:v}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const p=i.currentIndex+1;o({currentIndex:p,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[p]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const a=s();if(a.phase==="doing"){if(i){const l=a.quizzes[a.order[a.currentIndex]],c=l.qid,u=a.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:(u==null?void 0:u.timedOut)??!1};o({perQ:{...a.perQ,[c]:S}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const a=i.currentIndex+1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const a=i.currentIndex-1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const a=i.remainingSec-1;if(a<=0){const l=i.quizzes[i.order[i.currentIndex]],c=l.qid,u=i.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:S}})}else o({remainingSec:a})}}))}function cd({children:e,initialState:t}){const n=g.useMemo(()=>ad(t.section),[t]),r=g.useRef(t.onQuizComplete);return g.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),g.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const a=r.current;if(!a)return;const{sectionId:l,quizzes:c,order:u,perQ:S,startedAt:y,finishedAt:b}=s,x=u.map(R=>c[R]),v=x.length,p=x.filter(R=>{var f;return(f=S[R.qid])==null?void 0:f.isCorrect}).length,h=x.reduce((R,f)=>R+(f.score??0),0),d=x.reduce((R,f)=>{const w=S[f.qid];return R+(w!=null&&w.isCorrect?f.score??0:0)},0),k=typeof y=="number"&&typeof b=="number"?Math.max(0,b-y):0,_=x.map(R=>{const f=S[R.qid];return{qid:R.qid,index:R.index,question:R.question,score:R.score??0,isCorrect:(f==null?void 0:f.isCorrect)??!1,selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??[],ms:(f==null?void 0:f.ms)??0,timedOut:(f==null?void 0:f.timedOut)??!1}}),I={sectionId:l??"",total:v,correct:p,rate:v>0?Math.round(p/v*100):0,totalScore:h,gainedScore:d,timeMsTotal:k,perQuestion:_};a(I)}});return()=>o()},[n]),m.jsx(yr.Provider,{value:n,children:e})}const Eo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function ud({containerRef:e}){const t=vn(),n=pn(),r=g.useRef(null);return g.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const a=new ResizeObserver(()=>{const l=o.clientWidth,c=o.clientHeight;(l!==s||c!==i)&&(s=l,i=c,n.getState().setViewportSize(l,c),t.getState().emit({type:"viewport_resize",payload:{width:l,height:c}}))});return a.observe(o),()=>a.disconnect()},[t,n,e]),g.useEffect(()=>{const o=n.getState();r.current={};for(const i of Eo)r.current[i]=o[i];const s=n.subscribe(i=>{const a=r.current;if(a)for(const l of Eo){const c=a[l],u=i[l];c!==u&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:u}}):t.getState().emit({type:"settings_change",payload:{key:l,value:u}}),a[l]=u)}});return()=>{s(),r.current=null}},[t,n]),null}function dd(){const e=vn(),t=pn(),n=Mt(),r=g.useContext(Bo),o=g.useContext(bn),s=g.useCallback(l=>{const{viewerState:c}=l;if(c){c.mode&&t.getState().setMode(c.mode);const{...S}=c;t.setState(S)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(c==null?void 0:c.mode)==="scroll"||!(c!=null&&c.mode)){const S=n.getState().progress.getSectionScrollApi();if(S){if(l.scrollY===0)S.setScrollTop(0);else if(S.scrollToGIAtOffset){const y=l.anchorGI??l.globalIndex;if(typeof y=="number"){const b=l.anchorOffsetRatio??0;S.scrollToGIAtOffset(y,b)}}}}},[t,n]),i=g.useCallback(()=>{var x,v,p;const l=t.getState(),c=n.getState().progress,u=(x=c.getSectionScrollApi)==null?void 0:x.call(c),S=c.currentGlobalRunIndex??0,y=((v=u==null?void 0:u.getScrollTop)==null?void 0:v.call(u))??0,b=((p=u==null?void 0:u.getAnchorOffsetRatio)==null?void 0:p.call(u,S))??0;return{viewerState:{mode:l.mode,theme:l.theme,fontFamily:l.fontFamily,fontSizePx:l.fontSizePx,lineHeight:l.lineHeight,marginX:l.marginX,marginY:l.marginY,showOverlays:l.showOverlays,isSettingsOpen:l.isSettingsOpen,pointerStyle:l.pointerStyle,pointerColor:l.pointerColor,breakMarks:l.breakMarks,breakGapPx:l.breakGapPx,muteAudio:l.muteAudio,audioSpeed:l.audioSpeed,showPointer:l.showPointer,showSplit:l.showSplit,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:y,anchorGI:S,anchorOffsetRatio:b,currentPage:c.pageIndex??0,sectionId:c.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),a=g.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:c}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(c,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:u,anchorGI:S,anchorOffsetRatio:y}=l.payload,b=n.getState().progress.getSectionScrollApi();b&&(u===0?b.setScrollTop(0):b.scrollToGIAtOffset&&typeof S=="number"&&b.scrollToGIAtOffset(S,y));break}case"settings_change":{const{key:c,value:u}=l.payload,S=t.getState();c in S&&typeof S[c]!="function"&&t.setState({[c]:u});break}case"mode_change":{const{mode:c}=l.payload;t.getState().setMode(c);break}case"audio_control":{if(!o)break;const{action:c}=l.payload;switch(c){case"play":o.getState()._setStatusOnly("playing");break;case"pause":o.getState()._setStatusOnly("paused");break;case"stop":o.getState()._setStatusOnly("idle");break}break}case"page_change":{const{pageIndex:c}=l.payload;n.getState().progress.setPageIndex(c);break}case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return g.useLayoutEffect(()=>r?(r.current={dispatch:a,applySnapshot:s,getSnapshot:i},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,a,s,i]),g.useLayoutEffect(()=>e.subscribe((c,u)=>{c.isPlaybackMode&&!u.isPlaybackMode?(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)):!c.isPlaybackMode&&u.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,a,s]),null}const fd=({onTranslate:e})=>{const t=$(u=>u.rangeStartGI),n=$(u=>u.rangeEndGI),r=$(u=>u.getRangeText),o=$(u=>u.clearRange),s=t!=null&&n!=null,[i,a]=g.useState(null);g.useEffect(()=>{if(!s)return;const u=()=>{o()};return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[s,o]),g.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const u=()=>{const S=document.querySelector(`[data-g="${n}"]`);if(!S){a({x:window.innerWidth/2,y:80});return}const y=S.getBoundingClientRect(),b=document.querySelector(`[data-g="${t}"]`),x=b==null?void 0:b.getBoundingClientRect();let v=y.left+y.width/2;x&&(v=(x.left+y.right)/2);const p=160,h=50,d=16,k=12,_=Math.max(d+p/2,Math.min(v,window.innerWidth-d-p/2)),I=((x==null?void 0:x.top)??y.top)-h-k;let R=I;I<d&&(R=y.bottom+k),a({x:_,y:R})};return u(),window.addEventListener("scroll",u,!0),()=>window.removeEventListener("scroll",u,!0)},[s,t,n]);const l=g.useCallback(()=>{const u=r();u&&navigator.clipboard.writeText(u).catch(S=>{console.error("복사 실패:",S)}),o()},[r,o]),c=g.useCallback(()=>{const u=r();u&&e&&e(u)},[r,e]);return!s||!i?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"fixed",left:i.x,top:i.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[m.jsx("button",{onClick:l,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:c,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},pd="_handleStart_1336y_16 _handle_1336y_1",hd="_handleEnd_1336y_21 _handle_1336y_1",jo={handleStart:pd,handleEnd:hd},gd=()=>{const e=$(v=>v.rangeStartGI),t=$(v=>v.rangeEndGI),n=$(v=>v.setRange),r=e!=null&&t!=null,[o,s]=g.useState(null),[i,a]=g.useState(null),l=g.useRef(null),c=g.useRef(null);g.useEffect(()=>{if(!r||e==null||t==null){s(null),a(null);return}const v=()=>{const p=document.querySelector(`[data-g="${e}"]`),h=document.querySelector(`[data-g="${t}"]`);if(p){const d=p.getBoundingClientRect();s({x:d.left,y:d.bottom})}else s(null);if(h){const d=h.getBoundingClientRect();a({x:d.right,y:d.bottom})}else a(null)};return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[r,e,t]);const u=g.useCallback((v,p)=>{var d;const h=document.elementsFromPoint(v,p);for(const k of h){const _=(d=k.getAttribute)==null?void 0:d.call(k,"data-g");if(_!=null)return parseInt(_,10)}return null},[]),S=g.useCallback(v=>p=>{p.preventDefault(),p.stopPropagation(),l.current=v,c.current=v==="start"?e:t,p.target.setPointerCapture(p.pointerId)},[e,t]),y=g.useCallback(v=>{if(!l.current||e==null||t==null)return;const p=u(v.clientX,v.clientY);p!=null&&(l.current==="start"?p<=t?n(p,t):(n(t,p),l.current="end"):p>=e?n(e,p):(n(p,e),l.current="start"))},[e,t,n,u]),b=g.useCallback(v=>{l.current=null,c.current=null,v.target.releasePointerCapture(v.pointerId)},[]);return r?m.jsxs(m.Fragment,{children:[o&&m.jsx("div",{className:jo.handleStart,"data-range-handle":"start",style:{left:o.x-26,top:o.y},onPointerDown:S("start"),onPointerMove:y,onPointerUp:b,onPointerCancel:b}),i&&m.jsx("div",{className:jo.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:S("end"),onPointerMove:y,onPointerUp:b,onPointerCancel:b})]}):null};function md(){const e=$(o=>o.rangeStartGI),t=$(o=>o.rangeEndGI),n=$(o=>o.clearRange),r=e!=null&&t!=null;return g.useEffect(()=>{if(!r)return;const o=s=>{var a;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(a=i.closest("[data-g]"))==null?void 0:a.getAttribute("data-g");if(l){const c=parseInt(l,10),u=Math.min(e,t),S=Math.max(e,t);if(c>=u&&c<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const xd=({isOpen:e,onClose:t,text:n})=>e?m.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:10001},onClick:t,children:m.jsxs("div",{style:{position:"relative",backgroundColor:"#fff",borderRadius:12,padding:"24px 32px",minWidth:280,maxWidth:"80%",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)"},onClick:r=>r.stopPropagation(),children:[m.jsx("button",{onClick:t,style:{position:"absolute",top:12,right:12,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:20,color:"#666"},"aria-label":"닫기",children:"✕"}),m.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:18,fontWeight:600,color:"#333"},children:"번역"}),m.jsx("p",{style:{margin:0,fontSize:16,color:"#666",textAlign:"center",padding:"16px 0"},children:"준비중입니다"}),n&&m.jsxs("div",{style:{marginTop:16,padding:12,backgroundColor:"#f5f5f5",borderRadius:8,fontSize:14,color:"#888",maxHeight:100,overflow:"auto"},children:[m.jsx("span",{style:{fontWeight:500},children:"선택된 텍스트: "}),n]})]})}):null,bd=(e,t,n)=>Math.min(n,Math.max(t,e));function vd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:c,isPlaybackMode:u=!1,playbackScale:S,isDev:y=!1}){const b=String((e==null?void 0:e.section_id)??"0"),x=g.useMemo(()=>{var _,I;const d=((_=e==null?void 0:e.ast)==null?void 0:_.blocks)??[];let k=0;for(const R of d)(R==null?void 0:R.type)!=="image"&&(k+=((I=R==null?void 0:R.runs)==null?void 0:I.length)??0);return k},[e]),v=g.useMemo(()=>typeof n=="number"?bd(n,x>0?0:-1,Math.max(x-1,-1)):(x>0,0),[n,x]),p=g.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=g.useMemo(()=>{const d=(e==null?void 0:e.audios)??[],k=d.length>0?$c(e):void 0;return{clips:d,map:k,initialIndex:v,section:e}},[e,v]);return m.jsx(Vs,{onViewerEvent:l,isPlaybackMode:u,playbackScale:S,viewerRef:c,children:m.jsx(Xc,{initialState:{...t,isDev:y},children:m.jsx(Yc,{initialState:p,children:m.jsx(Vc,{initialState:h,children:m.jsx(cd,{initialState:{section:e,onQuizComplete:a},children:m.jsx(Sd,{})},b)},b)},b)})})}function Sd(){const e=X(u=>u.mode),t=g.useRef(null),[n,r]=g.useState(!1),[o,s]=g.useState(),i=g.useCallback(u=>{s(u),r(!0)},[]),a=g.useCallback(()=>{r(!1),s(void 0)},[]),l=u=>{u.preventDefault()},c=u=>{u.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:l,onDragStart:c,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(da,{}):m.jsx(yu,{}),m.jsx(Lc,{}),m.jsx(rd,{}),m.jsx(Ru,{}),m.jsx(fd,{onTranslate:i}),m.jsx(gd,{}),m.jsx(md,{}),m.jsx(xd,{isOpen:n,onClose:a,text:o}),m.jsx(ud,{containerRef:t}),m.jsx(dd,{})]})}exports.CRViewer=vd;
|