@readerseye2/cr_viewer 1.0.6 → 1.0.8
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.map +1 -1
- package/dist/components/RangeClickDismisser.d.ts +8 -0
- package/dist/components/RangeClickDismisser.d.ts.map +1 -0
- package/dist/components/RangeContextMenu.d.ts.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.js +1467 -1452
- package/dist/overlay-bars/topBar/OverlayTopBar.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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_7t2sb_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_7t2sb_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#333;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:1px solid #333;box-sizing:border-box}._visible_7t2sb_32{opacity:1;pointer-events:auto}._backBtn_7t2sb_37{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;background:transparent;color:#333;cursor:pointer;border-radius:8px;flex-shrink:0;transition:background .15s ease}._backBtn_7t2sb_37:hover{background:#f0f0f0}._backBtn_7t2sb_37:active{background:#e0e0e0}._title_7t2sb_58{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_7t2sb_67{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border:none;background:transparent;color:#333;cursor:pointer;border-radius:8px;flex-shrink:0;transition:background .15s ease}._settingsBtn_7t2sb_67:hover{background:#f0f0f0}._settingsBtn_7t2sb_67:active{background:#e0e0e0}._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)}})();
|
|
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
2
|
"use strict";var Ns=Object.defineProperty;var Fs=(e,t,n)=>t in e?Ns(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wr=(e,t,n)=>Fs(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),d=require("react"),Ws=require("react-dom");function Vs(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 nt=Vs(d),or=d.createContext(void 0);var Xt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Lo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Zt={exports:{}},vn={},Jt={exports:{}},Sn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
@@ -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 Cr;function Ds(){if(Cr)return Sn;Cr=1;var e=d;function t(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(b,x){var p=x(),v=r({inst:{value:p,getSnapshot:x}}),S=v[0].inst,h=v[1];return s(function(){S.value=p,S.getSnapshot=x,l(S)&&h({inst:S})},[b,p,x]),o(function(){return l(S)&&h({inst:S}),b(function(){l(S)&&h({inst:S})})},[b]),i(p),p}function l(b){var x=b.getSnapshot;b=b.value;try{var p=x();return!n(b,p)}catch{return!0}}function
|
|
10
|
+
*/var Cr;function Ds(){if(Cr)return Sn;Cr=1;var e=d;function t(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(b,x){var p=x(),v=r({inst:{value:p,getSnapshot:x}}),S=v[0].inst,h=v[1];return s(function(){S.value=p,S.getSnapshot=x,l(S)&&h({inst:S})},[b,p,x]),o(function(){return l(S)&&h({inst:S}),b(function(){l(S)&&h({inst:S})})},[b]),i(p),p}function l(b){var x=b.getSnapshot;b=b.value;try{var p=x();return!n(b,p)}catch{return!0}}function c(b,x){return x()}var f=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return Sn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:f,Sn}var yn={};/**
|
|
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 Ir;function $s(){return Ir||(Ir=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}function t(p,v){f||o.startTransition===void 0||(f=!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 S=v();if(!b){var h=v();s(S,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}h=i({inst:{value:S,getSnapshot:v}});var
|
|
18
|
+
*/var Ir;function $s(){return Ir||(Ir=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,v){return p===v&&(p!==0||1/p===1/v)||p!==p&&v!==v}function t(p,v){f||o.startTransition===void 0||(f=!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 S=v();if(!b){var h=v();s(S,h)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),b=!0)}h=i({inst:{value:S,getSnapshot:v}});var u=h[0].inst,w=h[1];return l(function(){u.value=S,u.getSnapshot=v,n(u)&&w({inst:u})},[p,S,v]),a(function(){return n(u)&&w({inst:u}),p(function(){n(u)&&w({inst:u})})},[p]),c(S),S}function n(p){var v=p.getSnapshot;p=p.value;try{var S=v();return!s(p,S)}catch{return!0}}function r(p,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=d,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,f=!1,b=!1,x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;yn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:x,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),yn}var kr;function Go(){return kr||(kr=1,process.env.NODE_ENV==="production"?Jt.exports=Ds():Jt.exports=$s()),Jt.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 Rr;function qs(){if(Rr)return vn;Rr=1;var e=d,t=Go();function n(
|
|
26
|
+
*/var Rr;function qs(){if(Rr)return vn;Rr=1;var e=d,t=Go();function n(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}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 vn.useSyncExternalStoreWithSelector=function(c,f,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(f())},T===null?void 0:function(){return u(T())}]},[f,b,x,p]);var h=o(c,v[0],v[1]);return i(function(){S.hasValue=!0,S.value=h},[h]),l(h),h},vn}var wn={};/**
|
|
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 Tr;function Us(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(u,f){return u===f&&(u!==0||1/u===1/f)||u!==u&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=d,n=Go(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;wn.useSyncExternalStoreWithSelector=function(u,f,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 c(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 c(f())},T===null?void 0:function(){return c(T())}]},[f,b,x,p]);var h=o(u,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())})()),wn}var _r;function Ks(){return _r||(_r=1,process.env.NODE_ENV==="production"?Zt.exports=qs():Zt.exports=Us()),Zt.exports}var Qs=Ks();const Ys=Lo(Qs),Mr=e=>{let t;const n=new Set,r=(u,f)=>{const b=typeof u=="function"?u(t):u;if(!Object.is(b,t)){const x=t;t=f??(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:u=>(n.add(u),()=>n.delete(u))},l=t=e(r,o,a);return a},yt=(e=>e?Mr(e):Mr),{useSyncExternalStoreWithSelector:Xs}=Ys,Zs=e=>e;function Ut(e,t=Zs,n){const r=Xs(e.subscribe,e.getState,e.getInitialState,t,n);return d.useDebugValue(r),r}function te(e,t){const n=d.useContext(or);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return Ut(n,e,t)}function Pt(){const e=d.useContext(or);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const wt=d.createContext(void 0);function Js(){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 ei({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=d.useMemo(()=>Js(),[]);return d.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),d.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),d.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),d.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 ti({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=d.useRef(null);d.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=d.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=d.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const sn={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"}},Cn=[8,16,24,40,64],In=[1.2,1.4,1.6,1.8,2,2.2,2.4],kn=[4,8,12,16,24],Yn=e=>Math.round(12+(e-1)*(16/11)),ni=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Yn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Rn=(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},Ho=[{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:Ho.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 ri(e){const{init:t,recorderStore:n}=e??{};return yt((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:()=>r({showOverlays:!o().showOverlays}),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:Cn,LINEHEIGHT_MAP:In,BREAK_GAP_MAP:kn,fontSizeFromLevel:Yn},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=kn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Rn(o().breakGapPx,kn),getFontLevel:()=>ni(o().fontSizePx),getLineLevel:()=>Rn(o().lineHeight,In),getMarginLevel:()=>Rn(o().marginX,Cn),setFontLevel:s=>r({fontSizePx:Yn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:In[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=Cn[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 pn=0,ht=1,Ot=2,No=4;function Er(e){return()=>e}function oi(e){e()}function Fo(e,t){return n=>e(t(n))}function jr(e,t){return()=>e(t)}function si(e,t){return n=>e(t,n)}function sr(e){return e!==void 0}function ii(...e){return()=>{e.map(oi)}}function Bt(){}function hn(e,t){return t(e),e}function li(e,t){return t(e)}function Re(...e){return e}function Se(e,t){return e(ht,t)}function he(e,t){e(pn,t)}function ir(e){e(Ot)}function _e(e){return e(No)}function re(e,t){return Se(e,si(t,pn))}function Je(e,t){const n=e(ht,r=>{n(),t(r)});return n}function Pr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Wo(e,t){return e===t}function ke(e=Wo){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ae(e){return t=>n=>{e(n)&&t(n)}}function X(e){return t=>Fo(t,e)}function st(e){return t=>()=>{t(e)}}function N(e,...t){const n=ai(...t);return((r,o)=>{switch(r){case Ot:ir(e);return;case ht:return Se(e,n(o))}})}function it(e,t){return n=>r=>{n(t=e(t,r))}}function vt(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 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 u=n;n=n|a,t[i]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function ai(...e){return t=>e.reduceRight(li,t)}function ci(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(),Bt);case Ot:r(),n=null;return}}}function V(e){let t=e;const n=xe();return((r,o)=>{switch(r){case pn:t=o;break;case ht:{o(t);break}case No:return t}return n(r,o)})}function Ne(e,t){return hn(V(t),n=>re(e,n))}function xe(){const e=[];return((t,n)=>{switch(t){case pn:e.slice().forEach(r=>{r(n)});return;case Ot:e.splice(0,e.length);return;case ht:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function qe(e){return hn(xe(),t=>re(e,t))}function ve(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ui(),singleton:n}}const ui=()=>Symbol();function di(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 Ot:{ir(t);return}case ht:return r===o&&i(n),Se(t,i)}}}function le(e,t=Wo){return N(e,ke(t))}function Xn(...e){return function(t,n){switch(t){case Ot:return;case ht:return ii(...e.map(r=>Se(r,n)))}}}var De=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(De||{});const fi={0:"debug",3:"error",1:"log",2:"warn"},pi=()=>typeof globalThis>"u"?window:globalThis,gt=ve(()=>{const e=V(3);return{log:V((t,n,r=1)=>{var o;const s=(o=pi().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[fi[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 lr(e,t,n).callbackRef}function lr(e,t,n){const r=d.useRef(null);let o=i=>{};const s=d.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 hi(e,t,n,r,o,s,i,a,l){const u=d.useCallback(f=>{const b=gi(f.children,t,a?"offsetWidth":"offsetHeight",o);let x=f.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,c=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:c}),s==null||s(a?Or("column-gap",getComputedStyle(f).columnGap,o):Or("row-gap",getComputedStyle(f).rowGap,o)),b!==null&&e(b)},[e,t,o,s,i,r,a]);return lr(u,n,l)}function gi(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),u=parseFloat(a.dataset.knownSize),f=t(a,n);if(f===0&&r("Zero-sized element, this should not happen",{child:a},De.ERROR),f===u)continue;const b=s[s.length-1];s.length===0||b.size!==f||b.endIndex!==l-1?s.push({endIndex:l,size:f,startIndex:l}):s[s.length-1].endIndex++}return s}function Or(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,De.WARN),t==="normal"?0:parseInt(t??"0",10)}function Vo(e,t,n){const r=d.useRef(null),o=d.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const u=l.getBoundingClientRect(),f=u.width;let b,x;if(t){const p=t.getBoundingClientRect(),v=u.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,u.top),b=u.top+p.scrollY}r.current={offsetTop:b,visibleHeight:x,visibleWidth:f},e(r.current)},[e,t]),{callbackRef:s,ref:i}=lr(o,!0,n),a=d.useCallback(()=>{o(i.current)},[o,i]);return d.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const u=new ResizeObserver(()=>{requestAnimationFrame(a)});return u.observe(t),()=>{t.removeEventListener("scroll",a),u.unobserve(t)}}else{const u=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return u==null||u.addEventListener("scroll",a),u==null||u.addEventListener("resize",a),()=>{u==null||u.removeEventListener("scroll",a),u==null||u.removeEventListener("resize",a)}}},[a,t,i]),s}const Ve=ve(()=>{const e=xe(),t=xe(),n=V(0),r=xe(),o=V(0),s=xe(),i=xe(),a=V(0),l=V(0),u=V(0),f=V(0),b=xe(),x=xe(),p=V(!1),v=V(!1),S=V(!1);return re(N(e,X(({scrollTop:h})=>h)),t),re(N(e,X(({scrollHeight:h})=>h)),i),re(t,o),{deviation:n,fixedFooterHeight:u,fixedHeaderHeight:l,footerHeight:f,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}),Ht={lvl:0};function Do(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===Ht}function Nt(e,t){if(!ye(e))return t===e.k?e.v:t<e.k?Nt(e.l,t):Nt(e.r,t)}function et(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=et(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return et(e.l,t,n)}function $e(e,t,n){return ye(e)?Uo(t,n,1):t===e.k?Be(e,{k:t,v:n}):t<e.k?Br(Be(e,{l:$e(e.l,t,n)})):Br(Be(e,{r:$e(e.r,t,n)}))}function Mt(){return Ht}function Et(e,t,n){if(ye(e))return[];const r=et(e,t)[0];return mi(Jn(e,r,n))}function Zn(e,t){if(ye(e))return Ht;const{k:n,l:r,r:o}=e;if(t===n){if(ye(r))return o;if(ye(o))return r;{const[s,i]=qo(r);return rn(Be(e,{k:s,l:$o(r),v:i}))}}else return t<n?rn(Be(e,{l:Zn(r,t)})):rn(Be(e,{r:Zn(o,t)}))}function xt(e){return ye(e)?[]:[...xt(e.l),{k:e.k,v:e.v},...xt(e.r)]}function Jn(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(Jn(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(Jn(s,t,n))),a}function rn(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(Tn(t))return Ko(Be(e,{lvl:n-1}));if(!ye(t)&&!ye(t.r))return Be(t.r,{l:Be(t,{r:t.r.l}),lvl:n,r:Be(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Tn(e))return er(Be(e,{lvl:n-1}));if(!ye(r)&&!ye(r.l)){const o=r.l,s=Tn(o)?r.lvl-1:r.lvl;return Be(o,{l:Be(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:er(Be(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Be(e,t){return Uo(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 $o(e){return ye(e.r)?e.l:rn(Be(e,{r:$o(e.r)}))}function Tn(e){return ye(e)||e.lvl>e.r.lvl}function qo(e){return ye(e.r)?[e.k,e.v]:qo(e.r)}function Uo(e,t,n,r=Ht,o=Ht){return{k:e,l:r,lvl:n,r:o,v:t}}function Br(e){return er(Ko(e))}function Ko(e){const{l:t}=e;return!ye(t)&&t.lvl===e.lvl?Be(t,{r:Be(e,{l:t.r})}):e}function er(e){const{lvl:t,r:n}=e;return!ye(n)&&!ye(n.r)&&n.lvl===t&&n.r.lvl===t?Be(n,{l:Be(e,{r:n.l}),lvl:t+1}):e}function mi(e){return Do(e,({k:t,v:n})=>({index:t,value:n}))}function Qo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Ft(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ar=ve(()=>({recalcInProgress:V(!1)}),[],{singleton:!0});function Yo(e,t,n){return e[ln(e,t,n)]}function ln(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 bi(e,t,n,r){const o=ln(e,t,r),s=ln(e,n,r,o);return e.slice(o,s+1)}function pt(e,t){return Math.round(e.getBoundingClientRect()[t])}function gn(e){return!ye(e.groupOffsetTree)}function cr({index:e},t){return t===e?0:t<e?-1:1}function xi(){return{groupIndices:[],groupOffsetTree:Mt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Mt()}}function vi(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=$e(e,0,s);continue}const a=Et(e,i-1,o+1);if(a.some(Ri(r)))continue;let l=!1,u=!1;for(const{end:f,start:b,value:x}of a)l?(o>=b||s===x)&&(e=Zn(e,b)):(u=x!==s,l=!0),f>o&&o>=b&&x!==s&&(e=$e(e,o+1,x));u&&(e=$e(e,i,s))}return[e,n]}function Si(e){return typeof e.groupIndex<"u"}function yi({offset:e},t){return t===e?0:t<e?-1:1}function Wt(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Yo(t,e,cr),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Xo(e,t){if(!gn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Zo(e,t,n){if(Si(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Xo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function wi(e,t,n,r=0){return r>0&&(t=Math.max(t,Yo(e,r,cr).offset)),Do(bi(e,t,n,yi),ki)}function Ci(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,De.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)=>$e($e(v,S,x),S+1,p),i)}else[i,a]=vi(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:u,lastSize:f,offsetTree:b}=tr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((x,p)=>$e(x,p,Wt(p,b,o)),Mt()),lastIndex:l,lastOffset:u,lastSize:f,offsetTree:b,sizeTree:i}}function Ii(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 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 tr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=ln(o,t-1,cr),a=o[l].offset;const u=et(n,t-1);s=u[0],i=u[1],o.length&&o[l].size===et(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:f}of Et(n,t,1/0)){const b=u-s,x=b*i+a+b*r;o.push({index:u,offset:x,size:f}),s=u,a=x,i=f}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function ki(e){return{index:e.index,value:e}}function Ri(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 Ti={offsetHeight:"height",offsetWidth:"width"},lt=ve(([{log:e},{recalcInProgress:t}])=>{const n=xe(),r=xe(),o=Ne(r,0),s=xe(),i=xe(),a=V(0),l=V([]),u=V(void 0),f=V(void 0),b=V(void 0),x=V(void 0),p=V((g,y)=>pt(g,Ti[y])),v=V(void 0),S=V(0),h=xi(),c=Ne(N(n,ge(l,e,S),it(Ci,h),ke()),h),w=Ne(N(l,ke(),it((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),X(({prev:g})=>g)),[]);re(N(l,ae(g=>g.length>0),ge(c,S),X(([g,y,_])=>{const B=g.reduce((R,P,k)=>$e(R,P,Wt(P,y.offsetTree,_)||k),Mt());return{...y,groupIndices:g,groupOffsetTree:B}})),c),re(N(r,ge(c),ae(([g,{lastIndex:y}])=>g<y),X(([g,{lastIndex:y,lastSize:_}])=>[{endIndex:y,size:_,startIndex:g}])),n),re(u,f);const C=Ne(N(u,X(g=>g===void 0)),!0);re(N(f,ae(g=>g!==void 0&&ye(_e(c).sizeTree)),X(g=>{const y=_e(b),_=_e(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,ae(g=>g!==void 0&&g.length>0&&ye(_e(c).sizeTree)),X(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,f),ae(([,g,y])=>g!==void 0&&y!==void 0),X(([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=qe(N(n,ge(c),it(({sizes:g},[y,_])=>({changed:_!==g,sizes:_}),{changed:!1,sizes:h}),X(g=>g.changed)));Se(N(a,it((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),X(g=>g.diff)),g=>{const{groupIndices:y}=_e(c);if(g>0)he(t,!0),he(s,g+zr(g,y));else if(g<0){const _=_e(w);_.length>0&&(g-=zr(-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},De.ERROR)});const T=qe(s);re(N(s,ge(c),X(([g,y])=>{const _=y.groupIndices.length>0,B=[],R=y.lastSize;if(_){const P=Nt(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=qe(N(i,ge(c,S),X(([g,{offsetTree:y},_])=>{const B=-g;return Wt(B,y,_)})));return re(N(i,ge(c,S),X(([g,y,_])=>{if(y.groupIndices.length>0){if(ye(y.sizeTree))return y;let B=Mt();const R=_e(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})=>$e(z,Math.max(0,L+g),j),B),P!==-g){const z=Nt(y.sizeTree,O);B=$e(B,0,z);const L=et(y.sizeTree,-g+1)[1];B=$e(B,1,L)}return{...y,sizeTree:B,...tr(y.offsetTree,0,B,_)}}else{const B=xt(y.sizeTree).reduce((R,{k:P,v:k})=>$e(R,Math.max(0,P+g),k),Mt());return{...y,sizeTree:B,...tr(y.offsetTree,0,B,_)}}})),c),{beforeUnshiftWith:T,data:v,defaultItemSize:f,firstItemIndex:a,fixedItemSize:u,fixedGroupSize:b,gap:S,groupIndices:l,heightEstimates:x,itemSize:p,listRefresh:I,shiftWith:i,shiftWithOffset:E,sizeRanges:n,sizes:c,statefulTotalCount:o,totalCount:r,trackItemSizes:C,unshiftWith:s}},Re(gt,ar),{singleton:!0});function _i(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Jo=ve(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=xe(),i=xe(),a=qe(N(s,X(_i)));return re(N(a,X(l=>l.totalCount)),n),re(N(a,X(l=>l.groupIndices)),e),re(N(je(o,t,r),ae(([l,u])=>gn(u)),X(([l,u,f])=>et(u.groupOffsetTree,Math.max(l-f,0),"v")[0]),ke(),X(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},Re(lt,Ve)),mt=ve(([{log:e}])=>{const t=V(!1),n=qe(N(t,ae(r=>r),ke()));return Se(t,r=>{r&&_e(e)("props updated",{},De.DEBUG)}),{didMount:n,propsReady:t}},Re(gt),{singleton:!0}),Mi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function es(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Mi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Kt=ve(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:u,smoothScrollTargetReached:f,viewportHeight:b},{log:x}])=>{const p=xe(),v=xe(),S=V(0);let h=null,c=null,w=null;function C(){h&&(h(),h=null),w&&(w(),w=null),c&&(clearTimeout(c),c=null),he(l,!1)}return re(N(p,ge(n,b,r,S,a,i,x),ge(e,s,o),X(([[I,T,E,g,y,_,B,R],P,k,O])=>{const z=es(I),{align:L,behavior:j,offset:A}=z,W=g-1,U=Zo(z,T,W);let Y=Wt(U,T.offsetTree,P)+_;L==="end"?(Y+=k+et(T.sizeTree,U)[1]-E+O,U===W&&(Y+=B)):L==="center"?Y+=(k+et(T.sizeTree,U)[1]-E+O)/2:Y-=y,A&&(Y+=A);const ce=ie=>{C(),ie?(R("retrying to scroll to",{location:I},De.DEBUG),he(p,I)):(he(v,!0),R("list did not change, scroll successful",{},De.DEBUG))};if(C(),j==="smooth"){let ie=!1;w=Se(t,me=>{ie=ie||me}),h=Je(f,()=>{ce(ie)})}else h=Je(N(t,Ei(150)),ce);return c=setTimeout(()=>{C()},1200),he(l,!0),R("scrolling from index to",{behavior:j,index:U,top:Y},De.DEBUG),{behavior:j,top:Y}})),u),{scrollTargetReached:v,scrollToIndex:p,topListHeight:S}},Re(lt,Ve,gt),{singleton:!0});function Ei(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function ur(e,t){e==0?t():requestAnimationFrame(()=>{ur(e-1,t)})}function dr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Qt=ve(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=V(!0),l=V(0),u=V(!0);return re(N(i,ge(l),ae(([f,b])=>!!b),st(!1)),a),re(N(i,ge(l),ae(([f,b])=>!!b),st(!1)),u),Se(N(je(t,i),ge(a,n,e,u),ae(([[,f],b,{sizeTree:x},p,v])=>f&&(!ye(x)||sr(p))&&!b&&!v),ge(l)),([,f])=>{Je(o,()=>{he(u,!0)}),ur(4,()=>{Je(r,()=>{he(a,!0)}),he(s,f)})}),{initialItemFinalLocationReached:u,initialTopMostItemIndex:l,scrolledToInitialItem:a}},Re(lt,Ve,Kt,mt),{singleton:!0});function ts(e,t){return Math.abs(e-t)<1.01}const Vt="up",Lt="down",ji="none",Pi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Oi=0,Yt=ve(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=V(!1),a=V(!0),l=xe(),u=xe(),f=V(4),b=V(Oi),x=Ne(N(Xn(N(le(o),vt(1),st(!0)),N(le(o),vt(1),st(!1),Pr(100))),ke()),!1),p=Ne(N(Xn(N(n,st(!0)),N(n,st(!1),Pr(200))),ke()),!1);re(N(je(le(o),le(b)),X(([w,C])=>w<=C),ke()),a),re(N(a,at(50)),u);const v=qe(N(je(r,le(s),le(t),le(e),le(f)),it((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}},Pi),ke((w,C)=>w&&w.atBottom===C.atBottom))),S=Ne(N(r,it((w,{scrollHeight:C,scrollTop:I,viewportHeight:T})=>{if(ts(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}),ae(w=>w.changed),X(w=>w.jump)),0);re(N(v,X(w=>w.atBottom)),i),re(N(i,at(50)),l);const h=V(Lt);re(N(r,X(({scrollTop:w})=>w),ke(),it((w,C)=>_e(p)?{direction:w.direction,prevScrollTop:C}:{direction:C<w.prevScrollTop?Vt:Lt,prevScrollTop:C},{direction:Lt,prevScrollTop:0}),X(w=>w.direction)),h),re(N(r,at(50),st(ji)),h);const c=V(0);return re(N(x,ae(w=>!w),st(0)),c),re(N(o,at(100),ge(x),ae(([w,C])=>C),it(([w,C],[I])=>[C,I],[0,0]),X(([w,C])=>C-w)),c),{atBottomState:v,atBottomStateChange:l,atBottomThreshold:f,atTopStateChange:u,atTopThreshold:b,isAtBottom:i,isAtTop:a,isScrolling:x,lastJumpDueToItemResize:S,scrollDirection:h,scrollVelocity:c}},Re(Ve)),Dt="top",$t="bottom",Ar="none";function Lr(e,t,n){return typeof e=="number"?n===Vt&&t===Dt||n===Lt&&t===$t?e:0:n===Vt?t===Dt?e.main:e.reverse:t===$t?e.main:e.reverse}function Gr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const fr=ve(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=xe(),i=V(0),a=V(0),l=V(0),u=Ne(N(je(le(r),le(o),le(n),le(s,Ft),le(l),le(i),le(t),le(e),le(a)),X(([f,b,x,[p,v],S,h,c,w,C])=>{const I=f-w,T=h+c,E=Math.max(x-I,0);let g=Ar;const y=Gr(C,Dt),_=Gr(C,$t);return p-=w,p+=x+c,v+=x+c,v-=w,p>f+T-y&&(g=Vt),v<f-E+b+_&&(g=Lt),g!==Ar?[Math.max(I-x-Lr(S,Dt,g)-y,0),I-E-c+b+Lr(S,$t,g)+_]:null}),ae(f=>f!=null),ke(Ft)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:u}},Re(Ve),{singleton:!0});function Bi(e,t,n){if(gn(t)){const r=Xo(e,t);return[{index:et(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 _n={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function on(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let u=0,f=0;if(e.length>0){u=e[0].offset;const S=e[e.length-1];f=S.offset+S.size}const b=n-i,x=a+b*l+(b-1)*r,p=u,v=x-f;return{bottom:f,firstItemIndex:s,items:Hr(e,o,s),offsetBottom:v,offsetTop:u,top:p,topItems:Hr(t,o,s),topListHeight:t.reduce((S,h)=>h.size+S,0),totalCount:n}}function ns(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const f of n.groupIndices){if(f-i>=e)break;i++}const a=e+i,l=dr(t,a),u=Array.from({length:a}).map((f,b)=>({data:s[b+l],index:b+l,offset:0,size:0}));return on(u,[],a,o,n,r)}function Hr(e,t,n){if(e.length===0)return[];if(!gn(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Et(t.groupOffsetTree,r,o);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let f;u.index===a.start?f={index:l,type:"group"}:f={groupIndex:l,index:u.index-(l+1)+n},s.push({...f,data:u.data,offset:u.offset,originalIndex:u.index,size:u.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 It=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:u,scrolledToInitialItem:f},{topListHeight:b},x,{didMount:p},{recalcInProgress:v}])=>{const S=V([]),h=V(0),c=xe(),w=V(0);re(s.topItemsIndexes,S);const C=Ne(N(je(p,v,le(l,Ft),le(o),le(r),le(u),f,le(S),le(t),le(n),le(w),e),ae(([g,y,,_,,,,,,,,B])=>{const R=B&&B.length!==_;return g&&!y&&!R}),X(([,,[g,y],_,B,R,P,k,O,z,L,j])=>{var A,W,U,Y;const ce=B,{offsetTree:ie,sizeTree:me}=ce,be=_e(h);if(_===0)return{..._n,totalCount:_};if(g===0&&y===0)return be===0?{..._n,totalCount:_}:ns(be,R,B,O,z,j||[]);if(ye(me))return be>0?null:on(Bi(dr(R,_),ce,j),[],_,z,ce,O);const K=[];if(k.length>0){const $=k[0],Q=k[k.length-1];let D=0;for(const de of Et(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 on([],K,_,z,ce,O);const oe=k.length>0?k[k.length-1]+1:0,G=wi(ie,g,y,oe);if(G.length===0)return null;const ee=_-1,M=hn([],$=>{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=Nr(L,Dt),H=Nr(L,$t);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=Et(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=(Y=(U=Et(me,J,J)[0])==null?void 0:U.value)!=null?Y:Q.size;M.push({data:j==null?void 0:j[J],index:J,offset:de,size:ne}),de+=ne+z}}}return on(M,K,_,z,ce,O)}),ae(g=>g!==null),ke()),_n);re(N(e,ae(sr),X(g=>g==null?void 0:g.length)),o),re(N(C,X(g=>g.topListHeight)),b),re(b,a),re(N(C,X(g=>[g.top,g.bottom])),i),re(N(C,X(g=>g.items)),c);const I=qe(N(C,ae(({items:g})=>g.length>0),ge(o,e),ae(([{items:g},y])=>g[g.length-1].originalIndex===y-1),X(([,g,y])=>[g-1,y]),ke(Ft),X(([g])=>g))),T=qe(N(C,at(200),ae(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),X(({items:g})=>g[0].index),ke())),E=qe(N(C,ae(({items:g})=>g.length>0),X(({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}}),ke(Qo)));return{endReached:I,initialItemCount:h,itemsRendered:c,listState:C,minOverscanItemCount:w,rangeChanged:E,startReached:T,topItemsIndexes:S,...x}},Re(lt,Jo,fr,Qt,Kt,Yt,mt,ar),{singleton:!0}),rs=ve(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=xe(),i=Ne(N(je(n,e,r,t,o),X(([a,l,u,f,b])=>a+l+u+f+b.offsetBottom+b.bottom)),0);return re(le(i),s),{totalListHeight:i,totalListHeightChanged:s}},Re(Ve,It),{singleton:!0}),zi=ve(([{viewportHeight:e},{totalListHeight:t}])=>{const n=V(!1),r=Ne(N(je(n,e,t),ae(([o])=>o),X(([,o,s])=>Math.max(0,o-s)),at(0),ke()),0);return{alignToBottom:n,paddingTopAddition:r}},Re(Ve,rs),{singleton:!0}),os=ve(()=>({context:V(null)})),Ai=({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,ss=ve(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:u}])=>{const f=xe();return re(N(f,ge(t,l,n,s,o,r,a),ge(e),X(([[b,x,p,v,S,h,c,w],C])=>{const{align:I,behavior:T,calculateViewLocation:E=Ai,done:g,...y}=b,_=Zo(b,x,v-1),B=Wt(_,x.offsetTree,C)+S+h,R=B+et(x.sizeTree,_)[1],P=w+h,k=w+p-c,O=E({itemBottom:R,itemTop:B,locationParams:{align:I,behavior:T,...y},viewportBottom:k,viewportTop:P});return O?g&&Je(N(i,ae(z=>!z),vt(_e(i)?1:2)),g):g==null||g(),O}),ae(b=>b!==null)),u),{scrollIntoView:f}},Re(lt,Ve,Kt,It,gt),{singleton:!0});function Fr(e){return e?e==="smooth"?"smooth":"auto":!1}const Li=(e,t)=>typeof e=="function"?Fr(e(t)):t&&Fr(e),Gi=ve(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:u},{log:f},{scrollingInProgress:b},{context:x},{scrollIntoView:p}])=>{const v=V(!1),S=xe();let h=null;function c(T){he(i,{align:"end",behavior:T,index:"LAST"})}Se(N(je(N(le(t),vt(1)),l),ge(le(v),s,a,b),X(([[T,E],g,y,_,B])=>{let R=E&&_,P="auto";return R&&(P=Li(g,y||B),R=R&&!!P),{followOutputBehavior:P,shouldFollow:R,totalCount:T}}),ae(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:E})=>{h&&(h(),h=null),_e(n)?requestAnimationFrame(()=>{_e(f)("following output to ",{totalCount:E},De.DEBUG),c(T)}):h=Je(e,()=>{_e(f)("following output to ",{totalCount:E},De.DEBUG),c(T),h=null})});function w(T){const E=Je(o,g=>{T&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!h&&(_e(f)("scrolling to bottom due to increased size",{},De.DEBUG),c("auto"))});setTimeout(E,100)}Se(N(je(le(v),t,u),ae(([T,,E])=>T&&E),it(({value:T},[,E])=>({refreshed:T===E,value:E}),{refreshed:!1,value:0}),ae(({refreshed:T})=>T),ge(v,t)),([,T])=>{_e(a)&&w(T!==!1)}),Se(S,()=>{w(_e(v)!==!1)}),Se(je(le(v),o),([T,E])=>{T&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&c("auto")});const C=V(null),I=xe();return re(Xn(N(le(r),X(T=>{var E;return(E=T==null?void 0:T.length)!=null?E:0})),N(le(t))),I),Se(N(je(N(I,vt(1)),l),ge(le(C),a,b,x),X(([[T,E],g,y,_,B])=>E&&y&&(g==null?void 0:g({context:B,totalCount:T,scrollingInProgress:_}))),ae(T=>!!T),at(0)),T=>{h&&(h(),h=null),_e(n)?requestAnimationFrame(()=>{_e(f)("scrolling into view",{}),he(p,T)}):h=Je(e,()=>{_e(f)("scrolling into view",{}),he(p,T),h=null})}),{autoscrollToBottom:S,followOutput:v,scrollIntoViewOnChange:C}},Re(lt,Yt,Kt,Qt,mt,gt,Ve,os,ss)),Hi=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(re(N(a,ge(s),ae(([,l])=>l!==0),ge(o,r,t,n,e),X(([[,l],u,f,b,x,p=[]])=>ns(l,u,f,b,x,p))),i),{}),Re(lt,Qt,It,mt),{singleton:!0}),Ni=ve(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=V(0);return Se(N(e,ge(r),ae(([,o])=>o!==0),X(([,o])=>({top:o}))),o=>{Je(N(n,vt(1),ae(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{he(t,o)})})}),{initialScrollTop:r}},Re(mt,Ve,It),{singleton:!0}),is=ve(([{scrollVelocity:e}])=>{const t=V(!1),n=xe(),r=V(!1);return re(N(e,ge(r,t,n),ae(([o,s])=>!!s),X(([o,s,i,a])=>{const{enter:l,exit:u}=s;if(i){if(u(o,a))return!1}else if(l(o,a))return!0;return i}),ke()),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}},Re(Yt),{singleton:!0}),pr=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),X(([{scrollHeight:a,scrollTop:l,viewportHeight:u},{offsetTop:f}])=>({scrollHeight:a,scrollTop:Math.max(0,l-f),viewportHeight:u}))),e),re(N(t,ge(r),X(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},Re(Ve)),Fi=ve(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=xe(),f=V(void 0),b=V(null),x=V(null);return re(a,b),re(l,x),Se(N(u,ge(t,r,i,b,x,n)),([p,v,S,h,c,w,C])=>{const I=Ii(v.sizeTree);h&&c!==null&&w!==null&&(S=c.scrollTop-w.offsetTop),S-=C,p({ranges:I,scrollTop:S})}),re(N(f,ae(sr),X(Wi)),o),re(N(s,ge(f),ae(([,p])=>p!==void 0),ke(),X(([,p])=>p.ranges)),e),{getState:u,restoreStateFrom:f}},Re(lt,Ve,Qt,mt,pr));function Wi(e){return{align:"start",index:0,offset:e.scrollTop}}const Vi=ve(([{topItemsIndexes:e}])=>{const t=V(0);return re(N(t,ae(n=>n>=0),X(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Re(It));function ls(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Di=ls(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),$i=ve(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:u,gap:f,shiftWithOffset:b,sizes:x},{log:p},{recalcInProgress:v}])=>{const S=qe(N(l,ge(i),it(([,c,w,C],[{bottom:I,items:T,offsetBottom:E,totalCount:g},y])=>{const _=I+E;let B=0;return w===g&&c.length>0&&T.length>0&&(T[0].originalIndex===0&&c[0].originalIndex===0||(B=_-C,B!==0&&(B+=y))),[B,T,g,_]},[0,[],0,0]),ae(([c])=>c!==0),ge(r,a,n,o,p,v),ae(([,c,w,C,,,I])=>!I&&!C&&c!==0&&w===Vt),X(([[c],,,,,w])=>(w("Upward scrolling compensation",{amount:c},De.DEBUG),c))));function h(c){c>0?(he(t,{behavior:"auto",top:-c}),he(e,0)):(he(e,0),he(t,{behavior:"auto",top:-c}))}return Se(N(S,ge(e,s)),([c,w,C])=>{C&&Di()?he(e,w-c):h(-c)}),Se(N(je(Ne(s,!1),e,v),ae(([c,w,C])=>!c&&!C&&w!==0),X(([c,w])=>w),at(1)),h),re(N(b,X(c=>({top:-c}))),t),Se(N(u,ge(x,f),X(([c,{groupIndices:w,lastSize:C,sizeTree:I},T])=>{function E(g){return g*(C+T)}if(w.length===0)return E(c);{let g=0;const y=Nt(I,0);let _=0,B=0;for(;_<c;){_++,g+=y;let R=w.length===B+1?1/0:w[B+1]-w[B]-1;_+R>c&&(g-=y,R=c-_+1),_+=R,g+=E(R),B++}return g}})),c=>{he(e,c),requestAnimationFrame(()=>{he(t,{top:c}),requestAnimationFrame(()=>{he(e,0),he(v,!1)})})}),{deviation:e}},Re(Ve,Yt,It,lt,gt,ar)),qi=ve(([e,t,n,r,o,s,i,a,l,u,f])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...u,...f}),Re(fr,Hi,mt,is,rs,Ni,zi,pr,ss,gt,os)),as=ve(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:u,sizes:f,statefulTotalCount:b,totalCount:x,trackItemSizes:p},{initialItemFinalLocationReached:v,initialTopMostItemIndex:S,scrolledToInitialItem:h},c,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,X(z=>z.visibleHeight)),c.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:a,initialItemFinalLocationReached:v,initialTopMostItemIndex:S,scrolledToInitialItem:h,sizeRanges:u,topItemCount:g,topItemsIndexes:P,totalCount:x,...C,groupIndices:i,itemSize:l,listState:B,minOverscanItemCount:R,scrollToIndex:T,statefulTotalCount:b,trackItemSizes:p,rangeChanged:k,...O,..._,...c,sizes:f,...w}},Re(lt,Qt,Ve,Fi,Gi,It,Kt,$i,Vi,Jo,qi));function Ui(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 en=typeof document<"u"?d.useLayoutEffect:d.useEffect;function cs(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=d.createContext({});function l(h,c){h.propsReady&&he(h.propsReady,!1);for(const w of r){const C=h[t.required[w]];he(C,c[w])}for(const w of o)if(w in c){const C=h[t.optional[w]];he(C,c[w])}h.propsReady&&he(h.propsReady,!0)}function u(h){return s.reduce((c,w)=>(c[w]=C=>{const I=h[t.methods[w]];he(I,C)},c),{})}function f(h){return i.reduce((c,w)=>(c[w]=ci(h[t.events[w]]),c),{})}const b=d.forwardRef((h,c)=>{const{children:w,...C}=h,[I]=d.useState(()=>hn(di(e),g=>{l(g,C)})),[T]=d.useState(jr(f,I));en(()=>{for(const g of i)g in C&&Se(T[g],C[g]);return()=>{Object.values(T).map(ir)}},[C,T,I]),en(()=>{l(I,C)}),d.useImperativeHandle(c,Er(u(I)));const E=n;return m.jsx(a.Provider,{value:I,children:n?m.jsx(E,{...Ui([...r,...o,...i],C),children:w}):w})}),x=h=>{const c=d.useContext(a);return d.useCallback(w=>{he(c[h],w)},[c,h])},p=h=>{const c=d.useContext(a)[h],w=d.useCallback(C=>Se(c,C),[c]);return d.useSyncExternalStore(w,()=>_e(c),()=>_e(c))},v=h=>{const c=d.useContext(a)[h],[w,C]=d.useState(jr(_e,c));return en(()=>Se(c,I=>{I!==w&&C(Er(I))}),[c,w]),w},S=d.version.startsWith("18")?p:v;return{Component:b,useEmitter:(h,c)=>{const w=d.useContext(a)[h];en(()=>Se(w,c),[c,w])},useEmitterValue:S,usePublisher:x}}const us=d.createContext(void 0),ds=d.createContext(void 0),fs=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Mn(e){return"self"in e}function Ki(e){return"body"in e}function ps(e,t,n,r=Bt,o,s){const i=d.useRef(null),a=d.useRef(null),l=d.useRef(null),u=d.useCallback(x=>{let p,v,S;const h=x.target;if(Ki(h)||Mn(h)){const w=Mn(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 c=()=>{e({scrollHeight:p,scrollTop:Math.max(S,0),viewportHeight:v})};x.suppressFlushSync?c():Ws.flushSync(c),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]);d.useEffect(()=>{const x=o||i.current;return r(o||i.current),u({suppressFlushSync:!0,target:x}),x.addEventListener("scroll",u,{passive:!0}),()=>{r(null),x.removeEventListener("scroll",u)}},[i,u,n,r,o]);function f(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,c;Mn(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,c=s?window.scrollX:window.scrollY):(h=p[s?"scrollWidth":"scrollHeight"],S=pt(p,s?"width":"height"),c=p[s?"scrollLeft":"scrollTop"]);const w=h-S;if(x.top=Math.ceil(Math.max(Math.min(w,x.top),0)),ts(S,h)||x.top===c){e({scrollHeight:h,scrollTop:c,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:f}}const En="-webkit-sticky",Wr="sticky",hr=ls(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=En,e.style.position===En?En:Wr});function gr(e){return e}const Qi=ve(()=>{const e=V(a=>`Item ${a}`),t=V(a=>`Group ${a}`),n=V({}),r=V(gr),o=V("div"),s=V(Bt),i=(a,l=null)=>Ne(N(n,X(u=>u[a]),ke()),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")}}),Yi=ve(([e,t])=>({...e,...t}),Re(as,Qi)),Xi=({height:e})=>m.jsx("div",{style:{height:e}}),Zi={overflowAnchor:"none",position:hr(),zIndex:1},hs={overflowAnchor:"none"},Ji={...hs,display:"inline-block",height:"100%"},Vr=d.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"),u=fe("context"),f=fe("groupContent"),b=fe("trackItemSizes"),x=fe("itemSize"),p=fe("log"),v=Ke("gap"),S=fe("horizontalDirection"),{callbackRef:h}=hi(n,x,b,e?Bt:a,p,v,o,S,fe("skipAnimationFrameInResizeObserver")),[c,w]=d.useState(0);mr("deviation",O=>{c!==O&&w(O)});const C=fe("EmptyPlaceholder"),I=fe("ScrollSeekPlaceholder")||Xi,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:c!==0?c:R?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:c!==0?c:R?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&C?m.jsx(C,{...He(C,u)}):m.jsx(T,{...He(T,u),"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,u);return _?d.createElement(I,{...He(I,u),height:O.size,index:O.index,key:L,type:O.type||"item",...O.type==="group"?{}:{groupIndex:O.groupIndex}}):O.type==="group"?d.createElement(g,{...He(g,u),"data-index":z,"data-item-index":O.index,"data-known-size":O.size,key:L,style:Zi},f(O.index,u)):d.createElement(E,{...He(E,u),...rl(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?Ji:hs},B?l(O.index,O.groupIndex,O.data,u):l(O.index,O.data,u))})})}),el={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},tl={outline:"none",overflowX:"auto",position:"relative"},mn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),nl={position:hr(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function rl(e,t){return{item:typeof e=="string"?void 0:t}}const ol=d.memo(function(){const e=fe("HeaderComponent"),t=Ke("headerHeight"),n=fe("HeaderFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),sl=d.memo(function(){const e=fe("FooterComponent"),t=Ke("footerHeight"),n=fe("HeaderFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null});function gs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return d.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),f=t("scrollerRef"),b=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:p,scrollToCallback:v}=ps(a,u,l,f,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?tl:el,...o},tabIndex:0,...i,...He(l,s),children:r})})}function ms({useEmitter:e,useEmitterValue:t,usePublisher:n}){return d.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),u=n("smoothScrollTargetReached"),f=t("totalListHeight"),b=t("deviation"),x=t("customScrollParent"),p=d.useRef(null),v=t("scrollerRef"),{scrollByCallback:S,scrollerRef:h,scrollToCallback:c}=ps(a,u,l,v,x);return fs(()=>{var w;return h.current=x||((w=p.current)==null?void 0:w.ownerDocument.defaultView),()=>{h.current=null}},[h,x]),e("windowScrollTo",c),e("scrollBy",S),m.jsx(l,{ref:p,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...f!==0?{height:f+b}:{}},...i,...He(l,s),children:r})})}const il=({children:e})=>{const t=d.useContext(us),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=fe("alignToBottom"),s=fe("horizontalDirection"),i=d.useMemo(()=>Fo(n,l=>pt(l,s?"width":"height")),[n,s]),a=Ct(i,!0,fe("skipAnimationFrameInResizeObserver"));return d.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:mn(o),children:e})},ll=({children:e})=>{const t=d.useContext(us),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=fe("customScrollParent"),s=Vo(n,o,fe("skipAnimationFrameInResizeObserver")),i=fe("alignToBottom");return d.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:mn(i),children:e})},al=({children:e})=>{const t=fe("TopItemListComponent")||"div",n=fe("headerHeight"),r={...nl,marginTop:`${n}px`},o=fe("context");return m.jsx(t,{style:r,...He(t,o),children:e})},cl=d.memo(function(e){const t=fe("useWindowScroll"),n=fe("topItemsIndexes").length>0,r=fe("customScrollParent"),o=fe("context");return m.jsxs(r||t?fl:dl,{...e,context:o,children:[n&&m.jsx(al,{children:m.jsx(Vr,{showTopList:!0})}),m.jsxs(r||t?ll:il,{children:[m.jsx(ol,{}),m.jsx(Vr,{}),m.jsx(sl,{})]})]})}),{Component:ul,useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}=cs(Yi,{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"}},cl),dl=gs({useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}),fl=ms({useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}),pl=ul,hl=ve(()=>{const e=V(u=>m.jsxs("td",{children:["Item $",u]})),t=V(null),n=V(u=>m.jsxs("td",{colSpan:1e3,children:["Group ",u]})),r=V(null),o=V(null),s=V({}),i=V(gr),a=V(Bt),l=(u,f=null)=>Ne(N(s,X(b=>b[u]),ke()),f);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")}});Re(as,hl);hr();const Dr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},gl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:$r,floor:an,max:Gt,min:jn,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 ml(e){return{...gl,items:e}}function tn(e,t){return e&&e.width===t.width&&e.height===t.height}function bl(e,t){return e&&e.column===t.column&&e.row===t.row}const xl=ve(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:u,smoothScrollTargetReached:f,viewportHeight:b},x,p,{didMount:v,propsReady:S},{customScrollParent:h,useWindowScroll:c,windowScrollContainerState:w,windowScrollTo:C,windowViewportRect:I},T])=>{const E=V(0),g=V(0),y=V(Dr),_=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),Y=V(!1),ce=V(!1);Se(N(v,ge(W),ae(([G,ee])=>!!ee)),()=>{he(U,!1)}),Se(N(je(v,U,B,_,W,Y),ae(([G,ee,M,F,,H])=>G&&!ee&&M.height!==0&&F.height!==0&&!H)),([,,,,G])=>{he(Y,!0),ur(1,()=>{he(R,G)}),Je(N(u),()=>{he(t,[0,0]),he(U,!0)})}),re(N(j,ae(G=>G!=null&&G.scrollTop>0),st(0)),g),Se(N(v,ge(j),ae(([,G])=>G!=null)),([,G])=>{G&&(he(_,G.viewport),he(B,G.item),he(z,G.gap),G.scrollTop>0&&(he(A,!0),Je(N(u,vt(1)),ee=>{he(A,!1)}),he(l,{top:G.scrollTop})))}),re(N(_,X(({height:G})=>G)),b),re(N(je(le(_,tn),le(B,tn),le(z,(G,ee)=>G&&G.column===ee.column&&G.row===ee.row),le(u)),X(([G,ee,M,F])=>({gap:M,item:ee,scrollTop:F,viewport:G}))),L),re(N(je(le(E),r,le(z,bl),le(B,tn),le(_,tn),le(O),le(g),le(A),le(U),le(W)),ae(([,,,,,,,G])=>!G),X(([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 Dr;if(Ce===0){const Ie=dr(J,G),Oe=Ie+Math.max(D-1,0);return ml(Ur(Ie,Oe,Q))}const Pe=bs(ze,Ce,ne);let Ae,Fe;de?ee===0&&M===0&&D>0?(Ae=0,Fe=D-1):(Ae=Pe*an((ee+se)/(ue+se)),Fe=Pe*$r((M+se)/(ue+se))-1,Fe=jn(G-1,Gt(Fe,Pe-1)),Ae=jn(Fe,Gt(0,Ae))):(Ae=0,Fe=-1);const We=Ur(Ae,Fe,Q),{bottom:Ee,top:Ye}=Kr($,F,H,We),Ue=$r(G/Pe),q=Ue*ue+(Ue-1)*se-Ee;return{bottom:Ee,itemHeight:ue,items:We,itemWidth:Ce,offsetBottom:q,offsetTop:Ye,top:Ye}})),y),re(N(O,ae(G=>G!==null),X(G=>G.length)),E),re(N(je(_,B,y,z),ae(([G,ee,{items:M}])=>M.length>0&&ee.height!==0&&G.height!==0),X(([G,ee,{items:M},F])=>{const{bottom:H,top:$}=Kr(G,F,ee,M);return[$,H]}),ke(Ft)),t);const ie=V(!1);re(N(u,ge(ie),X(([G,ee])=>ee||G!==0)),ie);const me=qe(N(je(y,E),ae(([{items:G}])=>G.length>0),ge(ie),ae(([[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}),X(([[,G]])=>G-1),ke())),be=qe(N(le(y),ae(({items:G})=>G.length>0&&G[0].index===0),st(0),ke())),K=qe(N(le(y),ge(A),ae(([{items:G},ee])=>G.length>0&&!ee),X(([{items:G}])=>({endIndex:G[G.length-1].index,startIndex:G[0].index})),ke(Qo),at(0)));re(K,p.scrollSeekRangeChanged),re(N(R,ge(_,B,E,z),X(([G,ee,M,F,H])=>{const $=es(G),{align:Q,behavior:D,offset:de}=$;let J=$.index;J==="LAST"&&(J=F-1),J=Gt(0,J,jn(F-1,J));let ne=nr(ee,H,M,J);return Q==="end"?ne=qr(ne-ee.height+M.height):Q==="center"&&(ne=qr(ne-ee.height/2+M.height/2)),de&&(ne+=de),{behavior:D,top:ne}})),l);const oe=Ne(N(y,X(G=>G.offsetBottom+G.bottom)),0);return re(N(I,X(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:u,smoothScrollTargetReached:f,totalCount:E,useWindowScroll:c,viewportDimensions:_,windowScrollContainerState:w,windowScrollTo:C,windowViewportRect:I,...p,gridState:y,horizontalDirection:ce,initialTopMostItemIndex:W,totalListHeight:oe,...x,endReached:me,propsReady:S,rangeChanged:K,startReached:be,stateChanged:L,stateRestoreInProgress:A,...T}},Re(fr,Ve,Yt,is,mt,pr,gt));function bs(e,t,n){return Gt(1,an((e+n)/(an(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=nr(e,t,n,r[0].index);return{bottom:nr(e,t,n,r[r.length-1].index)+o,top:s}}function nr(e,t,n,r){const o=bs(e.width,n.width,t.column),s=an(r/o),i=s*n.height+Gt(0,s-1)*t.row;return i>0?i+t.row:i}const vl=ve(()=>{const e=V(b=>`Item ${b}`),t=V({}),n=V(null),r=V("virtuoso-grid-item"),o=V("virtuoso-grid-list"),s=V(gr),i=V("div"),a=V(Bt),l=(b,x=null)=>Ne(N(t,X(p=>p[b]),ke()),x),u=V(!1),f=V(!1);return re(le(f),u),{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:u,reportReadyState:f,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),Sl=ve(([e,t])=>({...e,...t}),Re(xl,vl)),yl=d.memo(function(){const e=Te("gridState"),t=Te("listClassName"),n=Te("itemClassName"),r=Te("itemContent"),o=Te("computeItemKey"),s=Te("isSeeking"),i=Qe("scrollHeight"),a=Te("ItemComponent"),l=Te("ListComponent"),u=Te("ScrollSeekPlaceholder"),f=Te("context"),b=Qe("itemDimensions"),x=Qe("gap"),p=Te("log"),v=Te("stateRestoreInProgress"),S=Qe("reportReadyState"),h=Ct(d.useMemo(()=>c=>{const w=c.parentElement.parentElement.scrollHeight;i(w);const C=c.firstChild;if(C){const{height:I,width:T}=C.getBoundingClientRect();b({height:I,width:T})}x({column:Qr("column-gap",getComputedStyle(c).columnGap,p),row:Qr("row-gap",getComputedStyle(c).rowGap,p)})},[i,b,x,p]),!0,!1);return fs(()=>{e.itemHeight>0&&e.itemWidth>0&&S(!0)},[e]),v?null:m.jsx(l,{className:t,ref:h,...He(l,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(c=>{const w=o(c.index,c.data,f);return s?m.jsx(u,{...He(u,f),height:e.itemHeight,index:c.index,width:e.itemWidth},w):d.createElement(a,{...He(a,f),className:n,"data-index":c.index,key:w},r(c.index,c.data,f))})})}),wl=d.memo(function(){const e=Te("HeaderComponent"),t=Qe("headerHeight"),n=Te("headerFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Cl=d.memo(function(){const e=Te("FooterComponent"),t=Qe("footerHeight"),n=Te("headerFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Il=({children:e})=>{const t=d.useContext(ds),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=Ct(d.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return d.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:mn(!1),children:e})},kl=({children:e})=>{const t=d.useContext(ds),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Te("customScrollParent"),s=Vo(n,o,!1);return d.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:mn(!1),children:e})},Rl=d.memo(function({...e}){const t=Te("useWindowScroll"),n=Te("customScrollParent"),r=n||t?_l:Tl,o=n||t?kl:Il,s=Te("context");return m.jsx(r,{...e,...He(r,s),children:m.jsxs(o,{children:[m.jsx(wl,{}),m.jsx(yl,{}),m.jsx(Cl,{})]})})}),{useEmitter:xs,useEmitterValue:Te,usePublisher:Qe}=cs(Sl,{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"}},Rl),Tl=gs({useEmitter:xs,useEmitterValue:Te,usePublisher:Qe}),_l=ms({useEmitter:xs,useEmitterValue:Te,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,De.WARN),t==="normal"?0:parseInt(t??"0",10)}const bn=d.createContext(void 0);function we(e,t){const n=d.useContext(bn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return Ut(n,e,t)}function Yr(){const e=d.useContext(bn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const br=d.createContext(void 0);function St(){const e=d.useContext(br);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function Z(e,t){const n=d.useContext(br);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return Ut(n,o=>e(o.progress),t)}const Ml="_run_zzb61_3",El="_runWrap_zzb61_7",jl="_highlight_zzb61_13",Pl="_highlightleft_zzb61_14",Ol="_highlightright_zzb61_15",Bl="_highlightcenter_zzb61_16",zl="_underline_zzb61_48",Al="_underlineleft_zzb61_49",Ll="_underlineright_zzb61_50",Gl="_underlinecenter_zzb61_51",ot={run:Ml,runWrap:El,highlight:jl,highlightleft:Pl,highlightright:Ol,highlightcenter:Bl,underline:zl,underlineleft:Al,underlineright:Ll,underlinecenter:Gl},Xr=e=>Symbol.iterator in e,Zr=e=>"entries"in e,Jr=(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},Hl=(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 Nl(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:Xr(e)&&Xr(t)?Zr(e)&&Zr(t)?Jr(e,t):Hl(e,t):Jr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function qt(e){const t=d.useRef(void 0);return n=>{const r=e(n);return Nl(t.current,r)?t.current:t.current=r}}function Fl(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 Wl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Vl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),vs=d.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=we(y=>y.setClipIndex),i=we(y=>y.seek),a=Z(y=>y.setCurrentGlobalRunIndex),l=Z(y=>y.rangeStartGI),u=Z(y=>y.rangeEndGI),f=Z(y=>y.setRange),b=l!=null&&u!=null,x=d.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=d.useRef(null),v=d.useRef(!1),S=d.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(()=>{f(B,B),v.current=!0,p.current=null},800))},[t,r,f]),h=d.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),c=d.useCallback(()=>{h()},[h]),w=h,C=h,I=Z(y=>y.clearRange),T=d.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&&u!=null&&(I(),y.stopPropagation())},[b,l,u,I]),E=o,g=r+t.length-1;return m.jsx("span",{onClick:T,onDoubleClick:x,onPointerDown:S,onPointerUp:c,onPointerCancel:w,onPointerLeave:C,children:E.map((y,_)=>m.jsx($l,{ns:n,group:y,runs:t,paraLastG:g,rangeStartGI:l,rangeEndGI:u},`${n}/grp:${_}-${y.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Dl=d.memo(function(){const t=d.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=te(qt(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}),$l=d.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=d.useCallback(h=>{const c=h.currentGlobalRunIndex;return c!=null&&c>=n.startG&&c<=n.endG},[n]),l=Z(qt(a)),u=d.useCallback(h=>l?{showPointer:h.showPointer,pointerStyle:h.pointerStyle,pointerColor:h.pointerColor}:Vl,[l]),f=te(qt(u)),b=n.r0??0,x=n.len??Math.max(0,n.endG-n.startG+1),p=l&&f.showPointer&&f.pointerStyle!=="underline",v=l&&f.showPointer&&f.pointerStyle==="underline",S=p||v?{"--hl-color":f.pointerColor,"--ul-color":f.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:x}).map((h,c)=>{const C=r[b+c],I=n.startG+c,T=`${t}/run:${I}`,E=!!C.split&&I!==o;let g=`${ot.runWrap}`;return p&&(x===1?g+=` ${ot.highlight}`:c===0?g+=` ${ot.highlightleft}`:c+1===x?g+=` ${ot.highlightright}`:g+=` ${ot.highlightcenter}`),v&&(x===1?g+=` ${ot.underline}`:c===0?g+=` ${ot.underlineleft}`:c+1===x?g+=` ${ot.underlineright}`:g+=` ${ot.underlinecenter}`),m.jsxs(d.Fragment,{children:[m.jsx("span",{className:g,style:S,children:m.jsx(ql,{gi:n.startG,g:I,run:C,active:l,pointerCfg:f,isInRange:s!=null&&i!=null&&I>=s&&I<=i})}),E&&m.jsx(Dl,{})]},T)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),ql=d.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=d.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 u=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=u;const f=u.startsWith("#")?Fl(u):Wl(u);f&&(.299*f.r+.587*f.g+.114*f.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 Ul({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var u;const i=e.list?e.list.level*24:0,a=((u=e.list)==null?void 0:u.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(vs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Kl=d.memo(Ul,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Ql(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 to(e,!1);case"upperalpha":case"upperlatin":return to(e,!0);case"lowerroman":return eo(e,!1);case"upperroman":return eo(e,!0);case"decimalenclosedcircle":return Yl(e);default:return String(e)}}function Yl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function eo(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 to(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 xr(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 vr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Ql(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Xl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Zl(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 Jl(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 ea="_scroller_kqkmq_3",ta={scroller:ea},na=d.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${ta.scroller}${t?" "+t:""}`,style:n,...r})});function zt(){const e=d.useContext(wt);if(!e)throw new Error("useViewerRecorderStoreApi must be used inside <ViewerRecorderProvider>");return e}const rr=e=>/[가-힣a-zA-Z0-9]/.test(e),ra=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function oa(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,u=-1,f=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=ra(v);if(!S||!rr(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<f||C===f&&(h.top<b||u!==-1&&Number(v.dataset.g)<u))&&(f=C,u=Number(v.dataset.g),b=h.top);continue}const c=Number(v.dataset.g);if(Number.isNaN(c))continue;h.top<l-n?(l=h.top,a=h.top,i=c):h.top<=l+n&&(h.top<a||h.top===a&&(i===-1||c<i))&&(a=h.top,i=c);const w=Math.abs(h.top-s);(w<f||w===f&&(h.top<b||u!==-1&&c<u))&&(f=w,u=c,b=h.top)}return i!==-1?i:u}const Ss=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},no=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 u=Number(a.dataset.g);Number.isNaN(u)||(u<s&&(s=u),u>i&&(i=u))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},sa=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(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 ia(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(!sa(e,t,{topPaddingRatio:n,behavior:r}))return!1;await ia(e,o);const i=cn(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),u=a.height*n,f=a.top+u,b=l.top-f;return Math.abs(b)<=1},ft=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),Sr=d.createContext(null);function ys(){const e=d.useContext(Sr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Xe(e,t){const n=d.useContext(Sr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return Ut(n,e,t)}const ws=()=>{const e=Z(n=>n.section),t=e.quiz;if(t&&t.length){const n=ys();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},la="_navBtn_rnisf_2",aa="_disabled_rnisf_25",ca="_label_rnisf_31",jt={navBtn:la,disabled:aa,label:ca};var Cs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ro=d.createContext&&d.createContext(Cs),ua=["attr","size","title"];function da(e,t){if(e==null)return{};var n=fa(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 fa(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 un(){return un=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},un.apply(this,arguments)}function oo(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 dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(r){pa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pa(e,t,n){return t=ha(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha(e){var t=ga(e,"string");return typeof t=="symbol"?t:t+""}function ga(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 Is(e){return e&&e.map((t,n)=>d.createElement(t.tag,dn({key:n},t.attr),Is(t.child)))}function tt(e){return t=>d.createElement(ma,un({attr:dn({},e.attr)},t),Is(e.child))}function ma(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=da(e,ua),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),d.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&d.createElement("title",null,s),e.children)};return ro!==void 0?d.createElement(ro.Consumer,null,n=>t(n)):t(Cs)}function so(e){return tt({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 io(e){return tt({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 ba=({isIcon:e=!0})=>{const t=Z(i=>i.isCanPrev),n=Z(i=>i.onSectionNav),r=!t,o=d.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${jt.navBtn} ${r?jt.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:jt.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(so,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=Z(i=>i.isCanNext),n=Z(i=>i.onSectionNav),r=!t,o=d.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${jt.navBtn} ${r?jt.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:jt.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(io,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ks(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 xa({section:e,blocks:t,nsPrefix:n}){const r=d.useMemo(()=>{const y=[],_=xr();return t.forEach((B,R)=>{B.type==="paragraph"&&(y[R]=vr(B,_))}),y},[t]),o=Z(y=>{var _;return((_=y.layout)==null?void 0:_.prefix)??[]}),s=Z(y=>{var _;return((_=y.derivedNav)==null?void 0:_.splitGroupsPerBlock)??[]}),i=te(y=>y.marginX),a=te(y=>y.viewportHeight),l=te(y=>y.playbackViewportHeight),u=l>0?l:a,f=d.useRef({start:0,end:0}),b=d.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>=f.current.start&&y<=f.current.end,W=u>80?Math.floor((u-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(Kl,{block:_,computedMarker:R,ns:B,baseIndex:o[y],sectionId:e.section_id,preGroups:P})})},[t,r,o,n,e,s,u]),x=d.useRef(null),p=d.useCallback(y=>{x.current=y},[]),v=d.useMemo(()=>d.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=d.useRef(null),h=d.useMemo(()=>t.map(y=>y.id),[t]),c=d.useCallback(()=>{const y=e.quiz,_=Math.max(80,Math.floor(u*.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(ws,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{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(fn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,u]),w=d.useMemo(()=>({Item:v,Header:()=>m.jsx("div",{style:{height:40}}),Footer:c,Scroller:na}),[c,v]),C=d.useCallback(y=>h[y],[h]),I=St(),[T]=d.useState(()=>I.getState().progress.currentGlobalRunIndex??0),E=d.useMemo(()=>{if(!o.length)return 0;const y=o[o.length-1],_=Math.max(0,Math.min(T,y));return ks(o,_)},[o,T]);console.log("SectionRenderVirtuoso확인");const g=St();return d.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 Ss(y,R),await ft(),await ft(),await ft(),await ft(),console.log("첫랜더끝"),B(!1)})())},[x,g]),m.jsxs(m.Fragment,{children:[m.jsx(pl,{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(va,{scrollContainerRef:x,virtRef:S,prefix:o})]})}const va=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=Z(k=>k.setCurrentGlobalRunIndex),o=Z(k=>k.registerSectionScrollApi),s=Z(k=>k.currentGlobalRunIndex),i=we(k=>k.scrollLock),a=we(k=>k.syncToGI),l=zt(),u=d.useRef(!1),f=d.useRef(null),b=d.useRef(null),x=d.useRef(null),p=d.useRef(-1),v=d.useCallback(()=>{if(i)return;f.current=null;const k=b.current;if(!k)return;const O=oa(k,5);O!==-1&&O!==p.current&&(p.current=O,a(O),r(O,"scroll"))},[i,a,r]),S=d.useCallback(k=>{b.current=k,f.current==null&&(f.current=requestAnimationFrame(v))},[v]),h=d.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]),c=d.useRef(!1),w=d.useCallback(k=>{i||u.current&&(c.current||(S(k),h(k)))},[i,S,h]),C=d.useRef(void 0),I=d.useRef(void 0),T=d.useRef(void 0),E=d.useRef(void 0);d.useEffect(()=>{const k=e.current;if(k)return C.current=()=>{u.current=!0},I.current=()=>{u.current=!0},T.current=()=>{u.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),f.current!=null&&cancelAnimationFrame(f.current),x.current!=null&&(clearTimeout(x.current),x.current=null)}},[w,e]),d.useEffect(()=>{const k=e.current;if(!k||!i)return;const O=A=>{A.preventDefault(),A.stopPropagation(),u.current=!1},z=A=>{A.preventDefault(),A.stopPropagation(),u.current=!1},L=A=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(A.key)&&(A.preventDefault(),A.stopPropagation(),u.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=d.useRef({first:-1,last:-1}),y=d.useRef(!1),_=d.useCallback(()=>{const k=e.current;if(!k)return;const O=no(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=d.useRef(!1),R=d.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]);d.useEffect(()=>{!y.current&&i&&(B.current=!1,_()),y.current=i},[i,_]),d.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{c.current=!0,await Pn(k,s,{behavior:"smooth",topPaddingRatio:.2})}finally{c.current=!1}_()})();return}if(s<O||s>z){async function j(){if(!k)return;const A=k.scrollTop<=1?0:.2;return await Pn(k,s,{behavior:"smooth",topPaddingRatio:A})}j().then(A=>{A?_():R()})}},[i,s,R,_,e]);const P=d.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=ks(n,K);(ee=t.current)==null||ee.scrollToIndex({index:G,align:"start",behavior:z(oe)}),await Ss(k,K)},A=()=>new Promise(K=>requestAnimationFrame(()=>K())),W=async K=>{if(O(k,K,.1,.7))return L(K),!0;c.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 Pn(k,K,{behavior:"smooth",topPaddingRatio:ee}),await A()):M||await j(K,"auto"),c.current=!1,L(K),O(k,K,.1,.7)},U=async K=>W(K);return{ensureVisibleGI:W,scrollToGI:U,getVisibleRange:()=>no(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 d.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(P()),()=>o(void 0)),[P,o]),null};function Sa(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 ya(){const e=Z(v=>v.section),t=te(v=>v.theme),n=te(v=>v.fontFamily),r=te(v=>v.fontSizePx),o=te(v=>v.lineHeight),s=sn[t],{blocks:i,nsPrefix:a}=d.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=Pt(),u=d.useCallback(()=>{const{isSettingsOpen:v,setSettingsOpen:S,toggleOverlays:h}=l.getState();v?S(!1):h()},[l]),{onClick:f,onDoubleClick:b}=ti({onSingle:u,onDouble:()=>{},delay:250,shouldIgnoreTarget:Sa}),x=d.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=d.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:f,onDoubleClick:b,style:x,children:m.jsx("div",{style:p,children:m.jsx(xa,{section:e,blocks:i,nsPrefix:a})})})}function wa(e){return tt({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 Ca(e){return tt({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 Ia(e){return tt({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 ka(e){return tt({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)}const Ra="_wrap_1pn6r_2",Ta="_visible_1pn6r_21",_a="_container_1pn6r_27",Ma="_leftGroup_1pn6r_36",Ea="_rightGroup_1pn6r_37",ja="_leftleftGroup_1pn6r_51",Pa="_leftrightGroup_1pn6r_52",Oa="_btn_1pn6r_78",Ba="_btnForbidden_1pn6r_100",za="_btnActive_1pn6r_107",Aa="_label_1pn6r_112",Le={wrap:Ra,visible:Ta,container:_a,leftGroup:Ma,rightGroup:Ea,leftleftGroup:ja,leftrightGroup:Pa,btn:Oa,btnForbidden:Ba,btnActive:za,label:Aa},La=d.memo(function(){const t=d.useRef(null),n=d.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),u=te(R=>R.audioTargetWpm),f=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),c=Z(R=>R.setCurrentGlobalRunIndex),w=Z(R=>R.getSectionScrollApi),C=Z(R=>R.snapToReadable),I=Z(R=>R.edgeReadable),T=d.useRef(null),E=d.useRef(null),g=d.useRef(!1),y=d.useRef(null);d.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=(u||200)/R;f(P)},[a,i,u,f]),d.useEffect(()=>{l==="real"&&(g.current=!0)},[l]);const _=d.useMemo(()=>{const R=p(i);if(!R)return null;try{return new URL(R,window.location.href).href}catch{return R}},[i,p]);d.useEffect(()=>{g.current=!0},[_]),d.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&&(c(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,c,w]),d.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]),d.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 d.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,c(P,"audio"),P%5===0&&((O=(k=w())==null?void 0:k.ensureVisibleGI)==null||O.call(k,P)))},[o,i,s,l,B,C,c,w,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Ga(){return m.jsx(La,{})}const Ha="_scrubberWrap_jtztl_2",Na="_labels_jtztl_8",Fa="_index_jtztl_14",Wa="_controls_jtztl_18",Va="_percent_jtztl_24",Da="_range_jtztl_45",kt={scrubberWrap:Ha,labels:Na,index:Fa,controls:Wa,percent:Va,range:Da};function $a(){const e=Z(I=>I.currentGlobalRunIndex),t=Z(I=>I.totalRuns),n=Z(I=>I.setCurrentGlobalRunIndex),r=Z(I=>I.getSectionScrollApi),o=Z(I=>I.giToPercentTotal),s=Z(I=>I.percentToGITotal),i=Z(I=>I.snapToReadable),a=we(I=>I.scrollLock),l=we(I=>I.pause),u=we(I=>I.play),f=we(I=>I.syncToGI),[b,x]=d.useState(()=>o(e||0));d.useEffect(()=>{x(o(e||0))},[e,o]);const p=d.useRef(!1),v=d.useMemo(()=>Math.max(0,Math.min(e??0,Math.max(0,(t??1)-1)))+1,[e,t]),S=d.useCallback(()=>{a&&(l(),p.current=!0)},[a,l]),h=d.useCallback(I=>{x(Number(I.currentTarget.value))},[]),c=d.useCallback(async()=>{const I=s(b),T=i(I);l(),n(T,"scrubber-commit"),f(T);const E=r();E!=null&&E.ensureVisibleGI&&await E.ensureVisibleGI(T),p.current&&(p.current=!1,u())},[b,s,i,l,n,f,r,u]),w=d.useMemo(()=>({"--pct":`${b}%`}),[b]),C=d.useMemo(()=>Math.round(b),[b]);return m.jsxs("div",{className:kt.scrubberWrap,children:[m.jsx("div",{className:kt.labels,children:m.jsxs("span",{className:kt.index,children:[v," / ",t||0]})}),m.jsxs("div",{className:kt.controls,children:[m.jsx("input",{type:"range",className:kt.range,min:0,max:100,step:.5,value:b,style:w,onMouseDown:S,onTouchStart:S,onChange:h,onMouseUp:()=>{c()},onTouchEnd:()=>{c()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void c():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:kt.percent,children:[C,"%"]})]})]})}const qa=d.memo($a),Ua=e=>Math.max(50,Math.min(500,e)),Ka=d.memo(function(){const t=d.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=Z(y=>y.totalRuns),u=Z(y=>y.currentGlobalRunIndex),f=Z(y=>y.setCurrentGlobalRunIndex),b=Z(y=>y.getSectionScrollApi),x=Z(y=>y.nextReadableFrom),p=Z(y=>y.edgeReadable),v=d.useRef(null),S=d.useRef(null),h=d.useRef(0),c=d.useRef(-1),w=!n&&r==="fake"&&o==="playing",C=Math.max(1,(s==null?void 0:s.totalWords)??1),I=d.useMemo(()=>{const y=Ua(i||200);return C/y*6e4},[C,i]),T=d.useMemo(()=>!l||l<=1||I<=0?0:(l-1)/I,[l,I]);d.useEffect(()=>{if(!w)return;const y=Math.max(0,Math.min(u??0,Math.max(0,(l??1)-1)));h.current=y,c.current=y,S.current=null},[w,u,l]);const E=d.useRef(-1);d.useEffect(()=>{if(!l){E.current=-1;return}const y=p(1);E.current=y??-1},[p,l]);const g=d.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!==c.current&&(c.current=A,f(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!==c.current&&(c.current=z,f(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,f,b,a]);return d.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}),Qa=d.memo(function(){return m.jsx(Ka,{})}),Ya="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",Xa="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",Za="_WPMSpeedButtonsWrap_pxoh4_1",Ja="_btnWrap_pxoh4_8",ec="_label_pxoh4_14",tc="_wpmString_pxoh4_21",nc="_iconBtn_pxoh4_24",Rt={WPMSpeedButtonsWrap:Za,btnWrap:Ja,label:ec,wpmString:tc,iconBtn:nc},lo=5,ao=350,rc=40,oc=.85,sc=e=>Math.max(50,Math.min(500,e)),ic=d.memo(function(){const t=te(b=>b.audioTargetWpm);te(b=>b.audioSpeed);const n=te(b=>b.setAudioTargetWpm),r=d.useRef(t);d.useEffect(()=>{r.current=t},[t]);const o=d.useRef(null),s=d.useRef(ao),i=d.useRef(null),a=d.useCallback(b=>{const x=r.current,p=b==="inc"?lo:-lo,v=sc(x+p);return v===x?!1:(n(v),r.current=v,!0)},[n]),l=d.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),u=d.useCallback(()=>{i.current&&(s.current=Math.max(rc,Math.floor(s.current*oc)),o.current=window.setTimeout(()=>{a(i.current)?u():l()},s.current))},[a,l]),f=d.useCallback(b=>{if(i.current)return;i.current=b,s.current=ao,a(b)&&u();const p=()=>l();window.addEventListener("mouseup",p,{once:!0}),window.addEventListener("touchend",p,{once:!0})},[u,a,l]);return d.useEffect(()=>l,[l]),m.jsx("div",{onMouseLeave:l,className:Rt.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Rt.btnWrap,children:[m.jsxs("button",{className:Rt.iconBtn,type:"button",title:"WPM 느리게",onMouseDown:()=>f("dec"),onTouchStart:b=>{b.preventDefault(),f("dec")},onMouseUp:l,children:[m.jsx("img",{src:Ya})," "]}),m.jsxs("div",{className:Rt.label,children:[m.jsx("div",{children:t}),m.jsx("div",{className:Rt.wpmString,children:"WPM"})]}),m.jsx("button",{className:Rt.iconBtn,type:"button",title:"WPM 빠르게",onMouseDown:()=>f("inc"),onTouchStart:b=>{b.preventDefault(),f("inc")},onMouseUp:l,children:m.jsx("img",{src:Xa})})]})})}),lc="_StepBtn_ua1nh_1",ac={StepBtn:lc};function cc(e){return tt({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 uc(e){return tt({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 co({direction:e}){const t=Z(x=>x.currentGlobalRunIndex),n=Z(x=>x.totalRuns),r=Z(x=>x.hasReadableInDir),o=Z(x=>x.computeStepTarget),s=Z(x=>x.giToPercentTotal),i=Z(x=>x.setCurrentGlobalRunIndex),a=we(x=>x.syncToGI),l=Z(x=>x.getSectionScrollApi),u=d.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]),f=d.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=d.useCallback(()=>{u(e==="left"?-1:1)},[e,u]);return m.jsx("button",{className:ac.StepBtn,type:"button",onClick:b,disabled:f,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(cc,{}):m.jsx(uc,{})})}const dc="_GCPlayBtn_1p162_1",fc="_playing_1p162_28",uo={GCPlayBtn:dc,playing:fc},pc=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${uo.GCPlayBtn} ${r?uo.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function hc(){const e=te(C=>C.showOverlays),t=Z(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),u=te(C=>C.toggleShowSplit),f=Yr(),b=St();d.useEffect(()=>{const C=f.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,f]);const x=we(C=>C.play),p=we(C=>C.pause),v=we(C=>C.status),S=d.useCallback(C=>{C.stopPropagation(),v==="playing"||v==="loading"?p():x()},[v,x,p]),h=Yr(),c=St(),w=d.useCallback(async C=>{var L,j;if(C.stopPropagation(),v==="playing"||v==="loading"){p();return}const{progress:I}=c.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,c]);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(Ga,{}):m.jsx(Qa,{}),m.jsxs("div",{className:Le.container,children:[m.jsxs("div",{className:Le.leftGroup,children:[m.jsxs("div",{className:Le.leftleftGroup,children:[m.jsx(co,{direction:"left"}),m.jsx(pc,{isPlaying:v==="playing",onClick:o?w:S,title:v==="playing"?"일시정지":"재생"}),m.jsx(co,{direction:"right"})]}),m.jsx("div",{className:Le.leftrightGroup,children:m.jsx(ic,{})})]}),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(wa,{size:18}):m.jsx(Ca,{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(Ia,{size:18}),m.jsx("span",{className:Le.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:C=>{C.stopPropagation(),n&&u()},disabled:!n,className:`${Le.btn} ${i?Le.btnActive:""} ${n?"":Le.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ka,{size:18}),m.jsx("span",{className:Le.label,children:"끊어읽기"})]}),m.jsx(ba,{}),m.jsx(fn,{})]})]})]})}const gc=d.memo(hc);function mc(e){return tt({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 bc="_host_7t2sb_3",xc="_topbar_7t2sb_11",vc="_visible_7t2sb_32",Sc="_backBtn_7t2sb_37",yc="_title_7t2sb_58",wc="_settingsBtn_7t2sb_67",Tt={host:bc,topbar:xc,visible:vc,backBtn:Sc,title:yc,settingsBtn:wc};function Cc(){const e=te(l=>l.showOverlays),t=Z(l=>l.onViewerClose),r=Z(l=>l.section).ast.title,o=te(l=>l.setSettingsOpen),s=te(l=>l.setShowOverlays),i=d.useCallback(()=>{t==null||t()},[t]),a=d.useCallback(()=>{o(!0),s(!1)},[o,s]);return m.jsx("div",{className:Tt.host,children:m.jsxs("div",{className:`${Tt.topbar} ${e?Tt.visible:""}`,children:[m.jsx("button",{type:"button",className:Tt.backBtn,onClick:i,"aria-label":"뒤로가기",children:m.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:m.jsx("polyline",{points:"15 18 9 12 15 6"})})}),m.jsx("div",{className:Tt.title,children:m.jsx("span",{className:"truncate",children:r||"섹션 없음"})}),m.jsx("button",{type:"button",className:Tt.settingsBtn,onClick:a,"aria-label":"뷰어 설정",children:m.jsx(mc,{size:22})})]})})}const Ic=d.memo(Cc),kc="_wrap_62su0_7",Rc="_wrapHidden_62su0_29",Tc="_wrapVisible_62su0_35",_c="_scrollArea_62su0_71",Mc="_row_62su0_81",Ec="_label_62su0_89",jc="_btn_62su0_95",Pc="_btnActive_62su0_106",Oc="_btnSmall_62su0_110",Bc="_pill_62su0_122",zc="_themeCircle_62su0_133",Ac="_themeCircleActive_62su0_146",Lc="_stepRow_62su0_151",Gc="_stepLabel_62su0_159",Hc="_levelBox_62su0_172",Nc="_inlineFlex_62su0_177",Me={wrap:kc,wrapHidden:Rc,wrapVisible:Tc,scrollArea:_c,row:Mc,label:Ec,btn:jc,btnActive:Pc,btnSmall:Oc,pill:Bc,themeCircle:zc,themeCircleActive:Ac,stepRow:Lc,stepLabel:Gc,levelBox:Hc,inlineFlex:Nc};function Fc({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()),u=te(g=>g.getLineLevel()),f=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),c=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=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return m.jsxs("div",{className:E,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Me.scrollArea,children:[m.jsx(At,{label:"열람방식",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(_t,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(_t,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(At,{label:"테마",children:m.jsx("div",{className:Me.inlineFlex,children:Object.keys(sn).map(g=>{const y=g,_=sn[y];return m.jsx("button",{type:"button",onClick:()=>o(y),className:`${Me.themeCircle} ${r===g?Me.themeCircleActive:""}`,style:{background:_.bg,color:_.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),m.jsx(At,{label:"글꼴",children:m.jsx("div",{className:Me.inlineFlex,children:Ho.map(g=>m.jsx(_t,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),m.jsx(nn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>b(Math.max(1,l-1)),onInc:()=>b(Math.min(12,l+1))}),m.jsx(nn,{label:"줄 간격",level:u,min:1,max:7,onDec:()=>x(Math.max(1,u-1)),onInc:()=>x(Math.min(7,u+1))}),m.jsx(nn,{label:"여백",level:f,min:1,max:5,onDec:()=>p(Math.max(1,f-1)),onInc:()=>p(Math.min(5,f+1))}),m.jsx(At,{label:"포인터",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(_t,{active:v==="highlight",onClick:()=>S("highlight"),children:"형광펜"}),m.jsx(_t,{active:v==="underline",onClick:()=>S("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:h,onChange:g=>c(g.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(At,{label:"끊기표시",children:m.jsx("div",{className:Me.inlineFlex,children:m.jsx(_t,{active:w.slash,onClick:()=>C("slash"),children:"슬래쉬"})})}),m.jsx(nn,{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:Me.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:Me.pill,children:"보기 설정 초기화"})})]})}function At({label:e,children:t}){return m.jsxs("div",{className:Me.row,children:[m.jsx("label",{className:Me.label,children:e}),t]})}function _t({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 nn({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 Wc=d.memo(function(){const t=te(i=>i.showOverlays),n=te(i=>i.isSettingsOpen),r=Z(i=>i.rangeStartGI),o=Z(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(Ic,{}),m.jsx(gc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Fc,{visible:!t&&n})})]})}),Vc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let u=i;if(a){const f=(l==null?void 0:l.equalityFn)||Object.is;let b=i(r.getState());u=x=>{const p=i(x);if(!f(b,p)){const v=b;a(b=p,v)}},l!=null&&l.fireImmediately&&a(b,b)}return o(u)}),e(t,n,r)},Dc=Vc;function $c(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 Uc(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 Kc(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 c=v[p-h];if(c)return{clip:c.clip,t:c.t}}for(let h=1;h<=100;h++){const c=v[p+h];if(c)return{clip:c.clip,t:c.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Uc(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 u=s.length>0,f=u?"paused":"idle",b=u?"real":"fake",x=u?null:{totalWords:l};return yt(Dc((p,v)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:f,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(c=>({currentClip:Math.max(0,Math.min(h.clip,Math.max(0,c.clips.length-1))),currentTimeMs:Math.max(0,h.t)})),r=void 0}},setClipAndMs:(S,h)=>p(c=>{const w=Math.max(0,c.clips.length-1);return{currentClip:Math.max(0,Math.min(S,w)),currentTimeMs:Math.max(0,h),status:c.status,scrollLock:c.scrollLock}}),setClips:S=>p(h=>{const c=Array.isArray(S)?S:[],w=c.length>0;return{clips:c,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(c=>{if(c.playbackKind==="fake")return{status:"playing",scrollLock:!0};const w=typeof S=="number"?S:c.currentClip,C=typeof h=="number"?h:c.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(w,Math.max(0,c.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 c=typeof S=="number"?S:h.currentClip;return $c(h.clips[c])},getGIFromCT:(S,h)=>{if(!n)return-1;const c=n.byClip[S];if(!c||c.length===0)return-1;let w=0,C=c.length-1,I=0;for(;w<=C;){const T=w+C>>1;c[T].t<=h?(I=T,w=T+1):C=T-1}return c[Math.max(0,Math.min(I,c.length-1))].g},getCTFromGI:S=>{if(!n)return null;const{g2ct:h}=n;if(!h)return null;let c=h[S];if(!c){let w=S-1;const C=Math.max(0,S-100);for(;w>=C;){if(h[w]){c=h[w];break}w--}if(!c){let I=S+1;const T=S+100;for(;h[I]==null&&I<=T;)I++;h[I]&&(c=h[I])}}return c?{clip:c.clip,timeMs:c.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 Qc({children:e,initialState:t}){const n=d.useContext(wt)??void 0,r=d.useMemo(()=>Kc({...t,recorderStore:n}),[t,n]);return m.jsx(bn.Provider,{value:r,children:e})}function Yc(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 u=0;u<l.length;u++){const f=l[u],b=o+u;f.audioChunkIndex!=null&&f.audioTimeMs!=null&&((t[i=f.audioChunkIndex]||(t[i]=[])).push({t:f.audioTimeMs,g:b}),n[b]={clip:f.audioChunkIndex,t:f.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,u)=>l.t-u.t)),{byClip:t,g2ct:n}}function Xc(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 Zc(e){const t=Xl(e),n=Zl(t),r=t.reduce((f,b)=>f+(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((f,b)=>{var h;if(f.type!=="paragraph")return;const x=n[b]??0,p=f.runs??[];for(let c=0;c<p.length;c++){const w=((h=p[c])==null?void 0:h.text)||"";rr(w)&&(s[x+c]=1)}const S=Jl(p,x).map(c=>{var T;const w=c.startG-x,C=c.endG-c.startG+1;let I=-1;for(let E=0;E<C;E++){const g=((T=p[w+E])==null?void 0:T.text)??"";if(rr(g)){I=c.startG+E;break}}return{startG:c.startG,endG:c.endG,r0:w,len:C,firstReadableGI:I,splitIndex:c.splitIndex}});a[b]=S;for(const c of S){const w=i.length;for(let C=c.startG;C<=c.endG;C++)o[C]=w;i.push(c)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function Jc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:u}=e,f=a.totalRuns??0,b=typeof l=="number"?l:f>0?0:-1,x=b>=0?Xc(i.readableGi,b,f):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:x,lastUpdateBy:"program",totalRuns:f,pageIndex:0,sectionLoading:!0,_loadingStartTime:u,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function eu(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:u,layout:f}=Zc(l),b=Date.now(),x=Jc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:u,layout:f,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,c=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,Y=U.totalRuns>0?Math.max(-1,Math.min(j,U.totalRuns-1)):j;W===Y&&U.lastUpdateBy===A||(p(ce=>({progress:{...ce.progress,currentGlobalRunIndex:Y,lastUpdateBy:A}})),W!==Y&&a&&a.getState().emit({type:"global_index_change",payload:{globalIndex:Y}}))},C=j=>{const{sectionLoading:A,_loadingStartTime:W}=v().progress;if(A===j)return;const U=Date.now();if(j)p(Y=>({progress:{...Y.progress,sectionLoading:!0,_loadingStartTime:U}})),a&&a.getState().emit({type:"loading_start",payload:{}});else{const ce=(W?U-W:0)/1e3;p(ie=>({progress:{...ie.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:ce}})}},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 Y=((me=W.ast)==null?void 0:me.blocks)??[],ce=U.prefix,ie=[];for(let be=0;be<Y.length;be++){const K=Y[be];if(K.type!=="paragraph")continue;const oe=K.runs??[],G=ce[be]??0;for(let ee=0;ee<oe.length;ee++){const M=G+ee;M>=j&&M<=A&&ie.push(oe[ee].text??"")}}return ie.join("")},_=j=>{const{totalRuns:A,derivedNav:W}=v().progress,U=W==null?void 0:W.readableGi;if(!U||A<=0)return j;const Y=A,ce=Math.max(0,Math.min(j,Y-1));if(U[ce])return ce;let ie=ce-1,me=ce+1;for(;ie>=0||me<Y;){if(me<Y&&U[me])return me;if(ie>=0&&U[ie])return ie;me+=1,ie-=1}return ce},B=(j,A)=>{const{totalRuns:W,derivedNav:U}=v().progress,Y=U==null?void 0:U.readableGi;if(!Y||W<=0)return null;if(A>0){for(let ce=Math.min(Math.max(j,0),W-1);ce<W;ce+=1)if(Y[ce])return ce}else for(let ce=Math.min(Math.max(j,0),W-1);ce>=0;ce-=1)if(Y[ce])return ce;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 Y=A-1;Y>=0;Y-=1)if(U[Y])return Y}else for(let Y=0;Y<A;Y+=1)if(U[Y])return Y;return null};return{progress:{...x,registerSectionScrollApi:S,getSectionScrollApi:h,setTotalRuns:c,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 Y=(U==null?void 0:U.groups)??[],ce=U==null?void 0:U.giToGroupIdx;if(!Y.length||!ce){const G=W-1;return _(Math.max(0,Math.min(j+A,G)))}let ie=ce[j]??-1;if(ie<0||ie>=Y.length)for(let oe=0;oe<Y.length;oe+=1){const G=Y[oe];if(j>=G.startG&&j<=G.endG){ie=oe;break}}if(ie<0||ie>=Y.length)return R(A)??_(j);const me=oe=>oe>=0&&oe<Y.length&&(Y[oe].firstReadableGI??-1)>=0;let be=ie+A;for(;be>=0&&be<Y.length&&!me(be);)be+=A;if(be<0||be>=Y.length)return R(A)??_(j+A);const K=Y[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 tu({children:e,initialState:t}){const n=d.useContext(wt),r=d.useMemo(()=>eu({...t,recorderStore:n}),[t,n]);return m.jsx(br.Provider,{value:r,children:e})}function nu({children:e,initialState:t}){const n=d.useContext(wt)??void 0,r=d.useMemo(()=>ri({init:t,recorderStore:n}),[]);return m.jsx(or.Provider,{value:r,children:e})}const ru=({pages:e,pageIndex:t,maxWidth:n})=>{const r=Z(I=>I.section),o=d.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),u=te(I=>I.viewportHeight),f=te(I=>I.playbackViewportHeight),b=f>0?f:u,x=Z(I=>{var T;return((T=I.layout)==null?void 0:T.prefix)??[]}),p=Z(I=>{var T;return((T=I.derivedNav)==null?void 0:T.splitGroupsPerBlock)??[]}),v=e[t],S=d.useMemo(()=>{const I=[];return o.forEach((T,E)=>{(T.type==="paragraph"||T.type==="image")&&I.push(E)}),I},[o]),h=d.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]),c=d.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=d.useMemo(()=>{const I=[],T=xr();return c.forEach((E,g)=>{I[g]=vr(E.b,T)}),I},[c]),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=c.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]??[],Y=W+L,ce=W+j;let ie=C(U,Y,ce);const me=W+L;ie=ie.map(M=>{const F=Math.max(0,(M.startG??Y)-me),H=M.len??Math.max(1,(M.endG??ce)-(M.startG??Y)+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(vs,{preGroups:ie,runs:be,ns:B,baseIndex:me,sectionId:String(r.section_id)})]})},B)})})]})})},fo=.5;function ou(e,t){const n=d.useRef(null),r=d.useRef(null),o=d.useRef(!1);d.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 u=l[0],{width:f,height:b}=u.contentRect,x=r.current;if(!x){r.current={w:f,h:b};return}Math.abs(x.w-f)<fo&&Math.abs(x.h-b)<fo||(r.current={w:f,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 su(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,horizontalThreshold:i=120,verticalTolerance:a=40,velocityThreshold:l=.6,singleDelayMs:u=250,doubleClickWindowMs:f=300,suppressAfterSwipeMs:b=250,onDragMove:x,onDragEnd:p,pageTransitionThreshold:v}=e,S=v??i,h=Math.min(20,i),c=nt.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),w=()=>{c.current.singleTimer!=null&&(window.clearTimeout(c.current.singleTimer),c.current.singleTimer=null)},C=()=>{var k;const P=((k=document==null?void 0:document.body)==null?void 0:k.style)??null;P&&c.current.prevUserSelect!=null&&(P.userSelect=c.current.prevUserSelect,c.current.prevUserSelect=null),c.current.capturedEl&&c.current.pid!=null&&typeof c.current.capturedEl.hasPointerCapture=="function"&&c.current.capturedEl.hasPointerCapture(c.current.pid)&&c.current.capturedEl.releasePointerCapture(c.current.pid),c.current.capturedEl=null},I=nt.useCallback(P=>{s!=null&&s(P.target)||(c.current.pid=P.pointerId,c.current.startX=P.clientX,c.current.startY=P.clientY,c.current.startT=P.timeStamp,c.current.swiping=!1,c.current.canceledClick=!1,c.current.capturedEl=P.currentTarget)},[s]),T=nt.useCallback(P=>{var j;if(c.current.pid==null||P.pointerId!==c.current.pid)return;const k=P.clientX-c.current.startX,O=P.clientY-c.current.startY,z=Math.abs(k),L=Math.abs(O);if(!c.current.swiping){if(z>=h&&L<=a&&z>L){c.current.swiping=!0,c.current.canceledClick=!0;const A=c.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&&(c.current.prevUserSelect=W.userSelect??null,W.userSelect="none"),P.preventDefault()}return}x==null||x(k),P.preventDefault()},[a,x]),E=nt.useCallback(P=>{if(c.current.pid==null||P.pointerId!==c.current.pid)return;const k=P.timeStamp-c.current.startT,O=P.clientX-c.current.startX;if(c.current.swiping){const z=Math.abs(O)/Math.max(1,k);Math.abs(O)>=S||z>=l?O<0?n():t():p==null||p(),c.current.lastSwipeAt=P.timeStamp}else P.timeStamp-c.current.lastUpT;C(),c.current.lastUpT=P.timeStamp,c.current.pid=null,c.current.swiping=!1},[S,l,n,t,f,p]),g=nt.useCallback(()=>{c.current.swiping&&(p==null||p()),C(),c.current.pid=null,c.current.swiping=!1,c.current.canceledClick=!1},[p]),y=nt.useCallback(P=>{var k,O;(O=(k=c.current.capturedEl)==null?void 0:k.hasPointerCapture)!=null&&O.call(k,P.pointerId)||c.current.pid!=null&&c.current.swiping&&(p==null||p(),C(),c.current.pid=null,c.current.swiping=!1,c.current.canceledClick=!1)},[p]),_=nt.useCallback(()=>{c.current.pid!=null&&c.current.swiping&&(p==null||p()),C(),c.current.pid=null,c.current.swiping=!1,c.current.canceledClick=!1},[p]),B=nt.useCallback(P=>{if(!(s!=null&&s(P.target))&&!(P.timeStamp-c.current.lastSwipeAt<b)){if(c.current.canceledClick){c.current.canceledClick=!1;return}r&&c.current.singleTimer==null&&(c.current.singleTimer=window.setTimeout(()=>{c.current.singleTimer=null,r(P)},u))}},[r,s,u,b]),R=nt.useCallback(P=>{if(!(s!=null&&s(P.target))&&!(P.timeStamp-c.current.lastSwipeAt<b)){if(c.current.canceledClick){c.current.canceledClick=!1;return}w(),o==null||o(P)}},[o,s,b]);return nt.useEffect(()=>()=>{w(),C()},[]),{onPointerDown:I,onPointerMove:T,onPointerUp:E,onPointerCancel:g,onPointerLeave:y,onLostPointerCapture:_,onClick:B,onDoubleClick:R}}var On,po;function Rs(){if(po)return On;po=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return On=e,On}var Bn,ho;function iu(){if(ho)return Bn;ho=1;var e=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt;return Bn=e,Bn}var zn,go;function Ts(){if(go)return zn;go=1;var e=iu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return zn=n,zn}var An,mo;function lu(){if(mo)return An;mo=1;var e=Ts(),t=function(){return e.Date.now()};return An=t,An}var Ln,bo;function au(){if(bo)return Ln;bo=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Ln=t,Ln}var Gn,xo;function cu(){if(xo)return Gn;xo=1;var e=au(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Gn=n,Gn}var Hn,vo;function _s(){if(vo)return Hn;vo=1;var e=Ts(),t=e.Symbol;return Hn=t,Hn}var Nn,So;function uu(){if(So)return Nn;So=1;var e=_s(),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 u=!0}catch{}var f=r.call(i);return u&&(a?i[o]=l:delete i[o]),f}return Nn=s,Nn}var Fn,yo;function du(){if(yo)return Fn;yo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Fn=n,Fn}var Wn,wo;function fu(){if(wo)return Wn;wo=1;var e=_s(),t=uu(),n=du(),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 Wn=i,Wn}var Vn,Co;function pu(){if(Co)return Vn;Co=1;function e(t){return t!=null&&typeof t=="object"}return Vn=e,Vn}var Dn,Io;function hu(){if(Io)return Dn;Io=1;var e=fu(),t=pu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Dn=r,Dn}var $n,ko;function gu(){if(ko)return $n;ko=1;var e=cu(),t=Rs(),n=hu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(u){if(typeof u=="number")return u;if(n(u))return r;if(t(u)){var f=typeof u.valueOf=="function"?u.valueOf():u;u=t(f)?f+"":f}if(typeof u!="string")return u===0?u:+u;u=e(u);var b=s.test(u);return b||i.test(u)?a(u.slice(2),b?2:8):o.test(u)?r:+u}return $n=l,$n}var qn,Ro;function mu(){if(Ro)return qn;Ro=1;var e=Rs(),t=lu(),n=gu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,u){var f,b,x,p,v,S,h=0,c=!1,w=!1,C=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(u)&&(c=!!u.leading,w="maxWait"in u,x=w?o(n(u.maxWait)||0,l):x,C="trailing"in u?!!u.trailing:C);function I(k){var O=f,z=b;return f=b=void 0,h=k,p=a.apply(z,O),p}function T(k){return h=k,v=setTimeout(y,l),c?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&&f?I(k):(f=b=void 0,p)}function B(){v!==void 0&&clearTimeout(v),h=0,f=S=b=v=void 0}function R(){return v===void 0?p:_(t())}function P(){var k=t(),O=g(k);if(f=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 qn=i,qn}var bu=mu();const xu=Lo(bu);function vu(e,t=200,n,r){const o=d.useRef(e),s=d.useRef(n);d.useEffect(()=>{o.current=e},[e]),d.useEffect(()=>{s.current=n},[n]);const i=d.useMemo(()=>{const a=xu((...u)=>{o.current(...u)},t,r),l=((...u)=>{var f;(f=s.current)==null||f.call(s),a(...u)});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 d.useEffect(()=>()=>i.cancel(),[i]),i}let Ms=0;class Es extends Error{constructor(){super("calcPages canceled due to a newer invocation");wr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const Ze=e=>{if(e!==Ms)throw new Es},Un=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},To=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},Su=(e,t)=>{if(t<16)return async(r=24)=>{Ze(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(Ze(e),await new Promise(o=>requestAnimationFrame(()=>o())),Ze(e))}};async function yu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:u,breakGapPx:f=0,showSlash:b,paragraphMarkers:x,playbackScale:p=1,viewportHeight:v=0}){var h,c,w;const S=++Ms;Ze(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`,Ze(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=Su(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},Y=(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),u&&(D!=null&&D.split)&&Q!==H.length-1){const ne=Math.max(0,(f??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($)},ce=v>80?Math.floor((v-80)*.6):void 0,ie=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%",ce&&($.style.maxHeight=`${ce}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++){Ze(S);const F=r[M];if(L.dataset.block=String(M),L.innerHTML="",F.kind==="image"){const ue=F.block,Ce=ie(ue);L.appendChild(Ce);const ze=Ce.getBoundingClientRect(),{mt:Pe,mb:Ae}=Un(Ce);A[M]={contentH:Math.ceil(ze.height),mt:Pe,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"?((c=H.list)==null?void 0:c.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),Y(ue,H.runs),Y(Ce,H.runs);const Pe=document.createDocumentFragment();Pe.appendChild(ue),Pe.appendChild(Ce),L.appendChild(Pe)}else{const ue=U(H,$);ue.dataset.variant="with",Y(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=To(J),Ce=To(se),{mt:ze,mb:Pe}=Un(J),{mt:Ae,mb:Fe}=Un(se),We=((w=H.runs)==null?void 0:w.length)??0,Ee=ne?Ce:ue,Ye=ne?Ae:ze,Ue=ne?Fe:Pe;if(M<3){const q=J.getBoundingClientRect().height;console.log(`[calcPages] para ${M}: height=${q.toFixed(2)}, lastBottom=[${ue.slice(-3).map(Ie=>Ie.toFixed(1)).join(",")}], runs=${We}`)}j.set(M,{runsLen:We,lastBottomWith:ue,lastBottomNo:Ee,mtWith:ze,mbWith:Pe,mtNo:Ye,mbNo:Ue})}await W(24)}Ze(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;){Ze(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(Ze(S),r[K].kind==="image"){const Ee=A[K]??{contentH:0,mt:0,mb:0},Ue=(F===0?Ee.mt:H+Ee.mt)+Ee.contentH;if(_(Ue,F)){F+=Ue,Q=K,D=void 0,H=Ee.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),Pe=(F===0?Ce.top:H+Ce.top)+Ce.content;if(_(Pe,F)){F+=Pe,Q=K,D=ne-1,H=Ce.mb,K+=1,oe=void 0,G=null,ee=null;continue}let Ae=se,Fe=ne-1,We=se-1;for(;Ae<=Fe;){Ze(S);const Ee=Ae+Fe>>1,Ye=me(J,se,Ee,ue),Ue=(F===0?Ye.top:H+Ye.top)+Ye.content;_(Ue,F)?(We=Ee,Ae=Ee+1):Fe=Ee-1}if(We>=se){be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:We}),oe=We+1,G=K,ee=We,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 Ee=se;be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:Ee}),oe=Ee+1,G=K,ee=Ee,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=""),Ze(S),{pages:be,pageByRunIndex:null}}catch(C){throw(C==null?void 0:C.name)==="CalcPagesCanceled",C}}function wu(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 Cu(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 u=((o=l.block.runs)==null?void 0:o.length)??0;if(!u)continue;let f=0,b=u-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(f=Math.max(0,Math.min(i.startOffsetInBlock,b))),a===i.endBlock&&i.endOffsetInBlock!=null&&(b=Math.max(f,Math.min(i.endOffsetInBlock,b)));const x=r[l.originalIndex]??0,p=x+f,v=x+b;if(e>=p&&e<=v)return s}}return-1}function Iu(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 ku(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 Ru(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 Tu(){var Ue;const e=Z(q=>q.section),t=Z(q=>q.sectionLoading),n=Z(q=>q.rangeStartGI),r=Z(q=>q.rangeEndGI),o=n!=null&&r!=null,s=zt(),i=te(q=>q.theme),a=sn[i],l=te(q=>q.fontFamily),u=te(q=>q.fontSizePx),f=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=d.useRef(null),{items:c}=d.useMemo(()=>{var q;return Ru(((q=e==null?void 0:e.ast)==null?void 0:q.blocks)??[])},[e]),w=d.useMemo(()=>{const q=[],Ie=xr();return c.forEach(Oe=>{if(Oe.kind==="paragraph"){const ct=Oe.paraIndex;q[ct]=vr(Oe.block,Ie)}}),q},[c]),[C,I]=d.useState({pages:[],pageByRunIndex:null}),T=Z(q=>q.pageIndex),E=Z(q=>q.setPageIndex),g=d.useRef(0),y=d.useRef(null),[_,B]=d.useState(!1),[R,P]=d.useState(null),[k,O]=d.useState(!1),z=d.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:u,lineHeight:f,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,u,f]),{showSplit:L,breakGapPx:j,slash:A}=te(qt(q=>{var Ie;return{showSplit:q.showSplit,breakGapPx:q.breakGapPx??0,slash:((Ie=q.breakMarks)==null?void 0:Ie.slash)??!1}})),W=St();d.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=d.useCallback(()=>{console.log("@@@@@@recalc호출");const q=h.current,Ie=de.current,Oe=J.current;if(console.log("showSplit",L),!q||!Ie||!Oe||c.length===0){I({pages:[],pageByRunIndex:null}),E(0);return}(async()=>{const ct=performance.now();try{const bt=s.getState().playbackScale,{pages:yr,pageByRunIndex:Gs}=await yu({viewHost:q,measureRoot:Ie,contentArea:Oe,items:c,cfgMaxWidth:S,marginX:b,fontFamily:l,fontSizePx:u,lineHeight:f,showSplit:L,breakGapPx:j,showSlash:A,paragraphMarkers:w,playbackScale:bt,viewportHeight:v}),Hs=performance.now();console.log(`✅ calcPages 완료: ${(Hs-ct).toFixed(1)} ms (${yr.length} pages)`),I({pages:yr,pageByRunIndex:Gs}),E(0)}catch(bt){if(bt instanceof Es){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",bt)}})()},[e,c,S,b,l,u,f,L,j,A,w,s,v]),Y=Z(q=>q.setCurrentGlobalRunIndex);Z(q=>q.totalRuns);const ce=Z(q=>{var Ie;return((Ie=q.layout)==null?void 0:Ie.prefix)??[]}),ie=d.useCallback(q=>{const Ie=C.pages.length+1,Oe=T+q;if(Oe<0||Oe>=Ie)return;if(Oe===C.pages.length){E(Oe);return}const ct=wu(C.pages[Oe],c,ce);ct!=null?Y(ct,"scrubber-step"):E(Oe)},[T,C.pages,c,ce,Y,E]),me=d.useCallback(()=>{_||g.current!==0?(P("prev"),B(!1)):ie(-1)},[_,ie]),be=d.useCallback(()=>{_||g.current!==0?(P("next"),B(!1)):ie(1)},[_,ie]),K=Pt(),oe=d.useCallback(()=>{const{isSettingsOpen:q,setSettingsOpen:Ie,toggleOverlays:Oe}=K.getState();q?Ie(!1):Oe()},[K]),G=C.pages.length+1,ee=((Ue=h.current)==null?void 0:Ue.clientWidth)||400,M=d.useCallback(q=>{var bt;const Ie=y.current;if(!Ie)return;const Oe=((bt=h.current)==null?void 0:bt.clientWidth)||1,ct=q/Oe*33.333;Ie.style.transform=`translate3d(${-33.333+ct}%, 0, 0)`},[]),F=d.useCallback(q=>{T===0&&q>0||T>=G-1&&q<0||(g.current=q,M(q),_||B(!0))},[T,G,M,_]),H=d.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)")},[]),$=d.useCallback(q=>{if(q.target!==q.currentTarget||q.propertyName!=="transform")return;const Ie=R;O(!0),P(null),g.current=0,Ie==="prev"?ie(-1):Ie==="next"&&ie(1)},[R,ie]);d.useLayoutEffect(()=>{k&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{O(!1)})})},[k]);const Q=d.useCallback(q=>o||ku(q)?!0:Iu(q),[o]),D=su({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=d.useRef(null),J=d.useRef(null),ne=d.useCallback(()=>{const q=W.getState().progress.setSectionLoading;q(!0)},[W]),se=vu(U,200,ne,{trailing:!0,leading:!1,maxWait:1e3}),ue=d.useRef("");d.useEffect(()=>{if(v<=0)return;const q=`${l}|${u}|${f}|${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,u,f,b,L,j,A,v,e==null?void 0:e.section_id]),ou([h],se);const Ce=Z(q=>q.registerSectionScrollApi);d.useEffect(()=>(Ce({ensureVisibleGI:async()=>!0,scrollToGI:async()=>!0,getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:async()=>{},stepPage:ie}),()=>Ce(void 0)),[Ce,ie]);const ze=e.quiz&&e.quiz.length>0,Pe=T>0?T-1:null,Ae=T<G-1?T+1:null,Fe=d.useMemo(()=>R==="prev"?"translate3d(0%, 0, 0)":R==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[R]),We=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(ws,{}),m.jsx(fn,{isIcon:!1})]}):m.jsx(ru,{pages:C.pages,pageIndex:q,maxWidth:S}),Ee={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Ye=!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:Fe,transition:Ye?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:R?$:void 0,children:[m.jsx("div",{style:Ee,children:Pe!==null&&We(Pe)}),m.jsx("div",{style:Ee,children:We(T)}),m.jsx("div",{style:Ee,children:Ae!==null&&We(Ae)})]}),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:u,lineHeight:f,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(_u,{pages:C.pages,items:c,onGotoPage:E})]})}const _u=({pages:e,items:t,onGotoPage:n})=>{const r=Z(s=>s.currentGlobalRunIndex),o=Z(s=>{var i;return((i=s.layout)==null?void 0:i.prefix)??[]});return d.useEffect(()=>{if(r==null||e.length===0)return;const s=Cu(r,e,t,o);s>=0&&n(s)},[r,e,t,o,n]),m.jsx(m.Fragment,{})},Mu="_wrapper_dbk3n_1",Eu="_spinner_dbk3n_10",_o={wrapper:Mu,spinner:Eu};function ju({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${_o.wrapper}`,children:m.jsx("div",{className:_o.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Pu(){const e=Z(qt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(ju,{})})}const Ou="_Overlay_ybic8_3",Bu="_Dialog_ybic8_15",zu="_Body_ybic8_25",Au="_Header_ybic8_32",Lu="_Paging_ybic8_39",Gu="_Remaining_ybic8_48",Hu="_RemainingDanger_ybic8_55",Nu="_NextBtn_ybic8_59",Fu="_CloseBtn_ybic8_96",Wu="_Question_ybic8_113",Vu="_Score_ybic8_123",Du="_Image_ybic8_130",$u="_Options_ybic8_140",qu="_OptionBtn_ybic8_145",Uu="_OptionBtnActive_ybic8_165",Ku="_Footer_ybic8_172",Qu="_OptionBtnCorrect_ybic8_195",Yu="_Judge_ybic8_201",Xu="_Correct_ybic8_212",Zu="_Incorrect_ybic8_215",Ju="_ResultHeader_ybic8_220",ed="_ResultActions_ybic8_233",td="_CloseBtnSoft_ybic8_239",nd="_SummaryGrid_ybic8_249",rd="_StatCard_ybic8_257",od="_StatLabel_ybic8_265",sd="_StatValue_ybic8_270",id="_StatSub_ybic8_277",pe={Overlay:Ou,Dialog:Bu,Body:zu,Header:Au,Paging:Lu,Remaining:Gu,RemainingDanger:Hu,NextBtn:Nu,CloseBtn:Fu,Question:Wu,Score:Vu,Image:Du,Options:$u,OptionBtn:qu,OptionBtnActive:Uu,Footer:Ku,OptionBtnCorrect:Qu,Judge:Yu,Correct:Xu,Incorrect:Zu,ResultHeader:Ju,ResultActions:ed,CloseBtnSoft:td,SummaryGrid:nd,StatCard:rd,StatLabel:od,StatValue:sd,StatSub:id};function ld(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function js(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function ad(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 cd=d.memo(function(){const t=Xe(h=>h.phase),n=Xe(h=>h.quizzes),r=Xe(h=>h.order),o=Xe(h=>h.currentIndex),s=Xe(h=>h.answers),i=Xe(h=>h.correctCount),a=Xe(h=>h.remainingSec),l=Xe(h=>h.uiReveal),u=Xe(h=>h.startedAt),f=Xe(h=>h.finishedAt),b=Xe(h=>h.perQ),x=ys();d.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=d.useMemo(()=>{if(t==="idle"||t!=="finished")return;const h=r.map(j=>n[j]),c=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 u=="number"&&typeof f=="number"?Math.max(0,f-u):I.reduce((j,A)=>j+(A.ms??0),0),E=c>0?Math.round(T/c):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:c,correct:i,rate:c?Math.round(i/c*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,u,f,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(ud,{q:p,index:o,total:r.length,selected:v,uiReveal:l,onSelect:h=>{if(l)return;const c=x.getState();js(p)?c.selectToggle(h):c.selectSingle(h)},onBeforeNext:()=>x.getState().setReveal(!0),onNext:()=>x.getState().afterRevealNext(),remainingSec:a,onClose:()=>x.getState().close()}):m.jsx(dd,{total:r.length,correct:i,summary:S,onClose:()=>x.getState().close()})})})});function ud(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:u,onClose:f}=e,b=js(t),x=d.useMemo(()=>{const h=t.options.map((c,w)=>({opt:c,i:w}));for(let c=h.length-1;c>0;c--){const w=Math.floor(Math.random()*(c+1));[h[c],h[w]]=[h[w],h[c]]}return h},[t.qid]),p=d.useMemo(()=>ld(t),[t]),v=d.useMemo(()=>ad(t),[t]),S=d.useMemo(()=>{const h=[...o].sort((c,w)=>c-w);if(h.length!==v.length)return!1;for(let c=0;c<h.length;c++)if(h[c]!==v[c])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:f,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:c})=>{const w=o.includes(c),C=v.includes(c),I=[pe.OptionBtn,w?pe.OptionBtnActive:"",s&&C?pe.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(c),className:I,disabled:s,children:h},c)})}),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 u=="number"&&m.jsx("span",{className:`${pe.Remaining} ${u<=5?pe.RemainingDanger:""}`,children:` (${u} s )`})]})})]})}function Mo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function dd(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:Mo(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:pe.StatSub,children:`평균 ${Mo(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 fd(e){return e.map((t,n)=>n)}function pd(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 Kn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Qn(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 Eo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:fd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function hd(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=Eo(e);return yt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Eo(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 u=a.quizzes[a.order[a.currentIndex]].qid,f=a.answers[u]??[],b=f.includes(i)?f.filter(x=>x!==i):[...f,i].sort((x,p)=>x-p);o({answers:{...a.answers,[u]:b}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const u=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[u]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],u=l.qid,f=(i.answers[u]??[]).slice().sort((h,c)=>h-c),b=Qn(l),x=pd(f,b),p=i.questionStartedAt?Date.now()-i.questionStartedAt:0,v=i.perQ[u],S={qid:u,index:l.index,question:l.question,score:l.score??0,multi:Kn(l),selected:f,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,[u]: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]],u=l.qid,f=a.perQ[u],b={qid:u,index:l.index,question:l.question,score:l.score??0,multi:Kn(l),selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??Qn(l),isCorrect:(f==null?void 0:f.isCorrect)??!1,ms:(f==null?void 0:f.ms)??0,revealed:!0,timedOut:(f==null?void 0:f.timedOut)??!1};o({perQ:{...a.perQ,[u]: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]],u=l.qid,f=i.perQ[u],b={qid:u,index:l.index,question:l.question,score:l.score??0,multi:Kn(l),selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??Qn(l),isCorrect:(f==null?void 0:f.isCorrect)??!1,ms:(f==null?void 0:f.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[u]:b}})}else o({remainingSec:a})}}))}function gd({children:e,initialState:t}){const n=d.useMemo(()=>hd(t.section),[t]),r=d.useRef(t.onQuizComplete);return d.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),d.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:u,order:f,perQ:b,startedAt:x,finishedAt:p}=s,v=f.map(E=>u[E]),S=v.length,h=v.filter(E=>{var g;return(g=b[E.qid])==null?void 0:g.isCorrect}).length,c=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:c,gainedScore:w,timeMsTotal:C,perQuestion:I};a(T)}});return()=>o()},[n]),m.jsx(Sr.Provider,{value:n,children:e})}function md({containerRef:e}){const t=zt(),n=Pt();return d.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 bd=e=>e;function xd(e,t=bd){const n=d.useSyncExternalStore(e.subscribe,d.useCallback(()=>t(e.getState()),[e,t]),d.useCallback(()=>t(e.getInitialState()),[e,t]));return d.useDebugValue(n),n}const jo=e=>{const t=yt(e),n=r=>xd(t,r);return Object.assign(n,t),n},vd=(e=>e?jo(e):jo),Po=vd(e=>({_snapshotGetter:null,registerSnapshotGetter:t=>{e({_snapshotGetter:t})},unregisterSnapshotGetter:()=>{e({_snapshotGetter:null})}}));function Sd({containerRef:e}){const t=Pt(),n=St(),r=zt();return d.useEffect(()=>{if(!!!r.getState().emitCallback)return;const s=()=>{var h,c,w,C,I;const i=t.getState(),{progress:a}=n.getState(),l=(h=e.current)==null?void 0:h.getBoundingClientRect(),u=(l==null?void 0:l.width)??0,f=(l==null?void 0:l.height)??0,b=(c=a.getSectionScrollApi)==null?void 0:c.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:u,viewportHeight:f}};return Po.getState().registerSnapshotGetter(s),()=>{Po.getState().unregisterSnapshotGetter()}},[r,t,n,e]),null}function yd(){const e=zt(),t=Pt(),n=St(),r=d.useContext(bn),o=d.useCallback(l=>{const{viewerState:u}=l;if(u){u.mode&&t.getState().setMode(u.mode);const{mode:b,...x}=u;t.setState(x)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(u==null?void 0:u.mode)==="scroll"||!(u!=null&&u.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=d.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:u}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(u,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:f,anchorGI:b,anchorOffsetRatio:x}=l.payload,p=n.getState().progress.getSectionScrollApi();p&&(f===0?p.setScrollTop(0):p.scrollToGIAtOffset&&typeof b=="number"&&p.scrollToGIAtOffset(b,x));break}case"settings_change":{const{key:u,value:f}=l.payload,b=t.getState();u in b&&typeof b[u]!="function"&&t.setState({[u]:f});break}case"mode_change":{const{mode:u}=l.payload;t.getState().setMode(u);break}case"audio_control":{if(!r)break;const{action:u}=l.payload;switch(u){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=d.useCallback(()=>{e.getState().setDispatchHandler(s),e.getState().setApplySnapshotHandler(o)},[e,s,o]),a=d.useCallback(()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)},[e]);return d.useEffect(()=>{if(e.getState().isPlaybackMode)return i(),()=>a()},[e,i,a]),d.useEffect(()=>e.subscribe((u,f)=>{u.isPlaybackMode&&!f.isPlaybackMode?i():!u.isPlaybackMode&&f.isPlaybackMode&&a()}),[e,i,a]),null}const Oo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","audioTargetWpm","showPointer","showSplit","showOverlays","isSettingsOpen"];function wd(){const e=zt(),t=Pt(),n=d.useRef(null);return d.useEffect(()=>{const r=t.getState();n.current={};for(const s of Oo)n.current[s]=r[s];const o=t.subscribe(s=>{const i=n.current;if(i)for(const a of Oo){const l=i[a],u=s[a];l!==u&&(a==="mode"?e.getState().emit({type:"mode_change",payload:{mode:u}}):e.getState().emit({type:"settings_change",payload:{key:a,value:u}}),i[a]=u)}});return()=>{o(),n.current=null}},[e,t]),null}const Cd=({onTranslate:e})=>{const t=Z(f=>f.rangeStartGI),n=Z(f=>f.rangeEndGI),r=Z(f=>f.getRangeText),o=Z(f=>f.clearRange),s=t!=null&&n!=null,[i,a]=d.useState(null);d.useEffect(()=>{if(!s)return;const f=()=>{o()};return window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[s,o]),d.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const f=()=>{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,c=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)-c-C;let E=T;T<w&&(E=x.bottom+C),a({x:I,y:E})};return f(),window.addEventListener("scroll",f,!0),()=>window.removeEventListener("scroll",f,!0)},[s,t,n]);const l=d.useCallback(async()=>{const f=r();if(f)try{await navigator.clipboard.writeText(f)}catch(b){console.error("복사 실패:",b)}o()},[r,o]),u=d.useCallback(()=>{const f=r();f&&e&&e(f)},[r,e]);return!s||!i?null:m.jsxs("div",{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:u,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},Id="_handleStart_1336y_16 _handle_1336y_1",kd="_handleEnd_1336y_21 _handle_1336y_1",Bo={handleStart:Id,handleEnd:kd},Rd=()=>{const e=Z(S=>S.rangeStartGI),t=Z(S=>S.rangeEndGI),n=Z(S=>S.setRange),r=e!=null&&t!=null,[o,s]=d.useState(null),[i,a]=d.useState(null),l=d.useRef(null),u=d.useRef(null);d.useEffect(()=>{if(!r||e==null||t==null){s(null),a(null);return}const S=()=>{const h=document.querySelector(`[data-g="${e}"]`),c=document.querySelector(`[data-g="${t}"]`);if(h){const w=h.getBoundingClientRect();s({x:w.left,y:w.bottom})}else s(null);if(c){const w=c.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 f=d.useCallback((S,h)=>{var w;const c=document.elementsFromPoint(S,h);for(const C of c){const I=(w=C.getAttribute)==null?void 0:w.call(C,"data-g");if(I!=null)return parseInt(I,10)}return null},[]),b=d.useCallback(S=>h=>{h.preventDefault(),h.stopPropagation(),l.current=S,u.current=S==="start"?e:t,h.target.setPointerCapture(h.pointerId)},[e,t]),x=d.useCallback(S=>{if(!l.current||e==null||t==null)return;const h=f(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,f]),p=d.useCallback(S=>{l.current=null,u.current=null,S.target.releasePointerCapture(S.pointerId)},[]);return r?m.jsxs(m.Fragment,{children:[o&&m.jsx("div",{className:Bo.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:Bo.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:b("end"),onPointerMove:x,onPointerUp:p,onPointerCancel:p})]}):null},Td=({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,_d=(e,t,n)=>Math.min(n,Math.max(t,e));function Ps({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:u,isPlaybackMode:f=!1,playbackScale:b}){const x=String((e==null?void 0:e.section_id)??"0"),p=d.useMemo(()=>{var C,I;const c=((C=e==null?void 0:e.ast)==null?void 0:C.blocks)??[];let w=0;for(const T of c)(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=d.useMemo(()=>typeof n=="number"?_d(n,p>0?0:-1,Math.max(p-1,-1)):(p>0,0),[n,p]),S=d.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=d.useMemo(()=>{const c=(e==null?void 0:e.audios)??[],w=c.length>0?Yc(e):void 0;return{clips:c,map:w,initialIndex:v,section:e}},[e,v]);return m.jsx(ei,{onViewerEvent:l,isPlaybackMode:f,playbackScale:b,viewerRef:u,children:m.jsx(nu,{initialState:t,children:m.jsx(tu,{initialState:S,children:m.jsx(Qc,{initialState:h,children:m.jsx(gd,{initialState:{section:e,onQuizComplete:a},children:m.jsx(Md,{})},x)},x)},x)})})}function Md(){const e=te(f=>f.mode),t=d.useRef(null),[n,r]=d.useState(!1),[o,s]=d.useState(),i=d.useCallback(f=>{s(f),r(!0)},[]),a=d.useCallback(()=>{r(!1),s(void 0)},[]),l=f=>{f.preventDefault()},u=f=>{f.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:l,onDragStart:u,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(ya,{}):m.jsx(Tu,{}),m.jsx(Wc,{}),m.jsx(cd,{}),m.jsx(Pu,{}),m.jsx(Cd,{onTranslate:i}),m.jsx(Rd,{}),m.jsx(Td,{isOpen:n,onClose:a,text:o}),m.jsx(Sd,{containerRef:t}),m.jsx(md,{containerRef:t}),m.jsx(wd,{}),m.jsx(yd,{})]})}function Ed(e){return tt({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 jd(e){return tt({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 Pd="_button_onals_1",Od={button:Pd};function Bd({playbackState:e,disabled:t,onClick:n}){return m.jsx("button",{onClick:n,disabled:t,className:Od.button,title:e==="playing"?"일시정지":e==="paused"?"재개":"재생",children:e==="playing"?m.jsx(Ed,{}):m.jsx(jd,{})})}const zd=d.memo(Bd),Ad="_container_18q02_1",Ld="_topRow_18q02_11",Gd="_timeDisplay_18q02_17",Hd="_bottomRow_18q02_23",Nd="_sliderContainer_18q02_29",Fd="_trackBackground_18q02_35",Wd="_trackFill_18q02_47",Vd="_rangeInput_18q02_54",Dd="_viewportInfo_18q02_89",rt={container:Ad,topRow:Ld,timeDisplay:Gd,bottomRow:Hd,sliderContainer:Nd,trackBackground:Fd,trackFill:Wd,rangeInput:Vd,"rangeInput--disabled":"_rangeInput--disabled_18q02_66",viewportInfo:Dd};function $d({playbackState:e,disabled:t,elapsedTime:n,totalDuration:r,viewport:o,onTogglePlay:s,onSeekStart:i,onSeekChange:a,onSeekEnd:l}){const u=b=>{a(parseFloat(b.target.value))},f=[rt.rangeInput,t&&rt["rangeInput--disabled"]].filter(Boolean).join(" ");return m.jsxs("div",{className:rt.container,children:[m.jsxs("div",{className:rt.topRow,children:[m.jsx(zd,{playbackState:e,disabled:t,onClick:s}),m.jsxs("span",{className:rt.viewportInfo,children:["해상도: ",o.width.toFixed(0)," × ",o.height.toFixed(0)]}),m.jsxs("span",{className:rt.timeDisplay,children:[n.toFixed(1),"s / ",r.toFixed(1),"s"]})]}),m.jsx("div",{className:rt.bottomRow,children:m.jsxs("div",{className:rt.sliderContainer,children:[m.jsx("div",{className:rt.trackBackground,children:m.jsx("div",{className:rt.trackFill,style:{width:`${n/r*100}%`}})}),m.jsx("input",{type:"range",min:0,max:r,step:.01,value:n,onMouseDown:i,onTouchStart:i,onChange:u,onMouseUp:l,onTouchEnd:l,disabled:t,className:f})]})})]})}const Os=d.memo($d),qd="_outerContainer_77t1u_1",Ud="_scaleWrapper_77t1u_11",Kd="_viewerContainer_77t1u_15",Qd="_eventBlocker_77t1u_22",Yd="_emptyMessage_77t1u_29",Xd="_bufferingOverlay_77t1u_34",Zd="_spinner_77t1u_44",ut={outerContainer:qd,scaleWrapper:Ud,viewerContainer:Kd,eventBlocker:Qd,emptyMessage:Yd,bufferingOverlay:Xd,spinner:Zd},Jd=d.memo(Ps),zo=24;function e0({isBuffering:e,isEmpty:t,currentViewport:n,initialSnapshot:r,section:o,sectionSummaries:s,onSectionChange:i,viewerRef:a,onContainerResize:l,onScaleChange:u}){const f=d.useRef(null),[b,x]=d.useState({width:0,height:0});d.useEffect(()=>{const h=f.current;if(!h)return;const c=()=>{const C={width:h.clientWidth,height:h.clientHeight};x(C),l==null||l(C)};c();const w=new ResizeObserver(c);return w.observe(h),()=>w.disconnect()},[l]);const p=d.useMemo(()=>n.width>0&&n.height>0?n:{width:r.viewportWidth||400,height:r.viewportHeight||600},[n,r]),v=d.useMemo(()=>{if(b.width===0||b.height===0)return 1;const h=(b.width-zo*2)/p.width,c=(b.height-zo*2)/p.height;return Math.min(h,c,1)},[b,p]);d.useEffect(()=>{u==null||u(v)},[v,u]);const S=b.width>0&&b.height>0;return m.jsxs("div",{ref:f,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(Jd,{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 Bs=d.memo(e0),xn=d.createContext(void 0);function dt(e,t){const n=d.useContext(xn);if(!n)throw new Error("useViewerPlayerStore must be used inside <ViewerPlayerProvider>");return Ut(n,e,t)}function zs(){const e=d.useContext(xn);if(!e)throw new Error("useViewerPlayerStoreApi must be used inside <ViewerPlayerProvider>");return e}const Ao={width:0,height:0};function As(){return yt((e,t)=>({meta:null,playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:Ao,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??Ao,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0})}}))}function Ls({children:e,meta:t,initialSection:n,initialViewport:r}){const o=d.useMemo(()=>As(),[]);return d.useLayoutEffect(()=>{o.getState().setMeta(t??null)},[t,o]),d.useLayoutEffect(()=>{n&&o.getState().setCurrentSection(n)},[n,o]),d.useLayoutEffect(()=>{r&&o.getState().setCurrentViewport(r)},[r,o]),m.jsx(xn.Provider,{value:o,children:e})}const t0="_container_1dh6p_1",n0={container:t0},r0=100;function o0(e){const{meta:t,initialSection:n}=e,r={width:t.initialSnapshot.viewportWidth,height:t.initialSnapshot.viewportHeight};return m.jsx(Ls,{meta:t,initialSection:n,initialViewport:r,children:m.jsx(s0,{...e})})}function s0({meta:e,getChunk:t,availableChunks:n,initialStartTime:r=0,initialSection:o,sectionsMap:s,sectionSummaries:i=[],onSectionChange:a,onChunksEvicted:l}){const{totalDuration:u,chunkCount:f,chunkDuration:b,initialSnapshot:x}=e,p=zs(),v=dt(M=>M.playbackState),S=dt(M=>M.isBuffering),h=dt(M=>M.elapsedTime),c=dt(M=>M.currentViewport);dt(M=>M.viewportScale);const w=dt(M=>M.currentSection);dt(M=>M.loadedChunks);const C=d.useMemo(()=>f===0?0:Math.min(Math.floor(r/b),f-1),[r,b,f]),I=d.useRef(0),T=d.useRef(0),E=d.useRef(0),g=d.useRef(null),y=d.useRef(0),_=d.useRef(0),B=d.useRef(0),R=d.useRef(!1),P=d.useRef(null),k=d.useRef(new Map),O=d.useRef(new Set),z=d.useRef(null);d.useMemo(()=>{if(f===0)return 0;const M=Math.floor(h/b);return Math.min(M,f-1)},[h,b,f]);const L=`${u}-${f}-${x.globalIndex}`,j=d.useRef(L);d.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=d.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=d.useCallback(async M=>{if(M<0||M>=f)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)}},[f,t,l,p]),U=d.useCallback(M=>{const F=M+1;F<f&&!k.current.has(F)&&W(F)},[f,W]),Y=d.useRef(!0);d.useEffect(()=>{if(!Y.current||f===0)return;Y.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)];$<f&&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}},[f,W,C,r,s,A,p]);const ce=d.useCallback(async M=>{const F=p.getState(),H=Math.min(Math.floor(M/b),f-1),$=H+1,Q=[W(H)];$<f&&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,f,W,s,A,p]),ie=d.useCallback(async M=>{const F=p.getState(),H=Math.max(0,Math.min(M,u));F.setIsBuffering(!0),g.current&&(cancelAnimationFrame(g.current),g.current=null),I.current=H,F.setElapsedTime(H),y.current=H,await ce(H),F.setIsBuffering(!1)},[u,ce,p]),me=d.useCallback(()=>{const M=p.getState(),F=performance.now(),H=(F-E.current)/1e3;I.current=H,F-T.current>=r0&&(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<f-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(u),y.current=u;return}g.current=requestAnimationFrame(me)},[f,u,W,U,A,p]),be=d.useCallback(async()=>{var H;if(f===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>=u-.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),$()}},[f,u,x,me,W,U,p]),K=d.useRef(null),oe=d.useCallback(()=>{R.current=p.getState().playbackState==="playing",g.current&&(cancelAnimationFrame(g.current),g.current=null)},[p]),G=d.useCallback(M=>{const F=Math.max(0,Math.min(M,u));K.current=F,I.current=F,p.getState().setElapsedTime(F),y.current=F},[u,p]),ee=d.useCallback(async()=>{const M=K.current;K.current=null,M!==null&&await ie(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},[ie,me,p]);return d.useEffect(()=>()=>{g.current&&cancelAnimationFrame(g.current)},[]),w?m.jsxs("div",{className:n0.container,children:[m.jsx(Os,{playbackState:v,disabled:f===0,elapsedTime:h,totalDuration:u,viewport:{width:c.width,height:c.height},onTogglePlay:be,onSeekStart:oe,onSeekChange:G,onSeekEnd:ee}),m.jsx(Bs,{isBuffering:S,isEmpty:f===0,currentViewport:c,initialSnapshot:x,section:w,sectionSummaries:i,onSectionChange:a,viewerRef:z,onScaleChange:p.getState().setViewportScale})]}):null}exports.CRViewer=Ps;exports.CR_ViewerPlayback=o0;exports.PlaybackBar=Os;exports.PlaybackViewport=Bs;exports.ViewerPlayerContext=xn;exports.ViewerPlayerProvider=Ls;exports.createViewerPlayerStore=As;exports.useViewerPlayerStore=dt;exports.useViewerPlayerStoreApi=zs;
|
|
34
|
+
*/var Tr;function Us(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,f){return c===f&&(c!==0||1/c===1/f)||c!==c&&f!==f}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=d,n=Go(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;wn.useSyncExternalStoreWithSelector=function(c,f,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(f())},T===null?void 0:function(){return u(T())}]},[f,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())})()),wn}var _r;function Ks(){return _r||(_r=1,process.env.NODE_ENV==="production"?Zt.exports=qs():Zt.exports=Us()),Zt.exports}var Qs=Ks();const Ys=Lo(Qs),Mr=e=>{let t;const n=new Set,r=(c,f)=>{const b=typeof c=="function"?c(t):c;if(!Object.is(b,t)){const x=t;t=f??(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?Mr(e):Mr),{useSyncExternalStoreWithSelector:Xs}=Ys,Zs=e=>e;function Ut(e,t=Zs,n){const r=Xs(e.subscribe,e.getState,e.getInitialState,t,n);return d.useDebugValue(r),r}function te(e,t){const n=d.useContext(or);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return Ut(n,e,t)}function Pt(){const e=d.useContext(or);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const wt=d.createContext(void 0);function Js(){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 ei({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=d.useMemo(()=>Js(),[]);return d.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),d.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),d.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),d.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 ti({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=d.useRef(null);d.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=d.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=d.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const sn={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"}},Cn=[8,16,24,40,64],In=[1.2,1.4,1.6,1.8,2,2.2,2.4],kn=[4,8,12,16,24],Yn=e=>Math.round(12+(e-1)*(16/11)),ni=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Yn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Rn=(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},Ho=[{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:Ho.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 ri(e){const{init:t,recorderStore:n}=e??{};return yt((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:()=>r({showOverlays:!o().showOverlays}),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:Cn,LINEHEIGHT_MAP:In,BREAK_GAP_MAP:kn,fontSizeFromLevel:Yn},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=kn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Rn(o().breakGapPx,kn),getFontLevel:()=>ni(o().fontSizePx),getLineLevel:()=>Rn(o().lineHeight,In),getMarginLevel:()=>Rn(o().marginX,Cn),setFontLevel:s=>r({fontSizePx:Yn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:In[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=Cn[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 pn=0,ht=1,Ot=2,No=4;function Er(e){return()=>e}function oi(e){e()}function Fo(e,t){return n=>e(t(n))}function jr(e,t){return()=>e(t)}function si(e,t){return n=>e(t,n)}function sr(e){return e!==void 0}function ii(...e){return()=>{e.map(oi)}}function Bt(){}function hn(e,t){return t(e),e}function li(e,t){return t(e)}function Re(...e){return e}function Se(e,t){return e(ht,t)}function he(e,t){e(pn,t)}function ir(e){e(Ot)}function _e(e){return e(No)}function re(e,t){return Se(e,si(t,pn))}function et(e,t){const n=e(ht,r=>{n(),t(r)});return n}function Pr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Wo(e,t){return e===t}function ke(e=Wo){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ae(e){return t=>n=>{e(n)&&t(n)}}function Z(e){return t=>Fo(t,e)}function st(e){return t=>()=>{t(e)}}function N(e,...t){const n=ai(...t);return((r,o)=>{switch(r){case Ot:ir(e);return;case ht:return Se(e,n(o))}})}function it(e,t){return n=>r=>{n(t=e(t,r))}}function vt(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 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 ai(...e){return t=>e.reduceRight(li,t)}function ci(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(),Bt);case Ot:r(),n=null;return}}}function V(e){let t=e;const n=xe();return((r,o)=>{switch(r){case pn:t=o;break;case ht:{o(t);break}case No:return t}return n(r,o)})}function Ne(e,t){return hn(V(t),n=>re(e,n))}function xe(){const e=[];return((t,n)=>{switch(t){case pn:e.slice().forEach(r=>{r(n)});return;case Ot:e.splice(0,e.length);return;case ht:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function qe(e){return hn(xe(),t=>re(e,t))}function ve(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ui(),singleton:n}}const ui=()=>Symbol();function di(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 Ot:{ir(t);return}case ht:return r===o&&i(n),Se(t,i)}}}function le(e,t=Wo){return N(e,ke(t))}function Xn(...e){return function(t,n){switch(t){case Ot:return;case ht:return ii(...e.map(r=>Se(r,n)))}}}var De=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(De||{});const fi={0:"debug",3:"error",1:"log",2:"warn"},pi=()=>typeof globalThis>"u"?window:globalThis,gt=ve(()=>{const e=V(3);return{log:V((t,n,r=1)=>{var o;const s=(o=pi().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[fi[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 lr(e,t,n).callbackRef}function lr(e,t,n){const r=d.useRef(null);let o=i=>{};const s=d.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 hi(e,t,n,r,o,s,i,a,l){const c=d.useCallback(f=>{const b=gi(f.children,t,a?"offsetWidth":"offsetHeight",o);let x=f.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?Or("column-gap",getComputedStyle(f).columnGap,o):Or("row-gap",getComputedStyle(f).rowGap,o)),b!==null&&e(b)},[e,t,o,s,i,r,a]);return lr(c,n,l)}function gi(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),f=t(a,n);if(f===0&&r("Zero-sized element, this should not happen",{child:a},De.ERROR),f===c)continue;const b=s[s.length-1];s.length===0||b.size!==f||b.endIndex!==l-1?s.push({endIndex:l,size:f,startIndex:l}):s[s.length-1].endIndex++}return s}function Or(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,De.WARN),t==="normal"?0:parseInt(t??"0",10)}function Vo(e,t,n){const r=d.useRef(null),o=d.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),f=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:f},e(r.current)},[e,t]),{callbackRef:s,ref:i}=lr(o,!0,n),a=d.useCallback(()=>{o(i.current)},[o,i]);return d.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 Ve=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),f=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:f,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}),Ht={lvl:0};function Do(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===Ht}function Nt(e,t){if(!ye(e))return t===e.k?e.v:t<e.k?Nt(e.l,t):Nt(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 $e(e,t,n){return ye(e)?Uo(t,n,1):t===e.k?Be(e,{k:t,v:n}):t<e.k?Br(Be(e,{l:$e(e.l,t,n)})):Br(Be(e,{r:$e(e.r,t,n)}))}function Mt(){return Ht}function Et(e,t,n){if(ye(e))return[];const r=tt(e,t)[0];return mi(Jn(e,r,n))}function Zn(e,t){if(ye(e))return Ht;const{k:n,l:r,r:o}=e;if(t===n){if(ye(r))return o;if(ye(o))return r;{const[s,i]=qo(r);return rn(Be(e,{k:s,l:$o(r),v:i}))}}else return t<n?rn(Be(e,{l:Zn(r,t)})):rn(Be(e,{r:Zn(o,t)}))}function xt(e){return ye(e)?[]:[...xt(e.l),{k:e.k,v:e.v},...xt(e.r)]}function Jn(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(Jn(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(Jn(s,t,n))),a}function rn(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(Tn(t))return Ko(Be(e,{lvl:n-1}));if(!ye(t)&&!ye(t.r))return Be(t.r,{l:Be(t,{r:t.r.l}),lvl:n,r:Be(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Tn(e))return er(Be(e,{lvl:n-1}));if(!ye(r)&&!ye(r.l)){const o=r.l,s=Tn(o)?r.lvl-1:r.lvl;return Be(o,{l:Be(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:er(Be(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Be(e,t){return Uo(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 $o(e){return ye(e.r)?e.l:rn(Be(e,{r:$o(e.r)}))}function Tn(e){return ye(e)||e.lvl>e.r.lvl}function qo(e){return ye(e.r)?[e.k,e.v]:qo(e.r)}function Uo(e,t,n,r=Ht,o=Ht){return{k:e,l:r,lvl:n,r:o,v:t}}function Br(e){return er(Ko(e))}function Ko(e){const{l:t}=e;return!ye(t)&&t.lvl===e.lvl?Be(t,{r:Be(e,{l:t.r})}):e}function er(e){const{lvl:t,r:n}=e;return!ye(n)&&!ye(n.r)&&n.lvl===t&&n.r.lvl===t?Be(n,{l:Be(e,{r:n.l}),lvl:t+1}):e}function mi(e){return Do(e,({k:t,v:n})=>({index:t,value:n}))}function Qo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Ft(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ar=ve(()=>({recalcInProgress:V(!1)}),[],{singleton:!0});function Yo(e,t,n){return e[ln(e,t,n)]}function ln(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 bi(e,t,n,r){const o=ln(e,t,r),s=ln(e,n,r,o);return e.slice(o,s+1)}function pt(e,t){return Math.round(e.getBoundingClientRect()[t])}function gn(e){return!ye(e.groupOffsetTree)}function cr({index:e},t){return t===e?0:t<e?-1:1}function xi(){return{groupIndices:[],groupOffsetTree:Mt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Mt()}}function vi(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=$e(e,0,s);continue}const a=Et(e,i-1,o+1);if(a.some(Ri(r)))continue;let l=!1,c=!1;for(const{end:f,start:b,value:x}of a)l?(o>=b||s===x)&&(e=Zn(e,b)):(c=x!==s,l=!0),f>o&&o>=b&&x!==s&&(e=$e(e,o+1,x));c&&(e=$e(e,i,s))}return[e,n]}function Si(e){return typeof e.groupIndex<"u"}function yi({offset:e},t){return t===e?0:t<e?-1:1}function Wt(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Yo(t,e,cr),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Xo(e,t){if(!gn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Zo(e,t,n){if(Si(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Xo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function wi(e,t,n,r=0){return r>0&&(t=Math.max(t,Yo(e,r,cr).offset)),Do(bi(e,t,n,yi),ki)}function Ci(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,De.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)=>$e($e(v,S,x),S+1,p),i)}else[i,a]=vi(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:f,offsetTree:b}=tr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((x,p)=>$e(x,p,Wt(p,b,o)),Mt()),lastIndex:l,lastOffset:c,lastSize:f,offsetTree:b,sizeTree:i}}function Ii(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 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 tr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=ln(o,t-1,cr),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:f}of Et(n,t,1/0)){const b=c-s,x=b*i+a+b*r;o.push({index:c,offset:x,size:f}),s=c,a=x,i=f}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function ki(e){return{index:e.index,value:e}}function Ri(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 Ti={offsetHeight:"height",offsetWidth:"width"},lt=ve(([{log:e},{recalcInProgress:t}])=>{const n=xe(),r=xe(),o=Ne(r,0),s=xe(),i=xe(),a=V(0),l=V([]),c=V(void 0),f=V(void 0),b=V(void 0),x=V(void 0),p=V((g,y)=>pt(g,Ti[y])),v=V(void 0),S=V(0),h=xi(),u=Ne(N(n,ge(l,e,S),it(Ci,h),ke()),h),w=Ne(N(l,ke(),it((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),Z(({prev:g})=>g)),[]);re(N(l,ae(g=>g.length>0),ge(u,S),Z(([g,y,_])=>{const B=g.reduce((R,P,k)=>$e(R,P,Wt(P,y.offsetTree,_)||k),Mt());return{...y,groupIndices:g,groupOffsetTree:B}})),u),re(N(r,ge(u),ae(([g,{lastIndex:y}])=>g<y),Z(([g,{lastIndex:y,lastSize:_}])=>[{endIndex:y,size:_,startIndex:g}])),n),re(c,f);const C=Ne(N(c,Z(g=>g===void 0)),!0);re(N(f,ae(g=>g!==void 0&&ye(_e(u).sizeTree)),Z(g=>{const y=_e(b),_=_e(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,ae(g=>g!==void 0&&g.length>0&&ye(_e(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,f),ae(([,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=qe(N(n,ge(u),it(({sizes:g},[y,_])=>({changed:_!==g,sizes:_}),{changed:!1,sizes:h}),Z(g=>g.changed)));Se(N(a,it((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),Z(g=>g.diff)),g=>{const{groupIndices:y}=_e(u);if(g>0)he(t,!0),he(s,g+zr(g,y));else if(g<0){const _=_e(w);_.length>0&&(g-=zr(-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},De.ERROR)});const T=qe(s);re(N(s,ge(u),Z(([g,y])=>{const _=y.groupIndices.length>0,B=[],R=y.lastSize;if(_){const P=Nt(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=qe(N(i,ge(u,S),Z(([g,{offsetTree:y},_])=>{const B=-g;return Wt(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=Mt();const R=_e(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})=>$e(z,Math.max(0,L+g),j),B),P!==-g){const z=Nt(y.sizeTree,O);B=$e(B,0,z);const L=tt(y.sizeTree,-g+1)[1];B=$e(B,1,L)}return{...y,sizeTree:B,...tr(y.offsetTree,0,B,_)}}else{const B=xt(y.sizeTree).reduce((R,{k:P,v:k})=>$e(R,Math.max(0,P+g),k),Mt());return{...y,sizeTree:B,...tr(y.offsetTree,0,B,_)}}})),u),{beforeUnshiftWith:T,data:v,defaultItemSize:f,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}},Re(gt,ar),{singleton:!0});function _i(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Jo=ve(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=xe(),i=xe(),a=qe(N(s,Z(_i)));return re(N(a,Z(l=>l.totalCount)),n),re(N(a,Z(l=>l.groupIndices)),e),re(N(je(o,t,r),ae(([l,c])=>gn(c)),Z(([l,c,f])=>tt(c.groupOffsetTree,Math.max(l-f,0),"v")[0]),ke(),Z(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},Re(lt,Ve)),mt=ve(([{log:e}])=>{const t=V(!1),n=qe(N(t,ae(r=>r),ke()));return Se(t,r=>{r&&_e(e)("props updated",{},De.DEBUG)}),{didMount:n,propsReady:t}},Re(gt),{singleton:!0}),Mi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function es(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!Mi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Kt=ve(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:f,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=es(I),{align:L,behavior:j,offset:A}=z,W=g-1,U=Zo(z,T,W);let X=Wt(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 ce=ie=>{C(),ie?(R("retrying to scroll to",{location:I},De.DEBUG),he(p,I)):(he(v,!0),R("list did not change, scroll successful",{},De.DEBUG))};if(C(),j==="smooth"){let ie=!1;w=Se(t,me=>{ie=ie||me}),h=et(f,()=>{ce(ie)})}else h=et(N(t,Ei(150)),ce);return u=setTimeout(()=>{C()},1200),he(l,!0),R("scrolling from index to",{behavior:j,index:U,top:X},De.DEBUG),{behavior:j,top:X}})),c),{scrollTargetReached:v,scrollToIndex:p,topListHeight:S}},Re(lt,Ve,gt),{singleton:!0});function Ei(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function ur(e,t){e==0?t():requestAnimationFrame(()=>{ur(e-1,t)})}function dr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Qt=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),ae(([f,b])=>!!b),st(!1)),a),re(N(i,ge(l),ae(([f,b])=>!!b),st(!1)),c),Se(N(je(t,i),ge(a,n,e,c),ae(([[,f],b,{sizeTree:x},p,v])=>f&&(!ye(x)||sr(p))&&!b&&!v),ge(l)),([,f])=>{et(o,()=>{he(c,!0)}),ur(4,()=>{et(r,()=>{he(a,!0)}),he(s,f)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},Re(lt,Ve,Kt,mt),{singleton:!0});function ts(e,t){return Math.abs(e-t)<1.01}const Vt="up",Lt="down",ji="none",Pi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Oi=0,Yt=ve(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=V(!1),a=V(!0),l=xe(),c=xe(),f=V(4),b=V(Oi),x=Ne(N(Xn(N(le(o),vt(1),st(!0)),N(le(o),vt(1),st(!1),Pr(100))),ke()),!1),p=Ne(N(Xn(N(n,st(!0)),N(n,st(!1),Pr(200))),ke()),!1);re(N(je(le(o),le(b)),Z(([w,C])=>w<=C),ke()),a),re(N(a,at(50)),c);const v=qe(N(je(r,le(s),le(t),le(e),le(f)),it((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}},Pi),ke((w,C)=>w&&w.atBottom===C.atBottom))),S=Ne(N(r,it((w,{scrollHeight:C,scrollTop:I,viewportHeight:T})=>{if(ts(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}),ae(w=>w.changed),Z(w=>w.jump)),0);re(N(v,Z(w=>w.atBottom)),i),re(N(i,at(50)),l);const h=V(Lt);re(N(r,Z(({scrollTop:w})=>w),ke(),it((w,C)=>_e(p)?{direction:w.direction,prevScrollTop:C}:{direction:C<w.prevScrollTop?Vt:Lt,prevScrollTop:C},{direction:Lt,prevScrollTop:0}),Z(w=>w.direction)),h),re(N(r,at(50),st(ji)),h);const u=V(0);return re(N(x,ae(w=>!w),st(0)),u),re(N(o,at(100),ge(x),ae(([w,C])=>C),it(([w,C],[I])=>[C,I],[0,0]),Z(([w,C])=>C-w)),u),{atBottomState:v,atBottomStateChange:l,atBottomThreshold:f,atTopStateChange:c,atTopThreshold:b,isAtBottom:i,isAtTop:a,isScrolling:x,lastJumpDueToItemResize:S,scrollDirection:h,scrollVelocity:u}},Re(Ve)),Dt="top",$t="bottom",Ar="none";function Lr(e,t,n){return typeof e=="number"?n===Vt&&t===Dt||n===Lt&&t===$t?e:0:n===Vt?t===Dt?e.main:e.reverse:t===$t?e.main:e.reverse}function Gr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const fr=ve(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=xe(),i=V(0),a=V(0),l=V(0),c=Ne(N(je(le(r),le(o),le(n),le(s,Ft),le(l),le(i),le(t),le(e),le(a)),Z(([f,b,x,[p,v],S,h,u,w,C])=>{const I=f-w,T=h+u,E=Math.max(x-I,0);let g=Ar;const y=Gr(C,Dt),_=Gr(C,$t);return p-=w,p+=x+u,v+=x+u,v-=w,p>f+T-y&&(g=Vt),v<f-E+b+_&&(g=Lt),g!==Ar?[Math.max(I-x-Lr(S,Dt,g)-y,0),I-E-u+b+Lr(S,$t,g)+_]:null}),ae(f=>f!=null),ke(Ft)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},Re(Ve),{singleton:!0});function Bi(e,t,n){if(gn(t)){const r=Xo(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 _n={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function on(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,f=0;if(e.length>0){c=e[0].offset;const S=e[e.length-1];f=S.offset+S.size}const b=n-i,x=a+b*l+(b-1)*r,p=c,v=x-f;return{bottom:f,firstItemIndex:s,items:Hr(e,o,s),offsetBottom:v,offsetTop:c,top:p,topItems:Hr(t,o,s),topListHeight:t.reduce((S,h)=>h.size+S,0),totalCount:n}}function ns(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const f of n.groupIndices){if(f-i>=e)break;i++}const a=e+i,l=dr(t,a),c=Array.from({length:a}).map((f,b)=>({data:s[b+l],index:b+l,offset:0,size:0}));return on(c,[],a,o,n,r)}function Hr(e,t,n){if(e.length===0)return[];if(!gn(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=Et(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 f;c.index===a.start?f={index:l,type:"group"}:f={groupIndex:l,index:c.index-(l+1)+n},s.push({...f,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 It=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:f},{topListHeight:b},x,{didMount:p},{recalcInProgress:v}])=>{const S=V([]),h=V(0),u=xe(),w=V(0);re(s.topItemsIndexes,S);const C=Ne(N(je(p,v,le(l,Ft),le(o),le(r),le(c),f,le(S),le(t),le(n),le(w),e),ae(([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 ce=B,{offsetTree:ie,sizeTree:me}=ce,be=_e(h);if(_===0)return{..._n,totalCount:_};if(g===0&&y===0)return be===0?{..._n,totalCount:_}:ns(be,R,B,O,z,j||[]);if(ye(me))return be>0?null:on(Bi(dr(R,_),ce,j),[],_,z,ce,O);const K=[];if(k.length>0){const $=k[0],Q=k[k.length-1];let D=0;for(const de of Et(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 on([],K,_,z,ce,O);const oe=k.length>0?k[k.length-1]+1:0,G=wi(ie,g,y,oe);if(G.length===0)return null;const ee=_-1,M=hn([],$=>{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=Nr(L,Dt),H=Nr(L,$t);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=Et(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=Et(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 on(M,K,_,z,ce,O)}),ae(g=>g!==null),ke()),_n);re(N(e,ae(sr),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=qe(N(C,ae(({items:g})=>g.length>0),ge(o,e),ae(([{items:g},y])=>g[g.length-1].originalIndex===y-1),Z(([,g,y])=>[g-1,y]),ke(Ft),Z(([g])=>g))),T=qe(N(C,at(200),ae(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),Z(({items:g})=>g[0].index),ke())),E=qe(N(C,ae(({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}}),ke(Qo)));return{endReached:I,initialItemCount:h,itemsRendered:u,listState:C,minOverscanItemCount:w,rangeChanged:E,startReached:T,topItemsIndexes:S,...x}},Re(lt,Jo,fr,Qt,Kt,Yt,mt,ar),{singleton:!0}),rs=ve(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=xe(),i=Ne(N(je(n,e,r,t,o),Z(([a,l,c,f,b])=>a+l+c+f+b.offsetBottom+b.bottom)),0);return re(le(i),s),{totalListHeight:i,totalListHeightChanged:s}},Re(Ve,It),{singleton:!0}),zi=ve(([{viewportHeight:e},{totalListHeight:t}])=>{const n=V(!1),r=Ne(N(je(n,e,t),ae(([o])=>o),Z(([,o,s])=>Math.max(0,o-s)),at(0),ke()),0);return{alignToBottom:n,paddingTopAddition:r}},Re(Ve,rs),{singleton:!0}),os=ve(()=>({context:V(null)})),Ai=({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,ss=ve(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const f=xe();return re(N(f,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=Ai,done:g,...y}=b,_=Zo(b,x,v-1),B=Wt(_,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,ae(z=>!z),vt(_e(i)?1:2)),g):g==null||g(),O}),ae(b=>b!==null)),c),{scrollIntoView:f}},Re(lt,Ve,Kt,It,gt),{singleton:!0});function Fr(e){return e?e==="smooth"?"smooth":"auto":!1}const Li=(e,t)=>typeof e=="function"?Fr(e(t)):t&&Fr(e),Gi=ve(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:f},{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(le(t),vt(1)),l),ge(le(v),s,a,b),Z(([[T,E],g,y,_,B])=>{let R=E&&_,P="auto";return R&&(P=Li(g,y||B),R=R&&!!P),{followOutputBehavior:P,shouldFollow:R,totalCount:T}}),ae(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:E})=>{h&&(h(),h=null),_e(n)?requestAnimationFrame(()=>{_e(f)("following output to ",{totalCount:E},De.DEBUG),u(T)}):h=et(e,()=>{_e(f)("following output to ",{totalCount:E},De.DEBUG),u(T),h=null})});function w(T){const E=et(o,g=>{T&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!h&&(_e(f)("scrolling to bottom due to increased size",{},De.DEBUG),u("auto"))});setTimeout(E,100)}Se(N(je(le(v),t,c),ae(([T,,E])=>T&&E),it(({value:T},[,E])=>({refreshed:T===E,value:E}),{refreshed:!1,value:0}),ae(({refreshed:T})=>T),ge(v,t)),([,T])=>{_e(a)&&w(T!==!1)}),Se(S,()=>{w(_e(v)!==!1)}),Se(je(le(v),o),([T,E])=>{T&&!E.atBottom&&E.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&u("auto")});const C=V(null),I=xe();return re(Xn(N(le(r),Z(T=>{var E;return(E=T==null?void 0:T.length)!=null?E:0})),N(le(t))),I),Se(N(je(N(I,vt(1)),l),ge(le(C),a,b,x),Z(([[T,E],g,y,_,B])=>E&&y&&(g==null?void 0:g({context:B,totalCount:T,scrollingInProgress:_}))),ae(T=>!!T),at(0)),T=>{h&&(h(),h=null),_e(n)?requestAnimationFrame(()=>{_e(f)("scrolling into view",{}),he(p,T)}):h=et(e,()=>{_e(f)("scrolling into view",{}),he(p,T),h=null})}),{autoscrollToBottom:S,followOutput:v,scrollIntoViewOnChange:C}},Re(lt,Yt,Kt,Qt,mt,gt,Ve,os,ss)),Hi=ve(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(re(N(a,ge(s),ae(([,l])=>l!==0),ge(o,r,t,n,e),Z(([[,l],c,f,b,x,p=[]])=>ns(l,c,f,b,x,p))),i),{}),Re(lt,Qt,It,mt),{singleton:!0}),Ni=ve(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=V(0);return Se(N(e,ge(r),ae(([,o])=>o!==0),Z(([,o])=>({top:o}))),o=>{et(N(n,vt(1),ae(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{he(t,o)})})}),{initialScrollTop:r}},Re(mt,Ve,It),{singleton:!0}),is=ve(([{scrollVelocity:e}])=>{const t=V(!1),n=xe(),r=V(!1);return re(N(e,ge(r,t,n),ae(([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}),ke()),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}},Re(Yt),{singleton:!0}),pr=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:f}])=>({scrollHeight:a,scrollTop:Math.max(0,l-f),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}},Re(Ve)),Fi=ve(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=xe(),f=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=Ii(v.sizeTree);h&&u!==null&&w!==null&&(S=u.scrollTop-w.offsetTop),S-=C,p({ranges:I,scrollTop:S})}),re(N(f,ae(sr),Z(Wi)),o),re(N(s,ge(f),ae(([,p])=>p!==void 0),ke(),Z(([,p])=>p.ranges)),e),{getState:c,restoreStateFrom:f}},Re(lt,Ve,Qt,mt,pr));function Wi(e){return{align:"start",index:0,offset:e.scrollTop}}const Vi=ve(([{topItemsIndexes:e}])=>{const t=V(0);return re(N(t,ae(n=>n>=0),Z(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Re(It));function ls(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Di=ls(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),$i=ve(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:f,shiftWithOffset:b,sizes:x},{log:p},{recalcInProgress:v}])=>{const S=qe(N(l,ge(i),it(([,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]),ae(([u])=>u!==0),ge(r,a,n,o,p,v),ae(([,u,w,C,,,I])=>!I&&!C&&u!==0&&w===Vt),Z(([[u],,,,,w])=>(w("Upward scrolling compensation",{amount:u},De.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&&Di()?he(e,w-u):h(-u)}),Se(N(je(Ne(s,!1),e,v),ae(([u,w,C])=>!u&&!C&&w!==0),Z(([u,w])=>w),at(1)),h),re(N(b,Z(u=>({top:-u}))),t),Se(N(c,ge(x,f),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=Nt(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}},Re(Ve,Yt,It,lt,gt,ar)),qi=ve(([e,t,n,r,o,s,i,a,l,c,f])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...f}),Re(fr,Hi,mt,is,rs,Ni,zi,pr,ss,gt,os)),as=ve(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:f,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:f,...w}},Re(lt,Qt,Ve,Fi,Gi,It,Kt,$i,Vi,Jo,qi));function Ui(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 en=typeof document<"u"?d.useLayoutEffect:d.useEffect;function cs(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=d.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 f(h){return i.reduce((u,w)=>(u[w]=ci(h[t.events[w]]),u),{})}const b=d.forwardRef((h,u)=>{const{children:w,...C}=h,[I]=d.useState(()=>hn(di(e),g=>{l(g,C)})),[T]=d.useState(jr(f,I));en(()=>{for(const g of i)g in C&&Se(T[g],C[g]);return()=>{Object.values(T).map(ir)}},[C,T,I]),en(()=>{l(I,C)}),d.useImperativeHandle(u,Er(c(I)));const E=n;return m.jsx(a.Provider,{value:I,children:n?m.jsx(E,{...Ui([...r,...o,...i],C),children:w}):w})}),x=h=>{const u=d.useContext(a);return d.useCallback(w=>{he(u[h],w)},[u,h])},p=h=>{const u=d.useContext(a)[h],w=d.useCallback(C=>Se(u,C),[u]);return d.useSyncExternalStore(w,()=>_e(u),()=>_e(u))},v=h=>{const u=d.useContext(a)[h],[w,C]=d.useState(jr(_e,u));return en(()=>Se(u,I=>{I!==w&&C(Er(I))}),[u,w]),w},S=d.version.startsWith("18")?p:v;return{Component:b,useEmitter:(h,u)=>{const w=d.useContext(a)[h];en(()=>Se(w,u),[u,w])},useEmitterValue:S,usePublisher:x}}const us=d.createContext(void 0),ds=d.createContext(void 0),fs=typeof document<"u"?d.useLayoutEffect:d.useEffect;function Mn(e){return"self"in e}function Ki(e){return"body"in e}function ps(e,t,n,r=Bt,o,s){const i=d.useRef(null),a=d.useRef(null),l=d.useRef(null),c=d.useCallback(x=>{let p,v,S;const h=x.target;if(Ki(h)||Mn(h)){const w=Mn(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():Ws.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]);d.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 f(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;Mn(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)),ts(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:f}}const En="-webkit-sticky",Wr="sticky",hr=ls(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=En,e.style.position===En?En:Wr});function gr(e){return e}const Qi=ve(()=>{const e=V(a=>`Item ${a}`),t=V(a=>`Group ${a}`),n=V({}),r=V(gr),o=V("div"),s=V(Bt),i=(a,l=null)=>Ne(N(n,Z(c=>c[a]),ke()),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")}}),Yi=ve(([e,t])=>({...e,...t}),Re(as,Qi)),Xi=({height:e})=>m.jsx("div",{style:{height:e}}),Zi={overflowAnchor:"none",position:hr(),zIndex:1},hs={overflowAnchor:"none"},Ji={...hs,display:"inline-block",height:"100%"},Vr=d.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"),f=fe("groupContent"),b=fe("trackItemSizes"),x=fe("itemSize"),p=fe("log"),v=Ke("gap"),S=fe("horizontalDirection"),{callbackRef:h}=hi(n,x,b,e?Bt:a,p,v,o,S,fe("skipAnimationFrameInResizeObserver")),[u,w]=d.useState(0);mr("deviation",O=>{u!==O&&w(O)});const C=fe("EmptyPlaceholder"),I=fe("ScrollSeekPlaceholder")||Xi,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,{...He(C,c)}):m.jsx(T,{...He(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 _?d.createElement(I,{...He(I,c),height:O.size,index:O.index,key:L,type:O.type||"item",...O.type==="group"?{}:{groupIndex:O.groupIndex}}):O.type==="group"?d.createElement(g,{...He(g,c),"data-index":z,"data-item-index":O.index,"data-known-size":O.size,key:L,style:Zi},f(O.index,c)):d.createElement(E,{...He(E,c),...rl(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?Ji:hs},B?l(O.index,O.groupIndex,O.data,c):l(O.index,O.data,c))})})}),el={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},tl={outline:"none",overflowX:"auto",position:"relative"},mn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),nl={position:hr(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function rl(e,t){return{item:typeof e=="string"?void 0:t}}const ol=d.memo(function(){const e=fe("HeaderComponent"),t=Ke("headerHeight"),n=fe("HeaderFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),sl=d.memo(function(){const e=fe("FooterComponent"),t=Ke("footerHeight"),n=fe("HeaderFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,fe("skipAnimationFrameInResizeObserver")),o=fe("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null});function gs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return d.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),f=t("scrollerRef"),b=t("horizontalDirection")||!1,{scrollByCallback:x,scrollerRef:p,scrollToCallback:v}=ps(a,c,l,f,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?tl:el,...o},tabIndex:0,...i,...He(l,s),children:r})})}function ms({useEmitter:e,useEmitterValue:t,usePublisher:n}){return d.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),f=t("totalListHeight"),b=t("deviation"),x=t("customScrollParent"),p=d.useRef(null),v=t("scrollerRef"),{scrollByCallback:S,scrollerRef:h,scrollToCallback:u}=ps(a,c,l,v,x);return fs(()=>{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,...f!==0?{height:f+b}:{}},...i,...He(l,s),children:r})})}const il=({children:e})=>{const t=d.useContext(us),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=fe("alignToBottom"),s=fe("horizontalDirection"),i=d.useMemo(()=>Fo(n,l=>pt(l,s?"width":"height")),[n,s]),a=Ct(i,!0,fe("skipAnimationFrameInResizeObserver"));return d.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:mn(o),children:e})},ll=({children:e})=>{const t=d.useContext(us),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=fe("customScrollParent"),s=Vo(n,o,fe("skipAnimationFrameInResizeObserver")),i=fe("alignToBottom");return d.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:mn(i),children:e})},al=({children:e})=>{const t=fe("TopItemListComponent")||"div",n=fe("headerHeight"),r={...nl,marginTop:`${n}px`},o=fe("context");return m.jsx(t,{style:r,...He(t,o),children:e})},cl=d.memo(function(e){const t=fe("useWindowScroll"),n=fe("topItemsIndexes").length>0,r=fe("customScrollParent"),o=fe("context");return m.jsxs(r||t?fl:dl,{...e,context:o,children:[n&&m.jsx(al,{children:m.jsx(Vr,{showTopList:!0})}),m.jsxs(r||t?ll:il,{children:[m.jsx(ol,{}),m.jsx(Vr,{}),m.jsx(sl,{})]})]})}),{Component:ul,useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}=cs(Yi,{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"}},cl),dl=gs({useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}),fl=ms({useEmitter:mr,useEmitterValue:fe,usePublisher:Ke}),pl=ul,hl=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(gr),a=V(Bt),l=(c,f=null)=>Ne(N(s,Z(b=>b[c]),ke()),f);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")}});Re(as,hl);hr();const Dr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},gl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:$r,floor:an,max:Gt,min:jn,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 ml(e){return{...gl,items:e}}function tn(e,t){return e&&e.width===t.width&&e.height===t.height}function bl(e,t){return e&&e.column===t.column&&e.row===t.row}const xl=ve(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:f,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(Dr),_=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),ce=V(!1);Se(N(v,ge(W),ae(([G,ee])=>!!ee)),()=>{he(U,!1)}),Se(N(je(v,U,B,_,W,X),ae(([G,ee,M,F,,H])=>G&&!ee&&M.height!==0&&F.height!==0&&!H)),([,,,,G])=>{he(X,!0),ur(1,()=>{he(R,G)}),et(N(c),()=>{he(t,[0,0]),he(U,!0)})}),re(N(j,ae(G=>G!=null&&G.scrollTop>0),st(0)),g),Se(N(v,ge(j),ae(([,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(le(_,tn),le(B,tn),le(z,(G,ee)=>G&&G.column===ee.column&&G.row===ee.row),le(c)),Z(([G,ee,M,F])=>({gap:M,item:ee,scrollTop:F,viewport:G}))),L),re(N(je(le(E),r,le(z,bl),le(B,tn),le(_,tn),le(O),le(g),le(A),le(U),le(W)),ae(([,,,,,,,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 Dr;if(Ce===0){const Ie=dr(J,G),Oe=Ie+Math.max(D-1,0);return ml(Ur(Ie,Oe,Q))}const Pe=bs(ze,Ce,ne);let Ae,Fe;de?ee===0&&M===0&&D>0?(Ae=0,Fe=D-1):(Ae=Pe*an((ee+se)/(ue+se)),Fe=Pe*$r((M+se)/(ue+se))-1,Fe=jn(G-1,Gt(Fe,Pe-1)),Ae=jn(Fe,Gt(0,Ae))):(Ae=0,Fe=-1);const We=Ur(Ae,Fe,Q),{bottom:Ee,top:Xe}=Kr($,F,H,We),Ue=$r(G/Pe),q=Ue*ue+(Ue-1)*se-Ee;return{bottom:Ee,itemHeight:ue,items:We,itemWidth:Ce,offsetBottom:q,offsetTop:Xe,top:Xe}})),y),re(N(O,ae(G=>G!==null),Z(G=>G.length)),E),re(N(je(_,B,y,z),ae(([G,ee,{items:M}])=>M.length>0&&ee.height!==0&&G.height!==0),Z(([G,ee,{items:M},F])=>{const{bottom:H,top:$}=Kr(G,F,ee,M);return[$,H]}),ke(Ft)),t);const ie=V(!1);re(N(c,ge(ie),Z(([G,ee])=>ee||G!==0)),ie);const me=qe(N(je(y,E),ae(([{items:G}])=>G.length>0),ge(ie),ae(([[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),ke())),be=qe(N(le(y),ae(({items:G})=>G.length>0&&G[0].index===0),st(0),ke())),K=qe(N(le(y),ge(A),ae(([{items:G},ee])=>G.length>0&&!ee),Z(([{items:G}])=>({endIndex:G[G.length-1].index,startIndex:G[0].index})),ke(Qo),at(0)));re(K,p.scrollSeekRangeChanged),re(N(R,ge(_,B,E,z),Z(([G,ee,M,F,H])=>{const $=es(G),{align:Q,behavior:D,offset:de}=$;let J=$.index;J==="LAST"&&(J=F-1),J=Gt(0,J,jn(F-1,J));let ne=nr(ee,H,M,J);return Q==="end"?ne=qr(ne-ee.height+M.height):Q==="center"&&(ne=qr(ne-ee.height/2+M.height/2)),de&&(ne+=de),{behavior:D,top:ne}})),l);const oe=Ne(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:f,totalCount:E,useWindowScroll:u,viewportDimensions:_,windowScrollContainerState:w,windowScrollTo:C,windowViewportRect:I,...p,gridState:y,horizontalDirection:ce,initialTopMostItemIndex:W,totalListHeight:oe,...x,endReached:me,propsReady:S,rangeChanged:K,startReached:be,stateChanged:L,stateRestoreInProgress:A,...T}},Re(fr,Ve,Yt,is,mt,pr,gt));function bs(e,t,n){return Gt(1,an((e+n)/(an(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=nr(e,t,n,r[0].index);return{bottom:nr(e,t,n,r[r.length-1].index)+o,top:s}}function nr(e,t,n,r){const o=bs(e.width,n.width,t.column),s=an(r/o),i=s*n.height+Gt(0,s-1)*t.row;return i>0?i+t.row:i}const vl=ve(()=>{const e=V(b=>`Item ${b}`),t=V({}),n=V(null),r=V("virtuoso-grid-item"),o=V("virtuoso-grid-list"),s=V(gr),i=V("div"),a=V(Bt),l=(b,x=null)=>Ne(N(t,Z(p=>p[b]),ke()),x),c=V(!1),f=V(!1);return re(le(f),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:f,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),Sl=ve(([e,t])=>({...e,...t}),Re(xl,vl)),yl=d.memo(function(){const e=Te("gridState"),t=Te("listClassName"),n=Te("itemClassName"),r=Te("itemContent"),o=Te("computeItemKey"),s=Te("isSeeking"),i=Qe("scrollHeight"),a=Te("ItemComponent"),l=Te("ListComponent"),c=Te("ScrollSeekPlaceholder"),f=Te("context"),b=Qe("itemDimensions"),x=Qe("gap"),p=Te("log"),v=Te("stateRestoreInProgress"),S=Qe("reportReadyState"),h=Ct(d.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:Qr("column-gap",getComputedStyle(u).columnGap,p),row:Qr("row-gap",getComputedStyle(u).rowGap,p)})},[i,b,x,p]),!0,!1);return fs(()=>{e.itemHeight>0&&e.itemWidth>0&&S(!0)},[e]),v?null:m.jsx(l,{className:t,ref:h,...He(l,f),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(u=>{const w=o(u.index,u.data,f);return s?m.jsx(c,{...He(c,f),height:e.itemHeight,index:u.index,width:e.itemWidth},w):d.createElement(a,{...He(a,f),className:n,"data-index":u.index,key:w},r(u.index,u.data,f))})})}),wl=d.memo(function(){const e=Te("HeaderComponent"),t=Qe("headerHeight"),n=Te("headerFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Cl=d.memo(function(){const e=Te("FooterComponent"),t=Qe("footerHeight"),n=Te("headerFooterTag"),r=Ct(d.useMemo(()=>s=>{t(pt(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Il=({children:e})=>{const t=d.useContext(ds),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=Ct(d.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return d.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:mn(!1),children:e})},kl=({children:e})=>{const t=d.useContext(ds),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Te("customScrollParent"),s=Vo(n,o,!1);return d.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:mn(!1),children:e})},Rl=d.memo(function({...e}){const t=Te("useWindowScroll"),n=Te("customScrollParent"),r=n||t?_l:Tl,o=n||t?kl:Il,s=Te("context");return m.jsx(r,{...e,...He(r,s),children:m.jsxs(o,{children:[m.jsx(wl,{}),m.jsx(yl,{}),m.jsx(Cl,{})]})})}),{useEmitter:xs,useEmitterValue:Te,usePublisher:Qe}=cs(Sl,{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"}},Rl),Tl=gs({useEmitter:xs,useEmitterValue:Te,usePublisher:Qe}),_l=ms({useEmitter:xs,useEmitterValue:Te,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,De.WARN),t==="normal"?0:parseInt(t??"0",10)}const bn=d.createContext(void 0);function we(e,t){const n=d.useContext(bn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return Ut(n,e,t)}function Yr(){const e=d.useContext(bn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const br=d.createContext(void 0);function St(){const e=d.useContext(br);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function Y(e,t){const n=d.useContext(br);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return Ut(n,o=>e(o.progress),t)}const Ml="_run_zzb61_3",El="_runWrap_zzb61_7",jl="_highlight_zzb61_13",Pl="_highlightleft_zzb61_14",Ol="_highlightright_zzb61_15",Bl="_highlightcenter_zzb61_16",zl="_underline_zzb61_48",Al="_underlineleft_zzb61_49",Ll="_underlineright_zzb61_50",Gl="_underlinecenter_zzb61_51",ot={run:Ml,runWrap:El,highlight:jl,highlightleft:Pl,highlightright:Ol,highlightcenter:Bl,underline:zl,underlineleft:Al,underlineright:Ll,underlinecenter:Gl},Xr=e=>Symbol.iterator in e,Zr=e=>"entries"in e,Jr=(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},Hl=(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 Nl(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:Xr(e)&&Xr(t)?Zr(e)&&Zr(t)?Jr(e,t):Hl(e,t):Jr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function qt(e){const t=d.useRef(void 0);return n=>{const r=e(n);return Nl(t.current,r)?t.current:t.current=r}}function Fl(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 Wl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Vl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),vs=d.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),f=Y(y=>y.setRange),b=l!=null&&c!=null,x=d.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=d.useRef(null),v=d.useRef(!1),S=d.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(()=>{f(B,B),v.current=!0,p.current=null},800))},[t,r,f]),h=d.useCallback(()=>{p.current&&(window.clearTimeout(p.current),p.current=null)},[]),u=d.useCallback(()=>{h()},[h]),w=h,C=h,I=Y(y=>y.clearRange),T=d.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($l,{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),Dl=d.memo(function(){const t=d.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=te(qt(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}),$l=d.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=d.useCallback(h=>{const u=h.currentGlobalRunIndex;return u!=null&&u>=n.startG&&u<=n.endG},[n]),l=Y(qt(a)),c=d.useCallback(h=>l?{showPointer:h.showPointer,pointerStyle:h.pointerStyle,pointerColor:h.pointerColor}:Vl,[l]),f=te(qt(c)),b=n.r0??0,x=n.len??Math.max(0,n.endG-n.startG+1),p=l&&f.showPointer&&f.pointerStyle!=="underline",v=l&&f.showPointer&&f.pointerStyle==="underline",S=p||v?{"--hl-color":f.pointerColor,"--ul-color":f.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=`${ot.runWrap}`;return p&&(x===1?g+=` ${ot.highlight}`:u===0?g+=` ${ot.highlightleft}`:u+1===x?g+=` ${ot.highlightright}`:g+=` ${ot.highlightcenter}`),v&&(x===1?g+=` ${ot.underline}`:u===0?g+=` ${ot.underlineleft}`:u+1===x?g+=` ${ot.underlineright}`:g+=` ${ot.underlinecenter}`),m.jsxs(d.Fragment,{children:[m.jsx("span",{className:g,style:S,children:m.jsx(ql,{gi:n.startG,g:I,run:C,active:l,pointerCfg:f,isInRange:s!=null&&i!=null&&I>=s&&I<=i})}),E&&m.jsx(Dl,{})]},T)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),ql=d.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=d.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 f=c.startsWith("#")?Fl(c):Wl(c);f&&(.299*f.r+.587*f.g+.114*f.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 Ul({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(vs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Kl=d.memo(Ul,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Ql(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 to(e,!1);case"upperalpha":case"upperlatin":return to(e,!0);case"lowerroman":return eo(e,!1);case"upperroman":return eo(e,!0);case"decimalenclosedcircle":return Yl(e);default:return String(e)}}function Yl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function eo(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 to(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 xr(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 vr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Ql(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Xl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Zl(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 Jl(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 ea="_scroller_kqkmq_3",ta={scroller:ea},na=d.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${ta.scroller}${t?" "+t:""}`,style:n,...r})});function zt(){const e=d.useContext(wt);if(!e)throw new Error("useViewerRecorderStoreApi must be used inside <ViewerRecorderProvider>");return e}const rr=e=>/[가-힣a-zA-Z0-9]/.test(e),ra=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function oa(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,f=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=ra(v);if(!S||!rr(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<f||C===f&&(h.top<b||c!==-1&&Number(v.dataset.g)<c))&&(f=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<f||w===f&&(h.top<b||c!==-1&&u<c))&&(f=w,c=u,b=h.top)}return i!==-1?i:c}const Ss=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},no=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}},sa=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(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 ia(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(!sa(e,t,{topPaddingRatio:n,behavior:r}))return!1;await ia(e,o);const i=cn(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,f=a.top+c,b=l.top-f;return Math.abs(b)<=1},ft=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),Sr=d.createContext(null);function ys(){const e=d.useContext(Sr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Ze(e,t){const n=d.useContext(Sr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return Ut(n,e,t)}const ws=()=>{const e=Y(n=>n.section),t=e.quiz;if(t&&t.length){const n=ys();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},la="_navBtn_rnisf_2",aa="_disabled_rnisf_25",ca="_label_rnisf_31",jt={navBtn:la,disabled:aa,label:ca};var Cs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ro=d.createContext&&d.createContext(Cs),ua=["attr","size","title"];function da(e,t){if(e==null)return{};var n=fa(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 fa(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 un(){return un=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},un.apply(this,arguments)}function oo(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 dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(r){pa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function pa(e,t,n){return t=ha(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ha(e){var t=ga(e,"string");return typeof t=="symbol"?t:t+""}function ga(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 Is(e){return e&&e.map((t,n)=>d.createElement(t.tag,dn({key:n},t.attr),Is(t.child)))}function Ye(e){return t=>d.createElement(ma,un({attr:dn({},e.attr)},t),Is(e.child))}function ma(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=da(e,ua),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),d.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&d.createElement("title",null,s),e.children)};return ro!==void 0?d.createElement(ro.Consumer,null,n=>t(n)):t(Cs)}function so(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 io(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 ba=({isIcon:e=!0})=>{const t=Y(i=>i.isCanPrev),n=Y(i=>i.onSectionNav),r=!t,o=d.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${jt.navBtn} ${r?jt.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:jt.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(so,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=Y(i=>i.isCanNext),n=Y(i=>i.onSectionNav),r=!t,o=d.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${jt.navBtn} ${r?jt.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:jt.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(io,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ks(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 xa({section:e,blocks:t,nsPrefix:n}){const r=d.useMemo(()=>{const y=[],_=xr();return t.forEach((B,R)=>{B.type==="paragraph"&&(y[R]=vr(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,f=d.useRef({start:0,end:0}),b=d.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>=f.current.start&&y<=f.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(Kl,{block:_,computedMarker:R,ns:B,baseIndex:o[y],sectionId:e.section_id,preGroups:P})})},[t,r,o,n,e,s,c]),x=d.useRef(null),p=d.useCallback(y=>{x.current=y},[]),v=d.useMemo(()=>d.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=d.useRef(null),h=d.useMemo(()=>t.map(y=>y.id),[t]),u=d.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(ws,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{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(fn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,c]),w=d.useMemo(()=>({Item:v,Header:()=>m.jsx("div",{style:{height:40}}),Footer:u,Scroller:na}),[u,v]),C=d.useCallback(y=>h[y],[h]),I=St(),[T]=d.useState(()=>I.getState().progress.currentGlobalRunIndex??0),E=d.useMemo(()=>{if(!o.length)return 0;const y=o[o.length-1],_=Math.max(0,Math.min(T,y));return ks(o,_)},[o,T]);console.log("SectionRenderVirtuoso확인");const g=St();return d.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 Ss(y,R),await ft(),await ft(),await ft(),await ft(),console.log("첫랜더끝"),B(!1)})())},[x,g]),m.jsxs(m.Fragment,{children:[m.jsx(pl,{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(va,{scrollContainerRef:x,virtRef:S,prefix:o})]})}const va=({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=zt(),c=d.useRef(!1),f=d.useRef(null),b=d.useRef(null),x=d.useRef(null),p=d.useRef(-1),v=d.useCallback(()=>{if(i)return;f.current=null;const k=b.current;if(!k)return;const O=oa(k,5);O!==-1&&O!==p.current&&(p.current=O,a(O),r(O,"scroll"))},[i,a,r]),S=d.useCallback(k=>{b.current=k,f.current==null&&(f.current=requestAnimationFrame(v))},[v]),h=d.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=d.useRef(!1),w=d.useCallback(k=>{i||c.current&&(u.current||(S(k),h(k)))},[i,S,h]),C=d.useRef(void 0),I=d.useRef(void 0),T=d.useRef(void 0),E=d.useRef(void 0);d.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),f.current!=null&&cancelAnimationFrame(f.current),x.current!=null&&(clearTimeout(x.current),x.current=null)}},[w,e]),d.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=d.useRef({first:-1,last:-1}),y=d.useRef(!1),_=d.useCallback(()=>{const k=e.current;if(!k)return;const O=no(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=d.useRef(!1),R=d.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]);d.useEffect(()=>{!y.current&&i&&(B.current=!1,_()),y.current=i},[i,_]),d.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 Pn(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 Pn(k,s,{behavior:"smooth",topPaddingRatio:A})}j().then(A=>{A?_():R()})}},[i,s,R,_,e]);const P=d.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=ks(n,K);(ee=t.current)==null||ee.scrollToIndex({index:G,align:"start",behavior:z(oe)}),await Ss(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 Pn(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:()=>no(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 d.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(P()),()=>o(void 0)),[P,o]),null};function Sa(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 ya(){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=sn[t],{blocks:i,nsPrefix:a}=d.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=Pt(),c=d.useCallback(()=>{const{isSettingsOpen:v,setSettingsOpen:S,toggleOverlays:h}=l.getState();v?S(!1):h()},[l]),{onClick:f,onDoubleClick:b}=ti({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:Sa}),x=d.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=d.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:f,onDoubleClick:b,style:x,children:m.jsx("div",{style:p,children:m.jsx(xa,{section:e,blocks:i,nsPrefix:a})})})}function wa(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 Ca(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 Ia(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 ka(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 Ra(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 Ta="_wrap_1pn6r_2",_a="_visible_1pn6r_21",Ma="_container_1pn6r_27",Ea="_leftGroup_1pn6r_36",ja="_rightGroup_1pn6r_37",Pa="_leftleftGroup_1pn6r_51",Oa="_leftrightGroup_1pn6r_52",Ba="_btn_1pn6r_78",za="_btnForbidden_1pn6r_100",Aa="_btnActive_1pn6r_107",La="_label_1pn6r_112",Le={wrap:Ta,visible:_a,container:Ma,leftGroup:Ea,rightGroup:ja,leftleftGroup:Pa,leftrightGroup:Oa,btn:Ba,btnForbidden:za,btnActive:Aa,label:La},Ga=d.memo(function(){const t=d.useRef(null),n=d.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),f=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=d.useRef(null),E=d.useRef(null),g=d.useRef(!1),y=d.useRef(null);d.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;f(P)},[a,i,c,f]),d.useEffect(()=>{l==="real"&&(g.current=!0)},[l]);const _=d.useMemo(()=>{const R=p(i);if(!R)return null;try{return new URL(R,window.location.href).href}catch{return R}},[i,p]);d.useEffect(()=>{g.current=!0},[_]),d.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]),d.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]),d.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 d.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 Ha(){return m.jsx(Ga,{})}const Na="_scrubberWrap_jtztl_2",Fa="_labels_jtztl_8",Wa="_index_jtztl_14",Va="_controls_jtztl_18",Da="_percent_jtztl_24",$a="_range_jtztl_45",kt={scrubberWrap:Na,labels:Fa,index:Wa,controls:Va,percent:Da,range:$a};function qa(){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),f=we(I=>I.syncToGI),[b,x]=d.useState(()=>o(e||0));d.useEffect(()=>{x(o(e||0))},[e,o]);const p=d.useRef(!1),v=d.useMemo(()=>Math.max(0,Math.min(e??0,Math.max(0,(t??1)-1)))+1,[e,t]),S=d.useCallback(()=>{a&&(l(),p.current=!0)},[a,l]),h=d.useCallback(I=>{x(Number(I.currentTarget.value))},[]),u=d.useCallback(async()=>{const I=s(b),T=i(I);l(),n(T,"scrubber-commit"),f(T);const E=r();E!=null&&E.ensureVisibleGI&&await E.ensureVisibleGI(T),p.current&&(p.current=!1,c())},[b,s,i,l,n,f,r,c]),w=d.useMemo(()=>({"--pct":`${b}%`}),[b]),C=d.useMemo(()=>Math.round(b),[b]);return m.jsxs("div",{className:kt.scrubberWrap,children:[m.jsx("div",{className:kt.labels,children:m.jsxs("span",{className:kt.index,children:[v," / ",t||0]})}),m.jsxs("div",{className:kt.controls,children:[m.jsx("input",{type:"range",className:kt.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:kt.percent,children:[C,"%"]})]})]})}const Ua=d.memo(qa),Ka=e=>Math.max(50,Math.min(500,e)),Qa=d.memo(function(){const t=d.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),f=Y(y=>y.setCurrentGlobalRunIndex),b=Y(y=>y.getSectionScrollApi),x=Y(y=>y.nextReadableFrom),p=Y(y=>y.edgeReadable),v=d.useRef(null),S=d.useRef(null),h=d.useRef(0),u=d.useRef(-1),w=!n&&r==="fake"&&o==="playing",C=Math.max(1,(s==null?void 0:s.totalWords)??1),I=d.useMemo(()=>{const y=Ka(i||200);return C/y*6e4},[C,i]),T=d.useMemo(()=>!l||l<=1||I<=0?0:(l-1)/I,[l,I]);d.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=d.useRef(-1);d.useEffect(()=>{if(!l){E.current=-1;return}const y=p(1);E.current=y??-1},[p,l]);const g=d.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,f(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,f(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,f,b,a]);return d.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}),Ya=d.memo(function(){return m.jsx(Qa,{})}),Xa="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",Za="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",Ja="_WPMSpeedButtonsWrap_pxoh4_1",ec="_btnWrap_pxoh4_8",tc="_label_pxoh4_14",nc="_wpmString_pxoh4_21",rc="_iconBtn_pxoh4_24",Rt={WPMSpeedButtonsWrap:Ja,btnWrap:ec,label:tc,wpmString:nc,iconBtn:rc},lo=5,ao=350,oc=40,sc=.85,ic=e=>Math.max(50,Math.min(500,e)),lc=d.memo(function(){const t=te(b=>b.audioTargetWpm);te(b=>b.audioSpeed);const n=te(b=>b.setAudioTargetWpm),r=d.useRef(t);d.useEffect(()=>{r.current=t},[t]);const o=d.useRef(null),s=d.useRef(ao),i=d.useRef(null),a=d.useCallback(b=>{const x=r.current,p=b==="inc"?lo:-lo,v=ic(x+p);return v===x?!1:(n(v),r.current=v,!0)},[n]),l=d.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=d.useCallback(()=>{i.current&&(s.current=Math.max(oc,Math.floor(s.current*sc)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),f=d.useCallback(b=>{if(i.current)return;i.current=b,s.current=ao,a(b)&&c();const p=()=>l();window.addEventListener("mouseup",p,{once:!0}),window.addEventListener("touchend",p,{once:!0})},[c,a,l]);return d.useEffect(()=>l,[l]),m.jsx("div",{onMouseLeave:l,className:Rt.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Rt.btnWrap,children:[m.jsxs("button",{className:Rt.iconBtn,type:"button",title:"WPM 느리게",onMouseDown:()=>f("dec"),onTouchStart:b=>{b.preventDefault(),f("dec")},onMouseUp:l,children:[m.jsx("img",{src:Xa})," "]}),m.jsxs("div",{className:Rt.label,children:[m.jsx("div",{children:t}),m.jsx("div",{className:Rt.wpmString,children:"WPM"})]}),m.jsx("button",{className:Rt.iconBtn,type:"button",title:"WPM 빠르게",onMouseDown:()=>f("inc"),onTouchStart:b=>{b.preventDefault(),f("inc")},onMouseUp:l,children:m.jsx("img",{src:Za})})]})})}),ac="_StepBtn_ua1nh_1",cc={StepBtn:ac};function uc(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 dc(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 co({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=d.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]),f=d.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=d.useCallback(()=>{c(e==="left"?-1:1)},[e,c]);return m.jsx("button",{className:cc.StepBtn,type:"button",onClick:b,disabled:f,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(uc,{}):m.jsx(dc,{})})}const fc="_GCPlayBtn_1p162_1",pc="_playing_1p162_28",uo={GCPlayBtn:fc,playing:pc},hc=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${uo.GCPlayBtn} ${r?uo.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function gc(){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),f=Yr(),b=St();d.useEffect(()=>{const C=f.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,f]);const x=we(C=>C.play),p=we(C=>C.pause),v=we(C=>C.status),S=d.useCallback(C=>{C.stopPropagation(),v==="playing"||v==="loading"?p():x()},[v,x,p]),h=Yr(),u=St(),w=d.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(Ua,{}),r&&!o?m.jsx(Ha,{}):m.jsx(Ya,{}),m.jsxs("div",{className:Le.container,children:[m.jsxs("div",{className:Le.leftGroup,children:[m.jsxs("div",{className:Le.leftleftGroup,children:[m.jsx(co,{direction:"left"}),m.jsx(hc,{isPlaying:v==="playing",onClick:o?w:S,title:v==="playing"?"일시정지":"재생"}),m.jsx(co,{direction:"right"})]}),m.jsx("div",{className:Le.leftrightGroup,children:m.jsx(lc,{})})]}),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(wa,{size:18}):m.jsx(Ca,{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(Ia,{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(ka,{size:18}),m.jsx("span",{className:Le.label,children:"끊어읽기"})]}),m.jsx(ba,{}),m.jsx(fn,{})]})]})]})}const mc=d.memo(gc);function bc(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 xc="_host_v5qx1_3",vc="_topbar_v5qx1_11",Sc="_visible_v5qx1_32",yc="_backBtn_v5qx1_37",wc="_title_v5qx1_58",Cc="_settingsBtn_v5qx1_67",Tt={host:xc,topbar:vc,visible:Sc,backBtn:yc,title:wc,settingsBtn:Cc};function Ic(){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=d.useCallback(()=>{t==null||t()},[t]),a=d.useCallback(()=>{o(!0),s(!1)},[o,s]);return m.jsx("div",{className:Tt.host,children:m.jsxs("div",{className:`${Tt.topbar} ${e?Tt.visible:""}`,children:[m.jsx("button",{type:"button",className:Tt.backBtn,onClick:i,"aria-label":"뒤로가기",children:m.jsx(Ra,{size:28})}),m.jsx("div",{className:Tt.title,children:m.jsx("span",{className:"truncate",children:r||"섹션 없음"})}),m.jsx("button",{type:"button",className:Tt.settingsBtn,onClick:a,"aria-label":"뷰어 설정",children:m.jsx(bc,{size:28})})]})})}const kc=d.memo(Ic),Rc="_wrap_62su0_7",Tc="_wrapHidden_62su0_29",_c="_wrapVisible_62su0_35",Mc="_scrollArea_62su0_71",Ec="_row_62su0_81",jc="_label_62su0_89",Pc="_btn_62su0_95",Oc="_btnActive_62su0_106",Bc="_btnSmall_62su0_110",zc="_pill_62su0_122",Ac="_themeCircle_62su0_133",Lc="_themeCircleActive_62su0_146",Gc="_stepRow_62su0_151",Hc="_stepLabel_62su0_159",Nc="_levelBox_62su0_172",Fc="_inlineFlex_62su0_177",Me={wrap:Rc,wrapHidden:Tc,wrapVisible:_c,scrollArea:Mc,row:Ec,label:jc,btn:Pc,btnActive:Oc,btnSmall:Bc,pill:zc,themeCircle:Ac,themeCircleActive:Lc,stepRow:Gc,stepLabel:Hc,levelBox:Nc,inlineFlex:Fc};function Wc({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()),f=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=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return m.jsxs("div",{className:E,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Me.scrollArea,children:[m.jsx(At,{label:"열람방식",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(_t,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(_t,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(At,{label:"테마",children:m.jsx("div",{className:Me.inlineFlex,children:Object.keys(sn).map(g=>{const y=g,_=sn[y];return m.jsx("button",{type:"button",onClick:()=>o(y),className:`${Me.themeCircle} ${r===g?Me.themeCircleActive:""}`,style:{background:_.bg,color:_.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),m.jsx(At,{label:"글꼴",children:m.jsx("div",{className:Me.inlineFlex,children:Ho.map(g=>m.jsx(_t,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),m.jsx(nn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>b(Math.max(1,l-1)),onInc:()=>b(Math.min(12,l+1))}),m.jsx(nn,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>x(Math.max(1,c-1)),onInc:()=>x(Math.min(7,c+1))}),m.jsx(nn,{label:"여백",level:f,min:1,max:5,onDec:()=>p(Math.max(1,f-1)),onInc:()=>p(Math.min(5,f+1))}),m.jsx(At,{label:"포인터",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(_t,{active:v==="highlight",onClick:()=>S("highlight"),children:"형광펜"}),m.jsx(_t,{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(At,{label:"끊기표시",children:m.jsx("div",{className:Me.inlineFlex,children:m.jsx(_t,{active:w.slash,onClick:()=>C("slash"),children:"슬래쉬"})})}),m.jsx(nn,{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:Me.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:Me.pill,children:"보기 설정 초기화"})})]})}function At({label:e,children:t}){return m.jsxs("div",{className:Me.row,children:[m.jsx("label",{className:Me.label,children:e}),t]})}function _t({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 nn({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 Vc=d.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(kc,{}),m.jsx(mc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Wc,{visible:!t&&n})})]})}),Dc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const f=(l==null?void 0:l.equalityFn)||Object.is;let b=i(r.getState());c=x=>{const p=i(x);if(!f(b,p)){const v=b;a(b=p,v)}},l!=null&&l.fireImmediately&&a(b,b)}return o(c)}),e(t,n,r)},$c=Dc;function qc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Uc(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 Kc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Uc((r==null?void 0:r.text)??"");return t}function Qc(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,Kc(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,f=c?"paused":"idle",b=c?"real":"fake",x=c?null:{totalWords:l};return yt($c((p,v)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:f,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 qc(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 Yc({children:e,initialState:t}){const n=d.useContext(wt)??void 0,r=d.useMemo(()=>Qc({...t,recorderStore:n}),[t,n]);return m.jsx(bn.Provider,{value:r,children:e})}function Xc(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 f=l[c],b=o+c;f.audioChunkIndex!=null&&f.audioTimeMs!=null&&((t[i=f.audioChunkIndex]||(t[i]=[])).push({t:f.audioTimeMs,g:b}),n[b]={clip:f.audioChunkIndex,t:f.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function Zc(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 Jc(e){const t=Xl(e),n=Zl(t),r=t.reduce((f,b)=>f+(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((f,b)=>{var h;if(f.type!=="paragraph")return;const x=n[b]??0,p=f.runs??[];for(let u=0;u<p.length;u++){const w=((h=p[u])==null?void 0:h.text)||"";rr(w)&&(s[x+u]=1)}const S=Jl(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(rr(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 eu(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:c}=e,f=a.totalRuns??0,b=typeof l=="number"?l:f>0?0:-1,x=b>=0?Zc(i.readableGi,b,f):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:x,lastUpdateBy:"program",totalRuns:f,pageIndex:0,sectionLoading:!0,_loadingStartTime:c,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function tu(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:c,layout:f}=Jc(l),b=Date.now(),x=eu({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:c,layout:f,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(ce=>({progress:{...ce.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 ce=(W?U-W:0)/1e3;p(ie=>({progress:{...ie.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:ce}})}},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)??[],ce=U.prefix,ie=[];for(let be=0;be<X.length;be++){const K=X[be];if(K.type!=="paragraph")continue;const oe=K.runs??[],G=ce[be]??0;for(let ee=0;ee<oe.length;ee++){const M=G+ee;M>=j&&M<=A&&ie.push(oe[ee].text??"")}}return ie.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,ce=Math.max(0,Math.min(j,X-1));if(U[ce])return ce;let ie=ce-1,me=ce+1;for(;ie>=0||me<X;){if(me<X&&U[me])return me;if(ie>=0&&U[ie])return ie;me+=1,ie-=1}return ce},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 ce=Math.min(Math.max(j,0),W-1);ce<W;ce+=1)if(X[ce])return ce}else for(let ce=Math.min(Math.max(j,0),W-1);ce>=0;ce-=1)if(X[ce])return ce;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)??[],ce=U==null?void 0:U.giToGroupIdx;if(!X.length||!ce){const G=W-1;return _(Math.max(0,Math.min(j+A,G)))}let ie=ce[j]??-1;if(ie<0||ie>=X.length)for(let oe=0;oe<X.length;oe+=1){const G=X[oe];if(j>=G.startG&&j<=G.endG){ie=oe;break}}if(ie<0||ie>=X.length)return R(A)??_(j);const me=oe=>oe>=0&&oe<X.length&&(X[oe].firstReadableGI??-1)>=0;let be=ie+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 nu({children:e,initialState:t}){const n=d.useContext(wt),r=d.useMemo(()=>tu({...t,recorderStore:n}),[t,n]);return m.jsx(br.Provider,{value:r,children:e})}function ru({children:e,initialState:t}){const n=d.useContext(wt)??void 0,r=d.useMemo(()=>ri({init:t,recorderStore:n}),[]);return m.jsx(or.Provider,{value:r,children:e})}const ou=({pages:e,pageIndex:t,maxWidth:n})=>{const r=Y(I=>I.section),o=d.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),f=te(I=>I.playbackViewportHeight),b=f>0?f: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=d.useMemo(()=>{const I=[];return o.forEach((T,E)=>{(T.type==="paragraph"||T.type==="image")&&I.push(E)}),I},[o]),h=d.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=d.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=d.useMemo(()=>{const I=[],T=xr();return u.forEach((E,g)=>{I[g]=vr(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,ce=W+j;let ie=C(U,X,ce);const me=W+L;ie=ie.map(M=>{const F=Math.max(0,(M.startG??X)-me),H=M.len??Math.max(1,(M.endG??ce)-(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(vs,{preGroups:ie,runs:be,ns:B,baseIndex:me,sectionId:String(r.section_id)})]})},B)})})]})})},fo=.5;function su(e,t){const n=d.useRef(null),r=d.useRef(null),o=d.useRef(!1);d.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:f,height:b}=c.contentRect,x=r.current;if(!x){r.current={w:f,h:b};return}Math.abs(x.w-f)<fo&&Math.abs(x.h-b)<fo||(r.current={w:f,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 iu(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:f=300,suppressAfterSwipeMs:b=250,onDragMove:x,onDragEnd:p,pageTransitionThreshold:v}=e,S=v??i,h=Math.min(20,i),u=nt.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=nt.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=nt.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=nt.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,f,p]),g=nt.useCallback(()=>{u.current.swiping&&(p==null||p()),C(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[p]),y=nt.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]),_=nt.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=nt.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=nt.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 nt.useEffect(()=>()=>{w(),C()},[]),{onPointerDown:I,onPointerMove:T,onPointerUp:E,onPointerCancel:g,onPointerLeave:y,onLostPointerCapture:_,onClick:B,onDoubleClick:R}}var On,po;function Rs(){if(po)return On;po=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return On=e,On}var Bn,ho;function lu(){if(ho)return Bn;ho=1;var e=typeof Xt=="object"&&Xt&&Xt.Object===Object&&Xt;return Bn=e,Bn}var zn,go;function Ts(){if(go)return zn;go=1;var e=lu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return zn=n,zn}var An,mo;function au(){if(mo)return An;mo=1;var e=Ts(),t=function(){return e.Date.now()};return An=t,An}var Ln,bo;function cu(){if(bo)return Ln;bo=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Ln=t,Ln}var Gn,xo;function uu(){if(xo)return Gn;xo=1;var e=cu(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Gn=n,Gn}var Hn,vo;function _s(){if(vo)return Hn;vo=1;var e=Ts(),t=e.Symbol;return Hn=t,Hn}var Nn,So;function du(){if(So)return Nn;So=1;var e=_s(),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 f=r.call(i);return c&&(a?i[o]=l:delete i[o]),f}return Nn=s,Nn}var Fn,yo;function fu(){if(yo)return Fn;yo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Fn=n,Fn}var Wn,wo;function pu(){if(wo)return Wn;wo=1;var e=_s(),t=du(),n=fu(),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 Wn=i,Wn}var Vn,Co;function hu(){if(Co)return Vn;Co=1;function e(t){return t!=null&&typeof t=="object"}return Vn=e,Vn}var Dn,Io;function gu(){if(Io)return Dn;Io=1;var e=pu(),t=hu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Dn=r,Dn}var $n,ko;function mu(){if(ko)return $n;ko=1;var e=uu(),t=Rs(),n=gu(),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 f=typeof c.valueOf=="function"?c.valueOf():c;c=t(f)?f+"":f}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 $n=l,$n}var qn,Ro;function bu(){if(Ro)return qn;Ro=1;var e=Rs(),t=au(),n=mu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var f,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=f,z=b;return f=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&&f?I(k):(f=b=void 0,p)}function B(){v!==void 0&&clearTimeout(v),h=0,f=S=b=v=void 0}function R(){return v===void 0?p:_(t())}function P(){var k=t(),O=g(k);if(f=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 qn=i,qn}var xu=bu();const vu=Lo(xu);function Su(e,t=200,n,r){const o=d.useRef(e),s=d.useRef(n);d.useEffect(()=>{o.current=e},[e]),d.useEffect(()=>{s.current=n},[n]);const i=d.useMemo(()=>{const a=vu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var f;(f=s.current)==null||f.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 d.useEffect(()=>()=>i.cancel(),[i]),i}let Ms=0;class Es extends Error{constructor(){super("calcPages canceled due to a newer invocation");wr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const Je=e=>{if(e!==Ms)throw new Es},Un=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},To=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},yu=(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 wu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:f=0,showSlash:b,paragraphMarkers:x,playbackScale:p=1,viewportHeight:v=0}){var h,u,w;const S=++Ms;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=yu(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,(f??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($)},ce=v>80?Math.floor((v-80)*.6):void 0,ie=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%",ce&&($.style.maxHeight=`${ce}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=ie(ue);L.appendChild(Ce);const ze=Ce.getBoundingClientRect(),{mt:Pe,mb:Ae}=Un(Ce);A[M]={contentH:Math.ceil(ze.height),mt:Pe,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 Pe=document.createDocumentFragment();Pe.appendChild(ue),Pe.appendChild(Ce),L.appendChild(Pe)}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=To(J),Ce=To(se),{mt:ze,mb:Pe}=Un(J),{mt:Ae,mb:Fe}=Un(se),We=((w=H.runs)==null?void 0:w.length)??0,Ee=ne?Ce:ue,Xe=ne?Ae:ze,Ue=ne?Fe:Pe;if(M<3){const q=J.getBoundingClientRect().height;console.log(`[calcPages] para ${M}: height=${q.toFixed(2)}, lastBottom=[${ue.slice(-3).map(Ie=>Ie.toFixed(1)).join(",")}], runs=${We}`)}j.set(M,{runsLen:We,lastBottomWith:ue,lastBottomNo:Ee,mtWith:ze,mbWith:Pe,mtNo:Xe,mbNo:Ue})}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 Ee=A[K]??{contentH:0,mt:0,mb:0},Ue=(F===0?Ee.mt:H+Ee.mt)+Ee.contentH;if(_(Ue,F)){F+=Ue,Q=K,D=void 0,H=Ee.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),Pe=(F===0?Ce.top:H+Ce.top)+Ce.content;if(_(Pe,F)){F+=Pe,Q=K,D=ne-1,H=Ce.mb,K+=1,oe=void 0,G=null,ee=null;continue}let Ae=se,Fe=ne-1,We=se-1;for(;Ae<=Fe;){Je(S);const Ee=Ae+Fe>>1,Xe=me(J,se,Ee,ue),Ue=(F===0?Xe.top:H+Xe.top)+Xe.content;_(Ue,F)?(We=Ee,Ae=Ee+1):Fe=Ee-1}if(We>=se){be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:We}),oe=We+1,G=K,ee=We,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 Ee=se;be.push({startBlock:M,endBlock:K,...$!=null?{startOffsetInBlock:$}:{},endOffsetInBlock:Ee}),oe=Ee+1,G=K,ee=Ee,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 Cu(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 Iu(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 f=0,b=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(f=Math.max(0,Math.min(i.startOffsetInBlock,b))),a===i.endBlock&&i.endOffsetInBlock!=null&&(b=Math.max(f,Math.min(i.endOffsetInBlock,b)));const x=r[l.originalIndex]??0,p=x+f,v=x+b;if(e>=p&&e<=v)return s}}return-1}function ku(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 Ru(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 Tu(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 _u(){var Ue;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=zt(),i=te(q=>q.theme),a=sn[i],l=te(q=>q.fontFamily),c=te(q=>q.fontSizePx),f=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=d.useRef(null),{items:u}=d.useMemo(()=>{var q;return Tu(((q=e==null?void 0:e.ast)==null?void 0:q.blocks)??[])},[e]),w=d.useMemo(()=>{const q=[],Ie=xr();return u.forEach(Oe=>{if(Oe.kind==="paragraph"){const ct=Oe.paraIndex;q[ct]=vr(Oe.block,Ie)}}),q},[u]),[C,I]=d.useState({pages:[],pageByRunIndex:null}),T=Y(q=>q.pageIndex),E=Y(q=>q.setPageIndex),g=d.useRef(0),y=d.useRef(null),[_,B]=d.useState(!1),[R,P]=d.useState(null),[k,O]=d.useState(!1),z=d.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:c,lineHeight:f,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,c,f]),{showSplit:L,breakGapPx:j,slash:A}=te(qt(q=>{var Ie;return{showSplit:q.showSplit,breakGapPx:q.breakGapPx??0,slash:((Ie=q.breakMarks)==null?void 0:Ie.slash)??!1}})),W=St();d.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=d.useCallback(()=>{console.log("@@@@@@recalc호출");const q=h.current,Ie=de.current,Oe=J.current;if(console.log("showSplit",L),!q||!Ie||!Oe||u.length===0){I({pages:[],pageByRunIndex:null}),E(0);return}(async()=>{const ct=performance.now();try{const bt=s.getState().playbackScale,{pages:yr,pageByRunIndex:Gs}=await wu({viewHost:q,measureRoot:Ie,contentArea:Oe,items:u,cfgMaxWidth:S,marginX:b,fontFamily:l,fontSizePx:c,lineHeight:f,showSplit:L,breakGapPx:j,showSlash:A,paragraphMarkers:w,playbackScale:bt,viewportHeight:v}),Hs=performance.now();console.log(`✅ calcPages 완료: ${(Hs-ct).toFixed(1)} ms (${yr.length} pages)`),I({pages:yr,pageByRunIndex:Gs}),E(0)}catch(bt){if(bt instanceof Es){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",bt)}})()},[e,u,S,b,l,c,f,L,j,A,w,s,v]),X=Y(q=>q.setCurrentGlobalRunIndex);Y(q=>q.totalRuns);const ce=Y(q=>{var Ie;return((Ie=q.layout)==null?void 0:Ie.prefix)??[]}),ie=d.useCallback(q=>{const Ie=C.pages.length+1,Oe=T+q;if(Oe<0||Oe>=Ie)return;if(Oe===C.pages.length){E(Oe);return}const ct=Cu(C.pages[Oe],u,ce);ct!=null?X(ct,"scrubber-step"):E(Oe)},[T,C.pages,u,ce,X,E]),me=d.useCallback(()=>{_||g.current!==0?(P("prev"),B(!1)):ie(-1)},[_,ie]),be=d.useCallback(()=>{_||g.current!==0?(P("next"),B(!1)):ie(1)},[_,ie]),K=Pt(),oe=d.useCallback(()=>{const{isSettingsOpen:q,setSettingsOpen:Ie,toggleOverlays:Oe}=K.getState();q?Ie(!1):Oe()},[K]),G=C.pages.length+1,ee=((Ue=h.current)==null?void 0:Ue.clientWidth)||400,M=d.useCallback(q=>{var bt;const Ie=y.current;if(!Ie)return;const Oe=((bt=h.current)==null?void 0:bt.clientWidth)||1,ct=q/Oe*33.333;Ie.style.transform=`translate3d(${-33.333+ct}%, 0, 0)`},[]),F=d.useCallback(q=>{T===0&&q>0||T>=G-1&&q<0||(g.current=q,M(q),_||B(!0))},[T,G,M,_]),H=d.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)")},[]),$=d.useCallback(q=>{if(q.target!==q.currentTarget||q.propertyName!=="transform")return;const Ie=R;O(!0),P(null),g.current=0,Ie==="prev"?ie(-1):Ie==="next"&&ie(1)},[R,ie]);d.useLayoutEffect(()=>{k&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{O(!1)})})},[k]);const Q=d.useCallback(q=>o||Ru(q)?!0:ku(q),[o]),D=iu({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=d.useRef(null),J=d.useRef(null),ne=d.useCallback(()=>{const q=W.getState().progress.setSectionLoading;q(!0)},[W]),se=Su(U,200,ne,{trailing:!0,leading:!1,maxWait:1e3}),ue=d.useRef("");d.useEffect(()=>{if(v<=0)return;const q=`${l}|${c}|${f}|${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,f,b,L,j,A,v,e==null?void 0:e.section_id]),su([h],se);const Ce=Y(q=>q.registerSectionScrollApi);d.useEffect(()=>(Ce({ensureVisibleGI:async()=>!0,scrollToGI:async()=>!0,getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:async()=>{},stepPage:ie}),()=>Ce(void 0)),[Ce,ie]);const ze=e.quiz&&e.quiz.length>0,Pe=T>0?T-1:null,Ae=T<G-1?T+1:null,Fe=d.useMemo(()=>R==="prev"?"translate3d(0%, 0, 0)":R==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[R]),We=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(ws,{}),m.jsx(fn,{isIcon:!1})]}):m.jsx(ou,{pages:C.pages,pageIndex:q,maxWidth:S}),Ee={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:Fe,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:Ee,children:Pe!==null&&We(Pe)}),m.jsx("div",{style:Ee,children:We(T)}),m.jsx("div",{style:Ee,children:Ae!==null&&We(Ae)})]}),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:f,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(Mu,{pages:C.pages,items:u,onGotoPage:E})]})}const Mu=({pages:e,items:t,onGotoPage:n})=>{const r=Y(s=>s.currentGlobalRunIndex),o=Y(s=>{var i;return((i=s.layout)==null?void 0:i.prefix)??[]});return d.useEffect(()=>{if(r==null||e.length===0)return;const s=Iu(r,e,t,o);s>=0&&n(s)},[r,e,t,o,n]),m.jsx(m.Fragment,{})},Eu="_wrapper_dbk3n_1",ju="_spinner_dbk3n_10",_o={wrapper:Eu,spinner:ju};function Pu({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${_o.wrapper}`,children:m.jsx("div",{className:_o.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Ou(){const e=Y(qt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(Pu,{})})}const Bu="_Overlay_ybic8_3",zu="_Dialog_ybic8_15",Au="_Body_ybic8_25",Lu="_Header_ybic8_32",Gu="_Paging_ybic8_39",Hu="_Remaining_ybic8_48",Nu="_RemainingDanger_ybic8_55",Fu="_NextBtn_ybic8_59",Wu="_CloseBtn_ybic8_96",Vu="_Question_ybic8_113",Du="_Score_ybic8_123",$u="_Image_ybic8_130",qu="_Options_ybic8_140",Uu="_OptionBtn_ybic8_145",Ku="_OptionBtnActive_ybic8_165",Qu="_Footer_ybic8_172",Yu="_OptionBtnCorrect_ybic8_195",Xu="_Judge_ybic8_201",Zu="_Correct_ybic8_212",Ju="_Incorrect_ybic8_215",ed="_ResultHeader_ybic8_220",td="_ResultActions_ybic8_233",nd="_CloseBtnSoft_ybic8_239",rd="_SummaryGrid_ybic8_249",od="_StatCard_ybic8_257",sd="_StatLabel_ybic8_265",id="_StatValue_ybic8_270",ld="_StatSub_ybic8_277",pe={Overlay:Bu,Dialog:zu,Body:Au,Header:Lu,Paging:Gu,Remaining:Hu,RemainingDanger:Nu,NextBtn:Fu,CloseBtn:Wu,Question:Vu,Score:Du,Image:$u,Options:qu,OptionBtn:Uu,OptionBtnActive:Ku,Footer:Qu,OptionBtnCorrect:Yu,Judge:Xu,Correct:Zu,Incorrect:Ju,ResultHeader:ed,ResultActions:td,CloseBtnSoft:nd,SummaryGrid:rd,StatCard:od,StatLabel:sd,StatValue:id,StatSub:ld};function ad(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function js(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function cd(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 ud=d.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),f=Ze(h=>h.finishedAt),b=Ze(h=>h.perQ),x=ys();d.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=d.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 f=="number"?Math.max(0,f-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,f,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(dd,{q:p,index:o,total:r.length,selected:v,uiReveal:l,onSelect:h=>{if(l)return;const u=x.getState();js(p)?u.selectToggle(h):u.selectSingle(h)},onBeforeNext:()=>x.getState().setReveal(!0),onNext:()=>x.getState().afterRevealNext(),remainingSec:a,onClose:()=>x.getState().close()}):m.jsx(fd,{total:r.length,correct:i,summary:S,onClose:()=>x.getState().close()})})})});function dd(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:f}=e,b=js(t),x=d.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=d.useMemo(()=>ad(t),[t]),v=d.useMemo(()=>cd(t),[t]),S=d.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:f,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 Mo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function fd(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:Mo(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:pe.StatSub,children:`평균 ${Mo(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 pd(e){return e.map((t,n)=>n)}function hd(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 Kn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Qn(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 Eo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:pd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function gd(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=Eo(e);return yt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Eo(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,f=a.answers[c]??[],b=f.includes(i)?f.filter(x=>x!==i):[...f,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,f=(i.answers[c]??[]).slice().sort((h,u)=>h-u),b=Qn(l),x=hd(f,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:Kn(l),selected:f,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,f=a.perQ[c],b={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Kn(l),selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??Qn(l),isCorrect:(f==null?void 0:f.isCorrect)??!1,ms:(f==null?void 0:f.ms)??0,revealed:!0,timedOut:(f==null?void 0:f.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,f=i.perQ[c],b={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Kn(l),selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??Qn(l),isCorrect:(f==null?void 0:f.isCorrect)??!1,ms:(f==null?void 0:f.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:b}})}else o({remainingSec:a})}}))}function md({children:e,initialState:t}){const n=d.useMemo(()=>gd(t.section),[t]),r=d.useRef(t.onQuizComplete);return d.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),d.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:f,perQ:b,startedAt:x,finishedAt:p}=s,v=f.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(Sr.Provider,{value:n,children:e})}function bd({containerRef:e}){const t=zt(),n=Pt();return d.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 xd=e=>e;function vd(e,t=xd){const n=d.useSyncExternalStore(e.subscribe,d.useCallback(()=>t(e.getState()),[e,t]),d.useCallback(()=>t(e.getInitialState()),[e,t]));return d.useDebugValue(n),n}const jo=e=>{const t=yt(e),n=r=>vd(t,r);return Object.assign(n,t),n},Sd=(e=>e?jo(e):jo),Po=Sd(e=>({_snapshotGetter:null,registerSnapshotGetter:t=>{e({_snapshotGetter:t})},unregisterSnapshotGetter:()=>{e({_snapshotGetter:null})}}));function yd({containerRef:e}){const t=Pt(),n=St(),r=zt();return d.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,f=(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:f}};return Po.getState().registerSnapshotGetter(s),()=>{Po.getState().unregisterSnapshotGetter()}},[r,t,n,e]),null}function wd(){const e=zt(),t=Pt(),n=St(),r=d.useContext(bn),o=d.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=d.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:f,anchorGI:b,anchorOffsetRatio:x}=l.payload,p=n.getState().progress.getSectionScrollApi();p&&(f===0?p.setScrollTop(0):p.scrollToGIAtOffset&&typeof b=="number"&&p.scrollToGIAtOffset(b,x));break}case"settings_change":{const{key:c,value:f}=l.payload,b=t.getState();c in b&&typeof b[c]!="function"&&t.setState({[c]:f});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=d.useCallback(()=>{e.getState().setDispatchHandler(s),e.getState().setApplySnapshotHandler(o)},[e,s,o]),a=d.useCallback(()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)},[e]);return d.useEffect(()=>{if(e.getState().isPlaybackMode)return i(),()=>a()},[e,i,a]),d.useEffect(()=>e.subscribe((c,f)=>{c.isPlaybackMode&&!f.isPlaybackMode?i():!c.isPlaybackMode&&f.isPlaybackMode&&a()}),[e,i,a]),null}const Oo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","audioTargetWpm","showPointer","showSplit","showOverlays","isSettingsOpen"];function Cd(){const e=zt(),t=Pt(),n=d.useRef(null);return d.useEffect(()=>{const r=t.getState();n.current={};for(const s of Oo)n.current[s]=r[s];const o=t.subscribe(s=>{const i=n.current;if(i)for(const a of Oo){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 Id=({onTranslate:e})=>{const t=Y(f=>f.rangeStartGI),n=Y(f=>f.rangeEndGI),r=Y(f=>f.getRangeText),o=Y(f=>f.clearRange),s=t!=null&&n!=null,[i,a]=d.useState(null);d.useEffect(()=>{if(!s)return;const f=()=>{o()};return window.addEventListener("resize",f),()=>window.removeEventListener("resize",f)},[s,o]),d.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const f=()=>{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 f(),window.addEventListener("scroll",f,!0),()=>window.removeEventListener("scroll",f,!0)},[s,t,n]);const l=d.useCallback(async()=>{const f=r();if(f)try{await navigator.clipboard.writeText(f)}catch(b){console.error("복사 실패:",b)}o()},[r,o]),c=d.useCallback(()=>{const f=r();f&&e&&e(f)},[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:"번역"})]})},kd="_handleStart_1336y_16 _handle_1336y_1",Rd="_handleEnd_1336y_21 _handle_1336y_1",Bo={handleStart:kd,handleEnd:Rd},Td=()=>{const e=Y(S=>S.rangeStartGI),t=Y(S=>S.rangeEndGI),n=Y(S=>S.setRange),r=e!=null&&t!=null,[o,s]=d.useState(null),[i,a]=d.useState(null),l=d.useRef(null),c=d.useRef(null);d.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 f=d.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=d.useCallback(S=>h=>{h.preventDefault(),h.stopPropagation(),l.current=S,c.current=S==="start"?e:t,h.target.setPointerCapture(h.pointerId)},[e,t]),x=d.useCallback(S=>{if(!l.current||e==null||t==null)return;const h=f(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,f]),p=d.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:Bo.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:Bo.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:b("end"),onPointerMove:x,onPointerUp:p,onPointerCancel:p})]}):null};function _d(){const e=Y(o=>o.rangeStartGI),t=Y(o=>o.rangeEndGI),n=Y(o=>o.clearRange),r=e!=null&&t!=null;return d.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),f=Math.min(e,t),b=Math.max(e,t);if(c>=f&&c<=b)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Md=({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,Ed=(e,t,n)=>Math.min(n,Math.max(t,e));function Ps({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:c,isPlaybackMode:f=!1,playbackScale:b}){const x=String((e==null?void 0:e.section_id)??"0"),p=d.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=d.useMemo(()=>typeof n=="number"?Ed(n,p>0?0:-1,Math.max(p-1,-1)):(p>0,0),[n,p]),S=d.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=d.useMemo(()=>{const u=(e==null?void 0:e.audios)??[],w=u.length>0?Xc(e):void 0;return{clips:u,map:w,initialIndex:v,section:e}},[e,v]);return m.jsx(ei,{onViewerEvent:l,isPlaybackMode:f,playbackScale:b,viewerRef:c,children:m.jsx(ru,{initialState:t,children:m.jsx(nu,{initialState:S,children:m.jsx(Yc,{initialState:h,children:m.jsx(md,{initialState:{section:e,onQuizComplete:a},children:m.jsx(jd,{})},x)},x)},x)})})}function jd(){const e=te(f=>f.mode),t=d.useRef(null),[n,r]=d.useState(!1),[o,s]=d.useState(),i=d.useCallback(f=>{s(f),r(!0)},[]),a=d.useCallback(()=>{r(!1),s(void 0)},[]),l=f=>{f.preventDefault()},c=f=>{f.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(ya,{}):m.jsx(_u,{}),m.jsx(Vc,{}),m.jsx(ud,{}),m.jsx(Ou,{}),m.jsx(Id,{onTranslate:i}),m.jsx(Td,{}),m.jsx(_d,{}),m.jsx(Md,{isOpen:n,onClose:a,text:o}),m.jsx(yd,{containerRef:t}),m.jsx(bd,{containerRef:t}),m.jsx(Cd,{}),m.jsx(wd,{})]})}function Pd(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 Od(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 Bd="_button_onals_1",zd={button:Bd};function Ad({playbackState:e,disabled:t,onClick:n}){return m.jsx("button",{onClick:n,disabled:t,className:zd.button,title:e==="playing"?"일시정지":e==="paused"?"재개":"재생",children:e==="playing"?m.jsx(Pd,{}):m.jsx(Od,{})})}const Ld=d.memo(Ad),Gd="_container_18q02_1",Hd="_topRow_18q02_11",Nd="_timeDisplay_18q02_17",Fd="_bottomRow_18q02_23",Wd="_sliderContainer_18q02_29",Vd="_trackBackground_18q02_35",Dd="_trackFill_18q02_47",$d="_rangeInput_18q02_54",qd="_viewportInfo_18q02_89",rt={container:Gd,topRow:Hd,timeDisplay:Nd,bottomRow:Fd,sliderContainer:Wd,trackBackground:Vd,trackFill:Dd,rangeInput:$d,"rangeInput--disabled":"_rangeInput--disabled_18q02_66",viewportInfo:qd};function Ud({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))},f=[rt.rangeInput,t&&rt["rangeInput--disabled"]].filter(Boolean).join(" ");return m.jsxs("div",{className:rt.container,children:[m.jsxs("div",{className:rt.topRow,children:[m.jsx(Ld,{playbackState:e,disabled:t,onClick:s}),m.jsxs("span",{className:rt.viewportInfo,children:["해상도: ",o.width.toFixed(0)," × ",o.height.toFixed(0)]}),m.jsxs("span",{className:rt.timeDisplay,children:[n.toFixed(1),"s / ",r.toFixed(1),"s"]})]}),m.jsx("div",{className:rt.bottomRow,children:m.jsxs("div",{className:rt.sliderContainer,children:[m.jsx("div",{className:rt.trackBackground,children:m.jsx("div",{className:rt.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:f})]})})]})}const Os=d.memo(Ud),Kd="_outerContainer_77t1u_1",Qd="_scaleWrapper_77t1u_11",Yd="_viewerContainer_77t1u_15",Xd="_eventBlocker_77t1u_22",Zd="_emptyMessage_77t1u_29",Jd="_bufferingOverlay_77t1u_34",e0="_spinner_77t1u_44",ut={outerContainer:Kd,scaleWrapper:Qd,viewerContainer:Yd,eventBlocker:Xd,emptyMessage:Zd,bufferingOverlay:Jd,spinner:e0},t0=d.memo(Ps),zo=24;function n0({isBuffering:e,isEmpty:t,currentViewport:n,initialSnapshot:r,section:o,sectionSummaries:s,onSectionChange:i,viewerRef:a,onContainerResize:l,onScaleChange:c}){const f=d.useRef(null),[b,x]=d.useState({width:0,height:0});d.useEffect(()=>{const h=f.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=d.useMemo(()=>n.width>0&&n.height>0?n:{width:r.viewportWidth||400,height:r.viewportHeight||600},[n,r]),v=d.useMemo(()=>{if(b.width===0||b.height===0)return 1;const h=(b.width-zo*2)/p.width,u=(b.height-zo*2)/p.height;return Math.min(h,u,1)},[b,p]);d.useEffect(()=>{c==null||c(v)},[v,c]);const S=b.width>0&&b.height>0;return m.jsxs("div",{ref:f,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(t0,{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 Bs=d.memo(n0),xn=d.createContext(void 0);function dt(e,t){const n=d.useContext(xn);if(!n)throw new Error("useViewerPlayerStore must be used inside <ViewerPlayerProvider>");return Ut(n,e,t)}function zs(){const e=d.useContext(xn);if(!e)throw new Error("useViewerPlayerStoreApi must be used inside <ViewerPlayerProvider>");return e}const Ao={width:0,height:0};function As(){return yt((e,t)=>({meta:null,playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:Ao,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??Ao,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0})}}))}function Ls({children:e,meta:t,initialSection:n,initialViewport:r}){const o=d.useMemo(()=>As(),[]);return d.useLayoutEffect(()=>{o.getState().setMeta(t??null)},[t,o]),d.useLayoutEffect(()=>{n&&o.getState().setCurrentSection(n)},[n,o]),d.useLayoutEffect(()=>{r&&o.getState().setCurrentViewport(r)},[r,o]),m.jsx(xn.Provider,{value:o,children:e})}const r0="_container_1dh6p_1",o0={container:r0},s0=100;function i0(e){const{meta:t,initialSection:n}=e,r={width:t.initialSnapshot.viewportWidth,height:t.initialSnapshot.viewportHeight};return m.jsx(Ls,{meta:t,initialSection:n,initialViewport:r,children:m.jsx(l0,{...e})})}function l0({meta:e,getChunk:t,availableChunks:n,initialStartTime:r=0,initialSection:o,sectionsMap:s,sectionSummaries:i=[],onSectionChange:a,onChunksEvicted:l}){const{totalDuration:c,chunkCount:f,chunkDuration:b,initialSnapshot:x}=e,p=zs(),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=d.useMemo(()=>f===0?0:Math.min(Math.floor(r/b),f-1),[r,b,f]),I=d.useRef(0),T=d.useRef(0),E=d.useRef(0),g=d.useRef(null),y=d.useRef(0),_=d.useRef(0),B=d.useRef(0),R=d.useRef(!1),P=d.useRef(null),k=d.useRef(new Map),O=d.useRef(new Set),z=d.useRef(null);d.useMemo(()=>{if(f===0)return 0;const M=Math.floor(h/b);return Math.min(M,f-1)},[h,b,f]);const L=`${c}-${f}-${x.globalIndex}`,j=d.useRef(L);d.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=d.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=d.useCallback(async M=>{if(M<0||M>=f)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)}},[f,t,l,p]),U=d.useCallback(M=>{const F=M+1;F<f&&!k.current.has(F)&&W(F)},[f,W]),X=d.useRef(!0);d.useEffect(()=>{if(!X.current||f===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)];$<f&&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}},[f,W,C,r,s,A,p]);const ce=d.useCallback(async M=>{const F=p.getState(),H=Math.min(Math.floor(M/b),f-1),$=H+1,Q=[W(H)];$<f&&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,f,W,s,A,p]),ie=d.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 ce(H),F.setIsBuffering(!1)},[c,ce,p]),me=d.useCallback(()=>{const M=p.getState(),F=performance.now(),H=(F-E.current)/1e3;I.current=H,F-T.current>=s0&&(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<f-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)},[f,c,W,U,A,p]),be=d.useCallback(async()=>{var H;if(f===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),$()}},[f,c,x,me,W,U,p]),K=d.useRef(null),oe=d.useCallback(()=>{R.current=p.getState().playbackState==="playing",g.current&&(cancelAnimationFrame(g.current),g.current=null)},[p]),G=d.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=d.useCallback(async()=>{const M=K.current;K.current=null,M!==null&&await ie(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},[ie,me,p]);return d.useEffect(()=>()=>{g.current&&cancelAnimationFrame(g.current)},[]),w?m.jsxs("div",{className:o0.container,children:[m.jsx(Os,{playbackState:v,disabled:f===0,elapsedTime:h,totalDuration:c,viewport:{width:u.width,height:u.height},onTogglePlay:be,onSeekStart:oe,onSeekChange:G,onSeekEnd:ee}),m.jsx(Bs,{isBuffering:S,isEmpty:f===0,currentViewport:u,initialSnapshot:x,section:w,sectionSummaries:i,onSectionChange:a,viewerRef:z,onScaleChange:p.getState().setViewportScale})]}):null}exports.CRViewer=Ps;exports.CR_ViewerPlayback=i0;exports.PlaybackBar=Os;exports.PlaybackViewport=Bs;exports.ViewerPlayerContext=xn;exports.ViewerPlayerProvider=Ls;exports.createViewerPlayerStore=As;exports.useViewerPlayerStore=dt;exports.useViewerPlayerStoreApi=zs;
|