@readerseye2/cr_viewer 1.0.13 → 1.0.14

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/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_1fciy_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;flex-shrink:0;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_1fciy_2:hover:not(:disabled){background:#0000000f}._navBtn_1fciy_2:active:not(:disabled){background:#0000001a}._navBtn_1fciy_2:disabled,._navBtn_1fciy_2._disabled_1fciy_26{opacity:.4;cursor:not-allowed;transform:none}._label_1fciy_32{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center}._navGroup_1fciy_40{display:flex;gap:8px}._wrap_1symx_4{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;padding:8px 8px 10px;box-sizing:border-box;background:#fff;color:#333;border-top:1px solid #ddd;transition:opacity .15s ease;opacity:0;pointer-events:none;container-type:inline-size;container-name:bottombar}._visible_1symx_25{opacity:1;pointer-events:auto}._compact_1symx_31{padding:6px 8px 8px}._compact_1symx_31 ._row2_1symx_34{display:none}@container bottombar (min-width: 600px){._compact_1symx_31 ._row2_1symx_34{display:contents}}._controls_1symx_44{display:flex;flex-wrap:wrap;align-items:center;gap:4px}._row1_1symx_52,._row2_1symx_34{display:flex;align-items:center;justify-content:space-between;width:100%;gap:4px}._row2_1symx_34{margin-top:4px}@container bottombar (min-width: 500px){._row1_1symx_52,._row2_1symx_34{display:contents}._controls_1symx_44{flex-wrap:nowrap;justify-content:space-between}._row2_1symx_34{margin-top:0}}._groupExpand_1symx_80,._groupPlayback_1symx_81,._groupSpeed_1symx_82,._groupFeatures_1symx_83,._groupNav_1symx_84{display:flex;align-items:center;flex-shrink:0}._groupExpand_1symx_80{gap:0}._groupPlayback_1symx_81{gap:2px}._groupSpeed_1symx_82{gap:0}._groupFeatures_1symx_83,._groupNav_1symx_84{gap:2px}._btn_1symx_116{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease;flex-shrink:0}._btn_1symx_116:hover{background:#0000000f}._btn_1symx_116:active{background:#0000001f}._btnForbidden_1symx_141{opacity:.4;cursor:not-allowed;background:#f2f2f2!important}._btnActive_1symx_147{background:#333;color:#fff}._btnActive_1symx_147:hover{background:#555}._btnActive_1symx_147:active{background:#666}._label_1symx_158{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center;font-variant-numeric:tabular-nums}._compactBtn_1symx_167{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border:none;border-radius:4px;background:none;color:#000;cursor:pointer;padding:2px;flex-shrink:0}._compactBtn_1symx_167:hover{background:#0000000f}._compactBtn_1symx_167:active{background:#0000001f}._scrubberWrap_uw0cd_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none;margin-bottom:6px}._labels_uw0cd_9{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_uw0cd_9 ._index_uw0cd_15{font-variant-numeric:tabular-nums}._controls_uw0cd_19{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_uw0cd_19 ._percent_uw0cd_25{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_uw0cd_32{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_uw0cd_32:disabled{opacity:.5;cursor:not-allowed}._range_uw0cd_46{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_uw0cd_46::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_uw0cd_46::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_r3byt_1{float:right;box-sizing:border-box;display:flex;flex-direction:column}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7{box-sizing:border-box;padding:2px;display:flex;gap:1px;align-items:center}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._label_r3byt_14{font-size:.55rem;display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:24px}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22{padding:2px;border-radius:4px;border:1px solid #888;background:none;width:34px;height:34px;flex-shrink:0;cursor:pointer;transition:all .15s ease}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:hover{background:#0000000f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:active{background:#0000001f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22 img{width:100%;height:100%;object-fit:contain}._StepBtn_15t0r_1{background:none;border:none;border-radius:8px;font-size:1.6rem;display:flex;justify-content:center;align-items:center;color:#000;flex-shrink:0;width:34px;height:34px;cursor:pointer;transition:all .15s ease}._StepBtn_15t0r_1:hover{background:#0000000f}._StepBtn_15t0r_1:active{background:#0000001f}._GCPlayBtn_n54mc_1{width:var(--btn-size);height:var(--btn-size);box-sizing:border-box;border:none;outline:none;position:relative;background:none;border-radius:8px;transition:all .15s ease;cursor:pointer}._GCPlayBtn_n54mc_1:hover{background:#0000000f}._GCPlayBtn_n54mc_1:active{background:#0000001f}._GCPlayBtn_n54mc_1:focus{outline:none}._GCPlayBtn_n54mc_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease;transform:scale(1.3)}._GCPlayBtn_n54mc_1._playing_n54mc_34:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._host_v5qx1_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_v5qx1_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#033233;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:4px solid #033233;box-sizing:border-box}._visible_v5qx1_32{opacity:1;pointer-events:auto}._backBtn_v5qx1_37{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._backBtn_v5qx1_37:hover{background:#0000000d}._backBtn_v5qx1_37:active{background:#0000004d}._title_v5qx1_58{font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_v5qx1_67{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._settingsBtn_v5qx1_67:hover{background:#0000000d}._settingsBtn_v5qx1_67:active{background:#0000004d}._wrap_62su0_7{position:absolute;pointer-events:auto;background:#fff;color:#111;box-shadow:0 -6px 24px #0000001f;padding:20px 0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;overflow-y:auto;left:0;right:0;bottom:0;max-height:70%;border-top:1px solid rgba(0,0,0,.08);border-radius:16px 16px 0 0}._wrapHidden_62su0_29{transform:translateY(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translateY(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}@container viewer (min-aspect-ratio: 1/1){._wrap_62su0_7{left:auto;right:0;top:0;bottom:0;max-height:100%;width:400px;max-width:60%;border-top:none;border-left:1px solid rgba(0,0,0,.08);border-radius:0;box-shadow:-6px 0 24px #0000001f;padding:20px}._wrapHidden_62su0_29{transform:translate(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translate(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}}._scrollArea_62su0_71{width:100%;display:flex;flex-direction:column;max-width:400px;padding:0 20px;gap:10px;box-sizing:border-box}._row_62su0_81{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:45px}._label_62su0_89{width:78px;flex:0 0 78px;font-weight:700}._btn_62su0_95{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:8px 10px;font-size:13px}._btnActive_62su0_106{background:#00000014}._btnSmall_62su0_110{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:4px 8px;font-size:14px;line-height:1}._pill_62su0_122{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;background:#fff;color:#111;border:1px solid rgba(0,0,0,.16);border-radius:999px;padding:8px 12px;font-size:13px}._themeCircle_62su0_133{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;cursor:pointer;transition:all .2s ease;border:1px solid rgba(0,0,0,.15)}._themeCircleActive_62su0_146{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._stepRow_62su0_151{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px}._stepLabel_62su0_159{width:78px;flex:0 0 78px;font-weight:700}._stepValue_62su0_165{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_62su0_172{width:28px;text-align:center}._inlineFlex_62su0_177{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_dbk3n_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;pointer-events:none}._spinner_dbk3n_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_dbk3n_10 linear infinite}@keyframes _spin_dbk3n_10{to{transform:rotate(360deg)}}._Overlay_ybic8_3{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:#11182773;display:flex;align-items:center;justify-content:center;z-index:50}._Dialog_ybic8_15{width:min(760px,90%);max-height:80vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 48px #00000040;padding:20px}._Body_ybic8_25{margin-left:20px;margin-right:20px;display:block}._Header_ybic8_32{display:flex;align-items:center;gap:12px;margin-bottom:12px}._Paging_ybic8_39{font-weight:700;font-size:1rem;color:#333;display:flex;justify-content:center;width:100%}._Remaining_ybic8_48{margin-left:auto;font-weight:700;font-size:1rem;color:#fff}._RemainingDanger_ybic8_55{color:#dc2626}._NextBtn_ybic8_59{padding:10px 16px;border-radius:10px;border:none;background:#2563eb;color:#fff;font-size:1.2rem;font-weight:700;cursor:pointer;width:100%}@keyframes _nextbtn-blink_ybic8_1{0%,49%{transform:none;box-shadow:0 0 #dc262600;outline:0 solid rgba(220,38,38,0);filter:none}50%,to{box-shadow:0 0 0 2px #dc262659,0 6px 14px #dc262640;outline:2px solid rgba(220,38,38,.45)}}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55){animation:_nextbtn-blink_ybic8_1 1s steps(2,start) infinite}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):hover,._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):focus-visible{animation-play-state:running}._CloseBtn_ybic8_96{margin-left:8px;border:none;background:transparent;color:#6b7280;cursor:pointer;font-size:14px}._Title_ybic8_106{font-weight:700;font-size:18px;margin-bottom:8px;color:#111827}._Question_ybic8_113{font-size:1.2rem;color:#111827;font-weight:700;display:flex;justify-content:center;align-items:center}._Score_ybic8_123{display:flex;justify-content:center;align-items:center;margin-bottom:16px}._Image_ybic8_130{width:100%;display:flex;justify-content:center}._Image_ybic8_130 img{width:80%}._Options_ybic8_140{display:grid;gap:8px}._OptionBtn_ybic8_145{text-align:left;padding:12px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer;font-size:1rem;transition:box-shadow .15s ease,border-color .15s ease,background .15s ease;display:flex;justify-content:center;align-items:center}._OptionBtn_ybic8_145:hover{border-color:#cbd5e1;background:#f9fafb}._OptionBtnActive_ybic8_165{border-color:#2563eb;background:#2563eb14;box-shadow:0 4px 10px #2563eb33}._Footer_ybic8_172{display:flex;justify-content:space-between;margin-top:16px;gap:8px}._PrevBtn_ybic8_179{flex:0 0 auto;padding:10px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._PrevBtn_ybic8_179:disabled{cursor:not-allowed;opacity:.6}._OptionBtnCorrect_ybic8_195{border-color:#16a34a!important;box-shadow:0 4px 10px #16a34a33}._Judge_ybic8_201{margin:6px 0 10px;font-weight:700;font-size:1.5rem;padding:4px;width:100%;border-radius:10px;display:flex;justify-content:center;color:#fff}._Judge_ybic8_201._Correct_ybic8_212{background:#16a34a}._Judge_ybic8_201._Incorrect_ybic8_215{background:#dc2626}._ResultHeader_ybic8_220{font-weight:800;font-size:20px;margin-bottom:8px;color:#111827}._ResultText_ybic8_227{font-size:16px;margin-bottom:12px;color:#111827}._ResultActions_ybic8_233{display:flex;justify-content:flex-end;gap:8px}._CloseBtnSoft_ybic8_239{padding:10px 16px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._SummaryGrid_ybic8_249{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:12px 0 16px}._StatCard_ybic8_257{border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 2px 6px #1118270f}._StatLabel_ybic8_265{font-size:12px;color:#6b7280}._StatValue_ybic8_270{font-size:22px;font-weight:800;margin-top:4px;color:#111827}._StatSub_ybic8_277{font-size:12px;color:#6b7280}._SplitGrid_ybic8_282{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._SplitBox_ybic8_289{border:1px dashed #e5e7eb;border-radius:10px;padding:10px 12px}._SplitTitle_ybic8_295{font-size:12px;color:#6b7280}._SplitText_ybic8_300{font-size:16px;font-weight:700;color:#111827;margin-top:2px}._Pairs_ybic8_307{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._PairItem_ybic8_314{border:1px solid #f3f4f6;border-radius:10px;padding:10px 12px;background:#fafafa}._PairLabel_ybic8_321{font-size:12px;color:#6b7280}._PairValue_ybic8_326{font-size:15px;font-weight:700;margin-top:2px;color:#111827}._WrongBox_ybic8_333{margin-top:8px;border-top:1px solid #e5e7eb;padding-top:10px}._WrongTitle_ybic8_339{font-weight:700;font-size:14px;color:#111827;margin-bottom:6px}._WrongList_ybic8_346{list-style:none;padding:0;margin:0}._WrongList_ybic8_346 li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed #f3f4f6}._Badge_ybic8_360{display:inline-block;font-size:12px;padding:2px 6px;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700}._WrongName_ybic8_370{flex:1;color:#111827;font-size:14px}._WrongTime_ybic8_376{font-size:12px;color:#6b7280}._Empty_ybic8_381{color:#6b7280;font-size:13px}._Hint_ybic8_387{margin-top:8px;font-size:12px;color:#6b7280}._handle_1336y_1{position:fixed;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1336y_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1336y_16{border-radius:13px 0 13px 13px}._handleEnd_1336y_21{border-radius:0 13px 13px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
1
+ (function(){"use strict";try{if(typeof document<"u"){var e=document.createElement("style");e.appendChild(document.createTextNode('@charset "UTF-8";._run_zzb61_3{cursor:pointer}._runWrap_zzb61_7{position:relative;isolation:isolate;z-index:0}._highlight_zzb61_13:before,._highlightleft_zzb61_14:before,._highlightright_zzb61_15:before,._highlightcenter_zzb61_16:before{content:"";position:absolute;z-index:-1;top:-4px;bottom:-4px;background:var(--hl-color, pink);pointer-events:none}._highlight_zzb61_13:before{left:-4px;right:-4px}._highlightleft_zzb61_14:before{left:-4px;right:0}._highlightright_zzb61_15:before{left:0;right:-4px}._highlightcenter_zzb61_16:before{left:0;right:0}._underline_zzb61_48:after,._underlineleft_zzb61_49:after,._underlineright_zzb61_50:after,._underlinecenter_zzb61_51:after{content:"";position:absolute;left:0;right:0;height:var(--ul-thickness, .2em);bottom:calc(-1 * var(--ul-offset, .35em));background:var(--ul-color, red);pointer-events:none}._underline_zzb61_48:after{left:-4px;right:-4px}._underlineleft_zzb61_49:after{left:-4px;right:0}._underlineright_zzb61_50:after{left:0;right:0}._underlinecenter_zzb61_51:after{left:0;right:0}._scroller_kqkmq_3{height:100%;overflow-y:auto;overflow-x:hidden;outline:none;scrollbar-width:none;-ms-overflow-style:none}._scroller_kqkmq_3::-webkit-scrollbar{width:0;height:0;background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-track{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-thumb{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-button,._scroller_kqkmq_3::-webkit-scrollbar-corner{display:none;pointer-events:none}@media(forced-colors:active){._scroller_kqkmq_3{scrollbar-width:auto}}._navBtn_1fciy_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;flex-shrink:0;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_1fciy_2:hover:not(:disabled){background:#0000000f}._navBtn_1fciy_2:active:not(:disabled){background:#0000001a}._navBtn_1fciy_2:disabled,._navBtn_1fciy_2._disabled_1fciy_26{opacity:.4;cursor:not-allowed;transform:none}._label_1fciy_32{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center}._navGroup_1fciy_40{display:flex;gap:8px}._wrap_1hfub_4{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;padding:8px 8px 10px;box-sizing:border-box;background:#fff;color:#333;border-top:1px solid #ddd;transition:opacity .15s ease;opacity:0;pointer-events:none;container-type:inline-size;container-name:bottombar}._visible_1hfub_25{opacity:1;pointer-events:auto}._compact_1hfub_31{padding:6px 8px 8px}._compact_1hfub_31 ._row2_1hfub_34{display:none}@container bottombar (min-width: 600px){._compact_1hfub_31 ._row2_1hfub_34{display:contents}}._controls_1hfub_44{display:flex;flex-wrap:wrap;align-items:center;gap:4px}._row1_1hfub_52,._row2_1hfub_34{display:flex;align-items:center;justify-content:space-between;width:100%;gap:4px}._row2_1hfub_34{margin-top:4px}@container bottombar (min-width: 500px){._row1_1hfub_52,._row2_1hfub_34{display:contents}._controls_1hfub_44{flex-wrap:nowrap;justify-content:space-between}._row2_1hfub_34{margin-top:0}}._groupExpand_1hfub_80,._groupPlayback_1hfub_81,._groupSpeed_1hfub_82,._groupFeatures_1hfub_83,._groupNav_1hfub_84{display:flex;align-items:center;flex-shrink:0}._groupExpand_1hfub_80{gap:0}._groupPlayback_1hfub_81{gap:2px}._groupSpeed_1hfub_82{gap:0}._groupFeatures_1hfub_83,._groupNav_1hfub_84{gap:2px}._btn_1hfub_116{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:44px;height:44px;border:none;border-radius:8px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease;flex-shrink:0}._btn_1hfub_116:hover{background:#0000000f}._btn_1hfub_116:active{background:#0000001f}._btnForbidden_1hfub_141{opacity:.4;cursor:not-allowed;background:#f2f2f2!important}._btnActive_1hfub_147{background:#333;color:#fff}._btnActive_1hfub_147:hover{background:#555}._btnActive_1hfub_147:active{background:#666}._label_1hfub_158{margin-top:2px;font-size:.55rem;font-weight:500;text-align:center;font-variant-numeric:tabular-nums;white-space:nowrap}._compactBtn_1hfub_168{display:flex;align-items:center;justify-content:center;width:34px;height:34px;border:none;border-radius:4px;background:none;color:#000;cursor:pointer;padding:2px;flex-shrink:0}._compactBtn_1hfub_168:hover{background:#0000000f}._compactBtn_1hfub_168:active{background:#0000001f}._scrubberWrap_uw0cd_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none;margin-bottom:6px}._labels_uw0cd_9{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_uw0cd_9 ._index_uw0cd_15{font-variant-numeric:tabular-nums}._controls_uw0cd_19{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_uw0cd_19 ._percent_uw0cd_25{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_uw0cd_32{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_uw0cd_32:disabled{opacity:.5;cursor:not-allowed}._range_uw0cd_46{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_uw0cd_46::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_uw0cd_46::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_r3byt_1{float:right;box-sizing:border-box;display:flex;flex-direction:column}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7{box-sizing:border-box;padding:2px;display:flex;gap:1px;align-items:center}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._label_r3byt_14{font-size:.55rem;display:flex;flex-direction:column;justify-content:center;align-items:center;min-width:24px}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22{padding:2px;border-radius:4px;border:1px solid #888;background:none;width:34px;height:34px;flex-shrink:0;cursor:pointer;transition:all .15s ease}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:hover{background:#0000000f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22:active{background:#0000001f}._WPMSpeedButtonsWrap_r3byt_1 ._btnWrap_r3byt_7 ._iconBtn_r3byt_22 img{width:100%;height:100%;object-fit:contain}._StepBtn_15t0r_1{background:none;border:none;border-radius:8px;font-size:1.6rem;display:flex;justify-content:center;align-items:center;color:#000;flex-shrink:0;width:34px;height:34px;cursor:pointer;transition:all .15s ease}._StepBtn_15t0r_1:hover{background:#0000000f}._StepBtn_15t0r_1:active{background:#0000001f}._GCPlayBtn_n54mc_1{width:var(--btn-size);height:var(--btn-size);box-sizing:border-box;border:none;outline:none;position:relative;background:none;border-radius:8px;transition:all .15s ease;cursor:pointer}._GCPlayBtn_n54mc_1:hover{background:#0000000f}._GCPlayBtn_n54mc_1:active{background:#0000001f}._GCPlayBtn_n54mc_1:focus{outline:none}._GCPlayBtn_n54mc_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease;transform:scale(1.3)}._GCPlayBtn_n54mc_1._playing_n54mc_34:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._host_v5qx1_3{position:absolute;left:0;right:0;top:0;z-index:30}._topbar_v5qx1_11{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#033233;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:4px solid #033233;box-sizing:border-box}._visible_v5qx1_32{opacity:1;pointer-events:auto}._backBtn_v5qx1_37{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._backBtn_v5qx1_37:hover{background:#0000000d}._backBtn_v5qx1_37:active{background:#0000004d}._title_v5qx1_58{font-size:18px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._settingsBtn_v5qx1_67{display:flex;align-items:center;justify-content:center;width:44px;height:44px;border:none;background:transparent;color:#033233;cursor:pointer;border-radius:50%;flex-shrink:0;transition:background .15s ease}._settingsBtn_v5qx1_67:hover{background:#0000000d}._settingsBtn_v5qx1_67:active{background:#0000004d}._wrap_62su0_7{position:absolute;pointer-events:auto;background:#fff;color:#111;box-shadow:0 -6px 24px #0000001f;padding:20px 0;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;gap:10px;overflow-y:auto;left:0;right:0;bottom:0;max-height:70%;border-top:1px solid rgba(0,0,0,.08);border-radius:16px 16px 0 0}._wrapHidden_62su0_29{transform:translateY(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translateY(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}@container viewer (min-aspect-ratio: 1/1){._wrap_62su0_7{left:auto;right:0;top:0;bottom:0;max-height:100%;width:400px;max-width:60%;border-top:none;border-left:1px solid rgba(0,0,0,.08);border-radius:0;box-shadow:-6px 0 24px #0000001f;padding:20px}._wrapHidden_62su0_29{transform:translate(100%);visibility:hidden;transition:transform .22s ease,visibility 0s .22s}._wrapVisible_62su0_35{transform:translate(0);visibility:visible;transition:transform .22s ease,visibility 0s 0s}}._scrollArea_62su0_71{width:100%;display:flex;flex-direction:column;max-width:400px;padding:0 20px;gap:10px;box-sizing:border-box}._row_62su0_81{display:flex;align-items:center;justify-content:space-between;gap:20px;min-height:45px}._label_62su0_89{width:78px;flex:0 0 78px;font-weight:700}._btn_62su0_95{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:8px 10px;font-size:13px}._btnActive_62su0_106{background:#00000014}._btnSmall_62su0_110{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;border:1px solid rgba(0,0,0,.16);background:#fff;color:#111;border-radius:8px;padding:4px 8px;font-size:14px;line-height:1}._pill_62su0_122{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;background:#fff;color:#111;border:1px solid rgba(0,0,0,.16);border-radius:999px;padding:8px 12px;font-size:13px}._themeCircle_62su0_133{width:40px;height:40px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:600;cursor:pointer;transition:all .2s ease;border:1px solid rgba(0,0,0,.15)}._themeCircleActive_62su0_146{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._stepRow_62su0_151{display:flex;align-items:center;justify-content:space-between;gap:8px;min-height:40px}._stepLabel_62su0_159{width:78px;flex:0 0 78px;font-weight:700}._stepValue_62su0_165{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_62su0_172{width:28px;text-align:center}._inlineFlex_62su0_177{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_dbk3n_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;pointer-events:none}._spinner_dbk3n_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_dbk3n_10 linear infinite}@keyframes _spin_dbk3n_10{to{transform:rotate(360deg)}}._Overlay_ybic8_3{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;background:#11182773;display:flex;align-items:center;justify-content:center;z-index:50}._Dialog_ybic8_15{width:min(760px,90%);max-height:80vh;overflow:auto;background:#fff;border-radius:16px;box-shadow:0 24px 48px #00000040;padding:20px}._Body_ybic8_25{margin-left:20px;margin-right:20px;display:block}._Header_ybic8_32{display:flex;align-items:center;gap:12px;margin-bottom:12px}._Paging_ybic8_39{font-weight:700;font-size:1rem;color:#333;display:flex;justify-content:center;width:100%}._Remaining_ybic8_48{margin-left:auto;font-weight:700;font-size:1rem;color:#fff}._RemainingDanger_ybic8_55{color:#dc2626}._NextBtn_ybic8_59{padding:10px 16px;border-radius:10px;border:none;background:#2563eb;color:#fff;font-size:1.2rem;font-weight:700;cursor:pointer;width:100%}@keyframes _nextbtn-blink_ybic8_1{0%,49%{transform:none;box-shadow:0 0 #dc262600;outline:0 solid rgba(220,38,38,0);filter:none}50%,to{box-shadow:0 0 0 2px #dc262659,0 6px 14px #dc262640;outline:2px solid rgba(220,38,38,.45)}}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55){animation:_nextbtn-blink_ybic8_1 1s steps(2,start) infinite}._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):hover,._NextBtn_ybic8_59:has(._RemainingDanger_ybic8_55):focus-visible{animation-play-state:running}._CloseBtn_ybic8_96{margin-left:8px;border:none;background:transparent;color:#6b7280;cursor:pointer;font-size:14px}._Title_ybic8_106{font-weight:700;font-size:18px;margin-bottom:8px;color:#111827}._Question_ybic8_113{font-size:1.2rem;color:#111827;font-weight:700;display:flex;justify-content:center;align-items:center}._Score_ybic8_123{display:flex;justify-content:center;align-items:center;margin-bottom:16px}._Image_ybic8_130{width:100%;display:flex;justify-content:center}._Image_ybic8_130 img{width:80%}._Options_ybic8_140{display:grid;gap:8px}._OptionBtn_ybic8_145{text-align:left;padding:12px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer;font-size:1rem;transition:box-shadow .15s ease,border-color .15s ease,background .15s ease;display:flex;justify-content:center;align-items:center}._OptionBtn_ybic8_145:hover{border-color:#cbd5e1;background:#f9fafb}._OptionBtnActive_ybic8_165{border-color:#2563eb;background:#2563eb14;box-shadow:0 4px 10px #2563eb33}._Footer_ybic8_172{display:flex;justify-content:space-between;margin-top:16px;gap:8px}._PrevBtn_ybic8_179{flex:0 0 auto;padding:10px 14px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._PrevBtn_ybic8_179:disabled{cursor:not-allowed;opacity:.6}._OptionBtnCorrect_ybic8_195{border-color:#16a34a!important;box-shadow:0 4px 10px #16a34a33}._Judge_ybic8_201{margin:6px 0 10px;font-weight:700;font-size:1.5rem;padding:4px;width:100%;border-radius:10px;display:flex;justify-content:center;color:#fff}._Judge_ybic8_201._Correct_ybic8_212{background:#16a34a}._Judge_ybic8_201._Incorrect_ybic8_215{background:#dc2626}._ResultHeader_ybic8_220{font-weight:800;font-size:20px;margin-bottom:8px;color:#111827}._ResultText_ybic8_227{font-size:16px;margin-bottom:12px;color:#111827}._ResultActions_ybic8_233{display:flex;justify-content:flex-end;gap:8px}._CloseBtnSoft_ybic8_239{padding:10px 16px;border-radius:10px;border:1px solid #e5e7eb;background:#fff;color:#111827;cursor:pointer}._SummaryGrid_ybic8_249{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:12px;margin:12px 0 16px}._StatCard_ybic8_257{border:1px solid #e5e7eb;border-radius:12px;padding:12px 14px;background:#fff;box-shadow:0 2px 6px #1118270f}._StatLabel_ybic8_265{font-size:12px;color:#6b7280}._StatValue_ybic8_270{font-size:22px;font-weight:800;margin-top:4px;color:#111827}._StatSub_ybic8_277{font-size:12px;color:#6b7280}._SplitGrid_ybic8_282{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._SplitBox_ybic8_289{border:1px dashed #e5e7eb;border-radius:10px;padding:10px 12px}._SplitTitle_ybic8_295{font-size:12px;color:#6b7280}._SplitText_ybic8_300{font-size:16px;font-weight:700;color:#111827;margin-top:2px}._Pairs_ybic8_307{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin:8px 0 12px}._PairItem_ybic8_314{border:1px solid #f3f4f6;border-radius:10px;padding:10px 12px;background:#fafafa}._PairLabel_ybic8_321{font-size:12px;color:#6b7280}._PairValue_ybic8_326{font-size:15px;font-weight:700;margin-top:2px;color:#111827}._WrongBox_ybic8_333{margin-top:8px;border-top:1px solid #e5e7eb;padding-top:10px}._WrongTitle_ybic8_339{font-weight:700;font-size:14px;color:#111827;margin-bottom:6px}._WrongList_ybic8_346{list-style:none;padding:0;margin:0}._WrongList_ybic8_346 li{display:flex;align-items:center;gap:8px;padding:6px 0;border-bottom:1px dashed #f3f4f6}._Badge_ybic8_360{display:inline-block;font-size:12px;padding:2px 6px;border-radius:999px;background:#eef2ff;color:#3730a3;font-weight:700}._WrongName_ybic8_370{flex:1;color:#111827;font-size:14px}._WrongTime_ybic8_376{font-size:12px;color:#6b7280}._Empty_ybic8_381{color:#6b7280;font-size:13px}._Hint_ybic8_387{margin-top:8px;font-size:12px;color:#6b7280}._handle_1336y_1{position:fixed;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1336y_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1336y_16{border-radius:13px 0 13px 13px}._handleEnd_1336y_21{border-radius:0 13px 13px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
2
2
  "use strict";var Es=Object.defineProperty;var js=(e,t,n)=>t in e?Es(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var wr=(e,t,n)=>js(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),g=require("react"),Os=require("react-dom");function Ps(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const rt=Ps(g),sr=g.createContext(void 0);var Qt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yt={exports:{}},Sn={},Xt={exports:{}},yn={};/**
3
3
  * @license React
4
4
  * use-sync-external-store-shim.production.js
@@ -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 Bs(){if(Cr)return yn;Cr=1;var e=g;function t(S,y){return S===y&&(S!==0||1/S===1/y)||S!==S&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(S,y){var b=y(),x=r({inst:{value:b,getSnapshot:y}}),v=x[0].inst,p=x[1];return s(function(){v.value=b,v.getSnapshot=y,l(v)&&p({inst:v})},[S,b,y]),o(function(){return l(v)&&p({inst:v}),S(function(){l(v)&&p({inst:v})})},[S]),i(b),b}function l(S){var y=S.getSnapshot;S=S.value;try{var b=y();return!n(S,b)}catch{return!0}}function c(S,y){return y()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return yn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,yn}var wn={};/**
10
+ */var Cr;function Bs(){if(Cr)return yn;Cr=1;var e=g;function t(S,y){return S===y&&(S!==0||1/S===1/y)||S!==S&&y!==y}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(S,y){var x=y(),b=r({inst:{value:x,getSnapshot:y}}),v=b[0].inst,p=b[1];return s(function(){v.value=x,v.getSnapshot=y,l(v)&&p({inst:v})},[S,x,y]),o(function(){return l(v)&&p({inst:v}),S(function(){l(v)&&p({inst:v})})},[S]),i(x),x}function l(S){var y=S.getSnapshot;S=S.value;try{var x=y();return!n(S,x)}catch{return!0}}function c(S,y){return y()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return yn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,yn}var wn={};/**
11
11
  * @license React
12
12
  * use-sync-external-store-shim.development.js
13
13
  *
@@ -15,7 +15,7 @@
15
15
  *
16
16
  * This source code is licensed under the MIT license found in the
17
17
  * LICENSE file in the root directory of this source tree.
18
- */var Ir;function zs(){return Ir||(Ir=1,process.env.NODE_ENV!=="production"&&(function(){function e(b,x){return b===x&&(b!==0||1/b===1/x)||b!==b&&x!==x}function t(b,x){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=x();if(!S){var p=x();s(v,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),S=!0)}p=i({inst:{value:v,getSnapshot:x}});var h=p[0].inst,d=p[1];return l(function(){h.value=v,h.getSnapshot=x,n(h)&&d({inst:h})},[b,v,x]),a(function(){return n(h)&&d({inst:h}),b(function(){n(h)&&d({inst:h})})},[b]),c(v),v}function n(b){var x=b.getSnapshot;b=b.value;try{var v=x();return!s(b,v)}catch{return!0}}function r(b,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=g,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,u=!1,S=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;wn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wn}var kr;function Po(){return kr||(kr=1,process.env.NODE_ENV==="production"?Xt.exports=Bs():Xt.exports=zs()),Xt.exports}/**
18
+ */var Ir;function zs(){return Ir||(Ir=1,process.env.NODE_ENV!=="production"&&(function(){function e(x,b){return x===b&&(x!==0||1/x===1/b)||x!==x&&b!==b}function t(x,b){u||o.startTransition===void 0||(u=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=b();if(!S){var p=b();s(v,p)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),S=!0)}p=i({inst:{value:v,getSnapshot:b}});var h=p[0].inst,d=p[1];return l(function(){h.value=v,h.getSnapshot=b,n(h)&&d({inst:h})},[x,v,b]),a(function(){return n(h)&&d({inst:h}),x(function(){n(h)&&d({inst:h})})},[x]),c(v),v}function n(x){var b=x.getSnapshot;x=x.value;try{var v=b();return!s(x,v)}catch{return!0}}function r(x,b){return b()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=g,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,u=!1,S=!1,y=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;wn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:y,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),wn}var kr;function Po(){return kr||(kr=1,process.env.NODE_ENV==="production"?Xt.exports=Bs():Xt.exports=zs()),Xt.exports}/**
19
19
  * @license React
20
20
  * use-sync-external-store-shim/with-selector.production.js
21
21
  *
@@ -23,7 +23,7 @@
23
23
  *
24
24
  * This source code is licensed under the MIT license found in the
25
25
  * LICENSE file in the root directory of this source tree.
26
- */var Rr;function As(){if(Rr)return Sn;Rr=1;var e=g,t=Po();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Sn.useSyncExternalStoreWithSelector=function(c,u,S,y,b){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),b!==void 0&&v.hasValue){var f=v.value;if(b(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return b!==void 0&&b(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,b]);var p=o(c,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},Sn}var Cn={};/**
26
+ */var Rr;function As(){if(Rr)return Sn;Rr=1;var e=g,t=Po();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Sn.useSyncExternalStoreWithSelector=function(c,u,S,y,x){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),x!==void 0&&v.hasValue){var f=v.value;if(x(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return x!==void 0&&x(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,x]);var p=o(c,b[0],b[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},Sn}var Cn={};/**
27
27
  * @license React
28
28
  * use-sync-external-store-shim/with-selector.development.js
29
29
  *
@@ -31,4 +31,4 @@
31
31
  *
32
32
  * This source code is licensed under the MIT license found in the
33
33
  * LICENSE file in the root directory of this source tree.
34
- */var Tr;function Ls(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(c,u,S,y,b){var x=s(null);if(x.current===null){var v={hasValue:!1,value:null};x.current=v}else v=x.current;x=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),b!==void 0&&v.hasValue){var f=v.value;if(b(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return b!==void 0&&b(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,b]);var p=o(c,x[0],x[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Cn}var _r;function Gs(){return _r||(_r=1,process.env.NODE_ENV==="production"?Yt.exports=As():Yt.exports=Ls()),Yt.exports}var Hs=Gs();const Ns=Oo(Hs),Mr=e=>{let t;const n=new Set,r=(c,u)=>{const S=typeof c=="function"?c(t):c;if(!Object.is(S,t)){const y=t;t=u??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(b=>b(t,y))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,o,a);return a},Vt=(e=>e?Mr(e):Mr),{useSyncExternalStoreWithSelector:Fs}=Ns,Ws=e=>e;function fn(e,t=Ws,n){const r=Fs(e.subscribe,e.getState,e.getInitialState,t,n);return g.useDebugValue(r),r}function X(e,t){const n=g.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return fn(n,e,t)}function pn(){const e=g.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const bt=g.createContext(void 0),Bo=g.createContext(void 0);function Ds(){return Vt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] applySnapshot called but no handler registered")}}))}function Vs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=g.useMemo(()=>Ds(),[]);return g.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),g.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),m.jsx(bt.Provider,{value:s,children:m.jsx(Bo.Provider,{value:o,children:e})})}function $s({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=g.useRef(null);g.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=g.useCallback(a=>{if(!(r!=null&&r(a.target))&&a.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(a)},n)}},[n,e,r]),i=g.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const rn={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},In=[8,16,24,40,64],kn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Rn=[4,8,12,16,24],Xn=e=>Math.round(12+(e-1)*(16/11)),qs=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Xn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Tn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},zo=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],Ge={mode:"page",theme:"light",fontFamily:zo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,overlayCompactMode:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,isDev:!1};function Us(e){const{init:t,recorderStore:n}=e??{};return Vt((r,o)=>({...Ge,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{const s=!o().showOverlays;r({showOverlays:s,...s&&{overlayCompactMode:!0}})},setOverlayCompactMode:s=>r({overlayCompactMode:s}),toggleOverlayCompactMode:()=>r({overlayCompactMode:!o().overlayCompactMode}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:Ge.mode,theme:Ge.theme,fontFamily:Ge.fontFamily,fontSizePx:Ge.fontSizePx,lineHeight:Ge.lineHeight,marginX:Ge.marginX,marginY:Ge.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:Ge.pointerStyle,pointerColor:Ge.pointerColor,breakMarks:Ge.breakMarks,breakGapPx:Ge.breakGapPx,muteAudio:Ge.muteAudio,audioSpeed:Ge.audioSpeed,showPointer:Ge.showPointer,showSplit:Ge.showSplit})),maps:{MARGIN_MAP:In,LINEHEIGHT_MAP:kn,BREAK_GAP_MAP:Rn,fontSizeFromLevel:Xn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Rn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Tn(o().breakGapPx,Rn),getFontLevel:()=>qs(o().fontSizePx),getLineLevel:()=>Tn(o().lineHeight,kn),getMarginLevel:()=>Tn(o().marginX,In),setFontLevel:s=>r({fontSizePx:Xn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:kn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=In[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{const i=Math.max(.3,Math.min(2,s));r({audioSpeed:i}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:i}})},incAudioSpeed:()=>{const s=Math.min(2,Math.round((o().audioSpeed+.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},decAudioSpeed:()=>{const s=Math.max(.3,Math.round((o().audioSpeed-.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i})}))}const hn=0,dt=1,Et=2,Ao=4;function Er(e){return()=>e}function Ks(e){e()}function Lo(e,t){return n=>e(t(n))}function jr(e,t){return()=>e(t)}function Qs(e,t){return n=>e(t,n)}function ir(e){return e!==void 0}function Ys(...e){return()=>{e.map(Ks)}}function jt(){}function gn(e,t){return t(e),e}function Xs(e,t){return t(e)}function ke(...e){return e}function ve(e,t){return e(dt,t)}function de(e,t){e(hn,t)}function lr(e){e(Et)}function Te(e){return e(Ao)}function J(e,t){return ve(e,Qs(t,hn))}function tt(e,t){const n=e(dt,r=>{n(),t(r)});return n}function Or(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Go(e,t){return e===t}function Ie(e=Go){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function K(e){return t=>Lo(t,e)}function st(e){return t=>()=>{t(e)}}function L(e,...t){const n=Zs(...t);return((r,o)=>{switch(r){case Et:lr(e);return;case dt:return ve(e,n(o))}})}function it(e,t){return n=>r=>{n(t=e(t,r))}}function xt(e){return t=>n=>{e>0?e--:t(n)}}function at(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function fe(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{const c=n;n=n|a,t[i]=l,c!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function Zs(...e){return t=>e.reduceRight(Xs,t)}function Js(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case dt:return s?n===s?void 0:(r(),n=s,t=ve(e,s),t):(r(),jt);case Et:r(),n=null;return}}}function N(e){let t=e;const n=ge();return((r,o)=>{switch(r){case hn:t=o;break;case dt:{o(t);break}case Ao:return t}return n(r,o)})}function Ne(e,t){return gn(N(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case hn:e.slice().forEach(r=>{r(n)});return;case Et:e.splice(0,e.length);return;case dt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return gn(ge(),t=>J(e,t))}function be(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ei(),singleton:n}}const ei=()=>Symbol();function ti(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function Pe(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{n[i]=l,r=r|a,r===o&&de(t,n)})}),function(s,i){switch(s){case Et:{lr(t);return}case dt:return r===o&&i(n),ve(t,i)}}}function se(e,t=Go){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case Et:return;case dt:return Ys(...e.map(r=>ve(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const ni={0:"debug",3:"error",1:"log",2:"warn"},ri=()=>typeof globalThis>"u"?window:globalThis,ft=be(()=>{const e=N(3);return{log:N((t,n,r=1)=>{var o;const s=(o=ri().VIRTUOSO_LOG_LEVEL)!=null?o:Te(e);r>=s&&console[ni[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function vt(e,t,n){return ar(e,t,n).callbackRef}function ar(e,t,n){const r=g.useRef(null);let o=i=>{};const s=g.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function oi(e,t,n,r,o,s,i,a,l){const c=g.useCallback(u=>{const S=si(u.children,t,a?"offsetWidth":"offsetHeight",o);let y=u.parentElement;for(;!y.dataset.virtuosoScroller;)y=y.parentElement;const b=y.lastElementChild.dataset.viewportType==="window";let x;b&&(x=y.ownerDocument.defaultView);const v=i?a?i.scrollLeft:i.scrollTop:b?a?x.scrollX||x.document.documentElement.scrollLeft:x.scrollY||x.document.documentElement.scrollTop:a?y.scrollLeft:y.scrollTop,p=i?a?i.scrollWidth:i.scrollHeight:b?a?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight:a?y.scrollWidth:y.scrollHeight,h=i?a?i.offsetWidth:i.offsetHeight:b?a?x.innerWidth:x.innerHeight:a?y.offsetWidth:y.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(v,0),viewportHeight:h}),s==null||s(a?Pr("column-gap",getComputedStyle(u).columnGap,o):Pr("row-gap",getComputedStyle(u).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,a]);return ar(c,n,l)}function si(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),u=t(a,n);if(u===0&&r("Zero-sized element, this should not happen",{child:a},Ve.ERROR),u===c)continue;const S=s[s.length-1];s.length===0||S.size!==u||S.endIndex!==l-1?s.push({endIndex:l,size:u,startIndex:l}):s[s.length-1].endIndex++}return s}function Pr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ho(e,t,n){const r=g.useRef(null),o=g.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),u=c.width;let S,y;if(t){const b=t.getBoundingClientRect(),x=c.top-b.top;y=b.height-Math.max(0,x),S=x+t.scrollTop}else{const b=i.current.ownerDocument.defaultView;y=b.innerHeight-Math.max(0,c.top),S=c.top+b.scrollY}r.current={offsetTop:S,visibleHeight:y,visibleWidth:u},e(r.current)},[e,t]),{callbackRef:s,ref:i}=ar(o,!0,n),a=g.useCallback(()=>{o(i.current)},[o,i]);return g.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",a),c==null||c.addEventListener("resize",a),()=>{c==null||c.removeEventListener("scroll",a),c==null||c.removeEventListener("resize",a)}}},[a,t,i]),s}const We=be(()=>{const e=ge(),t=ge(),n=N(0),r=ge(),o=N(0),s=ge(),i=ge(),a=N(0),l=N(0),c=N(0),u=N(0),S=ge(),y=ge(),b=N(!1),x=N(!1),v=N(!1);return J(L(e,K(({scrollTop:p})=>p)),t),J(L(e,K(({scrollHeight:p})=>p)),i),J(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:a,horizontalDirection:x,scrollBy:y,scrollContainerState:e,scrollHeight:i,scrollingInProgress:b,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),At={lvl:0};function No(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function Se(e){return e===At}function Lt(e,t){if(!Se(e))return t===e.k?e.v:t<e.k?Lt(e.l,t):Lt(e.r,t)}function nt(e,t,n="k"){if(Se(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=nt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return nt(e.l,t,n)}function qe(e,t,n){return Se(e)?Do(t,n,1):t===e.k?ze(e,{k:t,v:n}):t<e.k?Br(ze(e,{l:qe(e.l,t,n)})):Br(ze(e,{r:qe(e.r,t,n)}))}function Rt(){return At}function Tt(e,t,n){if(Se(e))return[];const r=nt(e,t)[0];return ii(er(e,r,n))}function Jn(e,t){if(Se(e))return At;const{k:n,l:r,r:o}=e;if(t===n){if(Se(r))return o;if(Se(o))return r;{const[s,i]=Wo(r);return tn(ze(e,{k:s,l:Fo(r),v:i}))}}else return t<n?tn(ze(e,{l:Jn(r,t)})):tn(ze(e,{r:Jn(o,t)}))}function mt(e){return Se(e)?[]:[...mt(e.l),{k:e.k,v:e.v},...mt(e.r)]}function er(e,t,n){if(Se(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(er(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(er(s,t,n))),a}function tn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(_n(t))return Vo(ze(e,{lvl:n-1}));if(!Se(t)&&!Se(t.r))return ze(t.r,{l:ze(t,{r:t.r.l}),lvl:n,r:ze(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(ze(e,{lvl:n-1}));if(!Se(r)&&!Se(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return ze(o,{l:ze(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(ze(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ze(e,t){return Do(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Fo(e){return Se(e.r)?e.l:tn(ze(e,{r:Fo(e.r)}))}function _n(e){return Se(e)||e.lvl>e.r.lvl}function Wo(e){return Se(e.r)?[e.k,e.v]:Wo(e.r)}function Do(e,t,n,r=At,o=At){return{k:e,l:r,lvl:n,r:o,v:t}}function Br(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!Se(t)&&t.lvl===e.lvl?ze(t,{r:ze(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!Se(n)&&!Se(n.r)&&n.lvl===t&&n.r.lvl===t?ze(n,{l:ze(e,{r:n.l}),lvl:t+1}):e}function ii(e){return No(e,({k:t,v:n})=>({index:t,value:n}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Gt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const cr=be(()=>({recalcInProgress:N(!1)}),[],{singleton:!0});function qo(e,t,n){return e[on(e,t,n)]}function on(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function li(e,t,n,r){const o=on(e,t,r),s=on(e,n,r,o);return e.slice(o,s+1)}function ut(e,t){return Math.round(e.getBoundingClientRect()[t])}function mn(e){return!Se(e.groupOffsetTree)}function ur({index:e},t){return t===e?0:t<e?-1:1}function ai(){return{groupIndices:[],groupOffsetTree:Rt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Rt()}}function ci(e,t){let n=Se(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),Se(e)){e=qe(e,0,s);continue}const a=Tt(e,i-1,o+1);if(a.some(mi(r)))continue;let l=!1,c=!1;for(const{end:u,start:S,value:y}of a)l?(o>=S||s===y)&&(e=Jn(e,S)):(c=y!==s,l=!0),u>o&&o>=S&&y!==s&&(e=qe(e,o+1,y));c&&(e=qe(e,i,s))}return[e,n]}function ui(e){return typeof e.groupIndex<"u"}function di({offset:e},t){return t===e?0:t<e?-1:1}function Ht(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=qo(t,e,ur),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Uo(e,t){if(!mn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Ko(e,t,n){if(ui(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Uo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function fi(e,t,n,r=0){return r>0&&(t=Math.max(t,qo(e,r,ur).offset)),No(li(e,t,n,di),gi)}function pi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&Se(s)&&t.length===2){const y=t[0].size,b=t[1].size;i=n.reduce((x,v)=>qe(qe(x,v,y),v+1,b),i)}else[i,a]=ci(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S}=nr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((y,b)=>qe(y,b,Ht(b,S,o)),Rt()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S,sizeTree:i}}function hi(e){return mt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function zr(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=on(o,t-1,ur),a=o[l].offset;const c=nt(n,t-1);s=c[0],i=c[1],o.length&&o[l].size===nt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:u}of Tt(n,t,1/0)){const S=c-s,y=S*i+a+S*r;o.push({index:c,offset:y,size:u}),s=c,a=y,i=u}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function gi(e){return{index:e.index,value:e}}function mi(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const xi={offsetHeight:"height",offsetWidth:"width"},lt=be(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Ne(r,0),s=ge(),i=ge(),a=N(0),l=N([]),c=N(void 0),u=N(void 0),S=N(void 0),y=N(void 0),b=N((f,w)=>ut(f,xi[w])),x=N(void 0),v=N(0),p=ai(),h=Ne(L(n,fe(l,e,v),it(pi,p),Ie()),p),d=Ne(L(l,Ie(),it((f,w)=>({current:w,prev:f.current}),{current:[],prev:[]}),K(({prev:f})=>f)),[]);J(L(l,ie(f=>f.length>0),fe(h,v),K(([f,w,T])=>{const j=f.reduce((O,z,C)=>qe(O,z,Ht(z,w.offsetTree,T)||C),Rt());return{...w,groupIndices:f,groupOffsetTree:j}})),h),J(L(r,fe(h),ie(([f,{lastIndex:w}])=>f<w),K(([f,{lastIndex:w,lastSize:T}])=>[{endIndex:w,size:T,startIndex:f}])),n),J(c,u);const k=Ne(L(c,K(f=>f===void 0)),!0);J(L(u,ie(f=>f!==void 0&&Se(Te(h).sizeTree)),K(f=>{const w=Te(S),T=Te(l).length>0;return w?T?[{endIndex:0,size:w,startIndex:0},{endIndex:1,size:f,startIndex:1}]:[]:[{endIndex:0,size:f,startIndex:0}]})),n),J(L(y,ie(f=>f!==void 0&&f.length>0&&Se(Te(h).sizeTree)),K(f=>{const w=[];let T=f[0],j=0;for(let O=1;O<f.length;O++){const z=f[O];z!==T&&(w.push({endIndex:O-1,size:T,startIndex:j}),T=z,j=O)}return w.push({endIndex:f.length-1,size:T,startIndex:j}),w})),n),J(L(l,fe(S,u),ie(([,f,w])=>f!==void 0&&w!==void 0),K(([f,w,T])=>{const j=[];for(let O=0;O<f.length;O++){const z=f[O],C=f[O+1];j.push({startIndex:z,endIndex:z,size:w}),C!==void 0&&j.push({startIndex:z+1,endIndex:C-1,size:T})}return j})),n);const _=Ue(L(n,fe(h),it(({sizes:f},[w,T])=>({changed:T!==f,sizes:T}),{changed:!1,sizes:p}),K(f=>f.changed)));ve(L(a,it((f,w)=>({diff:f.prev-w,prev:w}),{diff:0,prev:0}),K(f=>f.diff)),f=>{const{groupIndices:w}=Te(h);if(f>0)de(t,!0),de(s,f+zr(f,w));else if(f<0){const T=Te(d);T.length>0&&(f-=zr(-f,T)),de(i,f)}}),ve(L(a,fe(e)),([f,w])=>{f<0&&w("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ve.ERROR)});const I=Ue(s);J(L(s,fe(h),K(([f,w])=>{const T=w.groupIndices.length>0,j=[],O=w.lastSize;if(T){const z=Lt(w.sizeTree,0);let C=0,M=0;for(;C<f;){const H=w.groupIndices[M],E=w.groupIndices.length===M+1?1/0:w.groupIndices[M+1]-H-1;j.push({endIndex:H,size:z,startIndex:H}),j.push({endIndex:H+1+E-1,size:O,startIndex:H+1}),M++,C+=E+1}const A=mt(w.sizeTree);return C!==f&&A.shift(),A.reduce((H,{k:E,v:P})=>{let F=H.ranges;return H.prevSize!==0&&(F=[...H.ranges,{endIndex:E+f-1,size:H.prevSize,startIndex:H.prevIndex}]),{prevIndex:E+f,prevSize:P,ranges:F}},{prevIndex:f,prevSize:0,ranges:j}).ranges}return mt(w.sizeTree).reduce((z,{k:C,v:M})=>({prevIndex:C+f,prevSize:M,ranges:[...z.ranges,{endIndex:C+f-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const R=Ue(L(i,fe(h,v),K(([f,{offsetTree:w},T])=>{const j=-f;return Ht(j,w,T)})));return J(L(i,fe(h,v),K(([f,w,T])=>{if(w.groupIndices.length>0){if(Se(w.sizeTree))return w;let j=Rt();const O=Te(d);let z=0,C=0,M=0;for(;z<-f;){M=O[C];const A=O[C+1]-M-1;C++,z+=A+1}if(j=mt(w.sizeTree).reduce((A,{k:H,v:E})=>qe(A,Math.max(0,H+f),E),j),z!==-f){const A=Lt(w.sizeTree,M);j=qe(j,0,A);const H=nt(w.sizeTree,-f+1)[1];j=qe(j,1,H)}return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}else{const j=mt(w.sizeTree).reduce((O,{k:z,v:C})=>qe(O,Math.max(0,z+f),C),Rt());return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}})),h),{beforeUnshiftWith:I,data:x,defaultItemSize:u,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:S,gap:v,groupIndices:l,heightEstimates:y,itemSize:b,listRefresh:_,shiftWith:i,shiftWithOffset:R,sizeRanges:n,sizes:h,statefulTotalCount:o,totalCount:r,trackItemSizes:k,unshiftWith:s}},ke(ft,cr),{singleton:!0});function bi(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Qo=be(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),a=Ue(L(s,K(bi)));return J(L(a,K(l=>l.totalCount)),n),J(L(a,K(l=>l.groupIndices)),e),J(L(Pe(o,t,r),ie(([l,c])=>mn(c)),K(([l,c,u])=>nt(c.groupOffsetTree,Math.max(l-u,0),"v")[0]),Ie(),K(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(lt,We)),pt=be(([{log:e}])=>{const t=N(!1),n=Ue(L(t,ie(r=>r),Ie()));return ve(t,r=>{r&&Te(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(ft),{singleton:!0}),vi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Yo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!vi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const $t=be(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:S},{log:y}])=>{const b=ge(),x=ge(),v=N(0);let p=null,h=null,d=null;function k(){p&&(p(),p=null),d&&(d(),d=null),h&&(clearTimeout(h),h=null),de(l,!1)}return J(L(b,fe(n,S,r,v,a,i,y),fe(e,s,o),K(([[_,I,R,f,w,T,j,O],z,C,M])=>{const A=Yo(_),{align:H,behavior:E,offset:P}=A,F=f-1,V=Ko(A,I,F);let Q=Ht(V,I.offsetTree,z)+T;H==="end"?(Q+=C+nt(I.sizeTree,V)[1]-R+M,V===F&&(Q+=j)):H==="center"?Q+=(C+nt(I.sizeTree,V)[1]-R+M)/2:Q-=w,P&&(Q+=P);const te=pe=>{k(),pe?(O("retrying to scroll to",{location:_},Ve.DEBUG),de(b,_)):(de(x,!0),O("list did not change, scroll successful",{},Ve.DEBUG))};if(k(),E==="smooth"){let pe=!1;d=ve(t,ye=>{pe=pe||ye}),p=tt(u,()=>{te(pe)})}else p=tt(L(t,Si(150)),te);return h=setTimeout(()=>{k()},1200),de(l,!0),O("scrolling from index to",{behavior:E,index:V,top:Q},Ve.DEBUG),{behavior:E,top:Q}})),c),{scrollTargetReached:x,scrollToIndex:b,topListHeight:v}},ke(lt,We,ft),{singleton:!0});function Si(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function dr(e,t){e==0?t():requestAnimationFrame(()=>{dr(e-1,t)})}function fr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const qt=be(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=N(!0),l=N(0),c=N(!0);return J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),a),J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),c),ve(L(Pe(t,i),fe(a,n,e,c),ie(([[,u],S,{sizeTree:y},b,x])=>u&&(!Se(y)||ir(b))&&!S&&!x),fe(l)),([,u])=>{tt(o,()=>{de(c,!0)}),dr(4,()=>{tt(r,()=>{de(a,!0)}),de(s,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},ke(lt,We,$t,pt),{singleton:!0});function Xo(e,t){return Math.abs(e-t)<1.01}const Nt="up",Bt="down",yi="none",wi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ci=0,Ut=be(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=N(!1),a=N(!0),l=ge(),c=ge(),u=N(4),S=N(Ci),y=Ne(L(Zn(L(se(o),xt(1),st(!0)),L(se(o),xt(1),st(!1),Or(100))),Ie()),!1),b=Ne(L(Zn(L(n,st(!0)),L(n,st(!1),Or(200))),Ie()),!1);J(L(Pe(se(o),se(S)),K(([d,k])=>d<=k),Ie()),a),J(L(a,at(50)),c);const x=Ue(L(Pe(r,se(s),se(t),se(e),se(u)),it((d,[{scrollHeight:k,scrollTop:_},I,R,f,w])=>{const T=_+I-k>-w,j={scrollHeight:k,scrollTop:_,viewportHeight:I};if(T){let z,C;return _>d.state.scrollTop?(z="SCROLLED_DOWN",C=d.state.scrollTop-_):(z="SIZE_DECREASED",C=d.state.scrollTop-_||d.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:C,state:j}}let O;return j.scrollHeight>d.state.scrollHeight?O="SIZE_INCREASED":I<d.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":_<d.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:j}},wi),Ie((d,k)=>d&&d.atBottom===k.atBottom))),v=Ne(L(r,it((d,{scrollHeight:k,scrollTop:_,viewportHeight:I})=>{if(Xo(d.scrollHeight,k))return{changed:!1,jump:0,scrollHeight:k,scrollTop:_};{const R=k-(_+I)<1;return d.scrollTop!==_&&R?{changed:!0,jump:d.scrollTop-_,scrollHeight:k,scrollTop:_}:{changed:!0,jump:0,scrollHeight:k,scrollTop:_}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(d=>d.changed),K(d=>d.jump)),0);J(L(x,K(d=>d.atBottom)),i),J(L(i,at(50)),l);const p=N(Bt);J(L(r,K(({scrollTop:d})=>d),Ie(),it((d,k)=>Te(b)?{direction:d.direction,prevScrollTop:k}:{direction:k<d.prevScrollTop?Nt:Bt,prevScrollTop:k},{direction:Bt,prevScrollTop:0}),K(d=>d.direction)),p),J(L(r,at(50),st(yi)),p);const h=N(0);return J(L(y,ie(d=>!d),st(0)),h),J(L(o,at(100),fe(y),ie(([d,k])=>k),it(([d,k],[_])=>[k,_],[0,0]),K(([d,k])=>k-d)),h),{atBottomState:x,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:S,isAtBottom:i,isAtTop:a,isScrolling:y,lastJumpDueToItemResize:v,scrollDirection:p,scrollVelocity:h}},ke(We)),Ft="top",Wt="bottom",Ar="none";function Lr(e,t,n){return typeof e=="number"?n===Nt&&t===Ft||n===Bt&&t===Wt?e:0:n===Nt?t===Ft?e.main:e.reverse:t===Wt?e.main:e.reverse}function Gr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const pr=be(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=N(0),a=N(0),l=N(0),c=Ne(L(Pe(se(r),se(o),se(n),se(s,Gt),se(l),se(i),se(t),se(e),se(a)),K(([u,S,y,[b,x],v,p,h,d,k])=>{const _=u-d,I=p+h,R=Math.max(y-_,0);let f=Ar;const w=Gr(k,Ft),T=Gr(k,Wt);return b-=d,b+=y+h,x+=y+h,x-=d,b>u+I-w&&(f=Nt),x<u-R+S+T&&(f=Bt),f!==Ar?[Math.max(_-y-Lr(v,Ft,f)-w,0),_-R-h+S+Lr(v,Wt,f)+T]:null}),ie(u=>u!=null),Ie(Gt)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},ke(We),{singleton:!0});function Ii(e,t,n){if(mn(t)){const r=Uo(e,t);return[{index:nt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Mn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function nn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,u=0;if(e.length>0){c=e[0].offset;const v=e[e.length-1];u=v.offset+v.size}const S=n-i,y=a+S*l+(S-1)*r,b=c,x=y-u;return{bottom:u,firstItemIndex:s,items:Hr(e,o,s),offsetBottom:x,offsetTop:c,top:b,topItems:Hr(t,o,s),topListHeight:t.reduce((v,p)=>p.size+v,0),totalCount:n}}function Zo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const u of n.groupIndices){if(u-i>=e)break;i++}const a=e+i,l=fr(t,a),c=Array.from({length:a}).map((u,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return nn(c,[],a,o,n,r)}function Hr(e,t,n){if(e.length===0)return[];if(!mn(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Tt(t.groupOffsetTree,r,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let u;c.index===a.start?u={index:l,type:"group"}:u={groupIndex:l,index:c.index-(l+1)+n},s.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Nr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const St=be(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:S},y,{didMount:b},{recalcInProgress:x}])=>{const v=N([]),p=N(0),h=ge(),d=N(0);J(s.topItemsIndexes,v);const k=Ne(L(Pe(b,x,se(l,Gt),se(o),se(r),se(c),u,se(v),se(t),se(n),se(d),e),ie(([f,w,,T,,,,,,,,j])=>{const O=j&&j.length!==T;return f&&!w&&!O}),K(([,,[f,w],T,j,O,z,C,M,A,H,E])=>{var P,F,V,Q;const te=j,{offsetTree:pe,sizeTree:ye}=te,me=Te(p);if(T===0)return{...Mn,totalCount:T};if(f===0&&w===0)return me===0?{...Mn,totalCount:T}:Zo(me,O,j,M,A,E||[]);if(Se(ye))return me>0?null:nn(Ii(fr(O,T),te,E),[],T,A,te,M);const q=[];if(C.length>0){const Y=C[0],re=C[C.length-1];let ee=0;for(const xe of Tt(ye,Y,re)){const oe=xe.value,le=Math.max(xe.start,Y),he=Math.min(xe.end,re);for(let ue=le;ue<=he;ue++)q.push({data:E==null?void 0:E[ue],index:ue,offset:ee,size:oe}),ee+=oe}}if(!z)return nn([],q,T,A,te,M);const ne=C.length>0?C[C.length-1]+1:0,B=fi(pe,f,w,ne);if(B.length===0)return null;const U=T-1,G=gn([],Y=>{for(const re of B){const ee=re.value;let xe=ee.offset,oe=re.start;const le=ee.size;if(ee.offset<f){oe+=Math.floor((f-ee.offset+A)/(le+A));const ue=oe-re.start;xe+=ue*le+ue*A}oe<ne&&(xe+=(ne-oe)*le,oe=ne);const he=Math.min(re.end,U);for(let ue=oe;ue<=he&&!(xe>=w);ue++)Y.push({data:E==null?void 0:E[ue],index:ue,offset:xe,size:le}),xe+=le+A}}),Z=Nr(H,Ft),D=Nr(H,Wt);if(G.length>0&&(Z>0||D>0)){const Y=G[0],re=G[G.length-1];if(Z>0&&Y.index>ne){const ee=Math.min(Z,Y.index-ne),xe=[];let oe=Y.offset;for(let le=Y.index-1;le>=Y.index-ee;le--){const he=(F=(P=Tt(ye,le,le)[0])==null?void 0:P.value)!=null?F:Y.size;oe-=he+A,xe.unshift({data:E==null?void 0:E[le],index:le,offset:oe,size:he})}G.unshift(...xe)}if(D>0&&re.index<U){const ee=Math.min(D,U-re.index);let xe=re.offset+re.size+A;for(let oe=re.index+1;oe<=re.index+ee;oe++){const le=(Q=(V=Tt(ye,oe,oe)[0])==null?void 0:V.value)!=null?Q:re.size;G.push({data:E==null?void 0:E[oe],index:oe,offset:xe,size:le}),xe+=le+A}}}return nn(G,q,T,A,te,M)}),ie(f=>f!==null),Ie()),Mn);J(L(e,ie(ir),K(f=>f==null?void 0:f.length)),o),J(L(k,K(f=>f.topListHeight)),S),J(S,a),J(L(k,K(f=>[f.top,f.bottom])),i),J(L(k,K(f=>f.items)),h);const _=Ue(L(k,ie(({items:f})=>f.length>0),fe(o,e),ie(([{items:f},w])=>f[f.length-1].originalIndex===w-1),K(([,f,w])=>[f-1,w]),Ie(Gt),K(([f])=>f))),I=Ue(L(k,at(200),ie(({items:f,topItems:w})=>f.length>0&&f[0].originalIndex===w.length),K(({items:f})=>f[0].index),Ie())),R=Ue(L(k,ie(({items:f})=>f.length>0),K(({items:f})=>{let w=0,T=f.length-1;for(;f[w].type==="group"&&w<T;)w++;for(;f[T].type==="group"&&T>w;)T--;return{endIndex:f[T].index,startIndex:f[w].index}}),Ie($o)));return{endReached:_,initialItemCount:p,itemsRendered:h,listState:k,minOverscanItemCount:d,rangeChanged:R,startReached:I,topItemsIndexes:v,...y}},ke(lt,Qo,pr,qt,$t,Ut,pt,cr),{singleton:!0}),Jo=be(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Ne(L(Pe(n,e,r,t,o),K(([a,l,c,u,S])=>a+l+c+u+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,St),{singleton:!0}),ki=be(([{viewportHeight:e},{totalListHeight:t}])=>{const n=N(!1),r=Ne(L(Pe(n,e,t),ie(([o])=>o),K(([,o,s])=>Math.max(0,o-s)),at(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,Jo),{singleton:!0}),es=be(()=>({context:N(null)})),Ri=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ts=be(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const u=ge();return J(L(u,fe(t,l,n,s,o,r,a),fe(e),K(([[S,y,b,x,v,p,h,d],k])=>{const{align:_,behavior:I,calculateViewLocation:R=Ri,done:f,...w}=S,T=Ko(S,y,x-1),j=Ht(T,y.offsetTree,k)+v+p,O=j+nt(y.sizeTree,T)[1],z=d+p,C=d+b-h,M=R({itemBottom:O,itemTop:j,locationParams:{align:_,behavior:I,...w},viewportBottom:C,viewportTop:z});return M?f&&tt(L(i,ie(A=>!A),xt(Te(i)?1:2)),f):f==null||f(),M}),ie(S=>S!==null)),c),{scrollIntoView:u}},ke(lt,We,$t,St,ft),{singleton:!0});function Fr(e){return e?e==="smooth"?"smooth":"auto":!1}const Ti=(e,t)=>typeof e=="function"?Fr(e(t)):t&&Fr(e),_i=be(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:u},{scrollingInProgress:S},{context:y},{scrollIntoView:b}])=>{const x=N(!1),v=ge();let p=null;function h(I){de(i,{align:"end",behavior:I,index:"LAST"})}ve(L(Pe(L(se(t),xt(1)),l),fe(se(x),s,a,S),K(([[I,R],f,w,T,j])=>{let O=R&&T,z="auto";return O&&(z=Ti(f,w||j),O=O&&!!z),{followOutputBehavior:z,shouldFollow:O,totalCount:I}}),ie(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:R})=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I)}):p=tt(e,()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I),p=null})});function d(I){const R=tt(o,f=>{I&&!f.atBottom&&f.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Te(u)("scrolling to bottom due to increased size",{},Ve.DEBUG),h("auto"))});setTimeout(R,100)}ve(L(Pe(se(x),t,c),ie(([I,,R])=>I&&R),it(({value:I},[,R])=>({refreshed:I===R,value:R}),{refreshed:!1,value:0}),ie(({refreshed:I})=>I),fe(x,t)),([,I])=>{Te(a)&&d(I!==!1)}),ve(v,()=>{d(Te(x)!==!1)}),ve(Pe(se(x),o),([I,R])=>{I&&!R.atBottom&&R.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")});const k=N(null),_=ge();return J(Zn(L(se(r),K(I=>{var R;return(R=I==null?void 0:I.length)!=null?R:0})),L(se(t))),_),ve(L(Pe(L(_,xt(1)),l),fe(se(k),a,S,y),K(([[I,R],f,w,T,j])=>R&&w&&(f==null?void 0:f({context:j,totalCount:I,scrollingInProgress:T}))),ie(I=>!!I),at(0)),I=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("scrolling into view",{}),de(b,I)}):p=tt(e,()=>{Te(u)("scrolling into view",{}),de(b,I),p=null})}),{autoscrollToBottom:v,followOutput:x,scrollIntoViewOnChange:k}},ke(lt,Ut,$t,qt,pt,ft,We,es,ts)),Mi=be(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(J(L(a,fe(s),ie(([,l])=>l!==0),fe(o,r,t,n,e),K(([[,l],c,u,S,y,b=[]])=>Zo(l,c,u,S,y,b))),i),{}),ke(lt,qt,St,pt),{singleton:!0}),Ei=be(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=N(0);return ve(L(e,fe(r),ie(([,o])=>o!==0),K(([,o])=>({top:o}))),o=>{tt(L(n,xt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{de(t,o)})})}),{initialScrollTop:r}},ke(pt,We,St),{singleton:!0}),ns=be(([{scrollVelocity:e}])=>{const t=N(!1),n=ge(),r=N(!1);return J(L(e,fe(r,t,n),ie(([o,s])=>!!s),K(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),Ie()),t),ve(L(Pe(t,e,n),fe(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Ut),{singleton:!0}),hr=be(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=N(!1),i=N(void 0);return J(L(Pe(n,r),K(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:a,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),J(L(t,fe(r),K(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),ji=be(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=ge(),u=N(void 0),S=N(null),y=N(null);return J(a,S),J(l,y),ve(L(c,fe(t,r,i,S,y,n)),([b,x,v,p,h,d,k])=>{const _=hi(x.sizeTree);p&&h!==null&&d!==null&&(v=h.scrollTop-d.offsetTop),v-=k,b({ranges:_,scrollTop:v})}),J(L(u,ie(ir),K(Oi)),o),J(L(s,fe(u),ie(([,b])=>b!==void 0),Ie(),K(([,b])=>b.ranges)),e),{getState:c,restoreStateFrom:u}},ke(lt,We,qt,pt,hr));function Oi(e){return{align:"start",index:0,offset:e.scrollTop}}const Pi=be(([{topItemsIndexes:e}])=>{const t=N(0);return J(L(t,ie(n=>n>=0),K(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(St));function rs(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Bi=rs(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),zi=be(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:S,sizes:y},{log:b},{recalcInProgress:x}])=>{const v=Ue(L(l,fe(i),it(([,h,d,k],[{bottom:_,items:I,offsetBottom:R,totalCount:f},w])=>{const T=_+R;let j=0;return d===f&&h.length>0&&I.length>0&&(I[0].originalIndex===0&&h[0].originalIndex===0||(j=T-k,j!==0&&(j+=w))),[j,I,f,T]},[0,[],0,0]),ie(([h])=>h!==0),fe(r,a,n,o,b,x),ie(([,h,d,k,,,_])=>!_&&!k&&h!==0&&d===Nt),K(([[h],,,,,d])=>(d("Upward scrolling compensation",{amount:h},Ve.DEBUG),h))));function p(h){h>0?(de(t,{behavior:"auto",top:-h}),de(e,0)):(de(e,0),de(t,{behavior:"auto",top:-h}))}return ve(L(v,fe(e,s)),([h,d,k])=>{k&&Bi()?de(e,d-h):p(-h)}),ve(L(Pe(Ne(s,!1),e,x),ie(([h,d,k])=>!h&&!k&&d!==0),K(([h,d])=>d),at(1)),p),J(L(S,K(h=>({top:-h}))),t),ve(L(c,fe(y,u),K(([h,{groupIndices:d,lastSize:k,sizeTree:_},I])=>{function R(f){return f*(k+I)}if(d.length===0)return R(h);{let f=0;const w=Lt(_,0);let T=0,j=0;for(;T<h;){T++,f+=w;let O=d.length===j+1?1/0:d[j+1]-d[j]-1;T+O>h&&(f-=w,O=h-T+1),T+=O,f+=R(O),j++}return f}})),h=>{de(e,h),requestAnimationFrame(()=>{de(t,{top:h}),requestAnimationFrame(()=>{de(e,0),de(x,!1)})})}),{deviation:e}},ke(We,Ut,St,lt,ft,cr)),Ai=be(([e,t,n,r,o,s,i,a,l,c,u])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...u}),ke(pr,Mi,pt,ns,Jo,Ei,ki,hr,ts,ft,es)),os=be(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:u,statefulTotalCount:S,totalCount:y,trackItemSizes:b},{initialItemFinalLocationReached:x,initialTopMostItemIndex:v,scrolledToInitialItem:p},h,d,k,_,{scrollToIndex:I},R,{topItemCount:f},{groupCounts:w},T])=>{const{listState:j,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:C,...M}=_;return J(C,T.scrollSeekRangeChanged),J(L(T.windowViewportRect,K(A=>A.visibleHeight)),h.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:w,heightEstimates:a,initialItemFinalLocationReached:x,initialTopMostItemIndex:v,scrolledToInitialItem:p,sizeRanges:c,topItemCount:f,topItemsIndexes:z,totalCount:y,...k,groupIndices:i,itemSize:l,listState:j,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:S,trackItemSizes:b,rangeChanged:C,...M,...T,...h,sizes:u,...d}},ke(lt,qt,We,ji,_i,St,$t,zi,Pi,Qo,Ai));function Li(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const Zt=typeof document<"u"?g.useLayoutEffect:g.useEffect;function ss(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=g.createContext({});function l(p,h){p.propsReady&&de(p.propsReady,!1);for(const d of r){const k=p[t.required[d]];de(k,h[d])}for(const d of o)if(d in h){const k=p[t.optional[d]];de(k,h[d])}p.propsReady&&de(p.propsReady,!0)}function c(p){return s.reduce((h,d)=>(h[d]=k=>{const _=p[t.methods[d]];de(_,k)},h),{})}function u(p){return i.reduce((h,d)=>(h[d]=Js(p[t.events[d]]),h),{})}const S=g.forwardRef((p,h)=>{const{children:d,...k}=p,[_]=g.useState(()=>gn(ti(e),f=>{l(f,k)})),[I]=g.useState(jr(u,_));Zt(()=>{for(const f of i)f in k&&ve(I[f],k[f]);return()=>{Object.values(I).map(lr)}},[k,I,_]),Zt(()=>{l(_,k)}),g.useImperativeHandle(h,Er(c(_)));const R=n;return m.jsx(a.Provider,{value:_,children:n?m.jsx(R,{...Li([...r,...o,...i],k),children:d}):d})}),y=p=>{const h=g.useContext(a);return g.useCallback(d=>{de(h[p],d)},[h,p])},b=p=>{const h=g.useContext(a)[p],d=g.useCallback(k=>ve(h,k),[h]);return g.useSyncExternalStore(d,()=>Te(h),()=>Te(h))},x=p=>{const h=g.useContext(a)[p],[d,k]=g.useState(jr(Te,h));return Zt(()=>ve(h,_=>{_!==d&&k(Er(_))}),[h,d]),d},v=g.version.startsWith("18")?b:x;return{Component:S,useEmitter:(p,h)=>{const d=g.useContext(a)[p];Zt(()=>ve(d,h),[h,d])},useEmitterValue:v,usePublisher:y}}const is=g.createContext(void 0),ls=g.createContext(void 0),as=typeof document<"u"?g.useLayoutEffect:g.useEffect;function En(e){return"self"in e}function Gi(e){return"body"in e}function cs(e,t,n,r=jt,o,s){const i=g.useRef(null),a=g.useRef(null),l=g.useRef(null),c=g.useCallback(y=>{let b,x,v;const p=y.target;if(Gi(p)||En(p)){const d=En(p)?p:p.defaultView;v=s?d.scrollX:d.scrollY,b=s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight,x=s?d.innerWidth:d.innerHeight}else v=s?p.scrollLeft:p.scrollTop,b=s?p.scrollWidth:p.scrollHeight,x=s?p.offsetWidth:p.offsetHeight;const h=()=>{e({scrollHeight:b,scrollTop:Math.max(v,0),viewportHeight:x})};y.suppressFlushSync?h():Os.flushSync(h),a.current!==null&&(v===a.current||v<=0||v===b-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);g.useEffect(()=>{const y=o||i.current;return r(o||i.current),c({suppressFlushSync:!0,target:y}),y.addEventListener("scroll",c,{passive:!0}),()=>{r(null),y.removeEventListener("scroll",c)}},[i,c,n,r,o]);function u(y){const b=i.current;if(!b||(s?"offsetWidth"in b&&b.offsetWidth===0:"offsetHeight"in b&&b.offsetHeight===0))return;const x=y.behavior==="smooth";let v,p,h;En(b)?(p=Math.max(ut(b.document.documentElement,s?"width":"height"),s?b.document.documentElement.scrollWidth:b.document.documentElement.scrollHeight),v=s?b.innerWidth:b.innerHeight,h=s?window.scrollX:window.scrollY):(p=b[s?"scrollWidth":"scrollHeight"],v=ut(b,s?"width":"height"),h=b[s?"scrollLeft":"scrollTop"]);const d=p-v;if(y.top=Math.ceil(Math.max(Math.min(d,y.top),0)),Xo(v,p)||y.top===h){e({scrollHeight:p,scrollTop:h,viewportHeight:v}),x&&t(!0);return}x?(a.current=y.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(y={behavior:y.behavior,left:y.top}),b.scrollTo(y)}function S(y){s&&(y={behavior:y.behavior,left:y.top}),i.current.scrollBy(y)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:u}}const jn="-webkit-sticky",Wr="sticky",gr=rs(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Wr});function mr(e){return e}const Hi=be(()=>{const e=N(a=>`Item ${a}`),t=N(a=>`Group ${a}`),n=N({}),r=N(mr),o=N("div"),s=N(jt),i=(a,l=null)=>Ne(L(n,K(c=>c[a]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Ni=be(([e,t])=>({...e,...t}),ke(os,Hi)),Fi=({height:e})=>m.jsx("div",{style:{height:e}}),Wi={overflowAnchor:"none",position:gr(),zIndex:1},us={overflowAnchor:"none"},Di={...us,display:"inline-block",height:"100%"},Dr=g.memo(function({showTopList:e=!1}){const t=ae("listState"),n=Ke("sizeRanges"),r=ae("useWindowScroll"),o=ae("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),a=o||r?s:i,l=ae("itemContent"),c=ae("context"),u=ae("groupContent"),S=ae("trackItemSizes"),y=ae("itemSize"),b=ae("log"),x=Ke("gap"),v=ae("horizontalDirection"),{callbackRef:p}=oi(n,y,S,e?jt:a,b,x,o,v,ae("skipAnimationFrameInResizeObserver")),[h,d]=g.useState(0);xr("deviation",M=>{h!==M&&d(M)});const k=ae("EmptyPlaceholder"),_=ae("ScrollSeekPlaceholder")||Fi,I=ae("ListComponent"),R=ae("ItemComponent"),f=ae("GroupComponent"),w=ae("computeItemKey"),T=ae("isSeeking"),j=ae("groupIndices").length>0,O=ae("alignToBottom"),z=ae("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:h!==0?h:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:h!==0?h:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...z?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k?m.jsx(k,{...He(k,c)}):m.jsx(I,{...He(I,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:C,children:(e?t.topItems:t.items).map(M=>{const A=M.originalIndex,H=w(A+t.firstItemIndex,M.data,c);return T?g.createElement(_,{...He(_,c),height:M.size,index:M.index,key:H,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?g.createElement(f,{...He(f,c),"data-index":A,"data-item-index":M.index,"data-known-size":M.size,key:H,style:Wi},u(M.index,c)):g.createElement(R,{...He(R,c),...Ui(R,M.data),"data-index":A,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:H,style:v?Di:us},j?l(M.index,M.groupIndex,M.data,c):l(M.index,M.data,c))})})}),Vi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},$i={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),qi={position:gr(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function Ui(e,t){return{item:typeof e=="string"?void 0:t}}const Ki=g.memo(function(){const e=ae("HeaderComponent"),t=Ke("headerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Qi=g.memo(function(){const e=ae("FooterComponent"),t=Ke("footerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null});function ds({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:y,scrollerRef:b,scrollToCallback:x}=cs(a,c,l,u,void 0,S);return e("scrollTo",x),e("scrollBy",y),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:b,style:{...S?$i:Vi,...o},tabIndex:0,...i,...He(l,s),children:r})})}function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("totalListHeight"),S=t("deviation"),y=t("customScrollParent"),b=g.useRef(null),x=t("scrollerRef"),{scrollByCallback:v,scrollerRef:p,scrollToCallback:h}=cs(a,c,l,x,y);return as(()=>{var d;return p.current=y||((d=b.current)==null?void 0:d.ownerDocument.defaultView),()=>{p.current=null}},[p,y]),e("windowScrollTo",h),e("scrollBy",v),m.jsx(l,{ref:b,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...u!==0?{height:u+S}:{}},...i,...He(l,s),children:r})})}const Yi=({children:e})=>{const t=g.useContext(is),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=ae("alignToBottom"),s=ae("horizontalDirection"),i=g.useMemo(()=>Lo(n,l=>ut(l,s?"width":"height")),[n,s]),a=vt(i,!0,ae("skipAnimationFrameInResizeObserver"));return g.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:xn(o),children:e})},Xi=({children:e})=>{const t=g.useContext(is),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=ae("customScrollParent"),s=Ho(n,o,ae("skipAnimationFrameInResizeObserver")),i=ae("alignToBottom");return g.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),m.jsx("div",{"data-viewport-type":"window",ref:s,style:xn(i),children:e})},Zi=({children:e})=>{const t=ae("TopItemListComponent")||"div",n=ae("headerHeight"),r={...qi,marginTop:`${n}px`},o=ae("context");return m.jsx(t,{style:r,...He(t,o),children:e})},Ji=g.memo(function(e){const t=ae("useWindowScroll"),n=ae("topItemsIndexes").length>0,r=ae("customScrollParent"),o=ae("context");return m.jsxs(r||t?nl:tl,{...e,context:o,children:[n&&m.jsx(Zi,{children:m.jsx(Dr,{showTopList:!0})}),m.jsxs(r||t?Xi:Yi,{children:[m.jsx(Ki,{}),m.jsx(Dr,{}),m.jsx(Qi,{})]})]})}),{Component:el,useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}=ss(Ni,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ji),tl=ds({useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}),nl=fs({useEmitter:xr,useEmitterValue:ae,usePublisher:Ke}),rl=el,ol=be(()=>{const e=N(c=>m.jsxs("td",{children:["Item $",c]})),t=N(null),n=N(c=>m.jsxs("td",{colSpan:1e3,children:["Group ",c]})),r=N(null),o=N(null),s=N({}),i=N(mr),a=N(jt),l=(c,u=null)=>Ne(L(s,K(S=>S[c]),Ie()),u);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(os,ol);gr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},sl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:$r,floor:sn,max:zt,min:On,round:qr}=Math;function Ur(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function il(e){return{...sl,items:e}}function Jt(e,t){return e&&e.width===t.width&&e.height===t.height}function ll(e,t){return e&&e.column===t.column&&e.row===t.row}const al=be(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:S},y,b,{didMount:x,propsReady:v},{customScrollParent:p,useWindowScroll:h,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_},I])=>{const R=N(0),f=N(0),w=N(Vr),T=N({height:0,width:0}),j=N({height:0,width:0}),O=ge(),z=ge(),C=N(0),M=N(null),A=N({column:0,row:0}),H=ge(),E=ge(),P=N(!1),F=N(0),V=N(!0),Q=N(!1),te=N(!1);ve(L(x,fe(F),ie(([B,U])=>!!U)),()=>{de(V,!1)}),ve(L(Pe(x,V,j,T,F,Q),ie(([B,U,G,Z,,D])=>B&&!U&&G.height!==0&&Z.height!==0&&!D)),([,,,,B])=>{de(Q,!0),dr(1,()=>{de(O,B)}),tt(L(c),()=>{de(t,[0,0]),de(V,!0)})}),J(L(E,ie(B=>B!=null&&B.scrollTop>0),st(0)),f),ve(L(x,fe(E),ie(([,B])=>B!=null)),([,B])=>{B&&(de(T,B.viewport),de(j,B.item),de(A,B.gap),B.scrollTop>0&&(de(P,!0),tt(L(c,xt(1)),U=>{de(P,!1)}),de(l,{top:B.scrollTop})))}),J(L(T,K(({height:B})=>B)),S),J(L(Pe(se(T,Jt),se(j,Jt),se(A,(B,U)=>B&&B.column===U.column&&B.row===U.row),se(c)),K(([B,U,G,Z])=>({gap:G,item:U,scrollTop:Z,viewport:B}))),H),J(L(Pe(se(R),r,se(A,ll),se(j,Jt),se(T,Jt),se(M),se(f),se(P),se(V),se(F)),ie(([,,,,,,,B])=>!B),K(([B,[U,G],Z,D,Y,re,ee,,xe,oe])=>{const{column:le,row:he}=Z,{height:ue,width:Ce}=D,{width:Ae}=Y;if(ee===0&&(B===0||Ae===0))return Vr;if(Ce===0){const yt=fr(oe,B),Kt=yt+Math.max(ee-1,0);return il(Ur(yt,Kt,re))}const Oe=ps(Ae,Ce,le);let Le,Fe;xe?U===0&&G===0&&ee>0?(Le=0,Fe=ee-1):(Le=Oe*sn((U+he)/(ue+he)),Fe=Oe*$r((G+he)/(ue+he))-1,Fe=On(B-1,zt(Fe,Oe-1)),Le=On(Fe,zt(0,Le))):(Le=0,Fe=-1);const De=Ur(Le,Fe,re),{bottom:je,top:Xe}=Kr(Y,Z,D,De),$e=$r(B/Oe),ht=$e*ue+($e-1)*he-je;return{bottom:je,itemHeight:ue,items:De,itemWidth:Ce,offsetBottom:ht,offsetTop:Xe,top:Xe}})),w),J(L(M,ie(B=>B!==null),K(B=>B.length)),R),J(L(Pe(T,j,w,A),ie(([B,U,{items:G}])=>G.length>0&&U.height!==0&&B.height!==0),K(([B,U,{items:G},Z])=>{const{bottom:D,top:Y}=Kr(B,Z,U,G);return[Y,D]}),Ie(Gt)),t);const pe=N(!1);J(L(c,fe(pe),K(([B,U])=>U||B!==0)),pe);const ye=Ue(L(Pe(w,R),ie(([{items:B}])=>B.length>0),fe(pe),ie(([[B,U],G])=>{const Z=B.items[B.items.length-1].index===U-1;return(G||B.bottom>0&&B.itemHeight>0&&B.offsetBottom===0&&B.items.length===U)&&Z}),K(([[,B]])=>B-1),Ie())),me=Ue(L(se(w),ie(({items:B})=>B.length>0&&B[0].index===0),st(0),Ie())),q=Ue(L(se(w),fe(P),ie(([{items:B},U])=>B.length>0&&!U),K(([{items:B}])=>({endIndex:B[B.length-1].index,startIndex:B[0].index})),Ie($o),at(0)));J(q,b.scrollSeekRangeChanged),J(L(O,fe(T,j,R,A),K(([B,U,G,Z,D])=>{const Y=Yo(B),{align:re,behavior:ee,offset:xe}=Y;let oe=Y.index;oe==="LAST"&&(oe=Z-1),oe=zt(0,oe,On(Z-1,oe));let le=rr(U,D,G,oe);return re==="end"?le=qr(le-U.height+G.height):re==="center"&&(le=qr(le-U.height/2+G.height/2)),xe&&(le+=xe),{behavior:ee,top:le}})),l);const ne=Ne(L(w,K(B=>B.offsetBottom+B.bottom)),0);return J(L(_,K(B=>({height:B.visibleHeight,width:B.visibleWidth}))),T),{customScrollParent:p,data:M,deviation:C,footerHeight:o,gap:A,headerHeight:s,increaseViewportBy:e,initialItemCount:f,itemDimensions:j,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:a,scrollHeight:z,scrollTo:l,scrollToIndex:O,scrollTop:c,smoothScrollTargetReached:u,totalCount:R,useWindowScroll:h,viewportDimensions:T,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_,...b,gridState:w,horizontalDirection:te,initialTopMostItemIndex:F,totalListHeight:ne,...y,endReached:ye,propsReady:v,rangeChanged:q,startReached:me,stateChanged:H,stateRestoreInProgress:P,...I}},ke(pr,We,Ut,ns,pt,hr,ft));function ps(e,t,n){return zt(1,sn((e+n)/(sn(t)+n)))}function Kr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=rr(e,t,n,r[0].index);return{bottom:rr(e,t,n,r[r.length-1].index)+o,top:s}}function rr(e,t,n,r){const o=ps(e.width,n.width,t.column),s=sn(r/o),i=s*n.height+zt(0,s-1)*t.row;return i>0?i+t.row:i}const cl=be(()=>{const e=N(S=>`Item ${S}`),t=N({}),n=N(null),r=N("virtuoso-grid-item"),o=N("virtuoso-grid-list"),s=N(mr),i=N("div"),a=N(jt),l=(S,y=null)=>Ne(L(t,K(b=>b[S]),Ie()),y),c=N(!1),u=N(!1);return J(se(u),c),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),ul=be(([e,t])=>({...e,...t}),ke(al,cl)),dl=g.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Qe("scrollHeight"),a=Re("ItemComponent"),l=Re("ListComponent"),c=Re("ScrollSeekPlaceholder"),u=Re("context"),S=Qe("itemDimensions"),y=Qe("gap"),b=Re("log"),x=Re("stateRestoreInProgress"),v=Qe("reportReadyState"),p=vt(g.useMemo(()=>h=>{const d=h.parentElement.parentElement.scrollHeight;i(d);const k=h.firstChild;if(k){const{height:_,width:I}=k.getBoundingClientRect();S({height:_,width:I})}y({column:Qr("column-gap",getComputedStyle(h).columnGap,b),row:Qr("row-gap",getComputedStyle(h).rowGap,b)})},[i,S,y,b]),!0,!1);return as(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),x?null:m.jsx(l,{className:t,ref:p,...He(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(h=>{const d=o(h.index,h.data,u);return s?m.jsx(c,{...He(c,u),height:e.itemHeight,index:h.index,width:e.itemWidth},d):g.createElement(a,{...He(a,u),className:n,"data-index":h.index,key:d},r(h.index,h.data,u))})})}),fl=g.memo(function(){const e=Re("HeaderComponent"),t=Qe("headerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),pl=g.memo(function(){const e=Re("FooterComponent"),t=Qe("footerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),hl=({children:e})=>{const t=g.useContext(ls),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=vt(g.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return g.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),m.jsx("div",{ref:o,style:xn(!1),children:e})},gl=({children:e})=>{const t=g.useContext(ls),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Re("customScrollParent"),s=Ho(n,o,!1);return g.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),m.jsx("div",{ref:s,style:xn(!1),children:e})},ml=g.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?bl:xl,o=n||t?gl:hl,s=Re("context");return m.jsx(r,{...e,...He(r,s),children:m.jsxs(o,{children:[m.jsx(fl,{}),m.jsx(dl,{}),m.jsx(pl,{})]})})}),{useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}=ss(ul,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},ml),xl=ds({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}),bl=fs({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe});function Qr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const bn=g.createContext(void 0);function we(e,t){const n=g.useContext(bn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return fn(n,e,t)}function ln(){const e=g.useContext(bn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const br=g.createContext(void 0);function Mt(){const e=g.useContext(br);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function $(e,t){const n=g.useContext(br);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return fn(n,o=>e(o.progress),t)}const vl="_run_zzb61_3",Sl="_runWrap_zzb61_7",yl="_highlight_zzb61_13",wl="_highlightleft_zzb61_14",Cl="_highlightright_zzb61_15",Il="_highlightcenter_zzb61_16",kl="_underline_zzb61_48",Rl="_underlineleft_zzb61_49",Tl="_underlineright_zzb61_50",_l="_underlinecenter_zzb61_51",ot={run:vl,runWrap:Sl,highlight:yl,highlightleft:wl,highlightright:Cl,highlightcenter:Il,underline:kl,underlineleft:Rl,underlineright:Tl,underlinecenter:_l},Yr=e=>Symbol.iterator in e,Xr=e=>"entries"in e,Zr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},Ml=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function El(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Yr(e)&&Yr(t)?Xr(e)&&Xr(t)?Zr(e,t):Ml(e,t):Zr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Dt(e){const t=g.useRef(void 0);return n=>{const r=e(n);return El(t.current,r)?t.current:t.current=r}}function jl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function Ol(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Pl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),gs=g.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=we(T=>T.setClipIndex),i=we(T=>T.seek),a=$(T=>T.setCurrentGlobalRunIndex),l=ln(),c=$(T=>T.rangeStartGI),u=$(T=>T.rangeEndGI),S=$(T=>T.setRange),y=c!=null&&u!=null,b=g.useCallback(T=>{var E;const j=(E=T.target)==null?void 0:E.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;if(z<0||z>=t.length)return;const C=t[z],M=C.text??"";if(!M.trim()||!/[가-힣a-zA-Z0-9]/.test(M))return;a(O,"program");const A=C.audioChunkIndex,H=C.audioTimeMs;A!=null&&H!=null&&(s(A),i(H))},[t,r,i,s,a]),x=g.useRef(null),v=g.useRef(!1),p=g.useCallback(T=>{var C;const j=(C=T.target)==null?void 0:C.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;z<0||z>=t.length||(v.current=!1,x.current&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(O,O),v.current=!0,x.current=null)},800))},[t,r,S,l]),h=g.useCallback(()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},[]),d=g.useCallback(()=>{h()},[h]),k=h,_=h,I=$(T=>T.clearRange),R=g.useCallback(T=>{var z;if(v.current){v.current=!1;return}const j=(z=T.target)==null?void 0:z.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g);isNaN(O)||y&&c!=null&&u!=null&&(I(),T.stopPropagation())},[y,c,u,I]),f=o,w=r+t.length-1;return m.jsx("span",{onClick:R,onDoubleClick:b,onPointerDown:p,onPointerUp:d,onPointerCancel:k,onPointerLeave:_,children:f.map((T,j)=>m.jsx(zl,{ns:n,group:T,runs:t,paraLastG:w,rangeStartGI:c,rangeEndGI:u},`${n}/grp:${j}-${T.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Bl=g.memo(function(){const t=g.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=X(Dt(t));return n.showSplit?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&m.jsx("span",{children:" / "}),m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),zl=g.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=g.useCallback(p=>{const h=p.currentGlobalRunIndex;return h!=null&&h>=n.startG&&h<=n.endG},[n]),l=$(Dt(a)),c=g.useCallback(p=>l?{showPointer:p.showPointer,pointerStyle:p.pointerStyle,pointerColor:p.pointerColor}:Pl,[l]),u=X(Dt(c)),S=n.r0??0,y=n.len??Math.max(0,n.endG-n.startG+1),b=l&&u.showPointer&&u.pointerStyle!=="underline",x=l&&u.showPointer&&u.pointerStyle==="underline",v=b||x?{"--hl-color":u.pointerColor,"--ul-color":u.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:y}).map((p,h)=>{const k=r[S+h],_=n.startG+h,I=`${t}/run:${_}`,R=!!k.split&&_!==o;let f=`${ot.runWrap}`;return b&&(y===1?f+=` ${ot.highlight}`:h===0?f+=` ${ot.highlightleft}`:h+1===y?f+=` ${ot.highlightright}`:f+=` ${ot.highlightcenter}`),x&&(y===1?f+=` ${ot.underline}`:h===0?f+=` ${ot.underlineleft}`:h+1===y?f+=` ${ot.underlineright}`:f+=` ${ot.underlinecenter}`),m.jsxs(g.Fragment,{children:[m.jsx("span",{className:f,style:v,children:m.jsx(Al,{gi:n.startG,g:_,run:k,active:l,pointerCfg:u,isInRange:s!=null&&i!=null&&_>=s&&_<=i})}),R&&m.jsx(Bl,{})]},I)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Al=g.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=g.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const c=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=c;const u=c.startsWith("#")?jl(c):Ol(c);u&&(.299*u.r+.587*u.g+.114*u.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:ot.run,style:a,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Ll({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var c;const i=e.list?e.list.level*24:0,a=((c=e.list)==null?void 0:c.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??a;return m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?m.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,m.jsx(gs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Gl=g.memo(Ll,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Hl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return eo(e,!1);case"upperalpha":case"upperlatin":return eo(e,!0);case"lowerroman":return Jr(e,!1);case"upperroman":return Jr(e,!0);case"decimalenclosedcircle":return Nl(e);default:return String(e)}}function Nl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function Jr(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function eo(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function vr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function Sr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Hl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Fl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Wl(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Dl(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const Vl="_scroller_kqkmq_3",$l={scroller:Vl},ql=g.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${$l.scroller}${t?" "+t:""}`,style:n,...r})});function vn(){const e=g.useContext(bt);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const or=e=>/[가-힣a-zA-Z0-9]/.test(e),Ul=e=>((e==null?void 0:e.textContent)??"").trim(),an=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Kl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,a=1/0,l=1/0,c=-1,u=1/0,S=1/0;const y=e.querySelectorAll("[data-g]");for(let b=0;b<y.length;b++){const x=y[b];if(!x||!x.isConnected)continue;const v=Ul(x);if(!v||!or(v))continue;const p=x.getBoundingClientRect();if(p.height<=r||p.width<=r||p.bottom<=o.top||p.top>=o.bottom)continue;if(p.top<s){const k=Math.abs(p.top-s);(k<u||k===u&&(p.top<S||c!==-1&&Number(x.dataset.g)<c))&&(u=k,c=Number(x.dataset.g),S=p.top);continue}const h=Number(x.dataset.g);if(Number.isNaN(h))continue;p.top<l-n?(l=p.top,a=p.top,i=h):p.top<=l+n&&(p.top<a||p.top===a&&(i===-1||h<i))&&(a=p.top,i=h);const d=Math.abs(p.top-s);(d<u||d===u&&(p.top<S||c!==-1&&h<c))&&(u=d,c=h,S=p.top)}return i!==-1?i:c}const ms=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=an(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=an(e,t)}return s},to=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of o){const l=a.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const c=Number(a.dataset.g);Number.isNaN(c)||(c<s&&(s=c),c>i&&(i=c))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Ql=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=an(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),a=s.height*n,l=i.top-(s.top+a);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Yl(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Pn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!Ql(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Yl(e,o);const i=an(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,u=a.top+c,S=l.top-u;return Math.abs(S)<=1},ct=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=g.createContext(null);function xs(){const e=g.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Je(e,t){const n=g.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return fn(n,e,t)}const bs=()=>{const e=$(r=>r.section),t=xs(),n=e.quiz;return!n||!n.length?null:m.jsxs("button",{onClick:()=>{t.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",n.length,")"]})},Xl="_navBtn_1fciy_2",Zl="_disabled_1fciy_26",Jl="_label_1fciy_32",_t={navBtn:Xl,disabled:Zl,label:Jl};var vs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},no=g.createContext&&g.createContext(vs),ea=["attr","size","title"];function ta(e,t){if(e==null)return{};var n=na(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function na(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cn(){return cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cn.apply(this,arguments)}function ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(n),!0).forEach(function(r){ra(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ro(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ra(e,t,n){return t=oa(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(e){var t=sa(e,"string");return typeof t=="symbol"?t:t+""}function sa(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ss(e){return e&&e.map((t,n)=>g.createElement(t.tag,un({key:n},t.attr),Ss(t.child)))}function Ye(e){return t=>g.createElement(ia,cn({attr:un({},e.attr)},t),Ss(e.child))}function ia(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ta(e,ea),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),g.createElement("svg",cn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:un(un({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&g.createElement("title",null,s),e.children)};return no!==void 0?g.createElement(no.Consumer,null,n=>t(n)):t(vs)}function oo(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function so(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const la=({isIcon:e=!0})=>{const t=$(i=>i.isCanPrev),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(oo,{size:18}),m.jsx("span",{className:_t.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(oo,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},dn=({isIcon:e=!0})=>{const t=$(i=>i.isCanNext),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(so,{size:18}),m.jsx("span",{className:_t.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(so,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ys(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function aa({section:e,blocks:t,nsPrefix:n}){const r=g.useMemo(()=>{const R=[],f=vr();return t.forEach((w,T)=>{w.type==="paragraph"&&(R[T]=Sr(w,f))}),R},[t]),o=$(R=>{var f;return((f=R.layout)==null?void 0:f.prefix)??[]}),s=$(R=>{var f;return((f=R.derivedNav)==null?void 0:f.splitGroupsPerBlock)??[]}),i=X(R=>R.marginX),a=X(R=>R.viewportHeight),l=g.useRef({start:0,end:0}),c=g.useCallback(R=>{const f=t[R],w=`${n}blk-${f.id}`;if(f.type==="image"){const{src:O,alt:z,width:C,height:M}=f,A=C&&M?`${C} / ${M}`:"4 / 3",H=R>=l.current.start&&R<=l.current.end,E=a>80?Math.floor((a-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:E,aspectRatio:A},children:m.jsx("img",{src:O,alt:z||"",loading:H?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),z&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:z})]})}const T=r[R]??void 0,j=s[R];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Gl,{block:f,computedMarker:T,ns:w,baseIndex:o[R],sectionId:e.section_id,preGroups:j})})},[t,r,o,n,e,s,a]),u=g.useRef(null),S=g.useCallback(R=>{u.current=R},[]),y=g.useMemo(()=>g.memo(R=>{const{style:f,children:w,...T}=R;return m.jsx("div",{...T,style:f,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:w})})}),[i]),b=g.useRef(null),x=g.useMemo(()=>t.map(R=>R.id),[t]),v=g.useCallback(()=>{const R=e.quiz,f=Math.max(80,Math.floor(a*.5));return R&&R.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(bs,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:f,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,a]),p=g.useMemo(()=>({Item:y,Header:()=>m.jsx("div",{style:{height:40}}),Footer:v,Scroller:ql}),[v,y]),h=g.useCallback(R=>x[R],[x]),d=Mt(),[k]=g.useState(()=>d.getState().progress.currentGlobalRunIndex??0),_=g.useMemo(()=>{if(!o.length)return 0;const R=o[o.length-1],f=Math.max(0,Math.min(k,R));return ys(o,f)},[o,k]);console.log("SectionRenderVirtuoso확인");const I=Mt();return g.useEffect(()=>{const R=u.current;R&&(console.log("@@@@@@@@@@@@@@@@"),(async()=>{const f=I.getState().progress.currentGlobalRunIndex,w=I.getState().progress.setSectionLoading;console.log("giFromStore",f);const T=f!=null&&f>=0?f:0;await ms(R,T),await ct(),await ct(),await ct(),await ct(),console.log("첫랜더끝"),w(!1)})())},[u,I]),m.jsxs(m.Fragment,{children:[m.jsx(rl,{ref:b,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:h,totalCount:t.length,itemContent:c,initialTopMostItemIndex:_,increaseViewportBy:{top:200,bottom:200},components:p,scrollerRef:S}),m.jsx(ca,{scrollContainerRef:u,virtRef:b,prefix:o})]})}const ca=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=$(C=>C.setCurrentGlobalRunIndex),o=$(C=>C.registerSectionScrollApi),s=$(C=>C.currentGlobalRunIndex),i=we(C=>C.scrollLock),a=we(C=>C.syncToGI),l=vn(),c=g.useRef(!1),u=g.useRef(null),S=g.useRef(null),y=g.useRef(null),b=g.useRef(-1),x=g.useCallback(()=>{if(i)return;u.current=null;const C=S.current;if(!C)return;const M=Kl(C,5);M!==-1&&M!==b.current&&(b.current=M,a(M),r(M,"scroll"))},[i,a,r]),v=g.useCallback(C=>{S.current=C,u.current==null&&(u.current=requestAnimationFrame(x))},[x]),p=g.useCallback(C=>{S.current=C,y.current!=null&&(window.clearTimeout(y.current),y.current=null),y.current=window.setTimeout(()=>{y.current=null,x();const M=b.current;if(M===-1)return;const A=C.scrollTop,H=C.scrollHeight-C.clientHeight,E=H>0?A/H:0;let P=0;const F=C.querySelector(`[data-g="${M}"]`);if(F){const V=C.getBoundingClientRect();P=(F.getBoundingClientRect().top-V.top)/V.height}l.getState().emit({type:"scroll",payload:{scrollTop:A,scrollRatio:E,anchorGI:M,anchorOffsetRatio:P}})},100)},[x,l]),h=g.useRef(!1),d=g.useCallback(C=>{i||c.current&&(h.current||(v(C),p(C)))},[i,v,p]),k=g.useRef(void 0),_=g.useRef(void 0),I=g.useRef(void 0),R=g.useRef(void 0);g.useEffect(()=>{const C=e.current;if(C)return k.current=()=>{c.current=!0},_.current=()=>{c.current=!0},I.current=()=>{c.current=!0},R.current=()=>d(C),C.addEventListener("wheel",k.current,{passive:!0}),C.addEventListener("touchmove",_.current,{passive:!0}),window.addEventListener("keydown",I.current,{passive:!0}),C.addEventListener("scroll",R.current,{passive:!0}),()=>{C.removeEventListener("wheel",k.current),C.removeEventListener("touchmove",_.current),window.removeEventListener("keydown",I.current),C.removeEventListener("scroll",R.current),u.current!=null&&cancelAnimationFrame(u.current),y.current!=null&&(clearTimeout(y.current),y.current=null)}},[d,e]),g.useEffect(()=>{const C=e.current;if(!C||!i)return;const M=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},A=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},H=P=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(P.key)&&(P.preventDefault(),P.stopPropagation(),c.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",M,{passive:!1}),C.addEventListener("touchmove",A,{passive:!1}),window.addEventListener("keydown",H,{passive:!1}),()=>{C.removeEventListener("wheel",M),C.removeEventListener("touchmove",A),window.removeEventListener("keydown",H),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const f=g.useRef({first:-1,last:-1}),w=g.useRef(!1),T=g.useCallback(()=>{const C=e.current;if(!C)return;const M=to(C),A=(M==null?void 0:M.first)??-1,H=(M==null?void 0:M.last)??-1;f.current={first:A,last:H}},[e]),j=g.useRef(!1),O=g.useCallback(()=>{const C=e.current;if(!C||j.current)return;j.current=!0;const M=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:M,behavior:"instant"})})},[e]);g.useEffect(()=>{!w.current&&i&&(j.current=!1,T()),w.current=i},[i,T]),g.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:M,last:A}=f.current;if(M===-1||A===-1){O();return}if(C.scrollTop<=1){(async()=>{try{h.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{h.current=!1}T()})();return}if(s<M||s>A){async function E(){if(!C)return;const P=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:P})}E().then(P=>{P?T():O()})}},[i,s,O,T,e]);const z=g.useCallback(()=>{const C=e.current;if(!C)return;function M(q,ne,B=.2,U=.8){const G=q.querySelector(`[data-g="${ne}"]`);if(!G)return!1;const Z=q.getBoundingClientRect(),D=G.getBoundingClientRect();if(D.height<=0||Z.height<=0)return!1;const Y=(D.top+D.height/2-Z.top)/Z.height;return Y>=B&&Y<=U}const A=q=>q==="instant"?"auto":q,H=q=>{const ne=C.scrollTop,B=C.scrollHeight-C.clientHeight,U=B>0?ne/B:0;let G=0;const Z=C.querySelector(`[data-g="${q}"]`);if(Z){const D=C.getBoundingClientRect();G=(Z.getBoundingClientRect().top-D.top)/D.height}l.getState().emit({type:"scroll",payload:{scrollTop:ne,scrollRatio:U,anchorGI:q,anchorOffsetRatio:G}})},E=async(q,ne="smooth")=>{var U;const B=ys(n,q);(U=t.current)==null||U.scrollToIndex({index:B,align:"start",behavior:A(ne)}),await ms(C,q)},P=()=>new Promise(q=>requestAnimationFrame(()=>q())),F=async q=>{if(M(C,q,.1,.7))return H(q),!0;h.current=!0;const ne=C.querySelector(`[data-g="${q}"]`),B=C.getBoundingClientRect();let U=C.scrollTop<=1?0:.1;if(ne){const Z=ne.getBoundingClientRect();U=((Z.top+Z.height/2-B.top)/B.height>.5,.15)}const G=!!ne;return G?(await Pn(C,q,{behavior:"smooth",topPaddingRatio:U}),await P()):G||await E(q,"auto"),h.current=!1,H(q),M(C,q,.1,.7)},V=async q=>F(q);return{ensureVisibleGI:F,scrollToGI:V,getVisibleRange:()=>to(C),getScrollTop:()=>C.scrollTop,setScrollTop:q=>{C.scrollTop=q},getAnchorOffsetRatio:q=>{const ne=C.querySelector(`[data-g="${q}"]`);if(!ne)return 0;const B=ne.getBoundingClientRect(),U=C.getBoundingClientRect();return(B.top-U.top)/U.height},scrollToGIAtOffset:async(q,ne)=>{await V(q),await new Promise(re=>setTimeout(re,50));const B=C.querySelector(`[data-g="${q}"]`);if(!B)return;const U=B.getBoundingClientRect(),G=C.getBoundingClientRect(),Z=U.top-G.top,D=ne*G.height,Y=Z-D;C.scrollTop=C.scrollTop+Y}}},[e,t,n,l]);return g.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(z()),()=>o(void 0)),[z,o]),null};function ua(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function da(){const e=$(x=>x.section),t=X(x=>x.theme),n=X(x=>x.fontFamily),r=X(x=>x.fontSizePx),o=X(x=>x.lineHeight),s=rn[t],{blocks:i,nsPrefix:a}=g.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=pn(),c=g.useCallback(()=>{const{isSettingsOpen:x,setSettingsOpen:v,toggleOverlays:p}=l.getState();x?v(!1):p()},[l]),{onClick:u,onDoubleClick:S}=$s({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:ua}),y=g.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitOverflowScrolling:"touch"}),[n,s.bg,s.fg,r,o]),b=g.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:u,onDoubleClick:S,style:y,children:m.jsx("div",{style:b,children:m.jsx(aa,{section:e,blocks:i,nsPrefix:a})})})}function fa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function pa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function ha(e){return Ye({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function ga(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function ma(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const xa="_wrap_1symx_4",ba="_visible_1symx_25",va="_compact_1symx_31",Sa="_row2_1symx_34",ya="_controls_1symx_44",wa="_row1_1symx_52",Ca="_groupExpand_1symx_80",Ia="_groupPlayback_1symx_81",ka="_groupSpeed_1symx_82",Ra="_groupFeatures_1symx_83",Ta="_groupNav_1symx_84",_a="_btn_1symx_116",Ma="_btnForbidden_1symx_141",Ea="_btnActive_1symx_147",ja="_label_1symx_158",Oa="_compactBtn_1symx_167",Ee={wrap:xa,visible:ba,compact:va,row2:Sa,controls:ya,row1:wa,groupExpand:Ca,groupPlayback:Ia,groupSpeed:ka,groupFeatures:Ra,groupNav:Ta,btn:_a,btnForbidden:Ma,btnActive:Ea,label:ja,compactBtn:Oa},Pa=g.memo(function(){const t=g.useRef(null),n=g.useContext(bt),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=we(w=>w.status),s=we(w=>w.currentTimeMs),i=we(w=>w.currentClip),a=we(w=>w.playbackKind),l=X(w=>w.muteAudio),c=X(w=>w.audioSpeed),u=we(w=>w.getClipSrc),S=we(w=>w._onTime),y=we(w=>w._onEnded),b=we(w=>w._onError),x=$(w=>w.setCurrentGlobalRunIndex),v=$(w=>w.getSectionScrollApi),p=$(w=>w.snapToReadable),h=$(w=>w.edgeReadable),d=g.useRef(null),k=g.useRef(null),_=g.useRef(!1),I=g.useRef(null);g.useEffect(()=>{a==="real"&&(_.current=!0)},[a]);const R=g.useMemo(()=>{const w=u(i);if(!w)return null;try{return new URL(w,window.location.href).href}catch{return w}},[i,u]);g.useEffect(()=>{_.current=!0},[R]),g.useEffect(()=>{const w=t.current;if(!w)return;const T=()=>{if(w.paused||w.ended)return;const z=w.currentTime*1e3;_.current&&z===0||(z>0&&(_.current=!1),S(z))},j=()=>{var C,M;y();const z=h(1);typeof z=="number"&&z>=0&&(x(z,"audio"),(M=(C=v())==null?void 0:C.ensureVisibleGI)==null||M.call(C,z))},O=z=>{const C=z.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),b()};return w.addEventListener("timeupdate",T),w.addEventListener("ended",j),w.addEventListener("error",O),()=>{w.removeEventListener("timeupdate",T),w.removeEventListener("ended",j),w.removeEventListener("error",O)}},[S,y,b,h,x,v]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w)return;if(!R){try{w.pause()}catch(z){console.log("pause error",z)}k.current=null;return}const T=w.currentSrc||w.src||null,j=!T||T!==R;if(j){try{w.pause()}catch(z){console.log("pause error",z)}w.src=R;try{w.load()}catch(z){console.log("load error",z)}k.current=R}w.muted=!!l,w.volume=1,w.playbackRate=typeof c=="number"?c:1;const O=async()=>{j&&await new Promise(z=>{let C=!1;const M=()=>{C||(C=!0,w.removeEventListener("loadedmetadata",M),w.removeEventListener("canplay",M),z())};w.addEventListener("loadedmetadata",M),w.addEventListener("canplay",M),w.readyState>=1&&M()});try{await w.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{w.pause()}catch(z){console.log("pause error",z)}},[R,l,o,c,r]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w||a!=="real")return;const T=s/1e3;if(Number.isFinite(T)){if(w.readyState<1){d.current=s;const j=()=>{if(d.current!=null){const O=d.current/1e3;try{w.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}d.current=null}w.removeEventListener("loadedmetadata",j),w.removeEventListener("canplay",j)};w.addEventListener("loadedmetadata",j),w.addEventListener("canplay",j);return}if(Math.abs(w.currentTime-T)>.2)try{w.currentTime=T}catch(j){console.log("currentTime보정오류",j)}}},[s,a,r]);const f=we(w=>w.getGIFromCT);return g.useEffect(()=>{var j,O;if(r||a!=="real"||o!=="playing"&&o!=="loading")return;const w=f(i,s);if(w<0)return;const T=p(w);T!==I.current&&(I.current=T,x(T,"audio"),T%5===0&&((O=(j=v())==null?void 0:j.ensureVisibleGI)==null||O.call(j,T)))},[o,i,s,a,f,p,x,v,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Ba(){return m.jsx(Pa,{})}const za="_scrubberWrap_uw0cd_2",Aa="_labels_uw0cd_9",La="_index_uw0cd_15",Ga="_controls_uw0cd_19",Ha="_percent_uw0cd_25",Na="_range_uw0cd_46",Ct={scrubberWrap:za,labels:Aa,index:La,controls:Ga,percent:Ha,range:Na};function Fa(){const e=X(I=>I.isDev),t=$(I=>I.currentGlobalRunIndex),n=$(I=>I.totalRuns),r=$(I=>I.setCurrentGlobalRunIndex),o=$(I=>I.getSectionScrollApi),s=$(I=>I.giToPercentTotal),i=$(I=>I.percentToGITotal),a=$(I=>I.snapToReadable),l=we(I=>I.scrollLock),c=we(I=>I.pause),u=we(I=>I.play),S=we(I=>I.syncToGI),[y,b]=g.useState(()=>s(t||0));g.useEffect(()=>{b(s(t||0))},[t,s]);const x=g.useRef(!1),v=g.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),p=g.useCallback(()=>{l&&(c(),x.current=!0)},[l,c]),h=g.useCallback(I=>{b(Number(I.currentTarget.value))},[]),d=g.useCallback(async()=>{const I=i(y),R=a(I);c(),r(R,"scrubber-commit"),S(R);const f=o();f!=null&&f.ensureVisibleGI&&await f.ensureVisibleGI(R),x.current&&(x.current=!1,u())},[y,i,a,c,r,S,o,u]),k=g.useMemo(()=>({"--pct":`${y}%`}),[y]),_=g.useMemo(()=>Math.round(y),[y]);return m.jsxs("div",{className:Ct.scrubberWrap,children:[e&&m.jsx("div",{className:Ct.labels,children:m.jsxs("span",{className:Ct.index,children:[v," / ",n||0]})}),m.jsxs("div",{className:Ct.controls,children:[m.jsx("input",{type:"range",className:Ct.range,min:0,max:100,step:.5,value:y,style:k,onMouseDown:p,onTouchStart:p,onChange:h,onMouseUp:()=>{d()},onTouchEnd:()=>{d()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void d():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:Ct.percent,children:[_,"%"]})]})]})}const Wa=g.memo(Fa),Da=g.memo(function(){const t=g.useContext(bt),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=we(w=>w.playbackKind),o=we(w=>w.status),s=we(w=>w.fake),i=X(w=>w.audioSpeed),a=we(w=>w.pause),l=$(w=>w.totalRuns),c=$(w=>w.currentGlobalRunIndex),u=$(w=>w.setCurrentGlobalRunIndex),S=$(w=>w.getSectionScrollApi),y=$(w=>w.nextReadableFrom),b=$(w=>w.edgeReadable),x=g.useRef(null),v=g.useRef(null),p=g.useRef(0),h=g.useRef(-1),d=!n&&r==="fake"&&o==="playing",k=Math.max(1,(s==null?void 0:s.totalWords)??1),_=g.useMemo(()=>{const w=200*i;return k/w*6e4},[k,i]),I=g.useMemo(()=>!l||l<=1||_<=0?0:(l-1)/_,[l,_]);g.useEffect(()=>{if(!d)return;const w=Math.max(0,Math.min(c??0,Math.max(0,(l??1)-1)));p.current=w,h.current=w,v.current=null},[d,c,l]);const R=g.useRef(-1);g.useEffect(()=>{if(!l){R.current=-1;return}const w=b(1);R.current=w??-1},[b,l]);const f=g.useCallback(w=>{(async()=>{var H,E;if(!d){x.current=null;return}if(!l||l<=1||I<=0){x.current=null;return}const T=v.current;v.current=w;const j=T==null?0:Math.max(0,w-T),O=l-1;p.current=Math.min(O,p.current+I*j);const z=Math.floor(p.current),C=S(),M=y(z,1);if(M==null){const P=R.current>=0?R.current:z;P!==h.current&&(h.current=P,u(P,"audio"),await((H=C==null?void 0:C.ensureVisibleGI)==null?void 0:H.call(C,P))),a(),x.current=null;return}const A=M;A!==h.current&&(h.current=A,u(A,"audio"),A%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,A))),x.current=requestAnimationFrame(f)})().catch(console.error)},[d,l,I,y,u,S,a]);return g.useEffect(()=>(d?x.current==null&&(x.current=requestAnimationFrame(f)):(x.current&&(cancelAnimationFrame(x.current),x.current=null),v.current=null),()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[d,f]),null}),Va=g.memo(function(){return m.jsx(Da,{})}),$a="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Ua="_WPMSpeedButtonsWrap_r3byt_1",Ka="_btnWrap_r3byt_7",Qa="_label_r3byt_14",Ya="_iconBtn_r3byt_22",Ot={WPMSpeedButtonsWrap:Ua,btnWrap:Ka,label:Qa,iconBtn:Ya},io=350,Xa=40,Za=.85,Ja=g.memo(function(){const t=X(y=>y.audioSpeed),n=X(y=>y.incAudioSpeed),r=X(y=>y.decAudioSpeed),o=g.useRef(null),s=g.useRef(io),i=g.useRef(null),a=g.useCallback(y=>{const b=t;if(y==="inc"){if(b>=2)return!1;n()}else{if(b<=.3)return!1;r()}return!0},[t,n,r]),l=g.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=g.useCallback(()=>{i.current&&(s.current=Math.max(Xa,Math.floor(s.current*Za)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),u=g.useCallback(y=>{if(i.current)return;i.current=y,s.current=io,a(y)&&c();const x=()=>l();window.addEventListener("mouseup",x,{once:!0}),window.addEventListener("touchend",x,{once:!0})},[c,a,l]);g.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return m.jsx("div",{onMouseLeave:l,className:Ot.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Ot.btnWrap,children:[m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>u("dec"),onTouchStart:y=>{y.preventDefault(),u("dec")},onMouseUp:l,children:m.jsx("img",{src:$a,alt:"느리게"})}),m.jsx("div",{className:Ot.label,style:{minWidth:"44px",textAlign:"center"},children:m.jsx("div",{children:S})}),m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>u("inc"),onTouchStart:y=>{y.preventDefault(),u("inc")},onMouseUp:l,children:m.jsx("img",{src:qa,alt:"빠르게"})})]})})}),ec="_StepBtn_15t0r_1",tc={StepBtn:ec};function nc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function rc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function lo({direction:e}){const t=$(S=>S.currentGlobalRunIndex),n=$(S=>S.totalRuns),r=$(S=>S.hasReadableInDir),o=$(S=>S.computeStepTarget),s=$(S=>S.setCurrentGlobalRunIndex),i=we(S=>S.syncToGI),a=$(S=>S.getSectionScrollApi),l=g.useCallback(async S=>{var x,v;const y=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),b=o(y,S);s(b,"scrubber-step"),i(b),await((v=(x=a())==null?void 0:x.ensureVisibleGI)==null?void 0:v.call(x,b))},[t,n,o,s,i,a]),c=g.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),y=!n||!r(S,1),b=!n||!r(S,-1);return e==="left"?b:y},[e,n,t,r]),u=g.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return m.jsx("button",{className:tc.StepBtn,type:"button",onClick:u,disabled:c,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(nc,{}):m.jsx(rc,{})})}const oc="_GCPlayBtn_n54mc_1",sc="_playing_n54mc_34",ao={GCPlayBtn:oc,playing:sc},ic=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${ao.GCPlayBtn} ${r?ao.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function lc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}function ac(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(e)}function cc(){const e=X(I=>I.showOverlays),t=$(I=>I.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=X(I=>I.muteAudio),s=X(I=>I.showPointer),i=X(I=>I.showSplit),a=X(I=>I.toggleMuteAudio),l=X(I=>I.toggleShowPointer),c=X(I=>I.toggleShowSplit),u=X(I=>I.overlayCompactMode),S=X(I=>I.toggleOverlayCompactMode),y=ln(),b=Mt();g.useEffect(()=>{const I=y.getState(),{syncToGI:R,useFake:f,useReal:w}=I,T=I.playbackKind,j=b.getState().progress.currentGlobalRunIndex??0;if(!r){T!=="fake"&&f();return}o?T!=="fake"&&(console.log("이부분일까?"),f()):T!=="real"&&(R(j),w())},[r,o,b,y]);const x=we(I=>I.play),v=we(I=>I.pause),p=we(I=>I.status),h=g.useCallback(I=>{I.stopPropagation(),p==="playing"||p==="loading"?v():x()},[p,x,v]),d=ln(),k=Mt(),_=g.useCallback(async I=>{var P,F;if(I.stopPropagation(),p==="playing"||p==="loading"){v();return}const{progress:R}=k.getState(),{currentGlobalRunIndex:f,snapToReadable:w,edgeReadable:T,setCurrentGlobalRunIndex:j,getSectionScrollApi:O}=R,z=d.getState(),C=z.currentClip,M=O==null?void 0:O(),A=typeof f=="number"?f:0,H=typeof w=="function"?w(A):A,E=typeof T=="function"?T(1):null;if(E!=null&&H>=E){j==null||j(E,"audio"),await((P=M==null?void 0:M.ensureVisibleGI)==null?void 0:P.call(M,E)),z.syncToGI(E);return}j==null||j(H,"audio"),await((F=M==null?void 0:M.ensureVisibleGI)==null?void 0:F.call(M,H)),z.syncToGI(H),x(C)},[p,v,x,d,k]);return m.jsxs("div",{className:`${Ee.wrap} ${e?Ee.visible:""} ${u?Ee.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!u&&m.jsx(Wa,{}),m.jsx("div",{style:u?{display:"none"}:void 0,children:r&&!o?m.jsx(Ba,{}):m.jsx(Va,{})}),m.jsxs("div",{className:Ee.controls,children:[m.jsxs("div",{className:Ee.row1,children:[m.jsx("div",{className:Ee.groupExpand,children:m.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:Ee.compactBtn,title:u?"오버레이 확대":"오버레이 축소",children:u?m.jsx(ac,{size:24}):m.jsx(lc,{size:24})})}),m.jsxs("div",{className:Ee.groupPlayback,children:[m.jsx(lo,{direction:"left"}),m.jsx(ic,{size:34,isPlaying:p==="playing",onClick:o?_:h,title:p==="playing"?"일시정지":"재생"}),m.jsx(lo,{direction:"right"})]}),m.jsx("div",{className:Ee.groupSpeed,children:m.jsx(Ja,{})})]}),m.jsxs("div",{className:Ee.row2,children:[m.jsxs("div",{className:Ee.groupFeatures,children:[r&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},className:`${Ee.btn} ${o?"":Ee.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(fa,{size:18}):m.jsx(pa,{size:18}),m.jsx("span",{className:Ee.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${Ee.btn} ${s?Ee.btnActive:""}`,title:"포인터 표시",children:[m.jsx(ha,{size:18}),m.jsx("span",{className:Ee.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},disabled:!n,className:`${Ee.btn} ${i?Ee.btnActive:""} ${n?"":Ee.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ga,{size:18}),m.jsx("span",{className:Ee.label,children:"끊어읽기"})]})]}),m.jsxs("div",{className:Ee.groupNav,children:[m.jsx(la,{}),m.jsx(dn,{})]})]})]})]})}const uc=g.memo(cc);function dc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const fc="_host_v5qx1_3",pc="_topbar_v5qx1_11",hc="_visible_v5qx1_32",gc="_backBtn_v5qx1_37",mc="_title_v5qx1_58",xc="_settingsBtn_v5qx1_67",It={host:fc,topbar:pc,visible:hc,backBtn:gc,title:mc,settingsBtn:xc};function bc(){const e=X(c=>c.showOverlays),t=X(c=>c.overlayCompactMode),n=$(c=>c.onViewerClose),o=$(c=>c.section).ast.title,s=X(c=>c.setSettingsOpen),i=X(c=>c.setShowOverlays),a=g.useCallback(()=>{n==null||n()},[n]),l=g.useCallback(()=>{s(!0),i(!1)},[s,i]);return m.jsx("div",{className:It.host,children:m.jsxs("div",{className:`${It.topbar} ${e&&!t?It.visible:""}`,children:[m.jsx("button",{type:"button",className:It.backBtn,onClick:a,"aria-label":"뒤로가기",children:m.jsx(ma,{size:28})}),m.jsx("div",{className:It.title,children:m.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),m.jsx("button",{type:"button",className:It.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:m.jsx(dc,{size:28})})]})})}const vc=g.memo(bc),Sc="_wrap_62su0_7",yc="_wrapHidden_62su0_29",wc="_wrapVisible_62su0_35",Cc="_scrollArea_62su0_71",Ic="_row_62su0_81",kc="_label_62su0_89",Rc="_btn_62su0_95",Tc="_btnActive_62su0_106",_c="_btnSmall_62su0_110",Mc="_pill_62su0_122",Ec="_themeCircle_62su0_133",jc="_themeCircleActive_62su0_146",Oc="_stepRow_62su0_151",Pc="_stepLabel_62su0_159",Bc="_levelBox_62su0_172",zc="_inlineFlex_62su0_177",Me={wrap:Sc,wrapHidden:yc,wrapVisible:wc,scrollArea:Cc,row:Ic,label:kc,btn:Rc,btnActive:Tc,btnSmall:_c,pill:Mc,themeCircle:Ec,themeCircleActive:jc,stepRow:Oc,stepLabel:Pc,levelBox:Bc,inlineFlex:zc};function Ac({visible:e}){const t=X(f=>f.mode),n=X(f=>f.setMode),r=X(f=>f.theme),o=X(f=>f.setTheme),s=X(f=>f.fontFamily),i=X(f=>f.setFontFamily),a=X(f=>f.resetToDefaults),l=X(f=>f.getFontLevel()),c=X(f=>f.getLineLevel()),u=X(f=>f.getMarginLevel()),S=X(f=>f.setFontLevel),y=X(f=>f.setLineLevel),b=X(f=>f.setMarginLevel),x=X(f=>f.pointerStyle),v=X(f=>f.setPointerStyle),p=X(f=>f.pointerColor),h=X(f=>f.setPointerColor),d=X(f=>f.breakMarks),k=X(f=>f.toggleBreakMark),_=X(f=>f.getBreakGapLevel()),I=X(f=>f.setBreakGapLevel),R=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return m.jsxs("div",{className:R,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Me.scrollArea,children:[m.jsx(Pt,{label:"열람방식",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(kt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(Pt,{label:"테마",children:m.jsx("div",{className:Me.inlineFlex,children:Object.keys(rn).map(f=>{const w=f,T=rn[w];return m.jsx("button",{type:"button",onClick:()=>o(w),className:`${Me.themeCircle} ${r===f?Me.themeCircleActive:""}`,style:{background:T.bg,color:T.fg,fontFamily:s},title:String(f),"aria-label":`테마: ${String(f)}`,children:"A"},`${f}_tc_button`)})})}),m.jsx(Pt,{label:"글꼴",children:m.jsx("div",{className:Me.inlineFlex,children:zo.map(f=>m.jsx(kt,{active:s===f.value,onClick:()=>i(f.value),title:f.value,children:f.label},f.label))})}),m.jsx(en,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),m.jsx(en,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>y(Math.max(1,c-1)),onInc:()=>y(Math.min(7,c+1))}),m.jsx(en,{label:"여백",level:u,min:1,max:5,onDec:()=>b(Math.max(1,u-1)),onInc:()=>b(Math.min(5,u+1))}),m.jsx(Pt,{label:"포인터",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:x==="highlight",onClick:()=>v("highlight"),children:"형광펜"}),m.jsx(kt,{active:x==="underline",onClick:()=>v("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:p,onChange:f=>h(f.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(Pt,{label:"끊기표시",children:m.jsx("div",{className:Me.inlineFlex,children:m.jsx(kt,{active:d.slash,onClick:()=>k("slash"),children:"슬래쉬"})})}),m.jsx(en,{label:"끊기간격",level:_,min:1,max:5,onDec:()=>I(Math.max(1,_-1)),onInc:()=>I(Math.min(5,_+1))})]}),m.jsx("div",{className:Me.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:Me.pill,children:"보기 설정 초기화"})})]})}function Pt({label:e,children:t}){return m.jsxs("div",{className:Me.row,children:[m.jsx("label",{className:Me.label,children:e}),t]})}function kt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${Me.btn} ${e?Me.btnActive:""}`,children:r})}function en({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,a=t>=r;return m.jsxs("div",{className:Me.stepRow,children:[m.jsx("label",{className:Me.stepLabel,children:e}),m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:Me.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:Me.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:a,className:Me.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Lc=g.memo(function(){const t=X(i=>i.showOverlays),n=X(i=>i.isSettingsOpen),r=$(i=>i.rangeStartGI),o=$(i=>i.rangeEndGI);return r!=null&&o!=null?null:m.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[m.jsx(vc,{}),m.jsx(uc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Ac,{visible:!t&&n})})]})}),Gc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());c=y=>{const b=i(y);if(!u(S,b)){const x=S;a(S=b,x)}},l!=null&&l.fireImmediately&&a(S,S)}return o(c)}),e(t,n,r)},Hc=Gc;function Nc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Fc(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function Wc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Fc((r==null?void 0:r.text)??"");return t}function Dc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=b=>{if(!n)return null;const{g2ct:x}=n;if(!x)return null;const v=x[b];if(v)return{clip:v.clip,t:v.t};for(let p=1;p<=100&&b-p>=0;p++){const h=x[b-p];if(h)return{clip:h.clip,t:h.t}}for(let p=1;p<=100;p++){const h=x[b+p];if(h)return{clip:h.clip,t:h.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Wc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const b=o(e.initialIndex);b&&(i=b.clip,a=b.t,r=void 0)}const c=s.length>0,u=c?"paused":"idle",S=c?"real":"fake",y=c?null:{totalWords:l};return Vt(Hc((b,x)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:u,scrollLock:!1,playbackKind:S,fake:y,useFake:()=>b(v=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:v.status==="playing"})),useReal:()=>b(v=>({playbackKind:"real",fake:{totalWords:l},scrollLock:v.status==="playing"})),injectMap:v=>{if(n=v,typeof r=="number"){const p=o(r);p&&b(h=>({currentClip:Math.max(0,Math.min(p.clip,Math.max(0,h.clips.length-1))),currentTimeMs:Math.max(0,p.t)})),r=void 0}},setClipAndMs:(v,p)=>b(h=>{const d=Math.max(0,h.clips.length-1);return{currentClip:Math.max(0,Math.min(v,d)),currentTimeMs:Math.max(0,p),status:h.status,scrollLock:h.scrollLock}}),setClips:v=>b(p=>{const h=Array.isArray(v)?v:[],d=h.length>0;return{clips:h,currentClip:0,currentTimeMs:0,status:d?"paused":"idle",playbackKind:d?"real":"fake",fake:d?null:p.fake??{totalWords:l},scrollLock:!1}}),clear:()=>b(v=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:v.fake??{totalWords:l},scrollLock:!1})),play:(v,p)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),b(h=>{if(h.playbackKind==="fake")return{status:"playing",scrollLock:!0};const d=typeof v=="number"?v:h.currentClip,k=typeof p=="number"?p:h.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(d,Math.max(0,h.clips.length-1))),currentTimeMs:k,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),b({status:"paused",scrollLock:!1})},seek:v=>b(p=>({currentTimeMs:Math.max(0,v),status:p.status})),stop:()=>b({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>b(v=>{if(v.playbackKind==="fake")return v;const p=Math.max(0,v.clips.length-1);return{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>b(v=>v.playbackKind==="fake"?v:{currentClip:Math.max(0,v.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:v=>b(p=>p.playbackKind==="fake"||v<0||v>=p.clips.length?p:{currentClip:v,currentTimeMs:0}),getClipSrc:v=>{const p=x();if(!p.clips.length)return null;const h=typeof v=="number"?v:p.currentClip;return Nc(p.clips[h])},getGIFromCT:(v,p)=>{if(!n)return-1;const h=n.byClip[v];if(!h||h.length===0)return-1;let d=0,k=h.length-1,_=0;for(;d<=k;){const I=d+k>>1;h[I].t<=p?(_=I,d=I+1):k=I-1}return h[Math.max(0,Math.min(_,h.length-1))].g},getCTFromGI:v=>{if(!n)return null;const{g2ct:p}=n;if(!p)return null;let h=p[v];if(!h){let d=v-1;const k=Math.max(0,v-100);for(;d>=k;){if(p[d]){h=p[d];break}d--}if(!h){let _=v+1;const I=v+100;for(;p[_]==null&&_<=I;)_++;p[_]&&(h=p[_])}}return h?{clip:h.clip,timeMs:h.t}:null},getMetaByGI:v=>{const p=x().getCTFromGI(v);return p?{clipIndex:p.clip,timeMs:p.timeMs}:null},syncToGI:v=>{const p=x().getMetaByGI(v);p&&x().setClipAndMs(p.clipIndex,p.timeMs)},_onTime:v=>b({currentTimeMs:v,status:"playing",scrollLock:!0}),_onEnded:()=>b(v=>{if(v.playbackKind==="fake")return{status:"ended",scrollLock:!1};const p=Math.max(0,v.clips.length-1);return v.currentClip>=p?{status:"ended",scrollLock:!1}:{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>b({status:"error",scrollLock:!1}),_setStatusOnly:v=>b({status:v})})))}function Vc({children:e,initialState:t}){const n=g.useContext(bt)??void 0,r=g.useMemo(()=>Dc({...t,recorderStore:n}),[t,n]);return m.jsx(bn.Provider,{value:r,children:e})}function $c(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const a of r){if((a==null?void 0:a.type)==="image")continue;const l=(a==null?void 0:a.runs)??[];for(let c=0;c<l.length;c++){const u=l[c],S=o+c;u.audioChunkIndex!=null&&u.audioTimeMs!=null&&((t[i=u.audioChunkIndex]||(t[i]=[])).push({t:u.audioTimeMs,g:S}),n[S]={clip:u.audioChunkIndex,t:u.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function qc(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function Uc(e){const t=Fl(e),n=Wl(t),r=t.reduce((u,S)=>u+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],a=[];return e.forEach((u,S)=>{var p;if(u.type!=="paragraph")return;const y=n[S]??0,b=u.runs??[];for(let h=0;h<b.length;h++){const d=((p=b[h])==null?void 0:p.text)||"";or(d)&&(s[y+h]=1)}const v=Dl(b,y).map(h=>{var I;const d=h.startG-y,k=h.endG-h.startG+1;let _=-1;for(let R=0;R<k;R++){const f=((I=b[d+R])==null?void 0:I.text)??"";if(or(f)){_=h.startG+R;break}}return{startG:h.startG,endG:h.endG,r0:d,len:k,firstReadableGI:_,splitIndex:h.splitIndex}});a[S]=v;for(const h of v){const d=i.length;for(let k=h.startG;k<=h.endG;k++)o[k]=d;i.push(h)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function Kc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:c}=e,u=a.totalRuns??0,S=typeof l=="number"?l:u>0?0:-1,y=S>=0?qc(i.readableGi,S,u):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:y,lastUpdateBy:"program",totalRuns:u,pageIndex:0,sectionLoading:!0,_loadingStartTime:c,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function Qc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:c,layout:u}=Uc(l),S=Date.now(),y=Kc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:c,layout:u,initialIndex:n,mountTime:S});return a&&(a.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),a.getState().emit({type:"loading_start",payload:{}},S)),Vt((b,x)=>{const v=E=>{b(P=>P.progress._scrollApi===E?P:{progress:{...P.progress,_scrollApi:E}})},p=()=>x().progress._scrollApi,h=E=>{b(P=>{const F=P.progress;if(F.totalRuns===E)return P;const V=F.currentGlobalRunIndex<0&&E>0;return{progress:{...F,totalRuns:E,currentGlobalRunIndex:V?0:F.currentGlobalRunIndex,lastUpdateBy:V?"program":F.lastUpdateBy}}})},d=(E,P="program")=>{const F=x().progress.currentGlobalRunIndex,V=x().progress,Q=V.totalRuns>0?Math.max(-1,Math.min(E,V.totalRuns-1)):E;F===Q&&V.lastUpdateBy===P||(b(te=>({progress:{...te.progress,currentGlobalRunIndex:Q,lastUpdateBy:P}})),F!==Q&&a&&a.getState().emit({type:"global_index_change",payload:{globalIndex:Q}}))},k=E=>{const{sectionLoading:P,_loadingStartTime:F}=x().progress;if(P===E)return;const V=Date.now();if(E)b(Q=>({progress:{...Q.progress,sectionLoading:!0,_loadingStartTime:V}})),a&&a.getState().emit({type:"loading_start",payload:{}});else{const te=(F?V-F:0)/1e3;b(pe=>({progress:{...pe.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:te}})}},_=E=>{b(P=>({progress:{...P.progress,pageIndex:E}}))},I=(E,P)=>{b(F=>({progress:{...F.progress,rangeStartGI:Math.min(E,P),rangeEndGI:Math.max(E,P)}}))},R=()=>{b(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}}))},f=E=>{const{rangeStartGI:P,rangeEndGI:F}=x().progress;P==null||F==null||(E<P?b(V=>({progress:{...V.progress,rangeStartGI:E}})):E>F?b(V=>({progress:{...V.progress,rangeEndGI:E}})):R())},w=()=>{var ye;const{rangeStartGI:E,rangeEndGI:P,section:F,layout:V}=x().progress;if(E==null||P==null||!V)return"";const Q=((ye=F.ast)==null?void 0:ye.blocks)??[],te=V.prefix,pe=[];for(let me=0;me<Q.length;me++){const q=Q[me];if(q.type!=="paragraph")continue;const ne=q.runs??[],B=te[me]??0;for(let U=0;U<ne.length;U++){const G=B+U;G>=E&&G<=P&&pe.push(ne[U].text??"")}}return pe.join("")},T=E=>{const{totalRuns:P,derivedNav:F}=x().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return E;const Q=P,te=Math.max(0,Math.min(E,Q-1));if(V[te])return te;let pe=te-1,ye=te+1;for(;pe>=0||ye<Q;){if(ye<Q&&V[ye])return ye;if(pe>=0&&V[pe])return pe;ye+=1,pe-=1}return te},j=(E,P)=>{const{totalRuns:F,derivedNav:V}=x().progress,Q=V==null?void 0:V.readableGi;if(!Q||F<=0)return null;if(P>0){for(let te=Math.min(Math.max(E,0),F-1);te<F;te+=1)if(Q[te])return te}else for(let te=Math.min(Math.max(E,0),F-1);te>=0;te-=1)if(Q[te])return te;return null},O=E=>{const{totalRuns:P,derivedNav:F}=x().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return null;if(E>0){for(let Q=P-1;Q>=0;Q-=1)if(V[Q])return Q}else for(let Q=0;Q<P;Q+=1)if(V[Q])return Q;return null};return{progress:{...y,registerSectionScrollApi:v,getSectionScrollApi:p,setTotalRuns:h,setCurrentGlobalRunIndex:d,setSectionLoading:k,setPageIndex:_,setRange:I,clearRange:R,extendRange:f,getRangeText:w,snapToReadable:T,nextReadableFrom:j,edgeReadable:O,hasReadableInDir:(E,P)=>j(E+(P>0?1:-1),P)!=null,computeStepTarget:(E,P)=>{const{totalRuns:F,derivedNav:V}=x().progress;if(!F||F<=0)return E;const Q=(V==null?void 0:V.groups)??[],te=V==null?void 0:V.giToGroupIdx;if(!Q.length||!te){const B=F-1;return T(Math.max(0,Math.min(E+P,B)))}let pe=te[E]??-1;if(pe<0||pe>=Q.length)for(let ne=0;ne<Q.length;ne+=1){const B=Q[ne];if(E>=B.startG&&E<=B.endG){pe=ne;break}}if(pe<0||pe>=Q.length)return O(P)??T(E);const ye=ne=>ne>=0&&ne<Q.length&&(Q[ne].firstReadableGI??-1)>=0;let me=pe+P;for(;me>=0&&me<Q.length&&!ye(me);)me+=P;if(me<0||me>=Q.length)return O(P)??T(E+P);const q=Q[me].firstReadableGI;return q>=0?q:T(E+P)},giToPercentTotal:E=>{const P=x().progress.totalRuns;return!P||P<=1?0:Math.max(0,Math.min(E,P-1))/(P-1)*100},percentToGITotal:E=>{const P=x().progress.totalRuns;if(!P||P<=1)return 0;const F=Math.max(0,Math.min(E,100)),V=Math.round(F/100*(P-1));return Math.max(0,Math.min(V,P-1))}}}})}function Yc({children:e,initialState:t}){const n=g.useContext(bt),r=g.useMemo(()=>Qc({...t,recorderStore:n}),[t,n]);return m.jsx(br.Provider,{value:r,children:e})}function Xc({children:e,initialState:t}){const n=g.useContext(bt)??void 0,r=g.useRef(Us({init:t,recorderStore:n}));return m.jsx(sr.Provider,{value:r.current,children:e})}const Zc=({pages:e,pageIndex:t,maxWidth:n})=>{const r=$(d=>d.section),o=g.useMemo(()=>{var d;return((d=r.ast)==null?void 0:d.blocks)??[]},[r]),s=X(d=>d.marginX),i=X(d=>d.lineHeight),a=X(d=>d.fontSizePx),l=X(d=>d.fontFamily),c=X(d=>d.viewportHeight),u=$(d=>{var k;return((k=d.layout)==null?void 0:k.prefix)??[]}),S=$(d=>{var k;return((k=d.derivedNav)==null?void 0:k.splitGroupsPerBlock)??[]}),y=e[t],b=g.useMemo(()=>{const d=[];return o.forEach((k,_)=>{(k.type==="paragraph"||k.type==="image")&&d.push(_)}),d},[o]),x=g.useMemo(()=>{if(!y)return[];const d=[];for(let k=y.startBlock;k<=y.endBlock;k++){const _=b[k];_!=null&&d.push(_)}return d},[y,b]),v=g.useMemo(()=>{const d=[];for(const k of x){const _=o[k];(_==null?void 0:_.type)==="paragraph"&&d.push({b:_,originalBlockIndex:k})}return d},[x,o]),p=g.useMemo(()=>{const d=[],k=vr();return v.forEach((_,I)=>{d[I]=Sr(_.b,k)}),d},[v]),h=(d,k,_)=>{if(!d||d.length===0)return[];const I=[];for(const R of d){const f=R.startG,w=R.endG;if(w<k||f>_)continue;const T=Math.max(f,k),j=Math.min(w,_),O=T-f|0,z=Math.max(0,j-T+1);if(z<=0)continue;const C=(R.r0??0)+O;I.push({...R,startG:T,endG:j,r0:C,len:z})}return I};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:a,lineHeight:i,boxSizing:"border-box"},children:m.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[m.jsx("div",{style:{height:40}}),m.jsx("div",{style:{flex:1,overflow:"hidden"},children:x.map((d,k)=>{var ne;const _=o[d],I=k===0,R=k===x.length-1,f={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},w=`sec-${r.section_id}/blk-${_.id??d}`;if(_.type==="image"){const{src:B,alt:U,width:G,height:Z}=_,D=G&&Z?`${G} / ${Z}`:"4 / 3",Y=c>80?Math.floor((c-80)*.6):void 0;return m.jsx("div",{style:f,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:Y,aspectRatio:D},children:m.jsx("img",{src:B,alt:U||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),U&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:U})]})},w)}const T=_,j=v.findIndex(B=>B.originalBlockIndex===d),O=j>=0?p[j]:void 0,z=T.runs??[],C=z.length;let M=0,A=Math.max(0,C-1);I&&y.startOffsetInBlock!=null&&(M=Math.min(Math.max(0,y.startOffsetInBlock),A)),R&&y.endOffsetInBlock!=null&&(A=Math.max(M,Math.min(y.endOffsetInBlock,A)));const H=M>0,E=u[d]??0,P=S[d]??[],F=E+M,V=E+A;let Q=h(P,F,V);const te=E+M;Q=Q.map(B=>{const U=Math.max(0,(B.startG??F)-te),G=B.len??Math.max(1,(B.endG??V)-(B.startG??F)+1);return{...B,r0:U,len:G}});const pe=M<=A?z.slice(M,A+1):[],ye=T.list?T.list.level*24:0,me=((ne=T.list)==null?void 0:ne.kind)==="bullet"?T.list.glyph??"•":void 0,q=H?void 0:O??me;return m.jsx("div",{style:f,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:T.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[T.list&&q?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:q||""}):null,m.jsx(gs,{preGroups:Q,runs:pe,ns:w,baseIndex:te,sectionId:String(r.section_id)})]})},w)})})]})})},co=.5;function Jc(e,t){const n=g.useRef(null),r=g.useRef(null),o=g.useRef(!1);g.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const c=l[0],{width:u,height:S}=c.contentRect,y=r.current;if(!y){r.current={w:u,h:S};return}Math.abs(y.w-u)<co&&Math.abs(y.h-S)<co||(r.current={w:u,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const a=()=>s();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function eu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:a=120,verticalTolerance:l=40,velocityThreshold:c=.6,singleDelayMs:u=250,doubleClickWindowMs:S=300,suppressAfterSwipeMs:y=250,onDragMove:b,onDragEnd:x,pageTransitionThreshold:v}=e,p=v??a,h=Math.min(20,a),d=rt.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),k=()=>{d.current.singleTimer!=null&&(window.clearTimeout(d.current.singleTimer),d.current.singleTimer=null)},_=()=>{var M;const C=((M=document==null?void 0:document.body)==null?void 0:M.style)??null;C&&d.current.prevUserSelect!=null&&(C.userSelect=d.current.prevUserSelect,d.current.prevUserSelect=null),d.current.capturedEl&&d.current.pid!=null&&typeof d.current.capturedEl.hasPointerCapture=="function"&&d.current.capturedEl.hasPointerCapture(d.current.pid)&&d.current.capturedEl.releasePointerCapture(d.current.pid),d.current.capturedEl=null},I=rt.useCallback(C=>{const M=i??s;M!=null&&M(C.target)||(d.current.pid=C.pointerId,d.current.startX=C.clientX,d.current.startY=C.clientY,d.current.startT=C.timeStamp,d.current.swiping=!1,d.current.canceledClick=!1,d.current.capturedEl=C.currentTarget)},[i,s]),R=rt.useCallback(C=>{var P;if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.clientX-d.current.startX,A=C.clientY-d.current.startY,H=Math.abs(M),E=Math.abs(A);if(!d.current.swiping){if(H>=h&&E<=l&&H>E){d.current.swiping=!0,d.current.canceledClick=!0;const F=d.current.capturedEl;if(F&&typeof F.setPointerCapture=="function")try{F.setPointerCapture(C.pointerId)}catch{}const V=((P=document==null?void 0:document.body)==null?void 0:P.style)??null;V&&(d.current.prevUserSelect=V.userSelect??null,V.userSelect="none"),C.preventDefault()}return}b==null||b(M),C.preventDefault()},[l,b,h]),f=rt.useCallback(C=>{if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.timeStamp-d.current.startT,A=C.clientX-d.current.startX;if(d.current.swiping){const H=Math.abs(A)/Math.max(1,M);Math.abs(A)>=p||H>=c?A<0?n():t():x==null||x(),d.current.lastSwipeAt=C.timeStamp}else C.timeStamp-d.current.lastUpT;_(),d.current.lastUpT=C.timeStamp,d.current.pid=null,d.current.swiping=!1},[p,c,n,t,S,x]),w=rt.useCallback(()=>{d.current.swiping&&(x==null||x()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[x]),T=rt.useCallback(C=>{var M,A;(A=(M=d.current.capturedEl)==null?void 0:M.hasPointerCapture)!=null&&A.call(M,C.pointerId)||d.current.pid!=null&&d.current.swiping&&(x==null||x(),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1)},[x]),j=rt.useCallback(()=>{d.current.pid!=null&&d.current.swiping&&(x==null||x()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[x]),O=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}r&&d.current.singleTimer==null&&(d.current.singleTimer=window.setTimeout(()=>{d.current.singleTimer=null,r(C)},u))}},[r,s,u,y]),z=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}k(),o==null||o(C)}},[o,s,y]);return rt.useEffect(()=>()=>{k(),_()},[]),{onPointerDown:I,onPointerMove:R,onPointerUp:f,onPointerCancel:w,onPointerLeave:T,onLostPointerCapture:j,onClick:O,onDoubleClick:z}}var Bn,uo;function ws(){if(uo)return Bn;uo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,fo;function tu(){if(fo)return zn;fo=1;var e=typeof Qt=="object"&&Qt&&Qt.Object===Object&&Qt;return zn=e,zn}var An,po;function Cs(){if(po)return An;po=1;var e=tu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,ho;function nu(){if(ho)return Ln;ho=1;var e=Cs(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,go;function ru(){if(go)return Gn;go=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gn=t,Gn}var Hn,mo;function ou(){if(mo)return Hn;mo=1;var e=ru(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,xo;function Is(){if(xo)return Nn;xo=1;var e=Cs(),t=e.Symbol;return Nn=t,Nn}var Fn,bo;function su(){if(bo)return Fn;bo=1;var e=Is(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var a=n.call(i,o),l=i[o];try{i[o]=void 0;var c=!0}catch{}var u=r.call(i);return c&&(a?i[o]=l:delete i[o]),u}return Fn=s,Fn}var Wn,vo;function iu(){if(vo)return Wn;vo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Wn=n,Wn}var Dn,So;function lu(){if(So)return Dn;So=1;var e=Is(),t=su(),n=iu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(a){return a==null?a===void 0?o:r:s&&s in Object(a)?t(a):n(a)}return Dn=i,Dn}var Vn,yo;function au(){if(yo)return Vn;yo=1;function e(t){return t!=null&&typeof t=="object"}return Vn=e,Vn}var $n,wo;function cu(){if(wo)return $n;wo=1;var e=lu(),t=au(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return $n=r,$n}var qn,Co;function uu(){if(Co)return qn;Co=1;var e=ou(),t=ws(),n=cu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=e(c);var S=s.test(c);return S||i.test(c)?a(c.slice(2),S?2:8):o.test(c)?r:+c}return qn=l,qn}var Un,Io;function du(){if(Io)return Un;Io=1;var e=ws(),t=nu(),n=uu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var u,S,y,b,x,v,p=0,h=!1,d=!1,k=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(h=!!c.leading,d="maxWait"in c,y=d?o(n(c.maxWait)||0,l):y,k="trailing"in c?!!c.trailing:k);function _(C){var M=u,A=S;return u=S=void 0,p=C,b=a.apply(A,M),b}function I(C){return p=C,x=setTimeout(w,l),h?_(C):b}function R(C){var M=C-v,A=C-p,H=l-M;return d?s(H,y-A):H}function f(C){var M=C-v,A=C-p;return v===void 0||M>=l||M<0||d&&A>=y}function w(){var C=t();if(f(C))return T(C);x=setTimeout(w,R(C))}function T(C){return x=void 0,k&&u?_(C):(u=S=void 0,b)}function j(){x!==void 0&&clearTimeout(x),p=0,u=v=S=x=void 0}function O(){return x===void 0?b:T(t())}function z(){var C=t(),M=f(C);if(u=arguments,S=this,v=C,M){if(x===void 0)return I(v);if(d)return clearTimeout(x),x=setTimeout(w,l),_(v)}return x===void 0&&(x=setTimeout(w,l)),b}return z.cancel=j,z.flush=O,z}return Un=i,Un}var fu=du();const pu=Oo(fu);function hu(e,t=200,n,r){const o=g.useRef(e),s=g.useRef(n);g.useEffect(()=>{o.current=e},[e]),g.useEffect(()=>{s.current=n},[n]);const i=g.useMemo(()=>{const a=pu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var u;(u=s.current)==null||u.call(s),a(...c)});return l.cancel=a.cancel.bind(a),l.flush=a.flush.bind(a),l},[t,r]);return g.useEffect(()=>()=>i.cancel(),[i]),i}let ks=0;class Rs extends Error{constructor(){super("calcPages canceled due to a newer invocation");wr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const et=e=>{if(e!==ks)throw new Rs},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},ko=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const a=s.getClientRects(),l=a.length?a[a.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},gu=(e,t)=>{if(t<16)return async(r=24)=>{et(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(et(e),await new Promise(o=>requestAnimationFrame(()=>o())),et(e))}};async function mu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:u=0,showSlash:S,paragraphMarkers:y,playbackScale:b=1,viewportHeight:x=0}){var p,h,d;const v=++ks;et(v);try{const k=Math.abs(b-1)>.001,_=1/b;k&&(t.style.transform=`scale(${_})`,t.style.transformOrigin="top left");const I=Math.max(0,e.offsetWidth||0),R=Math.max(0,Math.min(I,o));t.style.maxWidth=`${R}px`,et(v);let f=Math.round(n.offsetHeight||0);f||(f=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",b.toFixed(4),k?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",I),console.log("[calcPages] pageBoxWidth:",R),console.log("[calcPages] maxPageHeight:",f),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const w=1.5,T=(G,Z)=>Z+G<=f-w,j=getComputedStyle(e),O={letterSpacing:j.letterSpacing,wordSpacing:j.wordSpacing,fontKerning:j.fontKerning||"normal",fontVariantLigatures:j.fontVariantLigatures||"normal",textTransform:j.textTransform||"none",direction:j.direction||"ltr",wordBreak:j.wordBreak||"keep-all",overflowWrap:j.overflowWrap||j.wordWrap||"break-word",hyphens:j.hyphens||"manual"},z=G=>{G.style.letterSpacing=O.letterSpacing||"",G.style.wordSpacing=O.wordSpacing||"",G.style.fontKerning=O.fontKerning||"",G.style.fontVariantLigatures=O.fontVariantLigatures||"",G.style.textTransform=O.textTransform||"",G.style.direction=O.direction||"",G.style.wordBreak=O.wordBreak||"",G.style.wordWrap=O.overflowWrap||"",G.style.overflowWrap=O.overflowWrap||"",G.style.hyphens=O.hyphens||""},C=R,M=Math.max(0,C-2*(s||0));n.innerHTML="";const A=document.createElement("div");A.style.boxSizing="border-box",A.style.width=`${C}px`,A.style.maxWidth=`${C}px`,A.style.margin="0 auto",A.style.display="flex",n.appendChild(A);const H=document.createElement("div");H.style.boxSizing="border-box",H.style.paddingRight=`${s}px`,H.style.paddingLeft=`${s}px`,H.style.width=`${C}px`,H.style.maxWidth=`${C}px`,H.style.margin="0 auto",H.style.display="flex",H.style.justifyContent="center",H.style.height="auto",A.appendChild(H);const E=new Map,P={},F=gu(v,r.length),V=(G,Z)=>{const D=document.createElement("p");return D.style.margin="8px 0",D.style.paddingLeft=Z?`${Z}px`:"0",D.style.textAlign=G.textAlign??"start",D.style.whiteSpace="pre-wrap",D.style.lineHeight=String(l),D.style.fontSize=`${a}px`,D.style.boxSizing="border-box",D.style.fontFamily=i??"",D.style.width="100%",z(D),D},Q=(G,Z)=>{const D=Z??[],Y=document.createDocumentFragment();for(let re=0;re<D.length;re++){const ee=D[re],xe=document.createElement("span");xe.dataset.runbox=String(re),xe.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(ee==null?void 0:ee.text)??"",oe.style.whiteSpace="pre-wrap",ee!=null&&ee.bold&&(oe.style.fontWeight="700"),ee!=null&&ee.italic&&(oe.style.fontStyle="italic"),ee!=null&&ee.underline&&(oe.style.textDecoration="underline"),xe.appendChild(oe),c&&(ee!=null&&ee.split)&&re!==D.length-1){const le=Math.max(0,(u??0)/2),he=document.createElement("span");he.style.display="inline-block",he.style.width=`${le}px`;const ue=document.createElement("span");if(ue.style.display="inline-block",ue.style.width=`${le}px`,xe.appendChild(he),S){const Ce=document.createElement("span");Ce.textContent=" / ",xe.appendChild(Ce)}xe.appendChild(ue)}Y.appendChild(xe)}G.appendChild(Y)},te=x>80?Math.floor((x-80)*.6):void 0,pe=G=>{const Z=G!=null&&G.width&&(G!=null&&G.height)?`${G.width} / ${G.height}`:"4 / 3",D=document.createElement("div");D.style.margin="12px 0",D.style.textAlign="center",D.style.width=`${M}px`;const Y=document.createElement("div");Y.style.position="relative",Y.style.width="100%",te&&(Y.style.maxHeight=`${te}px`),Y.style.aspectRatio=Z;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",Y.appendChild(re),D.appendChild(Y),G!=null&&G.alt){const ee=document.createElement("div");ee.style.fontSize="12px",ee.style.color="#6B7280",ee.style.marginTop="4px",ee.textContent=String(G.alt),z(ee),D.appendChild(ee)}return D};for(let G=0;G<r.length;G++){et(v);const Z=r[G];if(H.dataset.block=String(G),H.innerHTML="",Z.kind==="image"){const ue=Z.block,Ce=pe(ue);H.appendChild(Ce);const Ae=Ce.getBoundingClientRect(),{mt:Oe,mb:Le}=Kn(Ce);P[G]={contentH:Math.ceil(Ae.height),mt:Oe,mb:Le},await F(24);continue}const D=Z.block,Y=D.list?(D.list.level??0)*24:0,re=Z.paraIndex??0,ee=y[re]??(((p=D.list)==null?void 0:p.kind)==="bullet"?((h=D.list)==null?void 0:h.glyph)??"•":void 0);if(!!(D.list&&ee)){const ue=V(D,Y);ue.dataset.variant="with";const Ce=V(D,Y);Ce.dataset.variant="no";const Ae=document.createElement("span");Ae.textContent=`${ee} `,Ae.style.minWidth="16px",Ae.style.display="inline-block",Ae.style.whiteSpace="nowrap",Ae.style.userSelect="none",ue.appendChild(Ae),Q(ue,D.runs),Q(Ce,D.runs);const Oe=document.createDocumentFragment();Oe.appendChild(ue),Oe.appendChild(Ce),H.appendChild(Oe)}else{const ue=V(D,Y);ue.dataset.variant="with",Q(ue,D.runs),H.appendChild(ue)}const oe=H.querySelector('p[data-variant="with"]'),le=H.querySelector('p[data-variant="no"]'),he=le??oe;if(oe&&he){const ue=ko(oe),Ce=ko(he),{mt:Ae,mb:Oe}=Kn(oe),{mt:Le,mb:Fe}=Kn(he),De=((d=D.runs)==null?void 0:d.length)??0,je=le?Ce:ue,Xe=le?Le:Ae,$e=le?Fe:Oe;if(G<3){const ht=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${G}: height=${ht.toFixed(2)}, lastBottom=[${ue.slice(-3).map(yt=>yt.toFixed(1)).join(",")}], runs=${De}`)}E.set(G,{runsLen:De,lastBottomWith:ue,lastBottomNo:je,mtWith:Ae,mbWith:Oe,mtNo:Xe,mbNo:$e})}await F(24)}et(v),H.innerHTML="";const ye=(G,Z,D,Y)=>{if(Z>D)return{top:0,content:0,mb:0};const re=Y?G.lastBottomNo:G.lastBottomWith,ee=Y?G.mtNo:G.mtWith,xe=Y?G.mbNo:G.mbWith,oe=Y?0:ee,le=Z>0?re[Z-1]??0:0,he=Math.max(0,(re[D]??0)-le);return{top:oe,content:he,mb:xe}},me=[];let q=0,ne,B=null,U=null;for(;q<r.length;){et(v);const G=q;let Z=0,D=0,Y=ne;Y!=null&&B===q&&U!=null&&(Y=Math.max(Y,U+1));let re=-1,ee;for(;q<r.length;){if(et(v),r[q].kind==="image"){const je=P[q]??{contentH:0,mt:0,mb:0},$e=(Z===0?je.mt:D+je.mt)+je.contentH;if(T($e,Z)){Z+=$e,re=q,ee=void 0,D=je.mb,q+=1,ne=void 0,B=null,U=null;continue}if(Z===0){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{}}),q+=1,ne=void 0,B=null,U=null,D=0;break}break}const oe=E.get(q),le=oe.runsLen,he=q===G&&Y!=null?Y:0;if(he>=le){q+=1,ne=void 0,B=null,U=null;continue}const ue=he>0,Ce=ye(oe,he,le-1,ue),Oe=(Z===0?Ce.top:D+Ce.top)+Ce.content;if(T(Oe,Z)){Z+=Oe,re=q,ee=le-1,D=Ce.mb,q+=1,ne=void 0,B=null,U=null;continue}let Le=he,Fe=le-1,De=he-1;for(;Le<=Fe;){et(v);const je=Le+Fe>>1,Xe=ye(oe,he,je,ue),$e=(Z===0?Xe.top:D+Xe.top)+Xe.content;T($e,Z)?(De=je,Le=je+1):Fe=je-1}if(De>=he){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:De}),ne=De+1,B=q,U=De,D=0;break}if(Z>0){me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}}),D=0;break}else{const je=he;me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:je}),ne=je+1,B=q,U=je,D=0;break}}(me.length===0||me[me.length-1].startBlock!==G)&&me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}})}return A.remove(),k&&(t.style.transform="",t.style.transformOrigin=""),et(v),{pages:me,pageByRunIndex:null}}catch(k){throw console.error(k),k}}function Ro(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const a=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+a}return null}function xu(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let a=i.startBlock;a<=i.endBlock;a++){const l=n[a];if(!l||l.kind!=="paragraph")continue;const c=((o=l.block.runs)==null?void 0:o.length)??0;if(!c)continue;let u=0,S=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(u=Math.max(0,Math.min(i.startOffsetInBlock,S))),a===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(u,Math.min(i.endOffsetInBlock,S)));const y=r[l.originalIndex]??0,b=y+u,x=y+S;if(e>=b&&e<=x)return s}}return-1}function bu(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function vu(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function Su(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function yu(){var Kt;const e=$(W=>W.section),t=$(W=>W.sectionLoading),n=$(W=>W.rangeStartGI),r=$(W=>W.rangeEndGI),o=n!=null&&r!=null,s=vn(),i=X(W=>W.theme),a=rn[i],l=X(W=>W.fontFamily),c=X(W=>W.fontSizePx),u=X(W=>W.lineHeight),S=X(W=>W.marginX),y=X(W=>W.viewportHeight),b=860,x=g.useRef(null),{items:v}=g.useMemo(()=>{var W;return Su(((W=e==null?void 0:e.ast)==null?void 0:W.blocks)??[])},[e]),p=g.useMemo(()=>{const W=[],_e=vr();return v.forEach(Be=>{if(Be.kind==="paragraph"){const gt=Be.paraIndex;W[gt]=Sr(Be.block,_e)}}),W},[v]),[h,d]=g.useState({pages:[],pageByRunIndex:null}),k=$(W=>W.pageIndex),_=$(W=>W.setPageIndex),I=g.useRef(0),R=g.useRef(null),[f,w]=g.useState(!1),[T,j]=g.useState(null),[O,z]=g.useState(!1),C=g.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:c,lineHeight:u,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,c,u]),{showSplit:M,breakGapPx:A,slash:H}=X(Dt(W=>{var _e;return{showSplit:W.showSplit,breakGapPx:W.breakGapPx??0,slash:((_e=W.breakMarks)==null?void 0:_e.slash)??!1}})),E=Mt();g.useEffect(()=>{h&&h.pages.length&&(console.log("그래서 총 페이지",h.pages.length),(async()=>{const W=E.getState().progress.setSectionLoading;await ct(),await ct(),await ct(),await ct(),console.log("recalc종료"),W(!1)})())},[h,E]);const P=g.useCallback(()=>{console.log("@@@@@@recalc호출");const W=x.current,_e=oe.current,Be=le.current;if(console.log("showSplit",M),!W||!_e||!Be||v.length===0){d({pages:[],pageByRunIndex:null}),_(0);return}(async()=>{const gt=performance.now();try{const Ze=s.getState().playbackScale,{pages:wt,pageByRunIndex:_s}=await mu({viewHost:W,measureRoot:_e,contentArea:Be,items:v,cfgMaxWidth:b,marginX:S,fontFamily:l,fontSizePx:c,lineHeight:u,showSplit:M,breakGapPx:A,showSlash:H,paragraphMarkers:p,playbackScale:Ze,viewportHeight:y}),Ms=performance.now();console.log(`✅ calcPages 완료: ${(Ms-gt).toFixed(1)} ms (${wt.length} pages)`),d({pages:wt,pageByRunIndex:_s}),_(0)}catch(Ze){if(Ze instanceof Rs){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Ze)}})()},[_,v,b,S,l,c,u,M,A,H,p,s,y]),F=$(W=>W.setCurrentGlobalRunIndex),V=$(W=>{var _e;return((_e=W.layout)==null?void 0:_e.prefix)??[]}),Q=we(W=>W.syncToGI),te=g.useCallback(W=>{const _e=h.pages.length+1,Be=k+W;if(Be<0||Be>=_e)return;const gt=k===h.pages.length;if(Be===h.pages.length){_(Be);return}if(gt&&W===-1){const wt=Ro(h.pages[Be],v,V);wt!=null&&(F(wt,"scrubber-step"),Q(wt)),_(Be);return}const Ze=Ro(h.pages[Be],v,V);Ze!=null?(F(Ze,"scrubber-step"),Q(Ze)):_(Be)},[k,h.pages,v,V,F,_,Q]),pe=g.useCallback(()=>{f||I.current!==0?(j("prev"),w(!1)):te(-1)},[f,te]),ye=g.useCallback(()=>{f||I.current!==0?(j("next"),w(!1)):te(1)},[f,te]),me=pn(),q=g.useCallback(()=>{const{isSettingsOpen:W,setSettingsOpen:_e,toggleOverlays:Be}=me.getState();W?_e(!1):Be()},[me]),ne=h.pages.length+1,B=((Kt=x.current)==null?void 0:Kt.clientWidth)||400,U=g.useCallback(W=>{var Ze;const _e=R.current;if(!_e)return;const Be=((Ze=x.current)==null?void 0:Ze.clientWidth)||1,gt=W/Be*33.333;_e.style.transform=`translate3d(${-33.333+gt}%, 0, 0)`},[]),G=g.useCallback(W=>{k===0&&W>0||k>=ne-1&&W<0||(I.current=W,U(W),f||w(!0))},[k,ne,U,f]),Z=g.useCallback(()=>{I.current=0,w(!1);const W=R.current;W&&(W.style.transition="transform 250ms ease-out",W.style.transform="translate3d(-33.333%, 0, 0)")},[]),D=g.useCallback(W=>{if(W.target!==W.currentTarget||W.propertyName!=="transform")return;const _e=T;z(!0),j(null),I.current=0,_e==="prev"?te(-1):_e==="next"&&te(1)},[T,te]);g.useLayoutEffect(()=>{O&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{z(!1)})})},[O]);const Y=ln(),re=g.useCallback(W=>o||vu(W)?!0:bu(W),[o]),ee=g.useCallback(W=>{const _e=Y.getState().status;return _e==="playing"||_e==="loading"?!0:re(W)},[Y,re]),xe=eu({onPrev:pe,onNext:ye,onSingle:q,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:ee,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:G,onDragEnd:Z,pageTransitionThreshold:B*.5}),oe=g.useRef(null),le=g.useRef(null),he=g.useCallback(()=>{const W=E.getState().progress.setSectionLoading;W(!0)},[E]),ue=g.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Ce=hu(P,200,he,ue),Ae=g.useRef("");g.useEffect(()=>{if(y<=0)return;const W=`${l}|${c}|${u}|${S}|${M}|${A}|${H}|${y}|${e==null?void 0:e.section_id}`;Ae.current!==W&&(Ae.current=W,console.log("debounceRecalc 취소"),Ce.cancel(),he(),P())},[Ce,P,he,l,c,u,S,M,A,H,y,e==null?void 0:e.section_id]),Jc([x],Ce);const Oe=$(W=>W.registerSectionScrollApi);g.useEffect(()=>(Oe({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:te}),()=>Oe(void 0)),[Oe,te]);const Le=e.quiz&&e.quiz.length>0,Fe=h.pages.length>0&&k===h.pages.length,De=k>0?k-1:null,je=k<ne-1?k+1:null,Xe=g.useMemo(()=>T==="prev"?"translate3d(0%, 0, 0)":T==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[T]),$e=W=>t?null:W===h.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Le&&m.jsx(bs,{}),m.jsx(dn,{isIcon:!1})]}):m.jsx(Zc,{pages:h.pages,pageIndex:W,maxWidth:b}),ht={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},yt=!O&&(!f||T!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:x,style:{...C,touchAction:"pan-y"},...xe,children:[m.jsxs("div",{ref:R,style:{display:"flex",width:"300%",height:"100%",transform:Xe,transition:yt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:T?D:void 0,children:[m.jsx("div",{style:ht,children:De!==null&&$e(De)}),m.jsx("div",{style:ht,children:$e(k)}),m.jsx("div",{style:ht,children:je!==null&&$e(je)})]}),m.jsx("div",{ref:oe,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:b,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:l,fontSize:c,lineHeight:u,pointerEvents:"none",background:"pink"},children:m.jsxs("div",{style:{width:"100%",maxWidth:b,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[m.jsx("div",{style:{height:40,background:"blue"}}),m.jsx("div",{ref:le,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(wu,{pages:h.pages,items:v,onGotoPage:_,currentPageIndex:k,isOnExtraPage:Fe})]})}const wu=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=$(c=>c.currentGlobalRunIndex),i=$(c=>c.lastUpdateBy),a=$(c=>{var u;return((u=c.layout)==null?void 0:u.prefix)??[]}),l=g.useRef(null);return g.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const c=xu(s,e,t,a);c>=0&&c!==r&&n(c)},[s,e,t,a,n,r,o,i]),m.jsx(m.Fragment,{})},Cu="_wrapper_dbk3n_1",Iu="_spinner_dbk3n_10",To={wrapper:Cu,spinner:Iu};function ku({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${To.wrapper}`,children:m.jsx("div",{className:To.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Ru(){const e=$(Dt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(ku,{})})}const Tu="_Overlay_ybic8_3",_u="_Dialog_ybic8_15",Mu="_Body_ybic8_25",Eu="_Header_ybic8_32",ju="_Paging_ybic8_39",Ou="_Remaining_ybic8_48",Pu="_RemainingDanger_ybic8_55",Bu="_NextBtn_ybic8_59",zu="_CloseBtn_ybic8_96",Au="_Question_ybic8_113",Lu="_Score_ybic8_123",Gu="_Image_ybic8_130",Hu="_Options_ybic8_140",Nu="_OptionBtn_ybic8_145",Fu="_OptionBtnActive_ybic8_165",Wu="_Footer_ybic8_172",Du="_OptionBtnCorrect_ybic8_195",Vu="_Judge_ybic8_201",$u="_Correct_ybic8_212",qu="_Incorrect_ybic8_215",Uu="_ResultHeader_ybic8_220",Ku="_ResultActions_ybic8_233",Qu="_CloseBtnSoft_ybic8_239",Yu="_SummaryGrid_ybic8_249",Xu="_StatCard_ybic8_257",Zu="_StatLabel_ybic8_265",Ju="_StatValue_ybic8_270",ed="_StatSub_ybic8_277",ce={Overlay:Tu,Dialog:_u,Body:Mu,Header:Eu,Paging:ju,Remaining:Ou,RemainingDanger:Pu,NextBtn:Bu,CloseBtn:zu,Question:Au,Score:Lu,Image:Gu,Options:Hu,OptionBtn:Nu,OptionBtnActive:Fu,Footer:Wu,OptionBtnCorrect:Du,Judge:Vu,Correct:$u,Incorrect:qu,ResultHeader:Uu,ResultActions:Ku,CloseBtnSoft:Qu,SummaryGrid:Yu,StatCard:Xu,StatLabel:Zu,StatValue:Ju,StatSub:ed};function td(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Ts(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function nd(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const rd=g.memo(function(){const t=Je(p=>p.phase),n=Je(p=>p.quizzes),r=Je(p=>p.order),o=Je(p=>p.currentIndex),s=Je(p=>p.answers),i=Je(p=>p.correctCount),a=Je(p=>p.remainingSec),l=Je(p=>p.uiReveal),c=Je(p=>p.startedAt),u=Je(p=>p.finishedAt),S=Je(p=>p.perQ),y=xs();g.useEffect(()=>{if(t==="idle"||t!=="doing"||a==null)return;const p=window.setInterval(()=>y.getState().tick(),1e3);return()=>window.clearInterval(p)},[t,a,y]);const b=t==="doing"?n[r[o]]:void 0,x=t==="doing"&&b?s[b.qid]??[]:[],v=g.useMemo(()=>{if(t==="idle"||t!=="finished")return;const p=r.map(E=>n[E]),h=p.length,d=p.reduce((E,P)=>E+(P.score??0),0),k=p.reduce((E,P)=>{const F=S[P.qid];return E+(F!=null&&F.isCorrect?P.score??0:0)},0),_=p.map(E=>S[E.qid]).filter(E=>!!E),I=typeof c=="number"&&typeof u=="number"?Math.max(0,u-c):_.reduce((E,P)=>E+(P.ms??0),0),R=h>0?Math.round(I/h):0,f=[..._].sort((E,P)=>E.ms-P.ms),w=f[0],T=f[f.length-1],j=_.filter(E=>!E.multi),O=_.filter(E=>E.multi),z=j.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,M=_.filter(E=>E.timedOut).length,A=_.filter(E=>E.revealed).length,H=_.filter(E=>!E.isCorrect).sort((E,P)=>P.ms-E.ms).slice(0,3);return{total:h,correct:i,rate:h?Math.round(i/h*100):0,timeMsTotal:I,avgMs:R,totalScore:d,gainedScore:k,fastest:w,slowest:T,singles:{total:j.length,correct:z},multis:{total:O.length,correct:C},timedOut:M,revealed:A,wrongTop3:H}},[t,r,n,S,c,u,i]);return t==="idle"?null:m.jsx("div",{className:ce.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:ce.Dialog,children:t==="doing"&&b?m.jsx(od,{q:b,index:o,total:r.length,selected:x,uiReveal:l,onSelect:p=>{if(l)return;const h=y.getState();Ts(b)?h.selectToggle(p):h.selectSingle(p)},onBeforeNext:()=>y.getState().setReveal(!0),onNext:()=>y.getState().afterRevealNext(),remainingSec:a,onClose:()=>y.getState().close()}):m.jsx(sd,{total:r.length,correct:i,summary:v,onClose:()=>y.getState().close()})})})});function od(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:u}=e,S=Ts(t),y=g.useMemo(()=>{const p=t.options.map((h,d)=>({opt:h,i:d}));for(let h=p.length-1;h>0;h--){const d=Math.floor(Math.random()*(h+1));[p[h],p[d]]=[p[d],p[h]]}return p},[t.options]),b=g.useMemo(()=>td(t),[t]),x=g.useMemo(()=>nd(t),[t]),v=g.useMemo(()=>{const p=[...o].sort((h,d)=>h-d);if(p.length!==x.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==x[h])return!1;return!0},[o,x]);return m.jsxs("div",{className:ce.Body,children:[m.jsxs("div",{className:ce.Header,children:[m.jsx("div",{className:ce.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:u,className:ce.CloseBtn,children:"X"})]}),m.jsx("div",{className:ce.Question,children:t.question}),m.jsx("div",{className:ce.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),m.jsx("div",{className:`${ce.Judge}${s?v?` ${ce.Correct}`:` ${ce.Incorrect}`:""}`,"aria-live":"polite",children:s?v?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:ce.Image,children:b&&m.jsx("img",{src:b,alt:""})}),m.jsx("div",{className:ce.Options,children:y.map(({opt:p,i:h})=>{const d=o.includes(h),k=x.includes(h),_=[ce.OptionBtn,d?ce.OptionBtnActive:"",s&&k?ce.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(h),className:_,disabled:s,children:p},h)})}),m.jsx("div",{className:ce.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:ce.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:a,className:`${ce.NextBtn}`,children:["Submit",typeof c=="number"&&m.jsx("span",{className:`${ce.Remaining} ${c<=5?ce.RemainingDanger:""}`,children:` (${c} s )`})]})})]})}function _o(e){return e==null?"-":`${Math.round(e/1e3)}s`}function sd(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return m.jsxs("div",{className:ce.Body,children:[m.jsx("div",{className:ce.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:ce.SummaryGrid,role:"list",children:[m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"정답률"}),m.jsxs("div",{className:ce.StatValue,children:[s,"%"]}),m.jsx("div",{className:ce.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 점수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:ce.StatValue,children:_o(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:ce.StatSub,children:`평균 ${_o(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:ce.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:ce.CloseBtnSoft,children:"닫기"})})]})}function id(e){return e.map((t,n)=>n)}function ld(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Yn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function Mo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:id(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function ad(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Mo(e);return Vt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Mo(i);o(a)},openFromSection:i=>{i&&s().hydrateFromSection(i);const a=s();if(!a.quizzes.length)return;const l=a.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid,u=a.answers[c]??[],S=u.includes(i)?u.filter(y=>y!==i):[...u,i].sort((y,b)=>y-b);o({answers:{...a.answers,[c]:S}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[c]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],c=l.qid,u=(i.answers[c]??[]).slice().sort((p,h)=>p-h),S=Yn(l),y=ld(u,S),b=i.questionStartedAt?Date.now()-i.questionStartedAt:0,x=i.perQ[c],v={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:u,correctIdxes:S,isCorrect:y,ms:b,revealed:(x==null?void 0:x.revealed)??!1,timedOut:(x==null?void 0:x.timedOut)??!1};if(o({correctCount:i.correctCount+(y?1:0),perQ:{...i.perQ,[c]:v}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const p=i.currentIndex+1;o({currentIndex:p,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[p]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const a=s();if(a.phase==="doing"){if(i){const l=a.quizzes[a.order[a.currentIndex]],c=l.qid,u=a.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:(u==null?void 0:u.timedOut)??!1};o({perQ:{...a.perQ,[c]:S}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const a=i.currentIndex+1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const a=i.currentIndex-1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const a=i.remainingSec-1;if(a<=0){const l=i.quizzes[i.order[i.currentIndex]],c=l.qid,u=i.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:S}})}else o({remainingSec:a})}}))}function cd({children:e,initialState:t}){const n=g.useMemo(()=>ad(t.section),[t]),r=g.useRef(t.onQuizComplete);return g.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),g.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const a=r.current;if(!a)return;const{sectionId:l,quizzes:c,order:u,perQ:S,startedAt:y,finishedAt:b}=s,x=u.map(R=>c[R]),v=x.length,p=x.filter(R=>{var f;return(f=S[R.qid])==null?void 0:f.isCorrect}).length,h=x.reduce((R,f)=>R+(f.score??0),0),d=x.reduce((R,f)=>{const w=S[f.qid];return R+(w!=null&&w.isCorrect?f.score??0:0)},0),k=typeof y=="number"&&typeof b=="number"?Math.max(0,b-y):0,_=x.map(R=>{const f=S[R.qid];return{qid:R.qid,index:R.index,question:R.question,score:R.score??0,isCorrect:(f==null?void 0:f.isCorrect)??!1,selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??[],ms:(f==null?void 0:f.ms)??0,timedOut:(f==null?void 0:f.timedOut)??!1}}),I={sectionId:l??"",total:v,correct:p,rate:v>0?Math.round(p/v*100):0,totalScore:h,gainedScore:d,timeMsTotal:k,perQuestion:_};a(I)}});return()=>o()},[n]),m.jsx(yr.Provider,{value:n,children:e})}const Eo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function ud({containerRef:e}){const t=vn(),n=pn(),r=g.useRef(null);return g.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const a=new ResizeObserver(()=>{const l=o.clientWidth,c=o.clientHeight;(l!==s||c!==i)&&(s=l,i=c,n.getState().setViewportSize(l,c),t.getState().emit({type:"viewport_resize",payload:{width:l,height:c}}))});return a.observe(o),()=>a.disconnect()},[t,n,e]),g.useEffect(()=>{const o=n.getState();r.current={};for(const i of Eo)r.current[i]=o[i];const s=n.subscribe(i=>{const a=r.current;if(a)for(const l of Eo){const c=a[l],u=i[l];c!==u&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:u}}):t.getState().emit({type:"settings_change",payload:{key:l,value:u}}),a[l]=u)}});return()=>{s(),r.current=null}},[t,n]),null}function dd(){const e=vn(),t=pn(),n=Mt(),r=g.useContext(Bo),o=g.useContext(bn),s=g.useCallback(l=>{const{viewerState:c}=l;if(c){c.mode&&t.getState().setMode(c.mode);const{...S}=c;t.setState(S)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(c==null?void 0:c.mode)==="scroll"||!(c!=null&&c.mode)){const S=n.getState().progress.getSectionScrollApi();if(S){if(l.scrollY===0)S.setScrollTop(0);else if(S.scrollToGIAtOffset){const y=l.anchorGI??l.globalIndex;if(typeof y=="number"){const b=l.anchorOffsetRatio??0;S.scrollToGIAtOffset(y,b)}}}}},[t,n]),i=g.useCallback(()=>{var x,v,p;const l=t.getState(),c=n.getState().progress,u=(x=c.getSectionScrollApi)==null?void 0:x.call(c),S=c.currentGlobalRunIndex??0,y=((v=u==null?void 0:u.getScrollTop)==null?void 0:v.call(u))??0,b=((p=u==null?void 0:u.getAnchorOffsetRatio)==null?void 0:p.call(u,S))??0;return{viewerState:{mode:l.mode,theme:l.theme,fontFamily:l.fontFamily,fontSizePx:l.fontSizePx,lineHeight:l.lineHeight,marginX:l.marginX,marginY:l.marginY,showOverlays:l.showOverlays,isSettingsOpen:l.isSettingsOpen,pointerStyle:l.pointerStyle,pointerColor:l.pointerColor,breakMarks:l.breakMarks,breakGapPx:l.breakGapPx,muteAudio:l.muteAudio,audioSpeed:l.audioSpeed,showPointer:l.showPointer,showSplit:l.showSplit,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:y,anchorGI:S,anchorOffsetRatio:b,currentPage:c.pageIndex??0,sectionId:c.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),a=g.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:c}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(c,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:u,anchorGI:S,anchorOffsetRatio:y}=l.payload,b=n.getState().progress.getSectionScrollApi();b&&(u===0?b.setScrollTop(0):b.scrollToGIAtOffset&&typeof S=="number"&&b.scrollToGIAtOffset(S,y));break}case"settings_change":{const{key:c,value:u}=l.payload,S=t.getState();c in S&&typeof S[c]!="function"&&t.setState({[c]:u});break}case"mode_change":{const{mode:c}=l.payload;t.getState().setMode(c);break}case"audio_control":{if(!o)break;const{action:c}=l.payload;switch(c){case"play":o.getState()._setStatusOnly("playing");break;case"pause":o.getState()._setStatusOnly("paused");break;case"stop":o.getState()._setStatusOnly("idle");break}break}case"page_change":{const{pageIndex:c}=l.payload;n.getState().progress.setPageIndex(c);break}case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return g.useLayoutEffect(()=>r?(r.current={dispatch:a,applySnapshot:s,getSnapshot:i},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,a,s,i]),g.useLayoutEffect(()=>e.subscribe((c,u)=>{c.isPlaybackMode&&!u.isPlaybackMode?(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)):!c.isPlaybackMode&&u.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,a,s]),null}const fd=({onTranslate:e})=>{const t=$(u=>u.rangeStartGI),n=$(u=>u.rangeEndGI),r=$(u=>u.getRangeText),o=$(u=>u.clearRange),s=t!=null&&n!=null,[i,a]=g.useState(null);g.useEffect(()=>{if(!s)return;const u=()=>{o()};return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[s,o]),g.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const u=()=>{const S=document.querySelector(`[data-g="${n}"]`);if(!S){a({x:window.innerWidth/2,y:80});return}const y=S.getBoundingClientRect(),b=document.querySelector(`[data-g="${t}"]`),x=b==null?void 0:b.getBoundingClientRect();let v=y.left+y.width/2;x&&(v=(x.left+y.right)/2);const p=160,h=50,d=16,k=12,_=Math.max(d+p/2,Math.min(v,window.innerWidth-d-p/2)),I=((x==null?void 0:x.top)??y.top)-h-k;let R=I;I<d&&(R=y.bottom+k),a({x:_,y:R})};return u(),window.addEventListener("scroll",u,!0),()=>window.removeEventListener("scroll",u,!0)},[s,t,n]);const l=g.useCallback(()=>{const u=r();u&&navigator.clipboard.writeText(u).catch(S=>{console.error("복사 실패:",S)}),o()},[r,o]),c=g.useCallback(()=>{const u=r();u&&e&&e(u)},[r,e]);return!s||!i?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"fixed",left:i.x,top:i.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[m.jsx("button",{onClick:l,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:c,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},pd="_handleStart_1336y_16 _handle_1336y_1",hd="_handleEnd_1336y_21 _handle_1336y_1",jo={handleStart:pd,handleEnd:hd},gd=()=>{const e=$(v=>v.rangeStartGI),t=$(v=>v.rangeEndGI),n=$(v=>v.setRange),r=e!=null&&t!=null,[o,s]=g.useState(null),[i,a]=g.useState(null),l=g.useRef(null),c=g.useRef(null);g.useEffect(()=>{if(!r||e==null||t==null){s(null),a(null);return}const v=()=>{const p=document.querySelector(`[data-g="${e}"]`),h=document.querySelector(`[data-g="${t}"]`);if(p){const d=p.getBoundingClientRect();s({x:d.left,y:d.bottom})}else s(null);if(h){const d=h.getBoundingClientRect();a({x:d.right,y:d.bottom})}else a(null)};return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[r,e,t]);const u=g.useCallback((v,p)=>{var d;const h=document.elementsFromPoint(v,p);for(const k of h){const _=(d=k.getAttribute)==null?void 0:d.call(k,"data-g");if(_!=null)return parseInt(_,10)}return null},[]),S=g.useCallback(v=>p=>{p.preventDefault(),p.stopPropagation(),l.current=v,c.current=v==="start"?e:t,p.target.setPointerCapture(p.pointerId)},[e,t]),y=g.useCallback(v=>{if(!l.current||e==null||t==null)return;const p=u(v.clientX,v.clientY);p!=null&&(l.current==="start"?p<=t?n(p,t):(n(t,p),l.current="end"):p>=e?n(e,p):(n(p,e),l.current="start"))},[e,t,n,u]),b=g.useCallback(v=>{l.current=null,c.current=null,v.target.releasePointerCapture(v.pointerId)},[]);return r?m.jsxs(m.Fragment,{children:[o&&m.jsx("div",{className:jo.handleStart,"data-range-handle":"start",style:{left:o.x-26,top:o.y},onPointerDown:S("start"),onPointerMove:y,onPointerUp:b,onPointerCancel:b}),i&&m.jsx("div",{className:jo.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:S("end"),onPointerMove:y,onPointerUp:b,onPointerCancel:b})]}):null};function md(){const e=$(o=>o.rangeStartGI),t=$(o=>o.rangeEndGI),n=$(o=>o.clearRange),r=e!=null&&t!=null;return g.useEffect(()=>{if(!r)return;const o=s=>{var a;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(a=i.closest("[data-g]"))==null?void 0:a.getAttribute("data-g");if(l){const c=parseInt(l,10),u=Math.min(e,t),S=Math.max(e,t);if(c>=u&&c<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const xd=({isOpen:e,onClose:t,text:n})=>e?m.jsx("div",{style:{position:"fixed",inset:0,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0, 0, 0, 0.5)",zIndex:10001},onClick:t,children:m.jsxs("div",{style:{position:"relative",backgroundColor:"#fff",borderRadius:12,padding:"24px 32px",minWidth:280,maxWidth:"80%",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.2)"},onClick:r=>r.stopPropagation(),children:[m.jsx("button",{onClick:t,style:{position:"absolute",top:12,right:12,width:28,height:28,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"transparent",border:"none",borderRadius:"50%",cursor:"pointer",fontSize:20,color:"#666"},"aria-label":"닫기",children:"✕"}),m.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:18,fontWeight:600,color:"#333"},children:"번역"}),m.jsx("p",{style:{margin:0,fontSize:16,color:"#666",textAlign:"center",padding:"16px 0"},children:"준비중입니다"}),n&&m.jsxs("div",{style:{marginTop:16,padding:12,backgroundColor:"#f5f5f5",borderRadius:8,fontSize:14,color:"#888",maxHeight:100,overflow:"auto"},children:[m.jsx("span",{style:{fontWeight:500},children:"선택된 텍스트: "}),n]})]})}):null,bd=(e,t,n)=>Math.min(n,Math.max(t,e));function vd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:c,isPlaybackMode:u=!1,playbackScale:S,isDev:y=!1}){const b=String((e==null?void 0:e.section_id)??"0"),x=g.useMemo(()=>{var _,I;const d=((_=e==null?void 0:e.ast)==null?void 0:_.blocks)??[];let k=0;for(const R of d)(R==null?void 0:R.type)!=="image"&&(k+=((I=R==null?void 0:R.runs)==null?void 0:I.length)??0);return k},[e]),v=g.useMemo(()=>typeof n=="number"?bd(n,x>0?0:-1,Math.max(x-1,-1)):(x>0,0),[n,x]),p=g.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=g.useMemo(()=>{const d=(e==null?void 0:e.audios)??[],k=d.length>0?$c(e):void 0;return{clips:d,map:k,initialIndex:v,section:e}},[e,v]);return m.jsx(Vs,{onViewerEvent:l,isPlaybackMode:u,playbackScale:S,viewerRef:c,children:m.jsx(Xc,{initialState:{...t,isDev:y},children:m.jsx(Yc,{initialState:p,children:m.jsx(Vc,{initialState:h,children:m.jsx(cd,{initialState:{section:e,onQuizComplete:a},children:m.jsx(Sd,{})},b)},b)},b)})})}function Sd(){const e=X(u=>u.mode),t=g.useRef(null),[n,r]=g.useState(!1),[o,s]=g.useState(),i=g.useCallback(u=>{s(u),r(!0)},[]),a=g.useCallback(()=>{r(!1),s(void 0)},[]),l=u=>{u.preventDefault()},c=u=>{u.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:l,onDragStart:c,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(da,{}):m.jsx(yu,{}),m.jsx(Lc,{}),m.jsx(rd,{}),m.jsx(Ru,{}),m.jsx(fd,{onTranslate:i}),m.jsx(gd,{}),m.jsx(md,{}),m.jsx(xd,{isOpen:n,onClose:a,text:o}),m.jsx(ud,{containerRef:t}),m.jsx(dd,{})]})}exports.CRViewer=vd;
34
+ */var Tr;function Ls(){return Tr||(Tr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=g,n=Po(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(c,u,S,y,x){var b=s(null);if(b.current===null){var v={hasValue:!1,value:null};b.current=v}else v=b.current;b=a(function(){function h(R){if(!d){if(d=!0,k=R,R=y(R),x!==void 0&&v.hasValue){var f=v.value;if(x(f,R))return _=f}return _=R}if(f=_,r(k,R))return f;var w=y(R);return x!==void 0&&x(f,w)?(k=R,f):(k=R,_=w)}var d=!1,k,_,I=S===void 0?null:S;return[function(){return h(u())},I===null?void 0:function(){return h(I())}]},[u,S,y,x]);var p=o(c,b[0],b[1]);return i(function(){v.hasValue=!0,v.value=p},[p]),l(p),p},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Cn}var _r;function Gs(){return _r||(_r=1,process.env.NODE_ENV==="production"?Yt.exports=As():Yt.exports=Ls()),Yt.exports}var Hs=Gs();const Ns=Oo(Hs),Mr=e=>{let t;const n=new Set,r=(c,u)=>{const S=typeof c=="function"?c(t):c;if(!Object.is(S,t)){const y=t;t=u??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(x=>x(t,y))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,o,a);return a},Vt=(e=>e?Mr(e):Mr),{useSyncExternalStoreWithSelector:Fs}=Ns,Ws=e=>e;function fn(e,t=Ws,n){const r=Fs(e.subscribe,e.getState,e.getInitialState,t,n);return g.useDebugValue(r),r}function X(e,t){const n=g.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return fn(n,e,t)}function pn(){const e=g.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const xt=g.createContext(void 0),Bo=g.createContext(void 0);function Ds(){return Vt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerEventBridge] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerEventBridge] applySnapshot called but no handler registered")}}))}function Vs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=g.useMemo(()=>Ds(),[]);return g.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),g.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),g.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),m.jsx(xt.Provider,{value:s,children:m.jsx(Bo.Provider,{value:o,children:e})})}function $s({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=g.useRef(null);g.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=g.useCallback(a=>{if(!(r!=null&&r(a.target))&&a.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(a)},n)}},[n,e,r]),i=g.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const rn={light:{bg:"#ffffff",fg:"#111827",overlayBg:"#ffffff",overlayFg:"#111827",borderColor:"#333333"},dark:{bg:"#0b0b0b",fg:"#e5e7eb",overlayBg:"#0b0b0b",overlayFg:"#e5e7eb",borderColor:"#ffffff"},sepia:{bg:"#f4ecd8",fg:"#3e2f1c",overlayBg:"#f4ecd8",overlayFg:"#3e2f1c",borderColor:"#bfa87a"},green:{bg:"#e9f5e1",fg:"#1b3d1f",overlayBg:"#e9f5e1",overlayFg:"#1b3d1f",borderColor:"#93b48b"}},In=[8,16,24,40,64],kn=[1.2,1.4,1.6,1.8,2,2.2,2.4],Rn=[4,8,12,16,24],Xn=e=>Math.round(12+(e-1)*(16/11)),qs=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=Xn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},Tn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},zo=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],Ge={mode:"page",theme:"light",fontFamily:zo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,overlayCompactMode:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,isDev:!1};function Us(e){const{init:t,recorderStore:n}=e??{};return Vt((r,o)=>({...Ge,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{const s=!o().showOverlays;r({showOverlays:s,...s&&{overlayCompactMode:!0}})},setOverlayCompactMode:s=>r({overlayCompactMode:s}),toggleOverlayCompactMode:()=>r({overlayCompactMode:!o().overlayCompactMode}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:Ge.mode,theme:Ge.theme,fontFamily:Ge.fontFamily,fontSizePx:Ge.fontSizePx,lineHeight:Ge.lineHeight,marginX:Ge.marginX,marginY:Ge.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:Ge.pointerStyle,pointerColor:Ge.pointerColor,breakMarks:Ge.breakMarks,breakGapPx:Ge.breakGapPx,muteAudio:Ge.muteAudio,audioSpeed:Ge.audioSpeed,showPointer:Ge.showPointer,showSplit:Ge.showSplit})),maps:{MARGIN_MAP:In,LINEHEIGHT_MAP:kn,BREAK_GAP_MAP:Rn,fontSizeFromLevel:Xn},setPointerStyle:s=>r({pointerStyle:s}),setPointerColor:s=>r({pointerColor:s}),toggleBreakMark:s=>{const i=o().breakMarks;r({breakMarks:{...i,[s]:!i[s]}})},setBreakMarks:s=>{r({breakMarks:{...o().breakMarks,...s}})},setBreakGapPx:s=>r({breakGapPx:s}),setBreakGapLevel:s=>{const i=Rn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>Tn(o().breakGapPx,Rn),getFontLevel:()=>qs(o().fontSizePx),getLineLevel:()=>Tn(o().lineHeight,kn),getMarginLevel:()=>Tn(o().marginX,In),setFontLevel:s=>r({fontSizePx:Xn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:kn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=In[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{const i=Math.max(.3,Math.min(2,s));r({audioSpeed:i}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:i}})},incAudioSpeed:()=>{const s=Math.min(2,Math.round((o().audioSpeed+.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},decAudioSpeed:()=>{const s=Math.max(.3,Math.round((o().audioSpeed-.05)*100)/100);r({audioSpeed:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioSpeed",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i})}))}const hn=0,dt=1,Et=2,Ao=4;function Er(e){return()=>e}function Ks(e){e()}function Lo(e,t){return n=>e(t(n))}function jr(e,t){return()=>e(t)}function Qs(e,t){return n=>e(t,n)}function ir(e){return e!==void 0}function Ys(...e){return()=>{e.map(Ks)}}function jt(){}function gn(e,t){return t(e),e}function Xs(e,t){return t(e)}function ke(...e){return e}function ve(e,t){return e(dt,t)}function de(e,t){e(hn,t)}function lr(e){e(Et)}function Te(e){return e(Ao)}function J(e,t){return ve(e,Qs(t,hn))}function tt(e,t){const n=e(dt,r=>{n(),t(r)});return n}function Or(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Go(e,t){return e===t}function Ie(e=Go){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function K(e){return t=>Lo(t,e)}function st(e){return t=>()=>{t(e)}}function L(e,...t){const n=Zs(...t);return((r,o)=>{switch(r){case Et:lr(e);return;case dt:return ve(e,n(o))}})}function it(e,t){return n=>r=>{n(t=e(t,r))}}function bt(e){return t=>n=>{e>0?e--:t(n)}}function at(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function fe(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{const c=n;n=n|a,t[i]=l,c!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function Zs(...e){return t=>e.reduceRight(Xs,t)}function Js(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case dt:return s?n===s?void 0:(r(),n=s,t=ve(e,s),t):(r(),jt);case Et:r(),n=null;return}}}function N(e){let t=e;const n=ge();return((r,o)=>{switch(r){case hn:t=o;break;case dt:{o(t);break}case Ao:return t}return n(r,o)})}function Ne(e,t){return gn(N(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case hn:e.slice().forEach(r=>{r(n)});return;case Et:e.splice(0,e.length);return;case dt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ue(e){return gn(ge(),t=>J(e,t))}function xe(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ei(),singleton:n}}const ei=()=>Symbol();function ti(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function Pe(...e){const t=ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);ve(s,l=>{n[i]=l,r=r|a,r===o&&de(t,n)})}),function(s,i){switch(s){case Et:{lr(t);return}case dt:return r===o&&i(n),ve(t,i)}}}function se(e,t=Go){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case Et:return;case dt:return Ys(...e.map(r=>ve(r,n)))}}}var Ve=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ve||{});const ni={0:"debug",3:"error",1:"log",2:"warn"},ri=()=>typeof globalThis>"u"?window:globalThis,ft=xe(()=>{const e=N(3);return{log:N((t,n,r=1)=>{var o;const s=(o=ri().VIRTUOSO_LOG_LEVEL)!=null?o:Te(e);r>=s&&console[ni[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function vt(e,t,n){return ar(e,t,n).callbackRef}function ar(e,t,n){const r=g.useRef(null);let o=i=>{};const s=g.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function oi(e,t,n,r,o,s,i,a,l){const c=g.useCallback(u=>{const S=si(u.children,t,a?"offsetWidth":"offsetHeight",o);let y=u.parentElement;for(;!y.dataset.virtuosoScroller;)y=y.parentElement;const x=y.lastElementChild.dataset.viewportType==="window";let b;x&&(b=y.ownerDocument.defaultView);const v=i?a?i.scrollLeft:i.scrollTop:x?a?b.scrollX||b.document.documentElement.scrollLeft:b.scrollY||b.document.documentElement.scrollTop:a?y.scrollLeft:y.scrollTop,p=i?a?i.scrollWidth:i.scrollHeight:x?a?b.document.documentElement.scrollWidth:b.document.documentElement.scrollHeight:a?y.scrollWidth:y.scrollHeight,h=i?a?i.offsetWidth:i.offsetHeight:x?a?b.innerWidth:b.innerHeight:a?y.offsetWidth:y.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(v,0),viewportHeight:h}),s==null||s(a?Pr("column-gap",getComputedStyle(u).columnGap,o):Pr("row-gap",getComputedStyle(u).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,a]);return ar(c,n,l)}function si(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),u=t(a,n);if(u===0&&r("Zero-sized element, this should not happen",{child:a},Ve.ERROR),u===c)continue;const S=s[s.length-1];s.length===0||S.size!==u||S.endIndex!==l-1?s.push({endIndex:l,size:u,startIndex:l}):s[s.length-1].endIndex++}return s}function Pr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ho(e,t,n){const r=g.useRef(null),o=g.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),u=c.width;let S,y;if(t){const x=t.getBoundingClientRect(),b=c.top-x.top;y=x.height-Math.max(0,b),S=b+t.scrollTop}else{const x=i.current.ownerDocument.defaultView;y=x.innerHeight-Math.max(0,c.top),S=c.top+x.scrollY}r.current={offsetTop:S,visibleHeight:y,visibleWidth:u},e(r.current)},[e,t]),{callbackRef:s,ref:i}=ar(o,!0,n),a=g.useCallback(()=>{o(i.current)},[o,i]);return g.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",a),c==null||c.addEventListener("resize",a),()=>{c==null||c.removeEventListener("scroll",a),c==null||c.removeEventListener("resize",a)}}},[a,t,i]),s}const We=xe(()=>{const e=ge(),t=ge(),n=N(0),r=ge(),o=N(0),s=ge(),i=ge(),a=N(0),l=N(0),c=N(0),u=N(0),S=ge(),y=ge(),x=N(!1),b=N(!1),v=N(!1);return J(L(e,K(({scrollTop:p})=>p)),t),J(L(e,K(({scrollHeight:p})=>p)),i),J(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:u,headerHeight:a,horizontalDirection:b,scrollBy:y,scrollContainerState:e,scrollHeight:i,scrollingInProgress:x,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),At={lvl:0};function No(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function Se(e){return e===At}function Lt(e,t){if(!Se(e))return t===e.k?e.v:t<e.k?Lt(e.l,t):Lt(e.r,t)}function nt(e,t,n="k"){if(Se(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=nt(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return nt(e.l,t,n)}function qe(e,t,n){return Se(e)?Do(t,n,1):t===e.k?ze(e,{k:t,v:n}):t<e.k?Br(ze(e,{l:qe(e.l,t,n)})):Br(ze(e,{r:qe(e.r,t,n)}))}function Rt(){return At}function Tt(e,t,n){if(Se(e))return[];const r=nt(e,t)[0];return ii(er(e,r,n))}function Jn(e,t){if(Se(e))return At;const{k:n,l:r,r:o}=e;if(t===n){if(Se(r))return o;if(Se(o))return r;{const[s,i]=Wo(r);return tn(ze(e,{k:s,l:Fo(r),v:i}))}}else return t<n?tn(ze(e,{l:Jn(r,t)})):tn(ze(e,{r:Jn(o,t)}))}function mt(e){return Se(e)?[]:[...mt(e.l),{k:e.k,v:e.v},...mt(e.r)]}function er(e,t,n){if(Se(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(er(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(er(s,t,n))),a}function tn(e){const{l:t,lvl:n,r}=e;if(r.lvl>=n-1&&t.lvl>=n-1)return e;if(n>r.lvl+1){if(_n(t))return Vo(ze(e,{lvl:n-1}));if(!Se(t)&&!Se(t.r))return ze(t.r,{l:ze(t,{r:t.r.l}),lvl:n,r:ze(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(ze(e,{lvl:n-1}));if(!Se(r)&&!Se(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return ze(o,{l:ze(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(ze(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function ze(e,t){return Do(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Fo(e){return Se(e.r)?e.l:tn(ze(e,{r:Fo(e.r)}))}function _n(e){return Se(e)||e.lvl>e.r.lvl}function Wo(e){return Se(e.r)?[e.k,e.v]:Wo(e.r)}function Do(e,t,n,r=At,o=At){return{k:e,l:r,lvl:n,r:o,v:t}}function Br(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!Se(t)&&t.lvl===e.lvl?ze(t,{r:ze(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!Se(n)&&!Se(n.r)&&n.lvl===t&&n.r.lvl===t?ze(n,{l:ze(e,{r:n.l}),lvl:t+1}):e}function ii(e){return No(e,({k:t,v:n})=>({index:t,value:n}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Gt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const cr=xe(()=>({recalcInProgress:N(!1)}),[],{singleton:!0});function qo(e,t,n){return e[on(e,t,n)]}function on(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function li(e,t,n,r){const o=on(e,t,r),s=on(e,n,r,o);return e.slice(o,s+1)}function ut(e,t){return Math.round(e.getBoundingClientRect()[t])}function mn(e){return!Se(e.groupOffsetTree)}function ur({index:e},t){return t===e?0:t<e?-1:1}function ai(){return{groupIndices:[],groupOffsetTree:Rt(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:Rt()}}function ci(e,t){let n=Se(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),Se(e)){e=qe(e,0,s);continue}const a=Tt(e,i-1,o+1);if(a.some(mi(r)))continue;let l=!1,c=!1;for(const{end:u,start:S,value:y}of a)l?(o>=S||s===y)&&(e=Jn(e,S)):(c=y!==s,l=!0),u>o&&o>=S&&y!==s&&(e=qe(e,o+1,y));c&&(e=qe(e,i,s))}return[e,n]}function ui(e){return typeof e.groupIndex<"u"}function di({offset:e},t){return t===e?0:t<e?-1:1}function Ht(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=qo(t,e,ur),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Uo(e,t){if(!mn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Ko(e,t,n){if(ui(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Uo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function fi(e,t,n,r=0){return r>0&&(t=Math.max(t,qo(e,r,ur).offset)),No(li(e,t,n,di),gi)}function pi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ve.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&Se(s)&&t.length===2){const y=t[0].size,x=t[1].size;i=n.reduce((b,v)=>qe(qe(b,v,y),v+1,x),i)}else[i,a]=ci(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S}=nr(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((y,x)=>qe(y,x,Ht(x,S,o)),Rt()),lastIndex:l,lastOffset:c,lastSize:u,offsetTree:S,sizeTree:i}}function hi(e){return mt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function zr(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=on(o,t-1,ur),a=o[l].offset;const c=nt(n,t-1);s=c[0],i=c[1],o.length&&o[l].size===nt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:u}of Tt(n,t,1/0)){const S=c-s,y=S*i+a+S*r;o.push({index:c,offset:y,size:u}),s=c,a=y,i=u}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function gi(e){return{index:e.index,value:e}}function mi(e){const{endIndex:t,size:n,startIndex:r}=e;return o=>o.start===r&&(o.end===t||o.end===1/0)&&o.value===n}const bi={offsetHeight:"height",offsetWidth:"width"},lt=xe(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Ne(r,0),s=ge(),i=ge(),a=N(0),l=N([]),c=N(void 0),u=N(void 0),S=N(void 0),y=N(void 0),x=N((f,w)=>ut(f,bi[w])),b=N(void 0),v=N(0),p=ai(),h=Ne(L(n,fe(l,e,v),it(pi,p),Ie()),p),d=Ne(L(l,Ie(),it((f,w)=>({current:w,prev:f.current}),{current:[],prev:[]}),K(({prev:f})=>f)),[]);J(L(l,ie(f=>f.length>0),fe(h,v),K(([f,w,T])=>{const j=f.reduce((O,z,C)=>qe(O,z,Ht(z,w.offsetTree,T)||C),Rt());return{...w,groupIndices:f,groupOffsetTree:j}})),h),J(L(r,fe(h),ie(([f,{lastIndex:w}])=>f<w),K(([f,{lastIndex:w,lastSize:T}])=>[{endIndex:w,size:T,startIndex:f}])),n),J(c,u);const k=Ne(L(c,K(f=>f===void 0)),!0);J(L(u,ie(f=>f!==void 0&&Se(Te(h).sizeTree)),K(f=>{const w=Te(S),T=Te(l).length>0;return w?T?[{endIndex:0,size:w,startIndex:0},{endIndex:1,size:f,startIndex:1}]:[]:[{endIndex:0,size:f,startIndex:0}]})),n),J(L(y,ie(f=>f!==void 0&&f.length>0&&Se(Te(h).sizeTree)),K(f=>{const w=[];let T=f[0],j=0;for(let O=1;O<f.length;O++){const z=f[O];z!==T&&(w.push({endIndex:O-1,size:T,startIndex:j}),T=z,j=O)}return w.push({endIndex:f.length-1,size:T,startIndex:j}),w})),n),J(L(l,fe(S,u),ie(([,f,w])=>f!==void 0&&w!==void 0),K(([f,w,T])=>{const j=[];for(let O=0;O<f.length;O++){const z=f[O],C=f[O+1];j.push({startIndex:z,endIndex:z,size:w}),C!==void 0&&j.push({startIndex:z+1,endIndex:C-1,size:T})}return j})),n);const _=Ue(L(n,fe(h),it(({sizes:f},[w,T])=>({changed:T!==f,sizes:T}),{changed:!1,sizes:p}),K(f=>f.changed)));ve(L(a,it((f,w)=>({diff:f.prev-w,prev:w}),{diff:0,prev:0}),K(f=>f.diff)),f=>{const{groupIndices:w}=Te(h);if(f>0)de(t,!0),de(s,f+zr(f,w));else if(f<0){const T=Te(d);T.length>0&&(f-=zr(-f,T)),de(i,f)}}),ve(L(a,fe(e)),([f,w])=>{f<0&&w("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ve.ERROR)});const I=Ue(s);J(L(s,fe(h),K(([f,w])=>{const T=w.groupIndices.length>0,j=[],O=w.lastSize;if(T){const z=Lt(w.sizeTree,0);let C=0,M=0;for(;C<f;){const H=w.groupIndices[M],E=w.groupIndices.length===M+1?1/0:w.groupIndices[M+1]-H-1;j.push({endIndex:H,size:z,startIndex:H}),j.push({endIndex:H+1+E-1,size:O,startIndex:H+1}),M++,C+=E+1}const A=mt(w.sizeTree);return C!==f&&A.shift(),A.reduce((H,{k:E,v:P})=>{let F=H.ranges;return H.prevSize!==0&&(F=[...H.ranges,{endIndex:E+f-1,size:H.prevSize,startIndex:H.prevIndex}]),{prevIndex:E+f,prevSize:P,ranges:F}},{prevIndex:f,prevSize:0,ranges:j}).ranges}return mt(w.sizeTree).reduce((z,{k:C,v:M})=>({prevIndex:C+f,prevSize:M,ranges:[...z.ranges,{endIndex:C+f-1,size:z.prevSize,startIndex:z.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const R=Ue(L(i,fe(h,v),K(([f,{offsetTree:w},T])=>{const j=-f;return Ht(j,w,T)})));return J(L(i,fe(h,v),K(([f,w,T])=>{if(w.groupIndices.length>0){if(Se(w.sizeTree))return w;let j=Rt();const O=Te(d);let z=0,C=0,M=0;for(;z<-f;){M=O[C];const A=O[C+1]-M-1;C++,z+=A+1}if(j=mt(w.sizeTree).reduce((A,{k:H,v:E})=>qe(A,Math.max(0,H+f),E),j),z!==-f){const A=Lt(w.sizeTree,M);j=qe(j,0,A);const H=nt(w.sizeTree,-f+1)[1];j=qe(j,1,H)}return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}else{const j=mt(w.sizeTree).reduce((O,{k:z,v:C})=>qe(O,Math.max(0,z+f),C),Rt());return{...w,sizeTree:j,...nr(w.offsetTree,0,j,T)}}})),h),{beforeUnshiftWith:I,data:b,defaultItemSize:u,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:S,gap:v,groupIndices:l,heightEstimates:y,itemSize:x,listRefresh:_,shiftWith:i,shiftWithOffset:R,sizeRanges:n,sizes:h,statefulTotalCount:o,totalCount:r,trackItemSizes:k,unshiftWith:s}},ke(ft,cr),{singleton:!0});function xi(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Qo=xe(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),a=Ue(L(s,K(xi)));return J(L(a,K(l=>l.totalCount)),n),J(L(a,K(l=>l.groupIndices)),e),J(L(Pe(o,t,r),ie(([l,c])=>mn(c)),K(([l,c,u])=>nt(c.groupOffsetTree,Math.max(l-u,0),"v")[0]),Ie(),K(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(lt,We)),pt=xe(([{log:e}])=>{const t=N(!1),n=Ue(L(t,ie(r=>r),Ie()));return ve(t,r=>{r&&Te(e)("props updated",{},Ve.DEBUG)}),{didMount:n,propsReady:t}},ke(ft),{singleton:!0}),vi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Yo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!vi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const $t=xe(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:u,viewportHeight:S},{log:y}])=>{const x=ge(),b=ge(),v=N(0);let p=null,h=null,d=null;function k(){p&&(p(),p=null),d&&(d(),d=null),h&&(clearTimeout(h),h=null),de(l,!1)}return J(L(x,fe(n,S,r,v,a,i,y),fe(e,s,o),K(([[_,I,R,f,w,T,j,O],z,C,M])=>{const A=Yo(_),{align:H,behavior:E,offset:P}=A,F=f-1,V=Ko(A,I,F);let Q=Ht(V,I.offsetTree,z)+T;H==="end"?(Q+=C+nt(I.sizeTree,V)[1]-R+M,V===F&&(Q+=j)):H==="center"?Q+=(C+nt(I.sizeTree,V)[1]-R+M)/2:Q-=w,P&&(Q+=P);const te=pe=>{k(),pe?(O("retrying to scroll to",{location:_},Ve.DEBUG),de(x,_)):(de(b,!0),O("list did not change, scroll successful",{},Ve.DEBUG))};if(k(),E==="smooth"){let pe=!1;d=ve(t,ye=>{pe=pe||ye}),p=tt(u,()=>{te(pe)})}else p=tt(L(t,Si(150)),te);return h=setTimeout(()=>{k()},1200),de(l,!0),O("scrolling from index to",{behavior:E,index:V,top:Q},Ve.DEBUG),{behavior:E,top:Q}})),c),{scrollTargetReached:b,scrollToIndex:x,topListHeight:v}},ke(lt,We,ft),{singleton:!0});function Si(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function dr(e,t){e==0?t():requestAnimationFrame(()=>{dr(e-1,t)})}function fr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const qt=xe(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=N(!0),l=N(0),c=N(!0);return J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),a),J(L(i,fe(l),ie(([u,S])=>!!S),st(!1)),c),ve(L(Pe(t,i),fe(a,n,e,c),ie(([[,u],S,{sizeTree:y},x,b])=>u&&(!Se(y)||ir(x))&&!S&&!b),fe(l)),([,u])=>{tt(o,()=>{de(c,!0)}),dr(4,()=>{tt(r,()=>{de(a,!0)}),de(s,u)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},ke(lt,We,$t,pt),{singleton:!0});function Xo(e,t){return Math.abs(e-t)<1.01}const Nt="up",Bt="down",yi="none",wi={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ci=0,Ut=xe(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=N(!1),a=N(!0),l=ge(),c=ge(),u=N(4),S=N(Ci),y=Ne(L(Zn(L(se(o),bt(1),st(!0)),L(se(o),bt(1),st(!1),Or(100))),Ie()),!1),x=Ne(L(Zn(L(n,st(!0)),L(n,st(!1),Or(200))),Ie()),!1);J(L(Pe(se(o),se(S)),K(([d,k])=>d<=k),Ie()),a),J(L(a,at(50)),c);const b=Ue(L(Pe(r,se(s),se(t),se(e),se(u)),it((d,[{scrollHeight:k,scrollTop:_},I,R,f,w])=>{const T=_+I-k>-w,j={scrollHeight:k,scrollTop:_,viewportHeight:I};if(T){let z,C;return _>d.state.scrollTop?(z="SCROLLED_DOWN",C=d.state.scrollTop-_):(z="SIZE_DECREASED",C=d.state.scrollTop-_||d.scrollTopDelta),{atBottom:!0,atBottomBecause:z,scrollTopDelta:C,state:j}}let O;return j.scrollHeight>d.state.scrollHeight?O="SIZE_INCREASED":I<d.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":_<d.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:j}},wi),Ie((d,k)=>d&&d.atBottom===k.atBottom))),v=Ne(L(r,it((d,{scrollHeight:k,scrollTop:_,viewportHeight:I})=>{if(Xo(d.scrollHeight,k))return{changed:!1,jump:0,scrollHeight:k,scrollTop:_};{const R=k-(_+I)<1;return d.scrollTop!==_&&R?{changed:!0,jump:d.scrollTop-_,scrollHeight:k,scrollTop:_}:{changed:!0,jump:0,scrollHeight:k,scrollTop:_}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(d=>d.changed),K(d=>d.jump)),0);J(L(b,K(d=>d.atBottom)),i),J(L(i,at(50)),l);const p=N(Bt);J(L(r,K(({scrollTop:d})=>d),Ie(),it((d,k)=>Te(x)?{direction:d.direction,prevScrollTop:k}:{direction:k<d.prevScrollTop?Nt:Bt,prevScrollTop:k},{direction:Bt,prevScrollTop:0}),K(d=>d.direction)),p),J(L(r,at(50),st(yi)),p);const h=N(0);return J(L(y,ie(d=>!d),st(0)),h),J(L(o,at(100),fe(y),ie(([d,k])=>k),it(([d,k],[_])=>[k,_],[0,0]),K(([d,k])=>k-d)),h),{atBottomState:b,atBottomStateChange:l,atBottomThreshold:u,atTopStateChange:c,atTopThreshold:S,isAtBottom:i,isAtTop:a,isScrolling:y,lastJumpDueToItemResize:v,scrollDirection:p,scrollVelocity:h}},ke(We)),Ft="top",Wt="bottom",Ar="none";function Lr(e,t,n){return typeof e=="number"?n===Nt&&t===Ft||n===Bt&&t===Wt?e:0:n===Nt?t===Ft?e.main:e.reverse:t===Wt?e.main:e.reverse}function Gr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const pr=xe(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=N(0),a=N(0),l=N(0),c=Ne(L(Pe(se(r),se(o),se(n),se(s,Gt),se(l),se(i),se(t),se(e),se(a)),K(([u,S,y,[x,b],v,p,h,d,k])=>{const _=u-d,I=p+h,R=Math.max(y-_,0);let f=Ar;const w=Gr(k,Ft),T=Gr(k,Wt);return x-=d,x+=y+h,b+=y+h,b-=d,x>u+I-w&&(f=Nt),b<u-R+S+T&&(f=Bt),f!==Ar?[Math.max(_-y-Lr(v,Ft,f)-w,0),_-R-h+S+Lr(v,Wt,f)+T]:null}),ie(u=>u!=null),Ie(Gt)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},ke(We),{singleton:!0});function Ii(e,t,n){if(mn(t)){const r=Uo(e,t);return[{index:nt(t.groupOffsetTree,r)[0],offset:0,size:0},{data:n==null?void 0:n[0],index:r,offset:0,size:0}]}return[{data:n==null?void 0:n[0],index:e,offset:0,size:0}]}const Mn={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function nn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,u=0;if(e.length>0){c=e[0].offset;const v=e[e.length-1];u=v.offset+v.size}const S=n-i,y=a+S*l+(S-1)*r,x=c,b=y-u;return{bottom:u,firstItemIndex:s,items:Hr(e,o,s),offsetBottom:b,offsetTop:c,top:x,topItems:Hr(t,o,s),topListHeight:t.reduce((v,p)=>p.size+v,0),totalCount:n}}function Zo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const u of n.groupIndices){if(u-i>=e)break;i++}const a=e+i,l=fr(t,a),c=Array.from({length:a}).map((u,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return nn(c,[],a,o,n,r)}function Hr(e,t,n){if(e.length===0)return[];if(!mn(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Tt(t.groupOffsetTree,r,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let u;c.index===a.start?u={index:l,type:"group"}:u={groupIndex:l,index:c.index-(l+1)+n},s.push({...u,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Nr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const St=xe(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:u},{topListHeight:S},y,{didMount:x},{recalcInProgress:b}])=>{const v=N([]),p=N(0),h=ge(),d=N(0);J(s.topItemsIndexes,v);const k=Ne(L(Pe(x,b,se(l,Gt),se(o),se(r),se(c),u,se(v),se(t),se(n),se(d),e),ie(([f,w,,T,,,,,,,,j])=>{const O=j&&j.length!==T;return f&&!w&&!O}),K(([,,[f,w],T,j,O,z,C,M,A,H,E])=>{var P,F,V,Q;const te=j,{offsetTree:pe,sizeTree:ye}=te,me=Te(p);if(T===0)return{...Mn,totalCount:T};if(f===0&&w===0)return me===0?{...Mn,totalCount:T}:Zo(me,O,j,M,A,E||[]);if(Se(ye))return me>0?null:nn(Ii(fr(O,T),te,E),[],T,A,te,M);const q=[];if(C.length>0){const Y=C[0],re=C[C.length-1];let ee=0;for(const be of Tt(ye,Y,re)){const oe=be.value,le=Math.max(be.start,Y),he=Math.min(be.end,re);for(let ue=le;ue<=he;ue++)q.push({data:E==null?void 0:E[ue],index:ue,offset:ee,size:oe}),ee+=oe}}if(!z)return nn([],q,T,A,te,M);const ne=C.length>0?C[C.length-1]+1:0,B=fi(pe,f,w,ne);if(B.length===0)return null;const U=T-1,G=gn([],Y=>{for(const re of B){const ee=re.value;let be=ee.offset,oe=re.start;const le=ee.size;if(ee.offset<f){oe+=Math.floor((f-ee.offset+A)/(le+A));const ue=oe-re.start;be+=ue*le+ue*A}oe<ne&&(be+=(ne-oe)*le,oe=ne);const he=Math.min(re.end,U);for(let ue=oe;ue<=he&&!(be>=w);ue++)Y.push({data:E==null?void 0:E[ue],index:ue,offset:be,size:le}),be+=le+A}}),Z=Nr(H,Ft),D=Nr(H,Wt);if(G.length>0&&(Z>0||D>0)){const Y=G[0],re=G[G.length-1];if(Z>0&&Y.index>ne){const ee=Math.min(Z,Y.index-ne),be=[];let oe=Y.offset;for(let le=Y.index-1;le>=Y.index-ee;le--){const he=(F=(P=Tt(ye,le,le)[0])==null?void 0:P.value)!=null?F:Y.size;oe-=he+A,be.unshift({data:E==null?void 0:E[le],index:le,offset:oe,size:he})}G.unshift(...be)}if(D>0&&re.index<U){const ee=Math.min(D,U-re.index);let be=re.offset+re.size+A;for(let oe=re.index+1;oe<=re.index+ee;oe++){const le=(Q=(V=Tt(ye,oe,oe)[0])==null?void 0:V.value)!=null?Q:re.size;G.push({data:E==null?void 0:E[oe],index:oe,offset:be,size:le}),be+=le+A}}}return nn(G,q,T,A,te,M)}),ie(f=>f!==null),Ie()),Mn);J(L(e,ie(ir),K(f=>f==null?void 0:f.length)),o),J(L(k,K(f=>f.topListHeight)),S),J(S,a),J(L(k,K(f=>[f.top,f.bottom])),i),J(L(k,K(f=>f.items)),h);const _=Ue(L(k,ie(({items:f})=>f.length>0),fe(o,e),ie(([{items:f},w])=>f[f.length-1].originalIndex===w-1),K(([,f,w])=>[f-1,w]),Ie(Gt),K(([f])=>f))),I=Ue(L(k,at(200),ie(({items:f,topItems:w})=>f.length>0&&f[0].originalIndex===w.length),K(({items:f})=>f[0].index),Ie())),R=Ue(L(k,ie(({items:f})=>f.length>0),K(({items:f})=>{let w=0,T=f.length-1;for(;f[w].type==="group"&&w<T;)w++;for(;f[T].type==="group"&&T>w;)T--;return{endIndex:f[T].index,startIndex:f[w].index}}),Ie($o)));return{endReached:_,initialItemCount:p,itemsRendered:h,listState:k,minOverscanItemCount:d,rangeChanged:R,startReached:I,topItemsIndexes:v,...y}},ke(lt,Qo,pr,qt,$t,Ut,pt,cr),{singleton:!0}),Jo=xe(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Ne(L(Pe(n,e,r,t,o),K(([a,l,c,u,S])=>a+l+c+u+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,St),{singleton:!0}),ki=xe(([{viewportHeight:e},{totalListHeight:t}])=>{const n=N(!1),r=Ne(L(Pe(n,e,t),ie(([o])=>o),K(([,o,s])=>Math.max(0,o-s)),at(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,Jo),{singleton:!0}),es=xe(()=>({context:N(null)})),Ri=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ts=xe(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const u=ge();return J(L(u,fe(t,l,n,s,o,r,a),fe(e),K(([[S,y,x,b,v,p,h,d],k])=>{const{align:_,behavior:I,calculateViewLocation:R=Ri,done:f,...w}=S,T=Ko(S,y,b-1),j=Ht(T,y.offsetTree,k)+v+p,O=j+nt(y.sizeTree,T)[1],z=d+p,C=d+x-h,M=R({itemBottom:O,itemTop:j,locationParams:{align:_,behavior:I,...w},viewportBottom:C,viewportTop:z});return M?f&&tt(L(i,ie(A=>!A),bt(Te(i)?1:2)),f):f==null||f(),M}),ie(S=>S!==null)),c),{scrollIntoView:u}},ke(lt,We,$t,St,ft),{singleton:!0});function Fr(e){return e?e==="smooth"?"smooth":"auto":!1}const Ti=(e,t)=>typeof e=="function"?Fr(e(t)):t&&Fr(e),_i=xe(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:u},{scrollingInProgress:S},{context:y},{scrollIntoView:x}])=>{const b=N(!1),v=ge();let p=null;function h(I){de(i,{align:"end",behavior:I,index:"LAST"})}ve(L(Pe(L(se(t),bt(1)),l),fe(se(b),s,a,S),K(([[I,R],f,w,T,j])=>{let O=R&&T,z="auto";return O&&(z=Ti(f,w||j),O=O&&!!z),{followOutputBehavior:z,shouldFollow:O,totalCount:I}}),ie(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:R})=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I)}):p=tt(e,()=>{Te(u)("following output to ",{totalCount:R},Ve.DEBUG),h(I),p=null})});function d(I){const R=tt(o,f=>{I&&!f.atBottom&&f.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Te(u)("scrolling to bottom due to increased size",{},Ve.DEBUG),h("auto"))});setTimeout(R,100)}ve(L(Pe(se(b),t,c),ie(([I,,R])=>I&&R),it(({value:I},[,R])=>({refreshed:I===R,value:R}),{refreshed:!1,value:0}),ie(({refreshed:I})=>I),fe(b,t)),([,I])=>{Te(a)&&d(I!==!1)}),ve(v,()=>{d(Te(b)!==!1)}),ve(Pe(se(b),o),([I,R])=>{I&&!R.atBottom&&R.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&h("auto")});const k=N(null),_=ge();return J(Zn(L(se(r),K(I=>{var R;return(R=I==null?void 0:I.length)!=null?R:0})),L(se(t))),_),ve(L(Pe(L(_,bt(1)),l),fe(se(k),a,S,y),K(([[I,R],f,w,T,j])=>R&&w&&(f==null?void 0:f({context:j,totalCount:I,scrollingInProgress:T}))),ie(I=>!!I),at(0)),I=>{p&&(p(),p=null),Te(n)?requestAnimationFrame(()=>{Te(u)("scrolling into view",{}),de(x,I)}):p=tt(e,()=>{Te(u)("scrolling into view",{}),de(x,I),p=null})}),{autoscrollToBottom:v,followOutput:b,scrollIntoViewOnChange:k}},ke(lt,Ut,$t,qt,pt,ft,We,es,ts)),Mi=xe(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(J(L(a,fe(s),ie(([,l])=>l!==0),fe(o,r,t,n,e),K(([[,l],c,u,S,y,x=[]])=>Zo(l,c,u,S,y,x))),i),{}),ke(lt,qt,St,pt),{singleton:!0}),Ei=xe(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=N(0);return ve(L(e,fe(r),ie(([,o])=>o!==0),K(([,o])=>({top:o}))),o=>{tt(L(n,bt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{de(t,o)})})}),{initialScrollTop:r}},ke(pt,We,St),{singleton:!0}),ns=xe(([{scrollVelocity:e}])=>{const t=N(!1),n=ge(),r=N(!1);return J(L(e,fe(r,t,n),ie(([o,s])=>!!s),K(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),Ie()),t),ve(L(Pe(t,e,n),fe(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Ut),{singleton:!0}),hr=xe(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=N(!1),i=N(void 0);return J(L(Pe(n,r),K(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:u}])=>({scrollHeight:a,scrollTop:Math.max(0,l-u),viewportHeight:c}))),e),J(L(t,fe(r),K(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),ji=xe(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=ge(),u=N(void 0),S=N(null),y=N(null);return J(a,S),J(l,y),ve(L(c,fe(t,r,i,S,y,n)),([x,b,v,p,h,d,k])=>{const _=hi(b.sizeTree);p&&h!==null&&d!==null&&(v=h.scrollTop-d.offsetTop),v-=k,x({ranges:_,scrollTop:v})}),J(L(u,ie(ir),K(Oi)),o),J(L(s,fe(u),ie(([,x])=>x!==void 0),Ie(),K(([,x])=>x.ranges)),e),{getState:c,restoreStateFrom:u}},ke(lt,We,qt,pt,hr));function Oi(e){return{align:"start",index:0,offset:e.scrollTop}}const Pi=xe(([{topItemsIndexes:e}])=>{const t=N(0);return J(L(t,ie(n=>n>=0),K(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(St));function rs(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Bi=rs(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),zi=xe(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:u,shiftWithOffset:S,sizes:y},{log:x},{recalcInProgress:b}])=>{const v=Ue(L(l,fe(i),it(([,h,d,k],[{bottom:_,items:I,offsetBottom:R,totalCount:f},w])=>{const T=_+R;let j=0;return d===f&&h.length>0&&I.length>0&&(I[0].originalIndex===0&&h[0].originalIndex===0||(j=T-k,j!==0&&(j+=w))),[j,I,f,T]},[0,[],0,0]),ie(([h])=>h!==0),fe(r,a,n,o,x,b),ie(([,h,d,k,,,_])=>!_&&!k&&h!==0&&d===Nt),K(([[h],,,,,d])=>(d("Upward scrolling compensation",{amount:h},Ve.DEBUG),h))));function p(h){h>0?(de(t,{behavior:"auto",top:-h}),de(e,0)):(de(e,0),de(t,{behavior:"auto",top:-h}))}return ve(L(v,fe(e,s)),([h,d,k])=>{k&&Bi()?de(e,d-h):p(-h)}),ve(L(Pe(Ne(s,!1),e,b),ie(([h,d,k])=>!h&&!k&&d!==0),K(([h,d])=>d),at(1)),p),J(L(S,K(h=>({top:-h}))),t),ve(L(c,fe(y,u),K(([h,{groupIndices:d,lastSize:k,sizeTree:_},I])=>{function R(f){return f*(k+I)}if(d.length===0)return R(h);{let f=0;const w=Lt(_,0);let T=0,j=0;for(;T<h;){T++,f+=w;let O=d.length===j+1?1/0:d[j+1]-d[j]-1;T+O>h&&(f-=w,O=h-T+1),T+=O,f+=R(O),j++}return f}})),h=>{de(e,h),requestAnimationFrame(()=>{de(t,{top:h}),requestAnimationFrame(()=>{de(e,0),de(b,!1)})})}),{deviation:e}},ke(We,Ut,St,lt,ft,cr)),Ai=xe(([e,t,n,r,o,s,i,a,l,c,u])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...u}),ke(pr,Mi,pt,ns,Jo,Ei,ki,hr,ts,ft,es)),os=xe(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:u,statefulTotalCount:S,totalCount:y,trackItemSizes:x},{initialItemFinalLocationReached:b,initialTopMostItemIndex:v,scrolledToInitialItem:p},h,d,k,_,{scrollToIndex:I},R,{topItemCount:f},{groupCounts:w},T])=>{const{listState:j,minOverscanItemCount:O,topItemsIndexes:z,rangeChanged:C,...M}=_;return J(C,T.scrollSeekRangeChanged),J(L(T.windowViewportRect,K(A=>A.visibleHeight)),h.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:w,heightEstimates:a,initialItemFinalLocationReached:b,initialTopMostItemIndex:v,scrolledToInitialItem:p,sizeRanges:c,topItemCount:f,topItemsIndexes:z,totalCount:y,...k,groupIndices:i,itemSize:l,listState:j,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:S,trackItemSizes:x,rangeChanged:C,...M,...T,...h,sizes:u,...d}},ke(lt,qt,We,ji,_i,St,$t,zi,Pi,Qo,Ai));function Li(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const i in t)Object.hasOwn(r,i)||(n[i]=t[i]);return n}const Zt=typeof document<"u"?g.useLayoutEffect:g.useEffect;function ss(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=g.createContext({});function l(p,h){p.propsReady&&de(p.propsReady,!1);for(const d of r){const k=p[t.required[d]];de(k,h[d])}for(const d of o)if(d in h){const k=p[t.optional[d]];de(k,h[d])}p.propsReady&&de(p.propsReady,!0)}function c(p){return s.reduce((h,d)=>(h[d]=k=>{const _=p[t.methods[d]];de(_,k)},h),{})}function u(p){return i.reduce((h,d)=>(h[d]=Js(p[t.events[d]]),h),{})}const S=g.forwardRef((p,h)=>{const{children:d,...k}=p,[_]=g.useState(()=>gn(ti(e),f=>{l(f,k)})),[I]=g.useState(jr(u,_));Zt(()=>{for(const f of i)f in k&&ve(I[f],k[f]);return()=>{Object.values(I).map(lr)}},[k,I,_]),Zt(()=>{l(_,k)}),g.useImperativeHandle(h,Er(c(_)));const R=n;return m.jsx(a.Provider,{value:_,children:n?m.jsx(R,{...Li([...r,...o,...i],k),children:d}):d})}),y=p=>{const h=g.useContext(a);return g.useCallback(d=>{de(h[p],d)},[h,p])},x=p=>{const h=g.useContext(a)[p],d=g.useCallback(k=>ve(h,k),[h]);return g.useSyncExternalStore(d,()=>Te(h),()=>Te(h))},b=p=>{const h=g.useContext(a)[p],[d,k]=g.useState(jr(Te,h));return Zt(()=>ve(h,_=>{_!==d&&k(Er(_))}),[h,d]),d},v=g.version.startsWith("18")?x:b;return{Component:S,useEmitter:(p,h)=>{const d=g.useContext(a)[p];Zt(()=>ve(d,h),[h,d])},useEmitterValue:v,usePublisher:y}}const is=g.createContext(void 0),ls=g.createContext(void 0),as=typeof document<"u"?g.useLayoutEffect:g.useEffect;function En(e){return"self"in e}function Gi(e){return"body"in e}function cs(e,t,n,r=jt,o,s){const i=g.useRef(null),a=g.useRef(null),l=g.useRef(null),c=g.useCallback(y=>{let x,b,v;const p=y.target;if(Gi(p)||En(p)){const d=En(p)?p:p.defaultView;v=s?d.scrollX:d.scrollY,x=s?d.document.documentElement.scrollWidth:d.document.documentElement.scrollHeight,b=s?d.innerWidth:d.innerHeight}else v=s?p.scrollLeft:p.scrollTop,x=s?p.scrollWidth:p.scrollHeight,b=s?p.offsetWidth:p.offsetHeight;const h=()=>{e({scrollHeight:x,scrollTop:Math.max(v,0),viewportHeight:b})};y.suppressFlushSync?h():Os.flushSync(h),a.current!==null&&(v===a.current||v<=0||v===x-b)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);g.useEffect(()=>{const y=o||i.current;return r(o||i.current),c({suppressFlushSync:!0,target:y}),y.addEventListener("scroll",c,{passive:!0}),()=>{r(null),y.removeEventListener("scroll",c)}},[i,c,n,r,o]);function u(y){const x=i.current;if(!x||(s?"offsetWidth"in x&&x.offsetWidth===0:"offsetHeight"in x&&x.offsetHeight===0))return;const b=y.behavior==="smooth";let v,p,h;En(x)?(p=Math.max(ut(x.document.documentElement,s?"width":"height"),s?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight),v=s?x.innerWidth:x.innerHeight,h=s?window.scrollX:window.scrollY):(p=x[s?"scrollWidth":"scrollHeight"],v=ut(x,s?"width":"height"),h=x[s?"scrollLeft":"scrollTop"]);const d=p-v;if(y.top=Math.ceil(Math.max(Math.min(d,y.top),0)),Xo(v,p)||y.top===h){e({scrollHeight:p,scrollTop:h,viewportHeight:v}),b&&t(!0);return}b?(a.current=y.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(y={behavior:y.behavior,left:y.top}),x.scrollTo(y)}function S(y){s&&(y={behavior:y.behavior,left:y.top}),i.current.scrollBy(y)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:u}}const jn="-webkit-sticky",Wr="sticky",gr=rs(()=>{if(typeof document>"u")return Wr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Wr});function mr(e){return e}const Hi=xe(()=>{const e=N(a=>`Item ${a}`),t=N(a=>`Group ${a}`),n=N({}),r=N(mr),o=N("div"),s=N(jt),i=(a,l=null)=>Ne(L(n,K(c=>c[a]),Ie()),l);return{components:n,computeItemKey:r,EmptyPlaceholder:i("EmptyPlaceholder"),FooterComponent:i("Footer"),GroupComponent:i("Group","div"),groupContent:t,HeaderComponent:i("Header"),HeaderFooterTag:o,ItemComponent:i("Item","div"),itemContent:e,ListComponent:i("List","div"),ScrollerComponent:i("Scroller","div"),scrollerRef:s,ScrollSeekPlaceholder:i("ScrollSeekPlaceholder"),TopItemListComponent:i("TopItemList")}}),Ni=xe(([e,t])=>({...e,...t}),ke(os,Hi)),Fi=({height:e})=>m.jsx("div",{style:{height:e}}),Wi={overflowAnchor:"none",position:gr(),zIndex:1},us={overflowAnchor:"none"},Di={...us,display:"inline-block",height:"100%"},Dr=g.memo(function({showTopList:e=!1}){const t=ae("listState"),n=Ke("sizeRanges"),r=ae("useWindowScroll"),o=ae("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),a=o||r?s:i,l=ae("itemContent"),c=ae("context"),u=ae("groupContent"),S=ae("trackItemSizes"),y=ae("itemSize"),x=ae("log"),b=Ke("gap"),v=ae("horizontalDirection"),{callbackRef:p}=oi(n,y,S,e?jt:a,x,b,o,v,ae("skipAnimationFrameInResizeObserver")),[h,d]=g.useState(0);br("deviation",M=>{h!==M&&d(M)});const k=ae("EmptyPlaceholder"),_=ae("ScrollSeekPlaceholder")||Fi,I=ae("ListComponent"),R=ae("ItemComponent"),f=ae("GroupComponent"),w=ae("computeItemKey"),T=ae("isSeeking"),j=ae("groupIndices").length>0,O=ae("alignToBottom"),z=ae("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:h!==0?h:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:h!==0?h:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...z?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&k?m.jsx(k,{...He(k,c)}):m.jsx(I,{...He(I,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:C,children:(e?t.topItems:t.items).map(M=>{const A=M.originalIndex,H=w(A+t.firstItemIndex,M.data,c);return T?g.createElement(_,{...He(_,c),height:M.size,index:M.index,key:H,type:M.type||"item",...M.type==="group"?{}:{groupIndex:M.groupIndex}}):M.type==="group"?g.createElement(f,{...He(f,c),"data-index":A,"data-item-index":M.index,"data-known-size":M.size,key:H,style:Wi},u(M.index,c)):g.createElement(R,{...He(R,c),...Ui(R,M.data),"data-index":A,"data-item-group-index":M.groupIndex,"data-item-index":M.index,"data-known-size":M.size,key:H,style:v?Di:us},j?l(M.index,M.groupIndex,M.data,c):l(M.index,M.data,c))})})}),Vi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},$i={outline:"none",overflowX:"auto",position:"relative"},bn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),qi={position:gr(),top:0,width:"100%",zIndex:1};function He(e,t){if(typeof e!="string")return{context:t}}function Ui(e,t){return{item:typeof e=="string"?void 0:t}}const Ki=g.memo(function(){const e=ae("HeaderComponent"),t=Ke("headerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),Qi=g.memo(function(){const e=ae("FooterComponent"),t=Ke("footerHeight"),n=ae("HeaderFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ae("skipAnimationFrameInResizeObserver")),o=ae("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null});function ds({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:y,scrollerRef:x,scrollToCallback:b}=cs(a,c,l,u,void 0,S);return e("scrollTo",b),e("scrollBy",y),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:x,style:{...S?$i:Vi,...o},tabIndex:0,...i,...He(l,s),children:r})})}function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return g.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),u=t("totalListHeight"),S=t("deviation"),y=t("customScrollParent"),x=g.useRef(null),b=t("scrollerRef"),{scrollByCallback:v,scrollerRef:p,scrollToCallback:h}=cs(a,c,l,b,y);return as(()=>{var d;return p.current=y||((d=x.current)==null?void 0:d.ownerDocument.defaultView),()=>{p.current=null}},[p,y]),e("windowScrollTo",h),e("scrollBy",v),m.jsx(l,{ref:x,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...u!==0?{height:u+S}:{}},...i,...He(l,s),children:r})})}const Yi=({children:e})=>{const t=g.useContext(is),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=ae("alignToBottom"),s=ae("horizontalDirection"),i=g.useMemo(()=>Lo(n,l=>ut(l,s?"width":"height")),[n,s]),a=vt(i,!0,ae("skipAnimationFrameInResizeObserver"));return g.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:a,style:bn(o),children:e})},Xi=({children:e})=>{const t=g.useContext(is),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=ae("customScrollParent"),s=Ho(n,o,ae("skipAnimationFrameInResizeObserver")),i=ae("alignToBottom");return g.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),m.jsx("div",{"data-viewport-type":"window",ref:s,style:bn(i),children:e})},Zi=({children:e})=>{const t=ae("TopItemListComponent")||"div",n=ae("headerHeight"),r={...qi,marginTop:`${n}px`},o=ae("context");return m.jsx(t,{style:r,...He(t,o),children:e})},Ji=g.memo(function(e){const t=ae("useWindowScroll"),n=ae("topItemsIndexes").length>0,r=ae("customScrollParent"),o=ae("context");return m.jsxs(r||t?nl:tl,{...e,context:o,children:[n&&m.jsx(Zi,{children:m.jsx(Dr,{showTopList:!0})}),m.jsxs(r||t?Xi:Yi,{children:[m.jsx(Ki,{}),m.jsx(Dr,{}),m.jsx(Qi,{})]})]})}),{Component:el,useEmitter:br,useEmitterValue:ae,usePublisher:Ke}=ss(Ni,{required:{},optional:{restoreStateFrom:"restoreStateFrom",context:"context",followOutput:"followOutput",scrollIntoViewOnChange:"scrollIntoViewOnChange",itemContent:"itemContent",groupContent:"groupContent",overscan:"overscan",increaseViewportBy:"increaseViewportBy",minOverscanItemCount:"minOverscanItemCount",totalCount:"totalCount",groupCounts:"groupCounts",topItemCount:"topItemCount",firstItemIndex:"firstItemIndex",initialTopMostItemIndex:"initialTopMostItemIndex",components:"components",atBottomThreshold:"atBottomThreshold",atTopThreshold:"atTopThreshold",computeItemKey:"computeItemKey",defaultItemHeight:"defaultItemHeight",fixedGroupHeight:"fixedGroupHeight",fixedItemHeight:"fixedItemHeight",heightEstimates:"heightEstimates",itemSize:"itemSize",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"HeaderFooterTag",data:"data",initialItemCount:"initialItemCount",initialScrollTop:"initialScrollTop",alignToBottom:"alignToBottom",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",horizontalDirection:"horizontalDirection",skipAnimationFrameInResizeObserver:"skipAnimationFrameInResizeObserver"},methods:{scrollToIndex:"scrollToIndex",scrollIntoView:"scrollIntoView",scrollTo:"scrollTo",scrollBy:"scrollBy",autoscrollToBottom:"autoscrollToBottom",getState:"getState"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",totalListHeightChanged:"totalListHeightChanged",itemsRendered:"itemsRendered",groupIndices:"groupIndices"}},Ji),tl=ds({useEmitter:br,useEmitterValue:ae,usePublisher:Ke}),nl=fs({useEmitter:br,useEmitterValue:ae,usePublisher:Ke}),rl=el,ol=xe(()=>{const e=N(c=>m.jsxs("td",{children:["Item $",c]})),t=N(null),n=N(c=>m.jsxs("td",{colSpan:1e3,children:["Group ",c]})),r=N(null),o=N(null),s=N({}),i=N(mr),a=N(jt),l=(c,u=null)=>Ne(L(s,K(S=>S[c]),Ie()),u);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});ke(os,ol);gr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},sl={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:$r,floor:sn,max:zt,min:On,round:qr}=Math;function Ur(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function il(e){return{...sl,items:e}}function Jt(e,t){return e&&e.width===t.width&&e.height===t.height}function ll(e,t){return e&&e.column===t.column&&e.row===t.row}const al=xe(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:u,viewportHeight:S},y,x,{didMount:b,propsReady:v},{customScrollParent:p,useWindowScroll:h,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_},I])=>{const R=N(0),f=N(0),w=N(Vr),T=N({height:0,width:0}),j=N({height:0,width:0}),O=ge(),z=ge(),C=N(0),M=N(null),A=N({column:0,row:0}),H=ge(),E=ge(),P=N(!1),F=N(0),V=N(!0),Q=N(!1),te=N(!1);ve(L(b,fe(F),ie(([B,U])=>!!U)),()=>{de(V,!1)}),ve(L(Pe(b,V,j,T,F,Q),ie(([B,U,G,Z,,D])=>B&&!U&&G.height!==0&&Z.height!==0&&!D)),([,,,,B])=>{de(Q,!0),dr(1,()=>{de(O,B)}),tt(L(c),()=>{de(t,[0,0]),de(V,!0)})}),J(L(E,ie(B=>B!=null&&B.scrollTop>0),st(0)),f),ve(L(b,fe(E),ie(([,B])=>B!=null)),([,B])=>{B&&(de(T,B.viewport),de(j,B.item),de(A,B.gap),B.scrollTop>0&&(de(P,!0),tt(L(c,bt(1)),U=>{de(P,!1)}),de(l,{top:B.scrollTop})))}),J(L(T,K(({height:B})=>B)),S),J(L(Pe(se(T,Jt),se(j,Jt),se(A,(B,U)=>B&&B.column===U.column&&B.row===U.row),se(c)),K(([B,U,G,Z])=>({gap:G,item:U,scrollTop:Z,viewport:B}))),H),J(L(Pe(se(R),r,se(A,ll),se(j,Jt),se(T,Jt),se(M),se(f),se(P),se(V),se(F)),ie(([,,,,,,,B])=>!B),K(([B,[U,G],Z,D,Y,re,ee,,be,oe])=>{const{column:le,row:he}=Z,{height:ue,width:Ce}=D,{width:Ae}=Y;if(ee===0&&(B===0||Ae===0))return Vr;if(Ce===0){const yt=fr(oe,B),Kt=yt+Math.max(ee-1,0);return il(Ur(yt,Kt,re))}const Oe=ps(Ae,Ce,le);let Le,Fe;be?U===0&&G===0&&ee>0?(Le=0,Fe=ee-1):(Le=Oe*sn((U+he)/(ue+he)),Fe=Oe*$r((G+he)/(ue+he))-1,Fe=On(B-1,zt(Fe,Oe-1)),Le=On(Fe,zt(0,Le))):(Le=0,Fe=-1);const De=Ur(Le,Fe,re),{bottom:je,top:Xe}=Kr(Y,Z,D,De),$e=$r(B/Oe),ht=$e*ue+($e-1)*he-je;return{bottom:je,itemHeight:ue,items:De,itemWidth:Ce,offsetBottom:ht,offsetTop:Xe,top:Xe}})),w),J(L(M,ie(B=>B!==null),K(B=>B.length)),R),J(L(Pe(T,j,w,A),ie(([B,U,{items:G}])=>G.length>0&&U.height!==0&&B.height!==0),K(([B,U,{items:G},Z])=>{const{bottom:D,top:Y}=Kr(B,Z,U,G);return[Y,D]}),Ie(Gt)),t);const pe=N(!1);J(L(c,fe(pe),K(([B,U])=>U||B!==0)),pe);const ye=Ue(L(Pe(w,R),ie(([{items:B}])=>B.length>0),fe(pe),ie(([[B,U],G])=>{const Z=B.items[B.items.length-1].index===U-1;return(G||B.bottom>0&&B.itemHeight>0&&B.offsetBottom===0&&B.items.length===U)&&Z}),K(([[,B]])=>B-1),Ie())),me=Ue(L(se(w),ie(({items:B})=>B.length>0&&B[0].index===0),st(0),Ie())),q=Ue(L(se(w),fe(P),ie(([{items:B},U])=>B.length>0&&!U),K(([{items:B}])=>({endIndex:B[B.length-1].index,startIndex:B[0].index})),Ie($o),at(0)));J(q,x.scrollSeekRangeChanged),J(L(O,fe(T,j,R,A),K(([B,U,G,Z,D])=>{const Y=Yo(B),{align:re,behavior:ee,offset:be}=Y;let oe=Y.index;oe==="LAST"&&(oe=Z-1),oe=zt(0,oe,On(Z-1,oe));let le=rr(U,D,G,oe);return re==="end"?le=qr(le-U.height+G.height):re==="center"&&(le=qr(le-U.height/2+G.height/2)),be&&(le+=be),{behavior:ee,top:le}})),l);const ne=Ne(L(w,K(B=>B.offsetBottom+B.bottom)),0);return J(L(_,K(B=>({height:B.visibleHeight,width:B.visibleWidth}))),T),{customScrollParent:p,data:M,deviation:C,footerHeight:o,gap:A,headerHeight:s,increaseViewportBy:e,initialItemCount:f,itemDimensions:j,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:a,scrollHeight:z,scrollTo:l,scrollToIndex:O,scrollTop:c,smoothScrollTargetReached:u,totalCount:R,useWindowScroll:h,viewportDimensions:T,windowScrollContainerState:d,windowScrollTo:k,windowViewportRect:_,...x,gridState:w,horizontalDirection:te,initialTopMostItemIndex:F,totalListHeight:ne,...y,endReached:ye,propsReady:v,rangeChanged:q,startReached:me,stateChanged:H,stateRestoreInProgress:P,...I}},ke(pr,We,Ut,ns,pt,hr,ft));function ps(e,t,n){return zt(1,sn((e+n)/(sn(t)+n)))}function Kr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=rr(e,t,n,r[0].index);return{bottom:rr(e,t,n,r[r.length-1].index)+o,top:s}}function rr(e,t,n,r){const o=ps(e.width,n.width,t.column),s=sn(r/o),i=s*n.height+zt(0,s-1)*t.row;return i>0?i+t.row:i}const cl=xe(()=>{const e=N(S=>`Item ${S}`),t=N({}),n=N(null),r=N("virtuoso-grid-item"),o=N("virtuoso-grid-list"),s=N(mr),i=N("div"),a=N(jt),l=(S,y=null)=>Ne(L(t,K(x=>x[S]),Ie()),y),c=N(!1),u=N(!1);return J(se(u),c),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:u,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),ul=xe(([e,t])=>({...e,...t}),ke(al,cl)),dl=g.memo(function(){const e=Re("gridState"),t=Re("listClassName"),n=Re("itemClassName"),r=Re("itemContent"),o=Re("computeItemKey"),s=Re("isSeeking"),i=Qe("scrollHeight"),a=Re("ItemComponent"),l=Re("ListComponent"),c=Re("ScrollSeekPlaceholder"),u=Re("context"),S=Qe("itemDimensions"),y=Qe("gap"),x=Re("log"),b=Re("stateRestoreInProgress"),v=Qe("reportReadyState"),p=vt(g.useMemo(()=>h=>{const d=h.parentElement.parentElement.scrollHeight;i(d);const k=h.firstChild;if(k){const{height:_,width:I}=k.getBoundingClientRect();S({height:_,width:I})}y({column:Qr("column-gap",getComputedStyle(h).columnGap,x),row:Qr("row-gap",getComputedStyle(h).rowGap,x)})},[i,S,y,x]),!0,!1);return as(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),b?null:m.jsx(l,{className:t,ref:p,...He(l,u),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(h=>{const d=o(h.index,h.data,u);return s?m.jsx(c,{...He(c,u),height:e.itemHeight,index:h.index,width:e.itemWidth},d):g.createElement(a,{...He(a,u),className:n,"data-index":h.index,key:d},r(h.index,h.data,u))})})}),fl=g.memo(function(){const e=Re("HeaderComponent"),t=Qe("headerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),pl=g.memo(function(){const e=Re("FooterComponent"),t=Qe("footerHeight"),n=Re("headerFooterTag"),r=vt(g.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=Re("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...He(e,o)})}):null}),hl=({children:e})=>{const t=g.useContext(ls),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=vt(g.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return g.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),m.jsx("div",{ref:o,style:bn(!1),children:e})},gl=({children:e})=>{const t=g.useContext(ls),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Re("customScrollParent"),s=Ho(n,o,!1);return g.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),m.jsx("div",{ref:s,style:bn(!1),children:e})},ml=g.memo(function({...e}){const t=Re("useWindowScroll"),n=Re("customScrollParent"),r=n||t?xl:bl,o=n||t?gl:hl,s=Re("context");return m.jsx(r,{...e,...He(r,s),children:m.jsxs(o,{children:[m.jsx(fl,{}),m.jsx(dl,{}),m.jsx(pl,{})]})})}),{useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}=ss(ul,{optional:{context:"context",totalCount:"totalCount",overscan:"overscan",itemContent:"itemContent",components:"components",computeItemKey:"computeItemKey",data:"data",initialItemCount:"initialItemCount",scrollSeekConfiguration:"scrollSeekConfiguration",headerFooterTag:"headerFooterTag",listClassName:"listClassName",itemClassName:"itemClassName",useWindowScroll:"useWindowScroll",customScrollParent:"customScrollParent",scrollerRef:"scrollerRef",logLevel:"logLevel",restoreStateFrom:"restoreStateFrom",initialTopMostItemIndex:"initialTopMostItemIndex",increaseViewportBy:"increaseViewportBy"},methods:{scrollTo:"scrollTo",scrollBy:"scrollBy",scrollToIndex:"scrollToIndex"},events:{isScrolling:"isScrolling",endReached:"endReached",startReached:"startReached",rangeChanged:"rangeChanged",atBottomStateChange:"atBottomStateChange",atTopStateChange:"atTopStateChange",stateChanged:"stateChanged",readyStateChanged:"readyStateChanged"}},ml),bl=ds({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe}),xl=fs({useEmitter:hs,useEmitterValue:Re,usePublisher:Qe});function Qr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ve.WARN),t==="normal"?0:parseInt(t??"0",10)}const xn=g.createContext(void 0);function we(e,t){const n=g.useContext(xn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return fn(n,e,t)}function ln(){const e=g.useContext(xn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const xr=g.createContext(void 0);function Mt(){const e=g.useContext(xr);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function $(e,t){const n=g.useContext(xr);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return fn(n,o=>e(o.progress),t)}const vl="_run_zzb61_3",Sl="_runWrap_zzb61_7",yl="_highlight_zzb61_13",wl="_highlightleft_zzb61_14",Cl="_highlightright_zzb61_15",Il="_highlightcenter_zzb61_16",kl="_underline_zzb61_48",Rl="_underlineleft_zzb61_49",Tl="_underlineright_zzb61_50",_l="_underlinecenter_zzb61_51",ot={run:vl,runWrap:Sl,highlight:yl,highlightleft:wl,highlightright:Cl,highlightcenter:Il,underline:kl,underlineleft:Rl,underlineright:Tl,underlinecenter:_l},Yr=e=>Symbol.iterator in e,Xr=e=>"entries"in e,Zr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},Ml=(e,t)=>{const n=e[Symbol.iterator](),r=t[Symbol.iterator]();let o=n.next(),s=r.next();for(;!o.done&&!s.done;){if(!Object.is(o.value,s.value))return!1;o=n.next(),s=r.next()}return!!o.done&&!!s.done};function El(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Yr(e)&&Yr(t)?Xr(e)&&Xr(t)?Zr(e,t):Ml(e,t):Zr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Dt(e){const t=g.useRef(void 0);return n=>{const r=e(n);return El(t.current,r)?t.current:t.current=r}}function jl(e){const t=e.replace("#",""),n=parseInt(t.length===3?t.repeat(2):t,16),r=n>>16&255,o=n>>8&255,s=n&255;return{r,g:o,b:s}}function Ol(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Pl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),gs=g.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=we(T=>T.setClipIndex),i=we(T=>T.seek),a=$(T=>T.setCurrentGlobalRunIndex),l=ln(),c=$(T=>T.rangeStartGI),u=$(T=>T.rangeEndGI),S=$(T=>T.setRange),y=c!=null&&u!=null,x=g.useCallback(T=>{var E;const j=(E=T.target)==null?void 0:E.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;if(z<0||z>=t.length)return;const C=t[z],M=C.text??"";if(!M.trim()||!/[가-힣a-zA-Z0-9]/.test(M))return;a(O,"program");const A=C.audioChunkIndex,H=C.audioTimeMs;A!=null&&H!=null&&(s(A),i(H))},[t,r,i,s,a]),b=g.useRef(null),v=g.useRef(!1),p=g.useCallback(T=>{var C;const j=(C=T.target)==null?void 0:C.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g),z=O-r;z<0||z>=t.length||(v.current=!1,b.current&&(window.clearTimeout(b.current),b.current=null),b.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(O,O),v.current=!0,b.current=null)},800))},[t,r,S,l]),h=g.useCallback(()=>{b.current&&(window.clearTimeout(b.current),b.current=null)},[]),d=g.useCallback(()=>{h()},[h]),k=h,_=h,I=$(T=>T.clearRange),R=g.useCallback(T=>{var z;if(v.current){v.current=!1;return}const j=(z=T.target)==null?void 0:z.closest("[data-g]");if(!j)return;const O=Number(j.dataset.g);isNaN(O)||y&&c!=null&&u!=null&&(I(),T.stopPropagation())},[y,c,u,I]),f=o,w=r+t.length-1;return m.jsx("span",{onClick:R,onDoubleClick:x,onPointerDown:p,onPointerUp:d,onPointerCancel:k,onPointerLeave:_,children:f.map((T,j)=>m.jsx(zl,{ns:n,group:T,runs:t,paraLastG:w,rangeStartGI:c,rangeEndGI:u},`${n}/grp:${j}-${T.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Bl=g.memo(function(){const t=g.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=X(Dt(t));return n.showSplit?m.jsxs(m.Fragment,{children:[m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&m.jsx("span",{children:" / "}),m.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),zl=g.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const a=g.useCallback(p=>{const h=p.currentGlobalRunIndex;return h!=null&&h>=n.startG&&h<=n.endG},[n]),l=$(Dt(a)),c=g.useCallback(p=>l?{showPointer:p.showPointer,pointerStyle:p.pointerStyle,pointerColor:p.pointerColor}:Pl,[l]),u=X(Dt(c)),S=n.r0??0,y=n.len??Math.max(0,n.endG-n.startG+1),x=l&&u.showPointer&&u.pointerStyle!=="underline",b=l&&u.showPointer&&u.pointerStyle==="underline",v=x||b?{"--hl-color":u.pointerColor,"--ul-color":u.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:y}).map((p,h)=>{const k=r[S+h],_=n.startG+h,I=`${t}/run:${_}`,R=!!k.split&&_!==o;let f=`${ot.runWrap}`;return x&&(y===1?f+=` ${ot.highlight}`:h===0?f+=` ${ot.highlightleft}`:h+1===y?f+=` ${ot.highlightright}`:f+=` ${ot.highlightcenter}`),b&&(y===1?f+=` ${ot.underline}`:h===0?f+=` ${ot.underlineleft}`:h+1===y?f+=` ${ot.underlineright}`:f+=` ${ot.underlinecenter}`),m.jsxs(g.Fragment,{children:[m.jsx("span",{className:f,style:v,children:m.jsx(Al,{gi:n.startG,g:_,run:k,active:l,pointerCfg:u,isInRange:s!=null&&i!=null&&_>=s&&_<=i})}),R&&m.jsx(Bl,{})]},I)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Al=g.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const a=g.useMemo(()=>{const l={whiteSpace:"pre-wrap"};if(r.bold&&(l.fontWeight=700),r.italic&&(l.fontStyle="italic"),r.underline&&(l.textDecoration="underline"),o&&s.showPointer){const c=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=c;const u=c.startsWith("#")?jl(c):Ol(c);u&&(.299*u.r+.587*u.g+.114*u.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:ot.run,style:a,"data-g":n,"data-gi":t,"data-test":(r==null?void 0:r.audioChunkIndex)||-1,children:r.text||""})},(e,t)=>e.g===t.g&&e.run===t.run&&e.active===t.active&&e.pointerCfg===t.pointerCfg&&e.isInRange===t.isInRange);function Ll({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var c;const i=e.list?e.list.level*24:0,a=((c=e.list)==null?void 0:c.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??a;return m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?m.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,m.jsx(gs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Gl=g.memo(Ll,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Hl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return eo(e,!1);case"upperalpha":case"upperlatin":return eo(e,!0);case"lowerroman":return Jr(e,!1);case"upperroman":return Jr(e,!0);case"decimalenclosedcircle":return Nl(e);default:return String(e)}}function Nl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function Jr(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function eo(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function vr(e){const t=new Map;return{next(n,r){const o=`${n}-${r}`,s=(t.get(o)??0)+1;return t.set(o,s),s},reset(){t.clear()}}}function Sr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Hl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Fl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Wl(e){const t=new Array(e.length+1).fill(0);for(let n=0;n<e.length;n++)t[n+1]=t[n]+e[n];return t}function Dl(e,t){const n=[];if(!e.length)return n;const r=(o,s,i)=>{n.push({splitIndex:i??o,runs:e.slice(o,s+1),startG:t+o,endG:t+s})};for(let o=0;o<e.length;o++){const s=e[o].splitIndex;if(s===void 0){r(o,o,void 0);continue}let i=o+1;for(;i<e.length&&e[i].splitIndex===s;)i++;r(o,i-1,s),o=i-1}return n}const Vl="_scroller_kqkmq_3",$l={scroller:Vl},ql=g.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${$l.scroller}${t?" "+t:""}`,style:n,...r})});function vn(){const e=g.useContext(xt);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const or=e=>/[가-힣a-zA-Z0-9]/.test(e),Ul=e=>((e==null?void 0:e.textContent)??"").trim(),an=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Kl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,a=1/0,l=1/0,c=-1,u=1/0,S=1/0;const y=e.querySelectorAll("[data-g]");for(let x=0;x<y.length;x++){const b=y[x];if(!b||!b.isConnected)continue;const v=Ul(b);if(!v||!or(v))continue;const p=b.getBoundingClientRect();if(p.height<=r||p.width<=r||p.bottom<=o.top||p.top>=o.bottom)continue;if(p.top<s){const k=Math.abs(p.top-s);(k<u||k===u&&(p.top<S||c!==-1&&Number(b.dataset.g)<c))&&(u=k,c=Number(b.dataset.g),S=p.top);continue}const h=Number(b.dataset.g);if(Number.isNaN(h))continue;p.top<l-n?(l=p.top,a=p.top,i=h):p.top<=l+n&&(p.top<a||p.top===a&&(i===-1||h<i))&&(a=p.top,i=h);const d=Math.abs(p.top-s);(d<u||d===u&&(p.top<S||c!==-1&&h<c))&&(u=d,c=h,S=p.top)}return i!==-1?i:c}const ms=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=an(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=an(e,t)}return s},to=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of o){const l=a.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const c=Number(a.dataset.g);Number.isNaN(c)||(c<s&&(s=c),c>i&&(i=c))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Ql=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=an(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),a=s.height*n,l=i.top-(s.top+a);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Yl(e,t=120){return new Promise(n=>{let r=null;const o=()=>{r!=null&&window.clearTimeout(r),r=window.setTimeout(()=>{e.removeEventListener("scroll",o,{capture:!0}),n()},t)};e.addEventListener("scroll",o,{passive:!0,capture:!0}),o()})}const Pn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!Ql(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Yl(e,o);const i=an(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,u=a.top+c,S=l.top-u;return Math.abs(S)<=1},ct=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=g.createContext(null);function bs(){const e=g.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Je(e,t){const n=g.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return fn(n,e,t)}const xs=()=>{const e=$(r=>r.section),t=bs(),n=e.quiz;return!n||!n.length?null:m.jsxs("button",{onClick:()=>{t.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",n.length,")"]})},Xl="_navBtn_1fciy_2",Zl="_disabled_1fciy_26",Jl="_label_1fciy_32",_t={navBtn:Xl,disabled:Zl,label:Jl};var vs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},no=g.createContext&&g.createContext(vs),ea=["attr","size","title"];function ta(e,t){if(e==null)return{};var n=na(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function na(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function cn(){return cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cn.apply(this,arguments)}function ro(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function un(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?ro(Object(n),!0).forEach(function(r){ra(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):ro(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ra(e,t,n){return t=oa(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function oa(e){var t=sa(e,"string");return typeof t=="symbol"?t:t+""}function sa(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Ss(e){return e&&e.map((t,n)=>g.createElement(t.tag,un({key:n},t.attr),Ss(t.child)))}function Ye(e){return t=>g.createElement(ia,cn({attr:un({},e.attr)},t),Ss(e.child))}function ia(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ta(e,ea),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),g.createElement("svg",cn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:un(un({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&g.createElement("title",null,s),e.children)};return no!==void 0?g.createElement(no.Consumer,null,n=>t(n)):t(vs)}function oo(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function so(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const la=({isIcon:e=!0})=>{const t=$(i=>i.isCanPrev),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(oo,{size:18}),m.jsx("span",{className:_t.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(oo,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},dn=({isIcon:e=!0})=>{const t=$(i=>i.isCanNext),n=$(i=>i.onSectionNav),r=!t,o=g.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${_t.navBtn} ${r?_t.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(so,{size:18}),m.jsx("span",{className:_t.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(so,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ys(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function aa({section:e,blocks:t,nsPrefix:n}){const r=g.useMemo(()=>{const R=[],f=vr();return t.forEach((w,T)=>{w.type==="paragraph"&&(R[T]=Sr(w,f))}),R},[t]),o=$(R=>{var f;return((f=R.layout)==null?void 0:f.prefix)??[]}),s=$(R=>{var f;return((f=R.derivedNav)==null?void 0:f.splitGroupsPerBlock)??[]}),i=X(R=>R.marginX),a=X(R=>R.viewportHeight),l=g.useRef({start:0,end:0}),c=g.useCallback(R=>{const f=t[R],w=`${n}blk-${f.id}`;if(f.type==="image"){const{src:O,alt:z,width:C,height:M}=f,A=C&&M?`${C} / ${M}`:"4 / 3",H=R>=l.current.start&&R<=l.current.end,E=a>80?Math.floor((a-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:E,aspectRatio:A},children:m.jsx("img",{src:O,alt:z||"",loading:H?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),z&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:z})]})}const T=r[R]??void 0,j=s[R];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Gl,{block:f,computedMarker:T,ns:w,baseIndex:o[R],sectionId:e.section_id,preGroups:j})})},[t,r,o,n,e,s,a]),u=g.useRef(null),S=g.useCallback(R=>{u.current=R},[]),y=g.useMemo(()=>g.memo(R=>{const{style:f,children:w,...T}=R;return m.jsx("div",{...T,style:f,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:w})})}),[i]),x=g.useRef(null),b=g.useMemo(()=>t.map(R=>R.id),[t]),v=g.useCallback(()=>{const R=e.quiz,f=Math.max(80,Math.floor(a*.5));return R&&R.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(xs,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:f,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(dn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[e,a]),p=g.useMemo(()=>({Item:y,Header:()=>m.jsx("div",{style:{height:40}}),Footer:v,Scroller:ql}),[v,y]),h=g.useCallback(R=>b[R],[b]),d=Mt(),[k]=g.useState(()=>d.getState().progress.currentGlobalRunIndex??0),_=g.useMemo(()=>{if(!o.length)return 0;const R=o[o.length-1],f=Math.max(0,Math.min(k,R));return ys(o,f)},[o,k]);console.log("SectionRenderVirtuoso확인");const I=Mt();return g.useEffect(()=>{const R=u.current;R&&(console.log("@@@@@@@@@@@@@@@@"),(async()=>{const f=I.getState().progress.currentGlobalRunIndex,w=I.getState().progress.setSectionLoading;console.log("giFromStore",f);const T=f!=null&&f>=0?f:0;await ms(R,T),await ct(),await ct(),await ct(),await ct(),console.log("첫랜더끝"),w(!1)})())},[u,I]),m.jsxs(m.Fragment,{children:[m.jsx(rl,{ref:x,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:h,totalCount:t.length,itemContent:c,initialTopMostItemIndex:_,increaseViewportBy:{top:200,bottom:200},components:p,scrollerRef:S}),m.jsx(ca,{scrollContainerRef:u,virtRef:x,prefix:o})]})}const ca=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=$(C=>C.setCurrentGlobalRunIndex),o=$(C=>C.registerSectionScrollApi),s=$(C=>C.currentGlobalRunIndex),i=we(C=>C.scrollLock),a=we(C=>C.syncToGI),l=vn(),c=g.useRef(!1),u=g.useRef(null),S=g.useRef(null),y=g.useRef(null),x=g.useRef(-1),b=g.useCallback(()=>{if(i)return;u.current=null;const C=S.current;if(!C)return;const M=Kl(C,5);M!==-1&&M!==x.current&&(x.current=M,a(M),r(M,"scroll"))},[i,a,r]),v=g.useCallback(C=>{S.current=C,u.current==null&&(u.current=requestAnimationFrame(b))},[b]),p=g.useCallback(C=>{S.current=C,y.current!=null&&(window.clearTimeout(y.current),y.current=null),y.current=window.setTimeout(()=>{y.current=null,b();const M=x.current;if(M===-1)return;const A=C.scrollTop,H=C.scrollHeight-C.clientHeight,E=H>0?A/H:0;let P=0;const F=C.querySelector(`[data-g="${M}"]`);if(F){const V=C.getBoundingClientRect();P=(F.getBoundingClientRect().top-V.top)/V.height}l.getState().emit({type:"scroll",payload:{scrollTop:A,scrollRatio:E,anchorGI:M,anchorOffsetRatio:P}})},100)},[b,l]),h=g.useRef(!1),d=g.useCallback(C=>{i||c.current&&(h.current||(v(C),p(C)))},[i,v,p]),k=g.useRef(void 0),_=g.useRef(void 0),I=g.useRef(void 0),R=g.useRef(void 0);g.useEffect(()=>{const C=e.current;if(C)return k.current=()=>{c.current=!0},_.current=()=>{c.current=!0},I.current=()=>{c.current=!0},R.current=()=>d(C),C.addEventListener("wheel",k.current,{passive:!0}),C.addEventListener("touchmove",_.current,{passive:!0}),window.addEventListener("keydown",I.current,{passive:!0}),C.addEventListener("scroll",R.current,{passive:!0}),()=>{C.removeEventListener("wheel",k.current),C.removeEventListener("touchmove",_.current),window.removeEventListener("keydown",I.current),C.removeEventListener("scroll",R.current),u.current!=null&&cancelAnimationFrame(u.current),y.current!=null&&(clearTimeout(y.current),y.current=null)}},[d,e]),g.useEffect(()=>{const C=e.current;if(!C||!i)return;const M=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},A=P=>{P.preventDefault(),P.stopPropagation(),c.current=!1},H=P=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(P.key)&&(P.preventDefault(),P.stopPropagation(),c.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",M,{passive:!1}),C.addEventListener("touchmove",A,{passive:!1}),window.addEventListener("keydown",H,{passive:!1}),()=>{C.removeEventListener("wheel",M),C.removeEventListener("touchmove",A),window.removeEventListener("keydown",H),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const f=g.useRef({first:-1,last:-1}),w=g.useRef(!1),T=g.useCallback(()=>{const C=e.current;if(!C)return;const M=to(C),A=(M==null?void 0:M.first)??-1,H=(M==null?void 0:M.last)??-1;f.current={first:A,last:H}},[e]),j=g.useRef(!1),O=g.useCallback(()=>{const C=e.current;if(!C||j.current)return;j.current=!0;const M=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:M,behavior:"instant"})})},[e]);g.useEffect(()=>{!w.current&&i&&(j.current=!1,T()),w.current=i},[i,T]),g.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:M,last:A}=f.current;if(M===-1||A===-1){O();return}if(C.scrollTop<=1){(async()=>{try{h.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{h.current=!1}T()})();return}if(s<M||s>A){async function E(){if(!C)return;const P=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:P})}E().then(P=>{P?T():O()})}},[i,s,O,T,e]);const z=g.useCallback(()=>{const C=e.current;if(!C)return;function M(q,ne,B=.2,U=.8){const G=q.querySelector(`[data-g="${ne}"]`);if(!G)return!1;const Z=q.getBoundingClientRect(),D=G.getBoundingClientRect();if(D.height<=0||Z.height<=0)return!1;const Y=(D.top+D.height/2-Z.top)/Z.height;return Y>=B&&Y<=U}const A=q=>q==="instant"?"auto":q,H=q=>{const ne=C.scrollTop,B=C.scrollHeight-C.clientHeight,U=B>0?ne/B:0;let G=0;const Z=C.querySelector(`[data-g="${q}"]`);if(Z){const D=C.getBoundingClientRect();G=(Z.getBoundingClientRect().top-D.top)/D.height}l.getState().emit({type:"scroll",payload:{scrollTop:ne,scrollRatio:U,anchorGI:q,anchorOffsetRatio:G}})},E=async(q,ne="smooth")=>{var U;const B=ys(n,q);(U=t.current)==null||U.scrollToIndex({index:B,align:"start",behavior:A(ne)}),await ms(C,q)},P=()=>new Promise(q=>requestAnimationFrame(()=>q())),F=async q=>{if(M(C,q,.1,.7))return H(q),!0;h.current=!0;const ne=C.querySelector(`[data-g="${q}"]`),B=C.getBoundingClientRect();let U=C.scrollTop<=1?0:.1;if(ne){const Z=ne.getBoundingClientRect();U=((Z.top+Z.height/2-B.top)/B.height>.5,.15)}const G=!!ne;return G?(await Pn(C,q,{behavior:"smooth",topPaddingRatio:U}),await P()):G||await E(q,"auto"),h.current=!1,H(q),M(C,q,.1,.7)},V=async q=>F(q);return{ensureVisibleGI:F,scrollToGI:V,getVisibleRange:()=>to(C),getScrollTop:()=>C.scrollTop,setScrollTop:q=>{C.scrollTop=q},getAnchorOffsetRatio:q=>{const ne=C.querySelector(`[data-g="${q}"]`);if(!ne)return 0;const B=ne.getBoundingClientRect(),U=C.getBoundingClientRect();return(B.top-U.top)/U.height},scrollToGIAtOffset:async(q,ne)=>{await V(q),await new Promise(re=>setTimeout(re,50));const B=C.querySelector(`[data-g="${q}"]`);if(!B)return;const U=B.getBoundingClientRect(),G=C.getBoundingClientRect(),Z=U.top-G.top,D=ne*G.height,Y=Z-D;C.scrollTop=C.scrollTop+Y}}},[e,t,n,l]);return g.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(z()),()=>o(void 0)),[z,o]),null};function ua(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function da(){const e=$(b=>b.section),t=X(b=>b.theme),n=X(b=>b.fontFamily),r=X(b=>b.fontSizePx),o=X(b=>b.lineHeight),s=rn[t],{blocks:i,nsPrefix:a}=g.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=pn(),c=g.useCallback(()=>{const{isSettingsOpen:b,setSettingsOpen:v,toggleOverlays:p}=l.getState();b?v(!1):p()},[l]),{onClick:u,onDoubleClick:S}=$s({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:ua}),y=g.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitOverflowScrolling:"touch"}),[n,s.bg,s.fg,r,o]),x=g.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:u,onDoubleClick:S,style:y,children:m.jsx("div",{style:x,children:m.jsx(aa,{section:e,blocks:i,nsPrefix:a})})})}function fa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM12.293 7.293a1 1 0 011.414 0L15 8.586l1.293-1.293a1 1 0 111.414 1.414L16.414 10l1.293 1.293a1 1 0 01-1.414 1.414L15 11.414l-1.293 1.293a1 1 0 01-1.414-1.414L13.586 10l-1.293-1.293a1 1 0 010-1.414z",clipRule:"evenodd"},child:[]}]})(e)}function pa(e){return Ye({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M9.383 3.076A1 1 0 0110 4v12a1 1 0 01-1.707.707L4.586 13H2a1 1 0 01-1-1V8a1 1 0 011-1h2.586l3.707-3.707a1 1 0 011.09-.217zM14.657 2.929a1 1 0 011.414 0A9.972 9.972 0 0119 10a9.972 9.972 0 01-2.929 7.071 1 1 0 01-1.414-1.414A7.971 7.971 0 0017 10c0-2.21-.894-4.208-2.343-5.657a1 1 0 010-1.414zm-2.829 2.828a1 1 0 011.415 0A5.983 5.983 0 0115 10a5.984 5.984 0 01-1.757 4.243 1 1 0 01-1.415-1.415A3.984 3.984 0 0013 10a3.983 3.983 0 00-1.172-2.828 1 1 0 010-1.415z",clipRule:"evenodd"},child:[]}]})(e)}function ha(e){return Ye({attr:{viewBox:"0 0 544 512"},child:[{tag:"path",attr:{d:"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z"},child:[]}]})(e)}function ga(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}function ma(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z",opacity:".87"},child:[]},{tag:"path",attr:{d:"M17.51 3.87 15.73 2.1 5.84 12l9.9 9.9 1.77-1.77L9.38 12l8.13-8.13z"},child:[]}]})(e)}const ba="_wrap_1hfub_4",xa="_visible_1hfub_25",va="_compact_1hfub_31",Sa="_row2_1hfub_34",ya="_controls_1hfub_44",wa="_row1_1hfub_52",Ca="_groupExpand_1hfub_80",Ia="_groupPlayback_1hfub_81",ka="_groupSpeed_1hfub_82",Ra="_groupFeatures_1hfub_83",Ta="_groupNav_1hfub_84",_a="_btn_1hfub_116",Ma="_btnForbidden_1hfub_141",Ea="_btnActive_1hfub_147",ja="_label_1hfub_158",Oa="_compactBtn_1hfub_168",Ee={wrap:ba,visible:xa,compact:va,row2:Sa,controls:ya,row1:wa,groupExpand:Ca,groupPlayback:Ia,groupSpeed:ka,groupFeatures:Ra,groupNav:Ta,btn:_a,btnForbidden:Ma,btnActive:Ea,label:ja,compactBtn:Oa},Pa=g.memo(function(){const t=g.useRef(null),n=g.useContext(xt),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=we(w=>w.status),s=we(w=>w.currentTimeMs),i=we(w=>w.currentClip),a=we(w=>w.playbackKind),l=X(w=>w.muteAudio),c=X(w=>w.audioSpeed),u=we(w=>w.getClipSrc),S=we(w=>w._onTime),y=we(w=>w._onEnded),x=we(w=>w._onError),b=$(w=>w.setCurrentGlobalRunIndex),v=$(w=>w.getSectionScrollApi),p=$(w=>w.snapToReadable),h=$(w=>w.edgeReadable),d=g.useRef(null),k=g.useRef(null),_=g.useRef(!1),I=g.useRef(null);g.useEffect(()=>{a==="real"&&(_.current=!0)},[a]);const R=g.useMemo(()=>{const w=u(i);if(!w)return null;try{return new URL(w,window.location.href).href}catch{return w}},[i,u]);g.useEffect(()=>{_.current=!0},[R]),g.useEffect(()=>{const w=t.current;if(!w)return;const T=()=>{if(w.paused||w.ended)return;const z=w.currentTime*1e3;_.current&&z===0||(z>0&&(_.current=!1),S(z))},j=()=>{var C,M;y();const z=h(1);typeof z=="number"&&z>=0&&(b(z,"audio"),(M=(C=v())==null?void 0:C.ensureVisibleGI)==null||M.call(C,z))},O=z=>{const C=z.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),x()};return w.addEventListener("timeupdate",T),w.addEventListener("ended",j),w.addEventListener("error",O),()=>{w.removeEventListener("timeupdate",T),w.removeEventListener("ended",j),w.removeEventListener("error",O)}},[S,y,x,h,b,v]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w)return;if(!R){try{w.pause()}catch(z){console.log("pause error",z)}k.current=null;return}const T=w.currentSrc||w.src||null,j=!T||T!==R;if(j){try{w.pause()}catch(z){console.log("pause error",z)}w.src=R;try{w.load()}catch(z){console.log("load error",z)}k.current=R}w.muted=!!l,w.volume=1,w.playbackRate=typeof c=="number"?c:1;const O=async()=>{j&&await new Promise(z=>{let C=!1;const M=()=>{C||(C=!0,w.removeEventListener("loadedmetadata",M),w.removeEventListener("canplay",M),z())};w.addEventListener("loadedmetadata",M),w.addEventListener("canplay",M),w.readyState>=1&&M()});try{await w.play()}catch(z){console.warn("el.play() failed",z)}};if(o==="loading"||o==="playing")O();else try{w.pause()}catch(z){console.log("pause error",z)}},[R,l,o,c,r]),g.useEffect(()=>{if(r)return;const w=t.current;if(!w||a!=="real")return;const T=s/1e3;if(Number.isFinite(T)){if(w.readyState<1){d.current=s;const j=()=>{if(d.current!=null){const O=d.current/1e3;try{w.currentTime=O}catch(z){console.log("currentTime보정 오류",z)}d.current=null}w.removeEventListener("loadedmetadata",j),w.removeEventListener("canplay",j)};w.addEventListener("loadedmetadata",j),w.addEventListener("canplay",j);return}if(Math.abs(w.currentTime-T)>.2)try{w.currentTime=T}catch(j){console.log("currentTime보정오류",j)}}},[s,a,r]);const f=we(w=>w.getGIFromCT);return g.useEffect(()=>{var j,O;if(r||a!=="real"||o!=="playing"&&o!=="loading")return;const w=f(i,s);if(w<0)return;const T=p(w);T!==I.current&&(I.current=T,b(T,"audio"),T%5===0&&((O=(j=v())==null?void 0:j.ensureVisibleGI)==null||O.call(j,T)))},[o,i,s,a,f,p,b,v,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Ba(){return m.jsx(Pa,{})}const za="_scrubberWrap_uw0cd_2",Aa="_labels_uw0cd_9",La="_index_uw0cd_15",Ga="_controls_uw0cd_19",Ha="_percent_uw0cd_25",Na="_range_uw0cd_46",Ct={scrubberWrap:za,labels:Aa,index:La,controls:Ga,percent:Ha,range:Na};function Fa(){const e=X(I=>I.isDev),t=$(I=>I.currentGlobalRunIndex),n=$(I=>I.totalRuns),r=$(I=>I.setCurrentGlobalRunIndex),o=$(I=>I.getSectionScrollApi),s=$(I=>I.giToPercentTotal),i=$(I=>I.percentToGITotal),a=$(I=>I.snapToReadable),l=we(I=>I.scrollLock),c=we(I=>I.pause),u=we(I=>I.play),S=we(I=>I.syncToGI),[y,x]=g.useState(()=>s(t||0));g.useEffect(()=>{x(s(t||0))},[t,s]);const b=g.useRef(!1),v=g.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),p=g.useCallback(()=>{l&&(c(),b.current=!0)},[l,c]),h=g.useCallback(I=>{x(Number(I.currentTarget.value))},[]),d=g.useCallback(async()=>{const I=i(y),R=a(I);c(),r(R,"scrubber-commit"),S(R);const f=o();f!=null&&f.ensureVisibleGI&&await f.ensureVisibleGI(R),b.current&&(b.current=!1,u())},[y,i,a,c,r,S,o,u]),k=g.useMemo(()=>({"--pct":`${y}%`}),[y]),_=g.useMemo(()=>Math.round(y),[y]);return m.jsxs("div",{className:Ct.scrubberWrap,children:[e&&m.jsx("div",{className:Ct.labels,children:m.jsxs("span",{className:Ct.index,children:[v," / ",n||0]})}),m.jsxs("div",{className:Ct.controls,children:[m.jsx("input",{type:"range",className:Ct.range,min:0,max:100,step:.5,value:y,style:k,onMouseDown:p,onTouchStart:p,onChange:h,onMouseUp:()=>{d()},onTouchEnd:()=>{d()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void d():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:Ct.percent,children:[_,"%"]})]})]})}const Wa=g.memo(Fa),Da=g.memo(function(){const t=g.useContext(xt),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=we(w=>w.playbackKind),o=we(w=>w.status),s=we(w=>w.fake),i=X(w=>w.audioSpeed),a=we(w=>w.pause),l=$(w=>w.totalRuns),c=$(w=>w.currentGlobalRunIndex),u=$(w=>w.setCurrentGlobalRunIndex),S=$(w=>w.getSectionScrollApi),y=$(w=>w.nextReadableFrom),x=$(w=>w.edgeReadable),b=g.useRef(null),v=g.useRef(null),p=g.useRef(0),h=g.useRef(-1),d=!n&&r==="fake"&&o==="playing",k=Math.max(1,(s==null?void 0:s.totalWords)??1),_=g.useMemo(()=>{const w=200*i;return k/w*6e4},[k,i]),I=g.useMemo(()=>!l||l<=1||_<=0?0:(l-1)/_,[l,_]);g.useEffect(()=>{if(!d)return;const w=Math.max(0,Math.min(c??0,Math.max(0,(l??1)-1)));p.current=w,h.current=w,v.current=null},[d,c,l]);const R=g.useRef(-1);g.useEffect(()=>{if(!l){R.current=-1;return}const w=x(1);R.current=w??-1},[x,l]);const f=g.useCallback(w=>{(async()=>{var H,E;if(!d){b.current=null;return}if(!l||l<=1||I<=0){b.current=null;return}const T=v.current;v.current=w;const j=T==null?0:Math.max(0,w-T),O=l-1;p.current=Math.min(O,p.current+I*j);const z=Math.floor(p.current),C=S(),M=y(z,1);if(M==null){const P=R.current>=0?R.current:z;P!==h.current&&(h.current=P,u(P,"audio"),await((H=C==null?void 0:C.ensureVisibleGI)==null?void 0:H.call(C,P))),a(),b.current=null;return}const A=M;A!==h.current&&(h.current=A,u(A,"audio"),A%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,A))),b.current=requestAnimationFrame(f)})().catch(console.error)},[d,l,I,y,u,S,a]);return g.useEffect(()=>(d?b.current==null&&(b.current=requestAnimationFrame(f)):(b.current&&(cancelAnimationFrame(b.current),b.current=null),v.current=null),()=>{b.current&&(cancelAnimationFrame(b.current),b.current=null)}),[d,f]),null}),Va=g.memo(function(){return m.jsx(Da,{})}),$a="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Ua="_WPMSpeedButtonsWrap_r3byt_1",Ka="_btnWrap_r3byt_7",Qa="_label_r3byt_14",Ya="_iconBtn_r3byt_22",Ot={WPMSpeedButtonsWrap:Ua,btnWrap:Ka,label:Qa,iconBtn:Ya},io=350,Xa=40,Za=.85,Ja=g.memo(function(){const t=X(y=>y.audioSpeed),n=X(y=>y.incAudioSpeed),r=X(y=>y.decAudioSpeed),o=g.useRef(null),s=g.useRef(io),i=g.useRef(null),a=g.useCallback(y=>{const x=t;if(y==="inc"){if(x>=2)return!1;n()}else{if(x<=.3)return!1;r()}return!0},[t,n,r]),l=g.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=g.useCallback(()=>{i.current&&(s.current=Math.max(Xa,Math.floor(s.current*Za)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),u=g.useCallback(y=>{if(i.current)return;i.current=y,s.current=io,a(y)&&c();const b=()=>l();window.addEventListener("mouseup",b,{once:!0}),window.addEventListener("touchend",b,{once:!0})},[c,a,l]);g.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return m.jsx("div",{onMouseLeave:l,className:Ot.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Ot.btnWrap,children:[m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>u("dec"),onTouchStart:y=>{y.preventDefault(),u("dec")},onMouseUp:l,children:m.jsx("img",{src:$a,alt:"느리게"})}),m.jsx("div",{className:Ot.label,style:{minWidth:"44px",textAlign:"center"},children:m.jsx("div",{children:S})}),m.jsx("button",{className:Ot.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>u("inc"),onTouchStart:y=>{y.preventDefault(),u("inc")},onMouseUp:l,children:m.jsx("img",{src:qa,alt:"빠르게"})})]})})}),ec="_StepBtn_15t0r_1",tc={StepBtn:ec};function nc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M208,48V208a8,8,0,0,1-13.66,5.66L128,147.31V208a8,8,0,0,1-13.66,5.66l-80-80a8,8,0,0,1,0-11.32l80-80A8,8,0,0,1,128,48v60.69l66.34-66.35A8,8,0,0,1,208,48Z"},child:[]}]})(e)}function rc(e){return Ye({attr:{viewBox:"0 0 256 256",fill:"currentColor"},child:[{tag:"path",attr:{d:"M221.66,133.66l-80,80A8,8,0,0,1,128,208V147.31L61.66,213.66A8,8,0,0,1,48,208V48a8,8,0,0,1,13.66-5.66L128,108.69V48a8,8,0,0,1,13.66-5.66l80,80A8,8,0,0,1,221.66,133.66Z"},child:[]}]})(e)}function lo({direction:e}){const t=$(S=>S.currentGlobalRunIndex),n=$(S=>S.totalRuns),r=$(S=>S.hasReadableInDir),o=$(S=>S.computeStepTarget),s=$(S=>S.setCurrentGlobalRunIndex),i=we(S=>S.syncToGI),a=$(S=>S.getSectionScrollApi),l=g.useCallback(async S=>{var b,v;const y=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),x=o(y,S);s(x,"scrubber-step"),i(x),await((v=(b=a())==null?void 0:b.ensureVisibleGI)==null?void 0:v.call(b,x))},[t,n,o,s,i,a]),c=g.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),y=!n||!r(S,1),x=!n||!r(S,-1);return e==="left"?x:y},[e,n,t,r]),u=g.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return m.jsx("button",{className:tc.StepBtn,type:"button",onClick:u,disabled:c,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(nc,{}):m.jsx(rc,{})})}const oc="_GCPlayBtn_n54mc_1",sc="_playing_n54mc_34",ao={GCPlayBtn:oc,playing:sc},ic=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${ao.GCPlayBtn} ${r?ao.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function lc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 294.1L383 167c9.4-9.4 24.6-9.4 33.9 0s9.3 24.6 0 34L273 345c-9.1 9.1-23.7 9.3-33.1.7L95 201.1c-4.7-4.7-7-10.9-7-17s2.3-12.3 7-17c9.4-9.4 24.6-9.4 33.9 0l127.1 127z"},child:[]}]})(e)}function ac(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{d:"M256 217.9L383 345c9.4 9.4 24.6 9.4 33.9 0 9.4-9.4 9.3-24.6 0-34L273 167c-9.1-9.1-23.7-9.3-33.1-.7L95 310.9c-4.7 4.7-7 10.9-7 17s2.3 12.3 7 17c9.4 9.4 24.6 9.4 33.9 0l127.1-127z"},child:[]}]})(e)}function cc(){const e=X(I=>I.showOverlays),t=$(I=>I.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=X(I=>I.muteAudio),s=X(I=>I.showPointer),i=X(I=>I.showSplit),a=X(I=>I.toggleMuteAudio),l=X(I=>I.toggleShowPointer),c=X(I=>I.toggleShowSplit),u=X(I=>I.overlayCompactMode),S=X(I=>I.toggleOverlayCompactMode),y=ln(),x=Mt();g.useEffect(()=>{const I=y.getState(),{syncToGI:R,useFake:f,useReal:w}=I,T=I.playbackKind,j=x.getState().progress.currentGlobalRunIndex??0;if(!r){T!=="fake"&&f();return}o?T!=="fake"&&(console.log("이부분일까?"),f()):T!=="real"&&(R(j),w())},[r,o,x,y]);const b=we(I=>I.play),v=we(I=>I.pause),p=we(I=>I.status),h=g.useCallback(I=>{I.stopPropagation(),p==="playing"||p==="loading"?v():b()},[p,b,v]),d=ln(),k=Mt(),_=g.useCallback(async I=>{var P,F;if(I.stopPropagation(),p==="playing"||p==="loading"){v();return}const{progress:R}=k.getState(),{currentGlobalRunIndex:f,snapToReadable:w,edgeReadable:T,setCurrentGlobalRunIndex:j,getSectionScrollApi:O}=R,z=d.getState(),C=z.currentClip,M=O==null?void 0:O(),A=typeof f=="number"?f:0,H=typeof w=="function"?w(A):A,E=typeof T=="function"?T(1):null;if(E!=null&&H>=E){j==null||j(E,"audio"),await((P=M==null?void 0:M.ensureVisibleGI)==null?void 0:P.call(M,E)),z.syncToGI(E);return}j==null||j(H,"audio"),await((F=M==null?void 0:M.ensureVisibleGI)==null?void 0:F.call(M,H)),z.syncToGI(H),b(C)},[p,v,b,d,k]);return m.jsxs("div",{className:`${Ee.wrap} ${e?Ee.visible:""} ${u?Ee.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!u&&m.jsx(Wa,{}),m.jsx("div",{style:u?{display:"none"}:void 0,children:r&&!o?m.jsx(Ba,{}):m.jsx(Va,{})}),m.jsxs("div",{className:Ee.controls,children:[m.jsxs("div",{className:Ee.row1,children:[m.jsx("div",{className:Ee.groupExpand,children:m.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:Ee.compactBtn,title:u?"오버레이 확대":"오버레이 축소",children:u?m.jsx(ac,{size:24}):m.jsx(lc,{size:24})})}),m.jsxs("div",{className:Ee.groupPlayback,children:[m.jsx(lo,{direction:"left"}),m.jsx(ic,{size:34,isPlaying:p==="playing",onClick:o?_:h,title:p==="playing"?"일시정지":"재생"}),m.jsx(lo,{direction:"right"})]}),m.jsx("div",{className:Ee.groupSpeed,children:m.jsx(Ja,{})})]}),m.jsxs("div",{className:Ee.row2,children:[m.jsxs("div",{className:Ee.groupFeatures,children:[r&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},className:`${Ee.btn} ${o?"":Ee.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(fa,{size:18}):m.jsx(pa,{size:18}),m.jsx("span",{className:Ee.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${Ee.btn} ${s?Ee.btnActive:""}`,title:"포인터 표시",children:[m.jsx(ha,{size:18}),m.jsx("span",{className:Ee.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},disabled:!n,className:`${Ee.btn} ${i?Ee.btnActive:""} ${n?"":Ee.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ga,{size:18}),m.jsx("span",{className:Ee.label,children:"끊어읽기"})]})]}),m.jsxs("div",{className:Ee.groupNav,children:[m.jsx(la,{}),m.jsx(dn,{})]})]})]})]})}const uc=g.memo(cc);function dc(e){return Ye({attr:{viewBox:"0 0 512 512"},child:[{tag:"path",attr:{fill:"none",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"32",d:"M262.29 192.31a64 64 0 1 0 57.4 57.4 64.13 64.13 0 0 0-57.4-57.4zM416.39 256a154.34 154.34 0 0 1-1.53 20.79l45.21 35.46a10.81 10.81 0 0 1 2.45 13.75l-42.77 74a10.81 10.81 0 0 1-13.14 4.59l-44.9-18.08a16.11 16.11 0 0 0-15.17 1.75A164.48 164.48 0 0 1 325 400.8a15.94 15.94 0 0 0-8.82 12.14l-6.73 47.89a11.08 11.08 0 0 1-10.68 9.17h-85.54a11.11 11.11 0 0 1-10.69-8.87l-6.72-47.82a16.07 16.07 0 0 0-9-12.22 155.3 155.3 0 0 1-21.46-12.57 16 16 0 0 0-15.11-1.71l-44.89 18.07a10.81 10.81 0 0 1-13.14-4.58l-42.77-74a10.8 10.8 0 0 1 2.45-13.75l38.21-30a16.05 16.05 0 0 0 6-14.08c-.36-4.17-.58-8.33-.58-12.5s.21-8.27.58-12.35a16 16 0 0 0-6.07-13.94l-38.19-30A10.81 10.81 0 0 1 49.48 186l42.77-74a10.81 10.81 0 0 1 13.14-4.59l44.9 18.08a16.11 16.11 0 0 0 15.17-1.75A164.48 164.48 0 0 1 187 111.2a15.94 15.94 0 0 0 8.82-12.14l6.73-47.89A11.08 11.08 0 0 1 213.23 42h85.54a11.11 11.11 0 0 1 10.69 8.87l6.72 47.82a16.07 16.07 0 0 0 9 12.22 155.3 155.3 0 0 1 21.46 12.57 16 16 0 0 0 15.11 1.71l44.89-18.07a10.81 10.81 0 0 1 13.14 4.58l42.77 74a10.8 10.8 0 0 1-2.45 13.75l-38.21 30a16.05 16.05 0 0 0-6.05 14.08c.33 4.14.55 8.3.55 12.47z"},child:[]}]})(e)}const fc="_host_v5qx1_3",pc="_topbar_v5qx1_11",hc="_visible_v5qx1_32",gc="_backBtn_v5qx1_37",mc="_title_v5qx1_58",bc="_settingsBtn_v5qx1_67",It={host:fc,topbar:pc,visible:hc,backBtn:gc,title:mc,settingsBtn:bc};function xc(){const e=X(c=>c.showOverlays),t=X(c=>c.overlayCompactMode),n=$(c=>c.onViewerClose),o=$(c=>c.section).ast.title,s=X(c=>c.setSettingsOpen),i=X(c=>c.setShowOverlays),a=g.useCallback(()=>{n==null||n()},[n]),l=g.useCallback(()=>{s(!0),i(!1)},[s,i]);return m.jsx("div",{className:It.host,children:m.jsxs("div",{className:`${It.topbar} ${e&&!t?It.visible:""}`,children:[m.jsx("button",{type:"button",className:It.backBtn,onClick:a,"aria-label":"뒤로가기",children:m.jsx(ma,{size:28})}),m.jsx("div",{className:It.title,children:m.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),m.jsx("button",{type:"button",className:It.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:m.jsx(dc,{size:28})})]})})}const vc=g.memo(xc),Sc="_wrap_62su0_7",yc="_wrapHidden_62su0_29",wc="_wrapVisible_62su0_35",Cc="_scrollArea_62su0_71",Ic="_row_62su0_81",kc="_label_62su0_89",Rc="_btn_62su0_95",Tc="_btnActive_62su0_106",_c="_btnSmall_62su0_110",Mc="_pill_62su0_122",Ec="_themeCircle_62su0_133",jc="_themeCircleActive_62su0_146",Oc="_stepRow_62su0_151",Pc="_stepLabel_62su0_159",Bc="_levelBox_62su0_172",zc="_inlineFlex_62su0_177",Me={wrap:Sc,wrapHidden:yc,wrapVisible:wc,scrollArea:Cc,row:Ic,label:kc,btn:Rc,btnActive:Tc,btnSmall:_c,pill:Mc,themeCircle:Ec,themeCircleActive:jc,stepRow:Oc,stepLabel:Pc,levelBox:Bc,inlineFlex:zc};function Ac({visible:e}){const t=X(f=>f.mode),n=X(f=>f.setMode),r=X(f=>f.theme),o=X(f=>f.setTheme),s=X(f=>f.fontFamily),i=X(f=>f.setFontFamily),a=X(f=>f.resetToDefaults),l=X(f=>f.getFontLevel()),c=X(f=>f.getLineLevel()),u=X(f=>f.getMarginLevel()),S=X(f=>f.setFontLevel),y=X(f=>f.setLineLevel),x=X(f=>f.setMarginLevel),b=X(f=>f.pointerStyle),v=X(f=>f.setPointerStyle),p=X(f=>f.pointerColor),h=X(f=>f.setPointerColor),d=X(f=>f.breakMarks),k=X(f=>f.toggleBreakMark),_=X(f=>f.getBreakGapLevel()),I=X(f=>f.setBreakGapLevel),R=`${Me.wrap} ${e?Me.wrapVisible:Me.wrapHidden}`;return m.jsxs("div",{className:R,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Me.scrollArea,children:[m.jsx(Pt,{label:"열람방식",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(kt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(Pt,{label:"테마",children:m.jsx("div",{className:Me.inlineFlex,children:Object.keys(rn).map(f=>{const w=f,T=rn[w];return m.jsx("button",{type:"button",onClick:()=>o(w),className:`${Me.themeCircle} ${r===f?Me.themeCircleActive:""}`,style:{background:T.bg,color:T.fg,fontFamily:s},title:String(f),"aria-label":`테마: ${String(f)}`,children:"A"},`${f}_tc_button`)})})}),m.jsx(Pt,{label:"글꼴",children:m.jsx("div",{className:Me.inlineFlex,children:zo.map(f=>m.jsx(kt,{active:s===f.value,onClick:()=>i(f.value),title:f.value,children:f.label},f.label))})}),m.jsx(en,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),m.jsx(en,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>y(Math.max(1,c-1)),onInc:()=>y(Math.min(7,c+1))}),m.jsx(en,{label:"여백",level:u,min:1,max:5,onDec:()=>x(Math.max(1,u-1)),onInc:()=>x(Math.min(5,u+1))}),m.jsx(Pt,{label:"포인터",children:m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx(kt,{active:b==="highlight",onClick:()=>v("highlight"),children:"형광펜"}),m.jsx(kt,{active:b==="underline",onClick:()=>v("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:p,onChange:f=>h(f.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(Pt,{label:"끊기표시",children:m.jsx("div",{className:Me.inlineFlex,children:m.jsx(kt,{active:d.slash,onClick:()=>k("slash"),children:"슬래쉬"})})}),m.jsx(en,{label:"끊기간격",level:_,min:1,max:5,onDec:()=>I(Math.max(1,_-1)),onInc:()=>I(Math.min(5,_+1))})]}),m.jsx("div",{className:Me.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:a,className:Me.pill,children:"보기 설정 초기화"})})]})}function Pt({label:e,children:t}){return m.jsxs("div",{className:Me.row,children:[m.jsx("label",{className:Me.label,children:e}),t]})}function kt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${Me.btn} ${e?Me.btnActive:""}`,children:r})}function en({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,a=t>=r;return m.jsxs("div",{className:Me.stepRow,children:[m.jsx("label",{className:Me.stepLabel,children:e}),m.jsxs("div",{className:Me.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:Me.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:Me.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:a,className:Me.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Lc=g.memo(function(){const t=X(i=>i.showOverlays),n=X(i=>i.isSettingsOpen),r=$(i=>i.rangeStartGI),o=$(i=>i.rangeEndGI);return r!=null&&o!=null?null:m.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0,containerType:"size",containerName:"viewer"},children:[m.jsx(vc,{}),m.jsx(uc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Ac,{visible:!t&&n})})]})}),Gc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const u=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());c=y=>{const x=i(y);if(!u(S,x)){const b=S;a(S=x,b)}},l!=null&&l.fireImmediately&&a(S,S)}return o(c)}),e(t,n,r)},Hc=Gc;function Nc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Fc(e){var o,s,i;if(!e||!/\S/.test(e))return 0;const t=((o=e.match(/[A-Za-z0-9]+(?:['’-][A-Za-z0-9]+)*/g))==null?void 0:o.length)??0,n=((s=e.match(/[\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A]+/g))==null?void 0:s.length)??0,r=((i=e.match(/[\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF\u3040-\u30FF\u31FF\uAC00-\uD7AF\u1100-\u11FF\u3130-\u318F]/g))==null?void 0:i.length)??0;return t+n+Math.floor(r/2)}function Wc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Fc((r==null?void 0:r.text)??"");return t}function Dc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=x=>{if(!n)return null;const{g2ct:b}=n;if(!b)return null;const v=b[x];if(v)return{clip:v.clip,t:v.t};for(let p=1;p<=100&&x-p>=0;p++){const h=b[x-p];if(h)return{clip:h.clip,t:h.t}}for(let p=1;p<=100;p++){const h=b[x+p];if(h)return{clip:h.clip,t:h.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Wc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const x=o(e.initialIndex);x&&(i=x.clip,a=x.t,r=void 0)}const c=s.length>0,u=c?"paused":"idle",S=c?"real":"fake",y=c?null:{totalWords:l};return Vt(Hc((x,b)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:u,scrollLock:!1,playbackKind:S,fake:y,useFake:()=>x(v=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:v.status==="playing"})),useReal:()=>x(v=>({playbackKind:"real",fake:{totalWords:l},scrollLock:v.status==="playing"})),injectMap:v=>{if(n=v,typeof r=="number"){const p=o(r);p&&x(h=>({currentClip:Math.max(0,Math.min(p.clip,Math.max(0,h.clips.length-1))),currentTimeMs:Math.max(0,p.t)})),r=void 0}},setClipAndMs:(v,p)=>x(h=>{const d=Math.max(0,h.clips.length-1);return{currentClip:Math.max(0,Math.min(v,d)),currentTimeMs:Math.max(0,p),status:h.status,scrollLock:h.scrollLock}}),setClips:v=>x(p=>{const h=Array.isArray(v)?v:[],d=h.length>0;return{clips:h,currentClip:0,currentTimeMs:0,status:d?"paused":"idle",playbackKind:d?"real":"fake",fake:d?null:p.fake??{totalWords:l},scrollLock:!1}}),clear:()=>x(v=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:v.fake??{totalWords:l},scrollLock:!1})),play:(v,p)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),x(h=>{if(h.playbackKind==="fake")return{status:"playing",scrollLock:!0};const d=typeof v=="number"?v:h.currentClip,k=typeof p=="number"?p:h.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(d,Math.max(0,h.clips.length-1))),currentTimeMs:k,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),x({status:"paused",scrollLock:!1})},seek:v=>x(p=>({currentTimeMs:Math.max(0,v),status:p.status})),stop:()=>x({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>x(v=>{if(v.playbackKind==="fake")return v;const p=Math.max(0,v.clips.length-1);return{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>x(v=>v.playbackKind==="fake"?v:{currentClip:Math.max(0,v.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:v=>x(p=>p.playbackKind==="fake"||v<0||v>=p.clips.length?p:{currentClip:v,currentTimeMs:0}),getClipSrc:v=>{const p=b();if(!p.clips.length)return null;const h=typeof v=="number"?v:p.currentClip;return Nc(p.clips[h])},getGIFromCT:(v,p)=>{if(!n)return-1;const h=n.byClip[v];if(!h||h.length===0)return-1;let d=0,k=h.length-1,_=0;for(;d<=k;){const I=d+k>>1;h[I].t<=p?(_=I,d=I+1):k=I-1}return h[Math.max(0,Math.min(_,h.length-1))].g},getCTFromGI:v=>{if(!n)return null;const{g2ct:p}=n;if(!p)return null;let h=p[v];if(!h){let d=v-1;const k=Math.max(0,v-100);for(;d>=k;){if(p[d]){h=p[d];break}d--}if(!h){let _=v+1;const I=v+100;for(;p[_]==null&&_<=I;)_++;p[_]&&(h=p[_])}}return h?{clip:h.clip,timeMs:h.t}:null},getMetaByGI:v=>{const p=b().getCTFromGI(v);return p?{clipIndex:p.clip,timeMs:p.timeMs}:null},syncToGI:v=>{const p=b().getMetaByGI(v);p&&b().setClipAndMs(p.clipIndex,p.timeMs)},_onTime:v=>x({currentTimeMs:v,status:"playing",scrollLock:!0}),_onEnded:()=>x(v=>{if(v.playbackKind==="fake")return{status:"ended",scrollLock:!1};const p=Math.max(0,v.clips.length-1);return v.currentClip>=p?{status:"ended",scrollLock:!1}:{currentClip:Math.min(v.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>x({status:"error",scrollLock:!1}),_setStatusOnly:v=>x({status:v})})))}function Vc({children:e,initialState:t}){const n=g.useContext(xt)??void 0,r=g.useMemo(()=>Dc({...t,recorderStore:n}),[t,n]);return m.jsx(xn.Provider,{value:r,children:e})}function $c(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const a of r){if((a==null?void 0:a.type)==="image")continue;const l=(a==null?void 0:a.runs)??[];for(let c=0;c<l.length;c++){const u=l[c],S=o+c;u.audioChunkIndex!=null&&u.audioTimeMs!=null&&((t[i=u.audioChunkIndex]||(t[i]=[])).push({t:u.audioTimeMs,g:S}),n[S]={clip:u.audioChunkIndex,t:u.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function qc(e,t,n){if(n<=0)return-1;const r=Math.max(0,Math.min(t,n-1));if(e[r]===1)return r;for(let o=1;o<n;o++){const s=r-o;if(s>=0&&e[s]===1)return s;const i=r+o;return i<n&&e[i]===1?i:-1}return-1}function Uc(e){const t=Fl(e),n=Wl(t),r=t.reduce((u,S)=>u+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],a=[];return e.forEach((u,S)=>{var p;if(u.type!=="paragraph")return;const y=n[S]??0,x=u.runs??[];for(let h=0;h<x.length;h++){const d=((p=x[h])==null?void 0:p.text)||"";or(d)&&(s[y+h]=1)}const v=Dl(x,y).map(h=>{var I;const d=h.startG-y,k=h.endG-h.startG+1;let _=-1;for(let R=0;R<k;R++){const f=((I=x[d+R])==null?void 0:I.text)??"";if(or(f)){_=h.startG+R;break}}return{startG:h.startG,endG:h.endG,r0:d,len:k,firstReadableGI:_,splitIndex:h.splitIndex}});a[S]=v;for(const h of v){const d=i.length;for(let k=h.startG;k<=h.endG;k++)o[k]=d;i.push(h)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function Kc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:a,initialIndex:l,mountTime:c}=e,u=a.totalRuns??0,S=typeof l=="number"?l:u>0?0:-1,y=S>=0?qc(i.readableGi,S,u):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:y,lastUpdateBy:"program",totalRuns:u,pageIndex:0,sectionLoading:!0,_loadingStartTime:c,_scrollApi:void 0,derivedNav:i,layout:a,rangeStartGI:null,rangeEndGI:null}}function Qc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,recorderStore:a}=e,l=t.ast.blocks,{nav:c,layout:u}=Uc(l),S=Date.now(),y=Kc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:c,layout:u,initialIndex:n,mountTime:S});return a&&(a.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),a.getState().emit({type:"loading_start",payload:{}},S)),Vt((x,b)=>{const v=E=>{x(P=>P.progress._scrollApi===E?P:{progress:{...P.progress,_scrollApi:E}})},p=()=>b().progress._scrollApi,h=E=>{x(P=>{const F=P.progress;if(F.totalRuns===E)return P;const V=F.currentGlobalRunIndex<0&&E>0;return{progress:{...F,totalRuns:E,currentGlobalRunIndex:V?0:F.currentGlobalRunIndex,lastUpdateBy:V?"program":F.lastUpdateBy}}})},d=(E,P="program")=>{const F=b().progress.currentGlobalRunIndex,V=b().progress,Q=V.totalRuns>0?Math.max(-1,Math.min(E,V.totalRuns-1)):E;F===Q&&V.lastUpdateBy===P||(x(te=>({progress:{...te.progress,currentGlobalRunIndex:Q,lastUpdateBy:P}})),F!==Q&&a&&a.getState().emit({type:"global_index_change",payload:{globalIndex:Q}}))},k=E=>{const{sectionLoading:P,_loadingStartTime:F}=b().progress;if(P===E)return;const V=Date.now();if(E)x(Q=>({progress:{...Q.progress,sectionLoading:!0,_loadingStartTime:V}})),a&&a.getState().emit({type:"loading_start",payload:{}});else{const te=(F?V-F:0)/1e3;x(pe=>({progress:{...pe.progress,sectionLoading:!1,_loadingStartTime:null}})),a&&a.getState().emit({type:"loading_end",payload:{duration:te}})}},_=E=>{x(P=>({progress:{...P.progress,pageIndex:E}}))},I=(E,P)=>{x(F=>({progress:{...F.progress,rangeStartGI:Math.min(E,P),rangeEndGI:Math.max(E,P)}}))},R=()=>{x(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}}))},f=E=>{const{rangeStartGI:P,rangeEndGI:F}=b().progress;P==null||F==null||(E<P?x(V=>({progress:{...V.progress,rangeStartGI:E}})):E>F?x(V=>({progress:{...V.progress,rangeEndGI:E}})):R())},w=()=>{var ye;const{rangeStartGI:E,rangeEndGI:P,section:F,layout:V}=b().progress;if(E==null||P==null||!V)return"";const Q=((ye=F.ast)==null?void 0:ye.blocks)??[],te=V.prefix,pe=[];for(let me=0;me<Q.length;me++){const q=Q[me];if(q.type!=="paragraph")continue;const ne=q.runs??[],B=te[me]??0;for(let U=0;U<ne.length;U++){const G=B+U;G>=E&&G<=P&&pe.push(ne[U].text??"")}}return pe.join("")},T=E=>{const{totalRuns:P,derivedNav:F}=b().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return E;const Q=P,te=Math.max(0,Math.min(E,Q-1));if(V[te])return te;let pe=te-1,ye=te+1;for(;pe>=0||ye<Q;){if(ye<Q&&V[ye])return ye;if(pe>=0&&V[pe])return pe;ye+=1,pe-=1}return te},j=(E,P)=>{const{totalRuns:F,derivedNav:V}=b().progress,Q=V==null?void 0:V.readableGi;if(!Q||F<=0)return null;if(P>0){for(let te=Math.min(Math.max(E,0),F-1);te<F;te+=1)if(Q[te])return te}else for(let te=Math.min(Math.max(E,0),F-1);te>=0;te-=1)if(Q[te])return te;return null},O=E=>{const{totalRuns:P,derivedNav:F}=b().progress,V=F==null?void 0:F.readableGi;if(!V||P<=0)return null;if(E>0){for(let Q=P-1;Q>=0;Q-=1)if(V[Q])return Q}else for(let Q=0;Q<P;Q+=1)if(V[Q])return Q;return null};return{progress:{...y,registerSectionScrollApi:v,getSectionScrollApi:p,setTotalRuns:h,setCurrentGlobalRunIndex:d,setSectionLoading:k,setPageIndex:_,setRange:I,clearRange:R,extendRange:f,getRangeText:w,snapToReadable:T,nextReadableFrom:j,edgeReadable:O,hasReadableInDir:(E,P)=>j(E+(P>0?1:-1),P)!=null,computeStepTarget:(E,P)=>{const{totalRuns:F,derivedNav:V}=b().progress;if(!F||F<=0)return E;const Q=(V==null?void 0:V.groups)??[],te=V==null?void 0:V.giToGroupIdx;if(!Q.length||!te){const B=F-1;return T(Math.max(0,Math.min(E+P,B)))}let pe=te[E]??-1;if(pe<0||pe>=Q.length)for(let ne=0;ne<Q.length;ne+=1){const B=Q[ne];if(E>=B.startG&&E<=B.endG){pe=ne;break}}if(pe<0||pe>=Q.length)return O(P)??T(E);const ye=ne=>ne>=0&&ne<Q.length&&(Q[ne].firstReadableGI??-1)>=0;let me=pe+P;for(;me>=0&&me<Q.length&&!ye(me);)me+=P;if(me<0||me>=Q.length)return O(P)??T(E+P);const q=Q[me].firstReadableGI;return q>=0?q:T(E+P)},giToPercentTotal:E=>{const P=b().progress.totalRuns;return!P||P<=1?0:Math.max(0,Math.min(E,P-1))/(P-1)*100},percentToGITotal:E=>{const P=b().progress.totalRuns;if(!P||P<=1)return 0;const F=Math.max(0,Math.min(E,100)),V=Math.round(F/100*(P-1));return Math.max(0,Math.min(V,P-1))}}}})}function Yc({children:e,initialState:t}){const n=g.useContext(xt),r=g.useMemo(()=>Qc({...t,recorderStore:n}),[t,n]);return m.jsx(xr.Provider,{value:r,children:e})}function Xc({children:e,initialState:t}){const n=g.useContext(xt)??void 0,r=g.useRef(Us({init:t,recorderStore:n}));return m.jsx(sr.Provider,{value:r.current,children:e})}const Zc=({pages:e,pageIndex:t,maxWidth:n})=>{const r=$(d=>d.section),o=g.useMemo(()=>{var d;return((d=r.ast)==null?void 0:d.blocks)??[]},[r]),s=X(d=>d.marginX),i=X(d=>d.lineHeight),a=X(d=>d.fontSizePx),l=X(d=>d.fontFamily),c=X(d=>d.viewportHeight),u=$(d=>{var k;return((k=d.layout)==null?void 0:k.prefix)??[]}),S=$(d=>{var k;return((k=d.derivedNav)==null?void 0:k.splitGroupsPerBlock)??[]}),y=e[t],x=g.useMemo(()=>{const d=[];return o.forEach((k,_)=>{(k.type==="paragraph"||k.type==="image")&&d.push(_)}),d},[o]),b=g.useMemo(()=>{if(!y)return[];const d=[];for(let k=y.startBlock;k<=y.endBlock;k++){const _=x[k];_!=null&&d.push(_)}return d},[y,x]),v=g.useMemo(()=>{const d=[];for(const k of b){const _=o[k];(_==null?void 0:_.type)==="paragraph"&&d.push({b:_,originalBlockIndex:k})}return d},[b,o]),p=g.useMemo(()=>{const d=[],k=vr();return v.forEach((_,I)=>{d[I]=Sr(_.b,k)}),d},[v]),h=(d,k,_)=>{if(!d||d.length===0)return[];const I=[];for(const R of d){const f=R.startG,w=R.endG;if(w<k||f>_)continue;const T=Math.max(f,k),j=Math.min(w,_),O=T-f|0,z=Math.max(0,j-T+1);if(z<=0)continue;const C=(R.r0??0)+O;I.push({...R,startG:T,endG:j,r0:C,len:z})}return I};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:a,lineHeight:i,boxSizing:"border-box"},children:m.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[m.jsx("div",{style:{height:40}}),m.jsx("div",{style:{flex:1,overflow:"hidden"},children:b.map((d,k)=>{var ne;const _=o[d],I=k===0,R=k===b.length-1,f={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},w=`sec-${r.section_id}/blk-${_.id??d}`;if(_.type==="image"){const{src:B,alt:U,width:G,height:Z}=_,D=G&&Z?`${G} / ${Z}`:"4 / 3",Y=c>80?Math.floor((c-80)*.6):void 0;return m.jsx("div",{style:f,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:Y,aspectRatio:D},children:m.jsx("img",{src:B,alt:U||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),U&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:U})]})},w)}const T=_,j=v.findIndex(B=>B.originalBlockIndex===d),O=j>=0?p[j]:void 0,z=T.runs??[],C=z.length;let M=0,A=Math.max(0,C-1);I&&y.startOffsetInBlock!=null&&(M=Math.min(Math.max(0,y.startOffsetInBlock),A)),R&&y.endOffsetInBlock!=null&&(A=Math.max(M,Math.min(y.endOffsetInBlock,A)));const H=M>0,E=u[d]??0,P=S[d]??[],F=E+M,V=E+A;let Q=h(P,F,V);const te=E+M;Q=Q.map(B=>{const U=Math.max(0,(B.startG??F)-te),G=B.len??Math.max(1,(B.endG??V)-(B.startG??F)+1);return{...B,r0:U,len:G}});const pe=M<=A?z.slice(M,A+1):[],ye=T.list?T.list.level*24:0,me=((ne=T.list)==null?void 0:ne.kind)==="bullet"?T.list.glyph??"•":void 0,q=H?void 0:O??me;return m.jsx("div",{style:f,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:T.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[T.list&&q?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:q||""}):null,m.jsx(gs,{preGroups:Q,runs:pe,ns:w,baseIndex:te,sectionId:String(r.section_id)})]})},w)})})]})})},co=.5;function Jc(e,t){const n=g.useRef(null),r=g.useRef(null),o=g.useRef(!1);g.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const c=l[0],{width:u,height:S}=c.contentRect,y=r.current;if(!y){r.current={w:u,h:S};return}Math.abs(y.w-u)<co&&Math.abs(y.h-S)<co||(r.current={w:u,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const a=()=>s();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function eu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:a=120,verticalTolerance:l=40,velocityThreshold:c=.6,singleDelayMs:u=250,doubleClickWindowMs:S=300,suppressAfterSwipeMs:y=250,onDragMove:x,onDragEnd:b,pageTransitionThreshold:v}=e,p=v??a,h=Math.min(20,a),d=rt.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),k=()=>{d.current.singleTimer!=null&&(window.clearTimeout(d.current.singleTimer),d.current.singleTimer=null)},_=()=>{var M;const C=((M=document==null?void 0:document.body)==null?void 0:M.style)??null;C&&d.current.prevUserSelect!=null&&(C.userSelect=d.current.prevUserSelect,d.current.prevUserSelect=null),d.current.capturedEl&&d.current.pid!=null&&typeof d.current.capturedEl.hasPointerCapture=="function"&&d.current.capturedEl.hasPointerCapture(d.current.pid)&&d.current.capturedEl.releasePointerCapture(d.current.pid),d.current.capturedEl=null},I=rt.useCallback(C=>{const M=i??s;M!=null&&M(C.target)||(d.current.pid=C.pointerId,d.current.startX=C.clientX,d.current.startY=C.clientY,d.current.startT=C.timeStamp,d.current.swiping=!1,d.current.canceledClick=!1,d.current.capturedEl=C.currentTarget)},[i,s]),R=rt.useCallback(C=>{var P;if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.clientX-d.current.startX,A=C.clientY-d.current.startY,H=Math.abs(M),E=Math.abs(A);if(!d.current.swiping){if(H>=h&&E<=l&&H>E){d.current.swiping=!0,d.current.canceledClick=!0;const F=d.current.capturedEl;if(F&&typeof F.setPointerCapture=="function")try{F.setPointerCapture(C.pointerId)}catch{}const V=((P=document==null?void 0:document.body)==null?void 0:P.style)??null;V&&(d.current.prevUserSelect=V.userSelect??null,V.userSelect="none"),C.preventDefault()}return}x==null||x(M),C.preventDefault()},[l,x,h]),f=rt.useCallback(C=>{if(d.current.pid==null||C.pointerId!==d.current.pid)return;const M=C.timeStamp-d.current.startT,A=C.clientX-d.current.startX;if(d.current.swiping){const H=Math.abs(A)/Math.max(1,M);Math.abs(A)>=p||H>=c?A<0?n():t():b==null||b(),d.current.lastSwipeAt=C.timeStamp}else C.timeStamp-d.current.lastUpT;_(),d.current.lastUpT=C.timeStamp,d.current.pid=null,d.current.swiping=!1},[p,c,n,t,S,b]),w=rt.useCallback(()=>{d.current.swiping&&(b==null||b()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[b]),T=rt.useCallback(C=>{var M,A;(A=(M=d.current.capturedEl)==null?void 0:M.hasPointerCapture)!=null&&A.call(M,C.pointerId)||d.current.pid!=null&&d.current.swiping&&(b==null||b(),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1)},[b]),j=rt.useCallback(()=>{d.current.pid!=null&&d.current.swiping&&(b==null||b()),_(),d.current.pid=null,d.current.swiping=!1,d.current.canceledClick=!1},[b]),O=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}r&&d.current.singleTimer==null&&(d.current.singleTimer=window.setTimeout(()=>{d.current.singleTimer=null,r(C)},u))}},[r,s,u,y]),z=rt.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-d.current.lastSwipeAt<y)){if(d.current.canceledClick){d.current.canceledClick=!1;return}k(),o==null||o(C)}},[o,s,y]);return rt.useEffect(()=>()=>{k(),_()},[]),{onPointerDown:I,onPointerMove:R,onPointerUp:f,onPointerCancel:w,onPointerLeave:T,onLostPointerCapture:j,onClick:O,onDoubleClick:z}}var Bn,uo;function ws(){if(uo)return Bn;uo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,fo;function tu(){if(fo)return zn;fo=1;var e=typeof Qt=="object"&&Qt&&Qt.Object===Object&&Qt;return zn=e,zn}var An,po;function Cs(){if(po)return An;po=1;var e=tu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,ho;function nu(){if(ho)return Ln;ho=1;var e=Cs(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,go;function ru(){if(go)return Gn;go=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return Gn=t,Gn}var Hn,mo;function ou(){if(mo)return Hn;mo=1;var e=ru(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,bo;function Is(){if(bo)return Nn;bo=1;var e=Cs(),t=e.Symbol;return Nn=t,Nn}var Fn,xo;function su(){if(xo)return Fn;xo=1;var e=Is(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var a=n.call(i,o),l=i[o];try{i[o]=void 0;var c=!0}catch{}var u=r.call(i);return c&&(a?i[o]=l:delete i[o]),u}return Fn=s,Fn}var Wn,vo;function iu(){if(vo)return Wn;vo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Wn=n,Wn}var Dn,So;function lu(){if(So)return Dn;So=1;var e=Is(),t=su(),n=iu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(a){return a==null?a===void 0?o:r:s&&s in Object(a)?t(a):n(a)}return Dn=i,Dn}var Vn,yo;function au(){if(yo)return Vn;yo=1;function e(t){return t!=null&&typeof t=="object"}return Vn=e,Vn}var $n,wo;function cu(){if(wo)return $n;wo=1;var e=lu(),t=au(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return $n=r,$n}var qn,Co;function uu(){if(Co)return qn;Co=1;var e=ou(),t=ws(),n=cu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var u=typeof c.valueOf=="function"?c.valueOf():c;c=t(u)?u+"":u}if(typeof c!="string")return c===0?c:+c;c=e(c);var S=s.test(c);return S||i.test(c)?a(c.slice(2),S?2:8):o.test(c)?r:+c}return qn=l,qn}var Un,Io;function du(){if(Io)return Un;Io=1;var e=ws(),t=nu(),n=uu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var u,S,y,x,b,v,p=0,h=!1,d=!1,k=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(h=!!c.leading,d="maxWait"in c,y=d?o(n(c.maxWait)||0,l):y,k="trailing"in c?!!c.trailing:k);function _(C){var M=u,A=S;return u=S=void 0,p=C,x=a.apply(A,M),x}function I(C){return p=C,b=setTimeout(w,l),h?_(C):x}function R(C){var M=C-v,A=C-p,H=l-M;return d?s(H,y-A):H}function f(C){var M=C-v,A=C-p;return v===void 0||M>=l||M<0||d&&A>=y}function w(){var C=t();if(f(C))return T(C);b=setTimeout(w,R(C))}function T(C){return b=void 0,k&&u?_(C):(u=S=void 0,x)}function j(){b!==void 0&&clearTimeout(b),p=0,u=v=S=b=void 0}function O(){return b===void 0?x:T(t())}function z(){var C=t(),M=f(C);if(u=arguments,S=this,v=C,M){if(b===void 0)return I(v);if(d)return clearTimeout(b),b=setTimeout(w,l),_(v)}return b===void 0&&(b=setTimeout(w,l)),x}return z.cancel=j,z.flush=O,z}return Un=i,Un}var fu=du();const pu=Oo(fu);function hu(e,t=200,n,r){const o=g.useRef(e),s=g.useRef(n);g.useEffect(()=>{o.current=e},[e]),g.useEffect(()=>{s.current=n},[n]);const i=g.useMemo(()=>{const a=pu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var u;(u=s.current)==null||u.call(s),a(...c)});return l.cancel=a.cancel.bind(a),l.flush=a.flush.bind(a),l},[t,r]);return g.useEffect(()=>()=>i.cancel(),[i]),i}let ks=0;class Rs extends Error{constructor(){super("calcPages canceled due to a newer invocation");wr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const et=e=>{if(e!==ks)throw new Rs},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},ko=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const a=s.getClientRects(),l=a.length?a[a.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},gu=(e,t)=>{if(t<16)return async(r=24)=>{et(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(et(e),await new Promise(o=>requestAnimationFrame(()=>o())),et(e))}};async function mu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:u=0,showSlash:S,paragraphMarkers:y,playbackScale:x=1,viewportHeight:b=0}){var p,h,d;const v=++ks;et(v);try{const k=Math.abs(x-1)>.001,_=1/x;k&&(t.style.transform=`scale(${_})`,t.style.transformOrigin="top left");const I=Math.max(0,e.offsetWidth||0),R=Math.max(0,Math.min(I,o));t.style.maxWidth=`${R}px`,et(v);let f=Math.round(n.offsetHeight||0);f||(f=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",x.toFixed(4),k?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",I),console.log("[calcPages] pageBoxWidth:",R),console.log("[calcPages] maxPageHeight:",f),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const w=1.5,T=(G,Z)=>Z+G<=f-w,j=getComputedStyle(e),O={letterSpacing:j.letterSpacing,wordSpacing:j.wordSpacing,fontKerning:j.fontKerning||"normal",fontVariantLigatures:j.fontVariantLigatures||"normal",textTransform:j.textTransform||"none",direction:j.direction||"ltr",wordBreak:j.wordBreak||"keep-all",overflowWrap:j.overflowWrap||j.wordWrap||"break-word",hyphens:j.hyphens||"manual"},z=G=>{G.style.letterSpacing=O.letterSpacing||"",G.style.wordSpacing=O.wordSpacing||"",G.style.fontKerning=O.fontKerning||"",G.style.fontVariantLigatures=O.fontVariantLigatures||"",G.style.textTransform=O.textTransform||"",G.style.direction=O.direction||"",G.style.wordBreak=O.wordBreak||"",G.style.wordWrap=O.overflowWrap||"",G.style.overflowWrap=O.overflowWrap||"",G.style.hyphens=O.hyphens||""},C=R,M=Math.max(0,C-2*(s||0));n.innerHTML="";const A=document.createElement("div");A.style.boxSizing="border-box",A.style.width=`${C}px`,A.style.maxWidth=`${C}px`,A.style.margin="0 auto",A.style.display="flex",n.appendChild(A);const H=document.createElement("div");H.style.boxSizing="border-box",H.style.paddingRight=`${s}px`,H.style.paddingLeft=`${s}px`,H.style.width=`${C}px`,H.style.maxWidth=`${C}px`,H.style.margin="0 auto",H.style.display="flex",H.style.justifyContent="center",H.style.height="auto",A.appendChild(H);const E=new Map,P={},F=gu(v,r.length),V=(G,Z)=>{const D=document.createElement("p");return D.style.margin="8px 0",D.style.paddingLeft=Z?`${Z}px`:"0",D.style.textAlign=G.textAlign??"start",D.style.whiteSpace="pre-wrap",D.style.lineHeight=String(l),D.style.fontSize=`${a}px`,D.style.boxSizing="border-box",D.style.fontFamily=i??"",D.style.width="100%",z(D),D},Q=(G,Z)=>{const D=Z??[],Y=document.createDocumentFragment();for(let re=0;re<D.length;re++){const ee=D[re],be=document.createElement("span");be.dataset.runbox=String(re),be.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(ee==null?void 0:ee.text)??"",oe.style.whiteSpace="pre-wrap",ee!=null&&ee.bold&&(oe.style.fontWeight="700"),ee!=null&&ee.italic&&(oe.style.fontStyle="italic"),ee!=null&&ee.underline&&(oe.style.textDecoration="underline"),be.appendChild(oe),c&&(ee!=null&&ee.split)&&re!==D.length-1){const le=Math.max(0,(u??0)/2),he=document.createElement("span");he.style.display="inline-block",he.style.width=`${le}px`;const ue=document.createElement("span");if(ue.style.display="inline-block",ue.style.width=`${le}px`,be.appendChild(he),S){const Ce=document.createElement("span");Ce.textContent=" / ",be.appendChild(Ce)}be.appendChild(ue)}Y.appendChild(be)}G.appendChild(Y)},te=b>80?Math.floor((b-80)*.6):void 0,pe=G=>{const Z=G!=null&&G.width&&(G!=null&&G.height)?`${G.width} / ${G.height}`:"4 / 3",D=document.createElement("div");D.style.margin="12px 0",D.style.textAlign="center",D.style.width=`${M}px`;const Y=document.createElement("div");Y.style.position="relative",Y.style.width="100%",te&&(Y.style.maxHeight=`${te}px`),Y.style.aspectRatio=Z;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",Y.appendChild(re),D.appendChild(Y),G!=null&&G.alt){const ee=document.createElement("div");ee.style.fontSize="12px",ee.style.color="#6B7280",ee.style.marginTop="4px",ee.textContent=String(G.alt),z(ee),D.appendChild(ee)}return D};for(let G=0;G<r.length;G++){et(v);const Z=r[G];if(H.dataset.block=String(G),H.innerHTML="",Z.kind==="image"){const ue=Z.block,Ce=pe(ue);H.appendChild(Ce);const Ae=Ce.getBoundingClientRect(),{mt:Oe,mb:Le}=Kn(Ce);P[G]={contentH:Math.ceil(Ae.height),mt:Oe,mb:Le},await F(24);continue}const D=Z.block,Y=D.list?(D.list.level??0)*24:0,re=Z.paraIndex??0,ee=y[re]??(((p=D.list)==null?void 0:p.kind)==="bullet"?((h=D.list)==null?void 0:h.glyph)??"•":void 0);if(!!(D.list&&ee)){const ue=V(D,Y);ue.dataset.variant="with";const Ce=V(D,Y);Ce.dataset.variant="no";const Ae=document.createElement("span");Ae.textContent=`${ee} `,Ae.style.minWidth="16px",Ae.style.display="inline-block",Ae.style.whiteSpace="nowrap",Ae.style.userSelect="none",ue.appendChild(Ae),Q(ue,D.runs),Q(Ce,D.runs);const Oe=document.createDocumentFragment();Oe.appendChild(ue),Oe.appendChild(Ce),H.appendChild(Oe)}else{const ue=V(D,Y);ue.dataset.variant="with",Q(ue,D.runs),H.appendChild(ue)}const oe=H.querySelector('p[data-variant="with"]'),le=H.querySelector('p[data-variant="no"]'),he=le??oe;if(oe&&he){const ue=ko(oe),Ce=ko(he),{mt:Ae,mb:Oe}=Kn(oe),{mt:Le,mb:Fe}=Kn(he),De=((d=D.runs)==null?void 0:d.length)??0,je=le?Ce:ue,Xe=le?Le:Ae,$e=le?Fe:Oe;if(G<3){const ht=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${G}: height=${ht.toFixed(2)}, lastBottom=[${ue.slice(-3).map(yt=>yt.toFixed(1)).join(",")}], runs=${De}`)}E.set(G,{runsLen:De,lastBottomWith:ue,lastBottomNo:je,mtWith:Ae,mbWith:Oe,mtNo:Xe,mbNo:$e})}await F(24)}et(v),H.innerHTML="";const ye=(G,Z,D,Y)=>{if(Z>D)return{top:0,content:0,mb:0};const re=Y?G.lastBottomNo:G.lastBottomWith,ee=Y?G.mtNo:G.mtWith,be=Y?G.mbNo:G.mbWith,oe=Y?0:ee,le=Z>0?re[Z-1]??0:0,he=Math.max(0,(re[D]??0)-le);return{top:oe,content:he,mb:be}},me=[];let q=0,ne,B=null,U=null;for(;q<r.length;){et(v);const G=q;let Z=0,D=0,Y=ne;Y!=null&&B===q&&U!=null&&(Y=Math.max(Y,U+1));let re=-1,ee;for(;q<r.length;){if(et(v),r[q].kind==="image"){const je=P[q]??{contentH:0,mt:0,mb:0},$e=(Z===0?je.mt:D+je.mt)+je.contentH;if(T($e,Z)){Z+=$e,re=q,ee=void 0,D=je.mb,q+=1,ne=void 0,B=null,U=null;continue}if(Z===0){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{}}),q+=1,ne=void 0,B=null,U=null,D=0;break}break}const oe=E.get(q),le=oe.runsLen,he=q===G&&Y!=null?Y:0;if(he>=le){q+=1,ne=void 0,B=null,U=null;continue}const ue=he>0,Ce=ye(oe,he,le-1,ue),Oe=(Z===0?Ce.top:D+Ce.top)+Ce.content;if(T(Oe,Z)){Z+=Oe,re=q,ee=le-1,D=Ce.mb,q+=1,ne=void 0,B=null,U=null;continue}let Le=he,Fe=le-1,De=he-1;for(;Le<=Fe;){et(v);const je=Le+Fe>>1,Xe=ye(oe,he,je,ue),$e=(Z===0?Xe.top:D+Xe.top)+Xe.content;T($e,Z)?(De=je,Le=je+1):Fe=je-1}if(De>=he){me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:De}),ne=De+1,B=q,U=De,D=0;break}if(Z>0){me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}}),D=0;break}else{const je=he;me.push({startBlock:G,endBlock:q,...Y!=null?{startOffsetInBlock:Y}:{},endOffsetInBlock:je}),ne=je+1,B=q,U=je,D=0;break}}(me.length===0||me[me.length-1].startBlock!==G)&&me.push({startBlock:G,endBlock:re>=0?re:Math.min(q-1,r.length-1),...Y!=null?{startOffsetInBlock:Y}:{},...ee!=null?{endOffsetInBlock:ee}:{}})}return A.remove(),k&&(t.style.transform="",t.style.transformOrigin=""),et(v),{pages:me,pageByRunIndex:null}}catch(k){throw console.error(k),k}}function Ro(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const a=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+a}return null}function bu(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let a=i.startBlock;a<=i.endBlock;a++){const l=n[a];if(!l||l.kind!=="paragraph")continue;const c=((o=l.block.runs)==null?void 0:o.length)??0;if(!c)continue;let u=0,S=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(u=Math.max(0,Math.min(i.startOffsetInBlock,S))),a===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(u,Math.min(i.endOffsetInBlock,S)));const y=r[l.originalIndex]??0,x=y+u,b=y+S;if(e>=x&&e<=b)return s}}return-1}function xu(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function vu(e){var n,r;const t=e;return t?((n=t.style)==null?void 0:n.cursor)==="grab"||((r=t.closest)==null?void 0:r.call(t,"[data-range-handle]"))!=null:!1}function Su(e){const t=[],n=[];let r=0;return e.forEach((o,s)=>{o.type==="paragraph"?(t.push({kind:"paragraph",block:o,originalIndex:s,paraIndex:r}),n.push(s),r+=1):o.type==="image"&&t.push({kind:"image",block:o,originalIndex:s})}),{items:t,paraIndexMap:n}}function yu(){var Kt;const e=$(W=>W.section),t=$(W=>W.sectionLoading),n=$(W=>W.rangeStartGI),r=$(W=>W.rangeEndGI),o=n!=null&&r!=null,s=vn(),i=X(W=>W.theme),a=rn[i],l=X(W=>W.fontFamily),c=X(W=>W.fontSizePx),u=X(W=>W.lineHeight),S=X(W=>W.marginX),y=X(W=>W.viewportHeight),x=860,b=g.useRef(null),{items:v}=g.useMemo(()=>{var W;return Su(((W=e==null?void 0:e.ast)==null?void 0:W.blocks)??[])},[e]),p=g.useMemo(()=>{const W=[],_e=vr();return v.forEach(Be=>{if(Be.kind==="paragraph"){const gt=Be.paraIndex;W[gt]=Sr(Be.block,_e)}}),W},[v]),[h,d]=g.useState({pages:[],pageByRunIndex:null}),k=$(W=>W.pageIndex),_=$(W=>W.setPageIndex),I=g.useRef(0),R=g.useRef(null),[f,w]=g.useState(!1),[T,j]=g.useState(null),[O,z]=g.useState(!1),C=g.useMemo(()=>({flex:1,fontFamily:l,background:a.bg,color:a.fg,fontSize:c,lineHeight:u,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[l,a.bg,a.fg,c,u]),{showSplit:M,breakGapPx:A,slash:H}=X(Dt(W=>{var _e;return{showSplit:W.showSplit,breakGapPx:W.breakGapPx??0,slash:((_e=W.breakMarks)==null?void 0:_e.slash)??!1}})),E=Mt();g.useEffect(()=>{h&&h.pages.length&&(console.log("그래서 총 페이지",h.pages.length),(async()=>{const W=E.getState().progress.setSectionLoading;await ct(),await ct(),await ct(),await ct(),console.log("recalc종료"),W(!1)})())},[h,E]);const P=g.useCallback(()=>{console.log("@@@@@@recalc호출");const W=b.current,_e=oe.current,Be=le.current;if(console.log("showSplit",M),!W||!_e||!Be||v.length===0){d({pages:[],pageByRunIndex:null}),_(0);return}(async()=>{const gt=performance.now();try{const Ze=s.getState().playbackScale,{pages:wt,pageByRunIndex:_s}=await mu({viewHost:W,measureRoot:_e,contentArea:Be,items:v,cfgMaxWidth:x,marginX:S,fontFamily:l,fontSizePx:c,lineHeight:u,showSplit:M,breakGapPx:A,showSlash:H,paragraphMarkers:p,playbackScale:Ze,viewportHeight:y}),Ms=performance.now();console.log(`✅ calcPages 완료: ${(Ms-gt).toFixed(1)} ms (${wt.length} pages)`),d({pages:wt,pageByRunIndex:_s}),_(0)}catch(Ze){if(Ze instanceof Rs){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Ze)}})()},[_,v,x,S,l,c,u,M,A,H,p,s,y]),F=$(W=>W.setCurrentGlobalRunIndex),V=$(W=>{var _e;return((_e=W.layout)==null?void 0:_e.prefix)??[]}),Q=we(W=>W.syncToGI),te=g.useCallback(W=>{const _e=h.pages.length+1,Be=k+W;if(Be<0||Be>=_e)return;const gt=k===h.pages.length;if(Be===h.pages.length){_(Be);return}if(gt&&W===-1){const wt=Ro(h.pages[Be],v,V);wt!=null&&(F(wt,"scrubber-step"),Q(wt)),_(Be);return}const Ze=Ro(h.pages[Be],v,V);Ze!=null?(F(Ze,"scrubber-step"),Q(Ze)):_(Be)},[k,h.pages,v,V,F,_,Q]),pe=g.useCallback(()=>{f||I.current!==0?(j("prev"),w(!1)):te(-1)},[f,te]),ye=g.useCallback(()=>{f||I.current!==0?(j("next"),w(!1)):te(1)},[f,te]),me=pn(),q=g.useCallback(()=>{const{isSettingsOpen:W,setSettingsOpen:_e,toggleOverlays:Be}=me.getState();W?_e(!1):Be()},[me]),ne=h.pages.length+1,B=((Kt=b.current)==null?void 0:Kt.clientWidth)||400,U=g.useCallback(W=>{var Ze;const _e=R.current;if(!_e)return;const Be=((Ze=b.current)==null?void 0:Ze.clientWidth)||1,gt=W/Be*33.333;_e.style.transform=`translate3d(${-33.333+gt}%, 0, 0)`},[]),G=g.useCallback(W=>{k===0&&W>0||k>=ne-1&&W<0||(I.current=W,U(W),f||w(!0))},[k,ne,U,f]),Z=g.useCallback(()=>{I.current=0,w(!1);const W=R.current;W&&(W.style.transition="transform 250ms ease-out",W.style.transform="translate3d(-33.333%, 0, 0)")},[]),D=g.useCallback(W=>{if(W.target!==W.currentTarget||W.propertyName!=="transform")return;const _e=T;z(!0),j(null),I.current=0,_e==="prev"?te(-1):_e==="next"&&te(1)},[T,te]);g.useLayoutEffect(()=>{O&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{z(!1)})})},[O]);const Y=ln(),re=g.useCallback(W=>o||vu(W)?!0:xu(W),[o]),ee=g.useCallback(W=>{const _e=Y.getState().status;return _e==="playing"||_e==="loading"?!0:re(W)},[Y,re]),be=eu({onPrev:pe,onNext:ye,onSingle:q,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:ee,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:G,onDragEnd:Z,pageTransitionThreshold:B*.5}),oe=g.useRef(null),le=g.useRef(null),he=g.useCallback(()=>{const W=E.getState().progress.setSectionLoading;W(!0)},[E]),ue=g.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Ce=hu(P,200,he,ue),Ae=g.useRef("");g.useEffect(()=>{if(y<=0)return;const W=`${l}|${c}|${u}|${S}|${M}|${A}|${H}|${y}|${e==null?void 0:e.section_id}`;Ae.current!==W&&(Ae.current=W,console.log("debounceRecalc 취소"),Ce.cancel(),he(),P())},[Ce,P,he,l,c,u,S,M,A,H,y,e==null?void 0:e.section_id]),Jc([b],Ce);const Oe=$(W=>W.registerSectionScrollApi);g.useEffect(()=>(Oe({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:te}),()=>Oe(void 0)),[Oe,te]);const Le=e.quiz&&e.quiz.length>0,Fe=h.pages.length>0&&k===h.pages.length,De=k>0?k-1:null,je=k<ne-1?k+1:null,Xe=g.useMemo(()=>T==="prev"?"translate3d(0%, 0, 0)":T==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[T]),$e=W=>t?null:W===h.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Le&&m.jsx(xs,{}),m.jsx(dn,{isIcon:!1})]}):m.jsx(Zc,{pages:h.pages,pageIndex:W,maxWidth:x}),ht={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},yt=!O&&(!f||T!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:b,style:{...C,touchAction:"pan-y"},...be,children:[m.jsxs("div",{ref:R,style:{display:"flex",width:"300%",height:"100%",transform:Xe,transition:yt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:T?D:void 0,children:[m.jsx("div",{style:ht,children:De!==null&&$e(De)}),m.jsx("div",{style:ht,children:$e(k)}),m.jsx("div",{style:ht,children:je!==null&&$e(je)})]}),m.jsx("div",{ref:oe,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:x,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:l,fontSize:c,lineHeight:u,pointerEvents:"none",background:"pink"},children:m.jsxs("div",{style:{width:"100%",maxWidth:x,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[m.jsx("div",{style:{height:40,background:"blue"}}),m.jsx("div",{ref:le,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(wu,{pages:h.pages,items:v,onGotoPage:_,currentPageIndex:k,isOnExtraPage:Fe})]})}const wu=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=$(c=>c.currentGlobalRunIndex),i=$(c=>c.lastUpdateBy),a=$(c=>{var u;return((u=c.layout)==null?void 0:u.prefix)??[]}),l=g.useRef(null);return g.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const c=bu(s,e,t,a);c>=0&&c!==r&&n(c)},[s,e,t,a,n,r,o,i]),m.jsx(m.Fragment,{})},Cu="_wrapper_dbk3n_1",Iu="_spinner_dbk3n_10",To={wrapper:Cu,spinner:Iu};function ku({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${To.wrapper}`,children:m.jsx("div",{className:To.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Ru(){const e=$(Dt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(ku,{})})}const Tu="_Overlay_ybic8_3",_u="_Dialog_ybic8_15",Mu="_Body_ybic8_25",Eu="_Header_ybic8_32",ju="_Paging_ybic8_39",Ou="_Remaining_ybic8_48",Pu="_RemainingDanger_ybic8_55",Bu="_NextBtn_ybic8_59",zu="_CloseBtn_ybic8_96",Au="_Question_ybic8_113",Lu="_Score_ybic8_123",Gu="_Image_ybic8_130",Hu="_Options_ybic8_140",Nu="_OptionBtn_ybic8_145",Fu="_OptionBtnActive_ybic8_165",Wu="_Footer_ybic8_172",Du="_OptionBtnCorrect_ybic8_195",Vu="_Judge_ybic8_201",$u="_Correct_ybic8_212",qu="_Incorrect_ybic8_215",Uu="_ResultHeader_ybic8_220",Ku="_ResultActions_ybic8_233",Qu="_CloseBtnSoft_ybic8_239",Yu="_SummaryGrid_ybic8_249",Xu="_StatCard_ybic8_257",Zu="_StatLabel_ybic8_265",Ju="_StatValue_ybic8_270",ed="_StatSub_ybic8_277",ce={Overlay:Tu,Dialog:_u,Body:Mu,Header:Eu,Paging:ju,Remaining:Ou,RemainingDanger:Pu,NextBtn:Bu,CloseBtn:zu,Question:Au,Score:Lu,Image:Gu,Options:Hu,OptionBtn:Nu,OptionBtnActive:Fu,Footer:Wu,OptionBtnCorrect:Du,Judge:Vu,Correct:$u,Incorrect:qu,ResultHeader:Uu,ResultActions:Ku,CloseBtnSoft:Qu,SummaryGrid:Yu,StatCard:Xu,StatLabel:Zu,StatValue:Ju,StatSub:ed};function td(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Ts(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function nd(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}const rd=g.memo(function(){const t=Je(p=>p.phase),n=Je(p=>p.quizzes),r=Je(p=>p.order),o=Je(p=>p.currentIndex),s=Je(p=>p.answers),i=Je(p=>p.correctCount),a=Je(p=>p.remainingSec),l=Je(p=>p.uiReveal),c=Je(p=>p.startedAt),u=Je(p=>p.finishedAt),S=Je(p=>p.perQ),y=bs();g.useEffect(()=>{if(t==="idle"||t!=="doing"||a==null)return;const p=window.setInterval(()=>y.getState().tick(),1e3);return()=>window.clearInterval(p)},[t,a,y]);const x=t==="doing"?n[r[o]]:void 0,b=t==="doing"&&x?s[x.qid]??[]:[],v=g.useMemo(()=>{if(t==="idle"||t!=="finished")return;const p=r.map(E=>n[E]),h=p.length,d=p.reduce((E,P)=>E+(P.score??0),0),k=p.reduce((E,P)=>{const F=S[P.qid];return E+(F!=null&&F.isCorrect?P.score??0:0)},0),_=p.map(E=>S[E.qid]).filter(E=>!!E),I=typeof c=="number"&&typeof u=="number"?Math.max(0,u-c):_.reduce((E,P)=>E+(P.ms??0),0),R=h>0?Math.round(I/h):0,f=[..._].sort((E,P)=>E.ms-P.ms),w=f[0],T=f[f.length-1],j=_.filter(E=>!E.multi),O=_.filter(E=>E.multi),z=j.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,M=_.filter(E=>E.timedOut).length,A=_.filter(E=>E.revealed).length,H=_.filter(E=>!E.isCorrect).sort((E,P)=>P.ms-E.ms).slice(0,3);return{total:h,correct:i,rate:h?Math.round(i/h*100):0,timeMsTotal:I,avgMs:R,totalScore:d,gainedScore:k,fastest:w,slowest:T,singles:{total:j.length,correct:z},multis:{total:O.length,correct:C},timedOut:M,revealed:A,wrongTop3:H}},[t,r,n,S,c,u,i]);return t==="idle"?null:m.jsx("div",{className:ce.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:ce.Dialog,children:t==="doing"&&x?m.jsx(od,{q:x,index:o,total:r.length,selected:b,uiReveal:l,onSelect:p=>{if(l)return;const h=y.getState();Ts(x)?h.selectToggle(p):h.selectSingle(p)},onBeforeNext:()=>y.getState().setReveal(!0),onNext:()=>y.getState().afterRevealNext(),remainingSec:a,onClose:()=>y.getState().close()}):m.jsx(sd,{total:r.length,correct:i,summary:v,onClose:()=>y.getState().close()})})})});function od(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:u}=e,S=Ts(t),y=g.useMemo(()=>{const p=t.options.map((h,d)=>({opt:h,i:d}));for(let h=p.length-1;h>0;h--){const d=Math.floor(Math.random()*(h+1));[p[h],p[d]]=[p[d],p[h]]}return p},[t.options]),x=g.useMemo(()=>td(t),[t]),b=g.useMemo(()=>nd(t),[t]),v=g.useMemo(()=>{const p=[...o].sort((h,d)=>h-d);if(p.length!==b.length)return!1;for(let h=0;h<p.length;h++)if(p[h]!==b[h])return!1;return!0},[o,b]);return m.jsxs("div",{className:ce.Body,children:[m.jsxs("div",{className:ce.Header,children:[m.jsx("div",{className:ce.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:u,className:ce.CloseBtn,children:"X"})]}),m.jsx("div",{className:ce.Question,children:t.question}),m.jsx("div",{className:ce.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),m.jsx("div",{className:`${ce.Judge}${s?v?` ${ce.Correct}`:` ${ce.Incorrect}`:""}`,"aria-live":"polite",children:s?v?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:ce.Image,children:x&&m.jsx("img",{src:x,alt:""})}),m.jsx("div",{className:ce.Options,children:y.map(({opt:p,i:h})=>{const d=o.includes(h),k=b.includes(h),_=[ce.OptionBtn,d?ce.OptionBtnActive:"",s&&k?ce.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(h),className:_,disabled:s,children:p},h)})}),m.jsx("div",{className:ce.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:ce.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:a,className:`${ce.NextBtn}`,children:["Submit",typeof c=="number"&&m.jsx("span",{className:`${ce.Remaining} ${c<=5?ce.RemainingDanger:""}`,children:` (${c} s )`})]})})]})}function _o(e){return e==null?"-":`${Math.round(e/1e3)}s`}function sd(e){const{total:t,correct:n,summary:r,onClose:o}=e,s=(r==null?void 0:r.rate)??(t>0?Math.round(n/t*100):0);return m.jsxs("div",{className:ce.Body,children:[m.jsx("div",{className:ce.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:ce.SummaryGrid,role:"list",children:[m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"정답률"}),m.jsxs("div",{className:ce.StatValue,children:[s,"%"]}),m.jsx("div",{className:ce.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 점수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:ce.StatValue,children:_o(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:ce.StatSub,children:`평균 ${_o(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:ce.StatCard,role:"listitem",children:[m.jsx("div",{className:ce.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:ce.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:ce.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:ce.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:ce.CloseBtnSoft,children:"닫기"})})]})}function id(e){return e.map((t,n)=>n)}function ld(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Qn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function Yn(e){const t=e.answers??[],n=[];return t.forEach(r=>{const o=e.options.findIndex(s=>s===r);o>=0&&n.push(o)}),n.sort((r,o)=>r-o)}function Mo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:id(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function ad(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Mo(e);return Vt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=Mo(i);o(a)},openFromSection:i=>{i&&s().hydrateFromSection(i);const a=s();if(!a.quizzes.length)return;const l=a.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid,u=a.answers[c]??[],S=u.includes(i)?u.filter(y=>y!==i):[...u,i].sort((y,x)=>y-x);o({answers:{...a.answers,[c]:S}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[c]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],c=l.qid,u=(i.answers[c]??[]).slice().sort((p,h)=>p-h),S=Yn(l),y=ld(u,S),x=i.questionStartedAt?Date.now()-i.questionStartedAt:0,b=i.perQ[c],v={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:u,correctIdxes:S,isCorrect:y,ms:x,revealed:(b==null?void 0:b.revealed)??!1,timedOut:(b==null?void 0:b.timedOut)??!1};if(o({correctCount:i.correctCount+(y?1:0),perQ:{...i.perQ,[c]:v}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const p=i.currentIndex+1;o({currentIndex:p,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[p]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const a=s();if(a.phase==="doing"){if(i){const l=a.quizzes[a.order[a.currentIndex]],c=l.qid,u=a.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:(u==null?void 0:u.timedOut)??!1};o({perQ:{...a.perQ,[c]:S}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const a=i.currentIndex+1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const a=i.currentIndex-1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const a=i.remainingSec-1;if(a<=0){const l=i.quizzes[i.order[i.currentIndex]],c=l.qid,u=i.perQ[c],S={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(u==null?void 0:u.selected)??[],correctIdxes:(u==null?void 0:u.correctIdxes)??Yn(l),isCorrect:(u==null?void 0:u.isCorrect)??!1,ms:(u==null?void 0:u.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:S}})}else o({remainingSec:a})}}))}function cd({children:e,initialState:t}){const n=g.useMemo(()=>ad(t.section),[t]),r=g.useRef(t.onQuizComplete);return g.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),g.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const a=r.current;if(!a)return;const{sectionId:l,quizzes:c,order:u,perQ:S,startedAt:y,finishedAt:x}=s,b=u.map(R=>c[R]),v=b.length,p=b.filter(R=>{var f;return(f=S[R.qid])==null?void 0:f.isCorrect}).length,h=b.reduce((R,f)=>R+(f.score??0),0),d=b.reduce((R,f)=>{const w=S[f.qid];return R+(w!=null&&w.isCorrect?f.score??0:0)},0),k=typeof y=="number"&&typeof x=="number"?Math.max(0,x-y):0,_=b.map(R=>{const f=S[R.qid];return{qid:R.qid,index:R.index,question:R.question,score:R.score??0,isCorrect:(f==null?void 0:f.isCorrect)??!1,selected:(f==null?void 0:f.selected)??[],correctIdxes:(f==null?void 0:f.correctIdxes)??[],ms:(f==null?void 0:f.ms)??0,timedOut:(f==null?void 0:f.timedOut)??!1}}),I={sectionId:l??"",total:v,correct:p,rate:v>0?Math.round(p/v*100):0,totalScore:h,gainedScore:d,timeMsTotal:k,perQuestion:_};a(I)}});return()=>o()},[n]),m.jsx(yr.Provider,{value:n,children:e})}const Eo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function ud({containerRef:e}){const t=vn(),n=pn(),r=g.useRef(null);return g.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const a=new ResizeObserver(()=>{const l=o.clientWidth,c=o.clientHeight;(l!==s||c!==i)&&(s=l,i=c,n.getState().setViewportSize(l,c),t.getState().emit({type:"viewport_resize",payload:{width:l,height:c}}))});return a.observe(o),()=>a.disconnect()},[t,n,e]),g.useEffect(()=>{const o=n.getState();r.current={};for(const i of Eo)r.current[i]=o[i];const s=n.subscribe(i=>{const a=r.current;if(a)for(const l of Eo){const c=a[l],u=i[l];c!==u&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:u}}):t.getState().emit({type:"settings_change",payload:{key:l,value:u}}),a[l]=u)}});return()=>{s(),r.current=null}},[t,n]),null}function dd(){const e=vn(),t=pn(),n=Mt(),r=g.useContext(Bo),o=g.useContext(xn),s=g.useCallback(l=>{const{viewerState:c}=l;if(c){c.mode&&t.getState().setMode(c.mode);const{...S}=c;t.setState(S)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(c==null?void 0:c.mode)==="scroll"||!(c!=null&&c.mode)){const S=n.getState().progress.getSectionScrollApi();if(S){if(l.scrollY===0)S.setScrollTop(0);else if(S.scrollToGIAtOffset){const y=l.anchorGI??l.globalIndex;if(typeof y=="number"){const x=l.anchorOffsetRatio??0;S.scrollToGIAtOffset(y,x)}}}}},[t,n]),i=g.useCallback(()=>{var b,v,p;const l=t.getState(),c=n.getState().progress,u=(b=c.getSectionScrollApi)==null?void 0:b.call(c),S=c.currentGlobalRunIndex??0,y=((v=u==null?void 0:u.getScrollTop)==null?void 0:v.call(u))??0,x=((p=u==null?void 0:u.getAnchorOffsetRatio)==null?void 0:p.call(u,S))??0;return{viewerState:{mode:l.mode,theme:l.theme,fontFamily:l.fontFamily,fontSizePx:l.fontSizePx,lineHeight:l.lineHeight,marginX:l.marginX,marginY:l.marginY,showOverlays:l.showOverlays,isSettingsOpen:l.isSettingsOpen,pointerStyle:l.pointerStyle,pointerColor:l.pointerColor,breakMarks:l.breakMarks,breakGapPx:l.breakGapPx,muteAudio:l.muteAudio,audioSpeed:l.audioSpeed,showPointer:l.showPointer,showSplit:l.showSplit,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:y,anchorGI:S,anchorOffsetRatio:x,currentPage:c.pageIndex??0,sectionId:c.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),a=g.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:c}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(c,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:u,anchorGI:S,anchorOffsetRatio:y}=l.payload,x=n.getState().progress.getSectionScrollApi();x&&(u===0?x.setScrollTop(0):x.scrollToGIAtOffset&&typeof S=="number"&&x.scrollToGIAtOffset(S,y));break}case"settings_change":{const{key:c,value:u}=l.payload,S=t.getState();c in S&&typeof S[c]!="function"&&t.setState({[c]:u});break}case"mode_change":{const{mode:c}=l.payload;t.getState().setMode(c);break}case"audio_control":{if(!o)break;const{action:c}=l.payload;switch(c){case"play":o.getState()._setStatusOnly("playing");break;case"pause":o.getState()._setStatusOnly("paused");break;case"stop":o.getState()._setStatusOnly("idle");break}break}case"page_change":{const{pageIndex:c}=l.payload;n.getState().progress.setPageIndex(c);break}case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return g.useLayoutEffect(()=>r?(r.current={dispatch:a,applySnapshot:s,getSnapshot:i},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,a,s,i]),g.useLayoutEffect(()=>e.subscribe((c,u)=>{c.isPlaybackMode&&!u.isPlaybackMode?(e.getState().setDispatchHandler(a),e.getState().setApplySnapshotHandler(s)):!c.isPlaybackMode&&u.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,a,s]),null}const fd=({onTranslate:e})=>{const t=$(u=>u.rangeStartGI),n=$(u=>u.rangeEndGI),r=$(u=>u.getRangeText),o=$(u=>u.clearRange),s=t!=null&&n!=null,[i,a]=g.useState(null);g.useEffect(()=>{if(!s)return;const u=()=>{o()};return window.addEventListener("resize",u),()=>window.removeEventListener("resize",u)},[s,o]),g.useEffect(()=>{if(!s||t==null||n==null){a(null);return}const u=()=>{const S=document.querySelector(`[data-g="${n}"]`);if(!S){a({x:window.innerWidth/2,y:80});return}const y=S.getBoundingClientRect(),x=document.querySelector(`[data-g="${t}"]`),b=x==null?void 0:x.getBoundingClientRect();let v=y.left+y.width/2;b&&(v=(b.left+y.right)/2);const p=160,h=50,d=16,k=12,_=Math.max(d+p/2,Math.min(v,window.innerWidth-d-p/2)),I=((b==null?void 0:b.top)??y.top)-h-k;let R=I;I<d&&(R=y.bottom+k),a({x:_,y:R})};return u(),window.addEventListener("scroll",u,!0),()=>window.removeEventListener("scroll",u,!0)},[s,t,n]);const l=g.useCallback(()=>{const u=r();u&&navigator.clipboard.writeText(u).catch(S=>{console.error("복사 실패:",S)}),o()},[r,o]),c=g.useCallback(()=>{const u=r();u&&e&&e(u)},[r,e]);return!s||!i?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"fixed",left:i.x,top:i.y,transform:"translateX(-50%)",display:"flex",gap:8,padding:"8px 12px",backgroundColor:"#fff",borderRadius:8,boxShadow:"0 4px 12px rgba(0, 0, 0, 0.3)",zIndex:1e4},children:[m.jsx("button",{onClick:l,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:c,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},pd="_handleStart_1336y_16 _handle_1336y_1",hd="_handleEnd_1336y_21 _handle_1336y_1",jo={handleStart:pd,handleEnd:hd},gd=()=>{const e=$(v=>v.rangeStartGI),t=$(v=>v.rangeEndGI),n=$(v=>v.setRange),r=e!=null&&t!=null,[o,s]=g.useState(null),[i,a]=g.useState(null),l=g.useRef(null),c=g.useRef(null);g.useEffect(()=>{if(!r||e==null||t==null){s(null),a(null);return}const v=()=>{const p=document.querySelector(`[data-g="${e}"]`),h=document.querySelector(`[data-g="${t}"]`);if(p){const d=p.getBoundingClientRect();s({x:d.left,y:d.bottom})}else s(null);if(h){const d=h.getBoundingClientRect();a({x:d.right,y:d.bottom})}else a(null)};return v(),window.addEventListener("scroll",v,!0),window.addEventListener("resize",v),()=>{window.removeEventListener("scroll",v,!0),window.removeEventListener("resize",v)}},[r,e,t]);const u=g.useCallback((v,p)=>{var d;const h=document.elementsFromPoint(v,p);for(const k of h){const _=(d=k.getAttribute)==null?void 0:d.call(k,"data-g");if(_!=null)return parseInt(_,10)}return null},[]),S=g.useCallback(v=>p=>{p.preventDefault(),p.stopPropagation(),l.current=v,c.current=v==="start"?e:t,p.target.setPointerCapture(p.pointerId)},[e,t]),y=g.useCallback(v=>{if(!l.current||e==null||t==null)return;const p=u(v.clientX,v.clientY);p!=null&&(l.current==="start"?p<=t?n(p,t):(n(t,p),l.current="end"):p>=e?n(e,p):(n(p,e),l.current="start"))},[e,t,n,u]),x=g.useCallback(v=>{l.current=null,c.current=null,v.target.releasePointerCapture(v.pointerId)},[]);return r?m.jsxs(m.Fragment,{children:[o&&m.jsx("div",{className:jo.handleStart,"data-range-handle":"start",style:{left:o.x-26,top:o.y},onPointerDown:S("start"),onPointerMove:y,onPointerUp:x,onPointerCancel:x}),i&&m.jsx("div",{className:jo.handleEnd,"data-range-handle":"end",style:{left:i.x,top:i.y},onPointerDown:S("end"),onPointerMove:y,onPointerUp:x,onPointerCancel:x})]}):null};function md(){const e=$(o=>o.rangeStartGI),t=$(o=>o.rangeEndGI),n=$(o=>o.clearRange),r=e!=null&&t!=null;return g.useEffect(()=>{if(!r)return;const o=s=>{var a;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(a=i.closest("[data-g]"))==null?void 0:a.getAttribute("data-g");if(l){const c=parseInt(l,10),u=Math.min(e,t),S=Math.max(e,t);if(c>=u&&c<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const bd=({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,xd=(e,t,n)=>Math.min(n,Math.max(t,e));function vd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:a,onViewerEvent:l,viewerRef:c,isPlaybackMode:u=!1,playbackScale:S,isDev:y=!1}){const x=String((e==null?void 0:e.section_id)??"0"),b=g.useMemo(()=>{var _,I;const d=((_=e==null?void 0:e.ast)==null?void 0:_.blocks)??[];let k=0;for(const R of d)(R==null?void 0:R.type)!=="image"&&(k+=((I=R==null?void 0:R.runs)==null?void 0:I.length)??0);return k},[e]),v=g.useMemo(()=>typeof n=="number"?xd(n,b>0?0:-1,Math.max(b-1,-1)):(b>0,0),[n,b]),p=g.useMemo(()=>({section:e,initialIndex:v,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,v,r,o,s,i]),h=g.useMemo(()=>{const d=(e==null?void 0:e.audios)??[],k=d.length>0?$c(e):void 0;return{clips:d,map:k,initialIndex:v,section:e}},[e,v]);return m.jsx(Vs,{onViewerEvent:l,isPlaybackMode:u,playbackScale:S,viewerRef:c,children:m.jsx(Xc,{initialState:{...t,isDev:y},children:m.jsx(Yc,{initialState:p,children:m.jsx(Vc,{initialState:h,children:m.jsx(cd,{initialState:{section:e,onQuizComplete:a},children:m.jsx(Sd,{})},x)},x)},x)})})}function Sd(){const e=X(u=>u.mode),t=g.useRef(null),[n,r]=g.useState(!1),[o,s]=g.useState(),i=g.useCallback(u=>{s(u),r(!0)},[]),a=g.useCallback(()=>{r(!1),s(void 0)},[]),l=u=>{u.preventDefault()},c=u=>{u.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:l,onDragStart:c,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(da,{}):m.jsx(yu,{}),m.jsx(Lc,{}),m.jsx(rd,{}),m.jsx(Ru,{}),m.jsx(fd,{onTranslate:i}),m.jsx(gd,{}),m.jsx(md,{}),m.jsx(bd,{isOpen:n,onClose:a,text:o}),m.jsx(ud,{containerRef:t}),m.jsx(dd,{})]})}exports.CRViewer=vd;