@readerseye2/cr_viewer 1.0.15 → 1.0.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CR_Viewer.d.ts +1 -1
- package/dist/CR_Viewer.d.ts.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -5
- package/package.json +4 -1
package/dist/CR_Viewer.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type QuizResult = {
|
|
|
24
24
|
timeMsTotal: number;
|
|
25
25
|
perQuestion: QuizQuestionResult[];
|
|
26
26
|
};
|
|
27
|
-
type CRViewerProps = {
|
|
27
|
+
export type CRViewerProps = {
|
|
28
28
|
section: SectionData;
|
|
29
29
|
initialViewerState?: import('./stores/viewer/crViewer.store').CRViewerStoreOptions['init'];
|
|
30
30
|
/** 서버에서 불러온 마지막 읽던 위치 (전역 run index) */
|
package/dist/CR_Viewer.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CR_Viewer.d.ts","sourceRoot":"","sources":["../src/CR_Viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"CR_Viewer.d.ts","sourceRoot":"","sources":["../src/CR_Viewer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,mCAAmC,CAAC;AAC3C,OAAO,oCAAoC,CAAC;AAC5C,OAAO,oCAAoC,CAAC;AAuB5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAMtF,YAAY,EAAE,cAAc,EAAE,CAAC;AAE/B,aAAa;AACb,MAAM,MAAM,kBAAkB,GAAG;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,kBAAkB;AAClB,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,EAAE,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,kBAAkB,CAAC,EAAE,OAAO,gCAAgC,EAAE,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC3F,wCAAwC;IACxC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAGjC,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,kBAAkB;IAClB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC9C,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,iCAAiC;IACjC,SAAS,CAAC,EAAE,OAAO,CAAC;IAGpB,eAAe;IACf,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAG9C,wCAAwC;IACxC,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,iBAAiB;IACjB,SAAS,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IAG1D,eAAe;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAGF,MAAM,CAAC,OAAO,UAAU,SAAS,CAAC,EAChC,OAAO,EACP,kBAAkB,EAClB,uBAAuB,EACvB,aAAa,EACb,YAAY,EACZ,SAAiB,EACjB,SAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,cAAsB,EACtB,aAAa,EACb,KAAa,GACd,EAAE,aAAa,2CAyEf"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
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_1ihf3_1{position:absolute;width:26px;height:26px;background-color:#3b82f6;box-shadow:0 2px 4px #0000004d;cursor:grab;z-index:10001;touch-action:none}._handle_1ihf3_1:active{cursor:grabbing;background-color:#2563eb}._handleStart_1ihf3_16{border-radius:13px 0 13px 13px}._handleEnd_1ihf3_21{border-radius:0 13px 13px}')),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
-
"use strict";var Os=Object.defineProperty;var Ps=(e,t,n)=>t in e?Os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Cr=(e,t,n)=>Ps(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime")
|
|
2
|
+
"use strict";var Os=Object.defineProperty;var Ps=(e,t,n)=>t in e?Os(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Cr=(e,t,n)=>Ps(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime");require("@fontsource/noto-sans-kr/400.css");require("@fontsource/noto-sans-kr/700.css");require("@fontsource/noto-serif-kr/400.css");require("@fontsource/noto-serif-kr/700.css");require("@fontsource/nanum-myeongjo/400.css");require("@fontsource/nanum-myeongjo/700.css");const h=require("react"),Bs=require("react-dom");function zs(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 ot=zs(h),sr=h.createContext(void 0);var Yt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Po(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Xt={exports:{}},Sn={},Zt={exports:{}},yn={};/**
|
|
3
3
|
* @license React
|
|
4
4
|
* use-sync-external-store-shim.production.js
|
|
5
5
|
*
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
*
|
|
32
32
|
* This source code is licensed under the MIT license found in the
|
|
33
33
|
* LICENSE file in the root directory of this source tree.
|
|
34
|
-
*/var _r;function Hs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=Bo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(a,d,S,b,v){var x=s(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=c(function(){function f(M){if(!u){if(u=!0,R=M,M=b(M),v!==void 0&&w.hasValue){var g=w.value;if(v(g,M))return T=g}return T=M}if(g=T,r(R,M))return g;var y=b(M);return v!==void 0&&v(g,y)?(R=M,g):(R=M,T=y)}var u=!1,R,T,I=S===void 0?null:S;return[function(){return f(d())},I===null?void 0:function(){return f(I())}]},[d,S,b,v]);var p=o(a,x[0],x[1]);return i(function(){w.hasValue=!0,w.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 Mr;function Ns(){return Mr||(Mr=1,process.env.NODE_ENV==="production"?Xt.exports=Gs():Xt.exports=Hs()),Xt.exports}var Fs=Ns();const Ws=Po(Fs),Er=e=>{let t;const n=new Set,r=(a,d)=>{const S=typeof a=="function"?a(t):a;if(!Object.is(S,t)){const b=t;t=d??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(v=>v(t,b))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:a=>(n.add(a),()=>n.delete(a))},l=t=e(r,o,c);return c},qt=(e=>e?Er(e):Er),{useSyncExternalStoreWithSelector:Ds}=Ws,$s=e=>e;function pn(e,t=$s,n){const r=Ds(e.subscribe,e.getState,e.getInitialState,t,n);return h.useDebugValue(r),r}function Y(e,t){const n=h.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return pn(n,e,t)}function hn(){const e=h.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const St=h.createContext(void 0),zo=h.createContext(void 0);function Vs(){return qt((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 qs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=h.useMemo(()=>Vs(),[]);return h.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),h.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),h.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),h.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),m.jsx(St.Provider,{value:s,children:m.jsx(zo.Provider,{value:o,children:e})})}function yt(){const e=h.useContext(St);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const ir=h.createContext(void 0);function xt(){const e=h.useContext(ir);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function q(e,t){const n=h.useContext(ir);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return pn(n,o=>e(o.progress),t)}function Us({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=h.useRef(null);h.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=h.useCallback(c=>{if(!(r!=null&&r(c.target))&&c.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(c)},n)}},[n,e,r]),i=h.useCallback(c=>{r!=null&&r(c.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const on={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)),Ks=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},Ao=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],He={mode:"page",theme:"light",fontFamily:Ao.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 Qs(e){const{init:t,recorderStore:n}=e??{};return qt((r,o)=>({...He,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{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:He.mode,theme:He.theme,fontFamily:He.fontFamily,fontSizePx:He.fontSizePx,lineHeight:He.lineHeight,marginX:He.marginX,marginY:He.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:He.pointerStyle,pointerColor:He.pointerColor,breakMarks:He.breakMarks,breakGapPx:He.breakGapPx,muteAudio:He.muteAudio,audioSpeed:He.audioSpeed,showPointer:He.showPointer,showSplit:He.showSplit})),maps:{MARGIN_MAP: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:()=>Ks(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 gn=0,pt=1,jt=2,Lo=4;function jr(e){return()=>e}function Ys(e){e()}function Go(e,t){return n=>e(t(n))}function Or(e,t){return()=>e(t)}function Xs(e,t){return n=>e(t,n)}function lr(e){return e!==void 0}function Zs(...e){return()=>{e.map(Ys)}}function Ot(){}function mn(e,t){return t(e),e}function Js(e,t){return t(e)}function ke(...e){return e}function xe(e,t){return e(pt,t)}function fe(e,t){e(gn,t)}function ar(e){e(jt)}function _e(e){return e(Lo)}function J(e,t){return xe(e,Xs(t,gn))}function tt(e,t){const n=e(pt,r=>{n(),t(r)});return n}function Pr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Ho(e,t){return e===t}function Ie(e=Ho){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function U(e){return t=>Go(t,e)}function it(e){return t=>()=>{t(e)}}function L(e,...t){const n=ei(...t);return((r,o)=>{switch(r){case jt:ar(e);return;case pt:return xe(e,n(o))}})}function lt(e,t){return n=>r=>{n(t=e(t,r))}}function vt(e){return t=>n=>{e>0?e--:t(n)}}function ct(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function he(...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 c=Math.pow(2,i);xe(s,l=>{const a=n;n=n|c,t[i]=l,a!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>{s([i].concat(t))};n===o?c():r=c}}function ei(...e){return t=>e.reduceRight(Js,t)}function ti(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case pt:return s?n===s?void 0:(r(),n=s,t=xe(e,s),t):(r(),Ot);case jt:r(),n=null;return}}}function G(e){let t=e;const n=ge();return((r,o)=>{switch(r){case gn:t=o;break;case pt:{o(t);break}case Lo:return t}return n(r,o)})}function Fe(e,t){return mn(G(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case gn:e.slice().forEach(r=>{r(n)});return;case jt:e.splice(0,e.length);return;case pt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function qe(e){return mn(ge(),t=>J(e,t))}function me(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ni(),singleton:n}}const ni=()=>Symbol();function ri(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const c=r(o.map(l=>n(l)));return i&&t.set(s,c),c};return n(e)}function ze(...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 c=Math.pow(2,i);xe(s,l=>{n[i]=l,r=r|c,r===o&&fe(t,n)})}),function(s,i){switch(s){case jt:{ar(t);return}case pt:return r===o&&i(n),xe(t,i)}}}function se(e,t=Ho){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case jt:return;case pt:return Zs(...e.map(r=>xe(r,n)))}}}var $e=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))($e||{});const oi={0:"debug",3:"error",1:"log",2:"warn"},si=()=>typeof globalThis>"u"?window:globalThis,ht=me(()=>{const e=G(3);return{log:G((t,n,r=1)=>{var o;const s=(o=si().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[oi[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function wt(e,t,n){return cr(e,t,n).callbackRef}function cr(e,t,n){const r=h.useRef(null);let o=i=>{};const s=h.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?c():requestAnimationFrame(c)}):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 ii(e,t,n,r,o,s,i,c,l){const a=h.useCallback(d=>{const S=li(d.children,t,c?"offsetWidth":"offsetHeight",o);let b=d.parentElement;for(;!b.dataset.virtuosoScroller;)b=b.parentElement;const v=b.lastElementChild.dataset.viewportType==="window";let x;v&&(x=b.ownerDocument.defaultView);const w=i?c?i.scrollLeft:i.scrollTop:v?c?x.scrollX||x.document.documentElement.scrollLeft:x.scrollY||x.document.documentElement.scrollTop:c?b.scrollLeft:b.scrollTop,p=i?c?i.scrollWidth:i.scrollHeight:v?c?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight:c?b.scrollWidth:b.scrollHeight,f=i?c?i.offsetWidth:i.offsetHeight:v?c?x.innerWidth:x.innerHeight:c?b.offsetWidth:b.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(w,0),viewportHeight:f}),s==null||s(c?Br("column-gap",getComputedStyle(d).columnGap,o):Br("row-gap",getComputedStyle(d).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,c]);return cr(a,n,l)}function li(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index),a=parseFloat(c.dataset.knownSize),d=t(c,n);if(d===0&&r("Zero-sized element, this should not happen",{child:c},$e.ERROR),d===a)continue;const S=s[s.length-1];s.length===0||S.size!==d||S.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function Br(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,$e.WARN),t==="normal"?0:parseInt(t??"0",10)}function No(e,t,n){const r=h.useRef(null),o=h.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const a=l.getBoundingClientRect(),d=a.width;let S,b;if(t){const v=t.getBoundingClientRect(),x=a.top-v.top;b=v.height-Math.max(0,x),S=x+t.scrollTop}else{const v=i.current.ownerDocument.defaultView;b=v.innerHeight-Math.max(0,a.top),S=a.top+v.scrollY}r.current={offsetTop:S,visibleHeight:b,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=cr(o,!0,n),c=h.useCallback(()=>{o(i.current)},[o,i]);return h.useEffect(()=>{var l;if(t){t.addEventListener("scroll",c);const a=new ResizeObserver(()=>{requestAnimationFrame(c)});return a.observe(t),()=>{t.removeEventListener("scroll",c),a.unobserve(t)}}else{const a=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}}},[c,t,i]),s}const We=me(()=>{const e=ge(),t=ge(),n=G(0),r=ge(),o=G(0),s=ge(),i=ge(),c=G(0),l=G(0),a=G(0),d=G(0),S=ge(),b=ge(),v=G(!1),x=G(!1),w=G(!1);return J(L(e,U(({scrollTop:p})=>p)),t),J(L(e,U(({scrollHeight:p})=>p)),i),J(t,o),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:l,footerHeight:d,headerHeight:c,horizontalDirection:x,scrollBy:b,scrollContainerState:e,scrollHeight:i,scrollingInProgress:v,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Gt={lvl:0};function Fo(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:c,value:l}=t(e[i]);s.push({end:c-1,start:r,value:o}),r=c,o=l}return s.push({end:1/0,start:r,value:o}),s}function ve(e){return e===Gt}function Ht(e,t){if(!ve(e))return t===e.k?e.v:t<e.k?Ht(e.l,t):Ht(e.r,t)}function nt(e,t,n="k"){if(ve(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 Ve(e,t,n){return ve(e)?$o(t,n,1):t===e.k?Le(e,{k:t,v:n}):t<e.k?zr(Le(e,{l:Ve(e.l,t,n)})):zr(Le(e,{r:Ve(e.r,t,n)}))}function _t(){return Gt}function Mt(e,t,n){if(ve(e))return[];const r=nt(e,t)[0];return ai(er(e,r,n))}function Jn(e,t){if(ve(e))return Gt;const{k:n,l:r,r:o}=e;if(t===n){if(ve(r))return o;if(ve(o))return r;{const[s,i]=Do(r);return nn(Le(e,{k:s,l:Wo(r),v:i}))}}else return t<n?nn(Le(e,{l:Jn(r,t)})):nn(Le(e,{r:Jn(o,t)}))}function bt(e){return ve(e)?[]:[...bt(e.l),{k:e.k,v:e.v},...bt(e.r)]}function er(e,t,n){if(ve(e))return[];const{k:r,l:o,r:s,v:i}=e;let c=[];return r>t&&(c=c.concat(er(o,t,n))),r>=t&&r<=n&&c.push({k:r,v:i}),r<=n&&(c=c.concat(er(s,t,n))),c}function nn(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(Le(e,{lvl:n-1}));if(!ve(t)&&!ve(t.r))return Le(t.r,{l:Le(t,{r:t.r.l}),lvl:n,r:Le(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(Le(e,{lvl:n-1}));if(!ve(r)&&!ve(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return Le(o,{l:Le(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(Le(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Le(e,t){return $o(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 Wo(e){return ve(e.r)?e.l:nn(Le(e,{r:Wo(e.r)}))}function _n(e){return ve(e)||e.lvl>e.r.lvl}function Do(e){return ve(e.r)?[e.k,e.v]:Do(e.r)}function $o(e,t,n,r=Gt,o=Gt){return{k:e,l:r,lvl:n,r:o,v:t}}function zr(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!ve(t)&&t.lvl===e.lvl?Le(t,{r:Le(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!ve(n)&&!ve(n.r)&&n.lvl===t&&n.r.lvl===t?Le(n,{l:Le(e,{r:n.l}),lvl:t+1}):e}function ai(e){return Fo(e,({k:t,v:n})=>({index:t,value:n}))}function qo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Nt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ur=me(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function Uo(e,t,n){return e[sn(e,t,n)]}function sn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-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 ci(e,t,n,r){const o=sn(e,t,r),s=sn(e,n,r,o);return e.slice(o,s+1)}function ft(e,t){return Math.round(e.getBoundingClientRect()[t])}function bn(e){return!ve(e.groupOffsetTree)}function dr({index:e},t){return t===e?0:t<e?-1:1}function ui(){return{groupIndices:[],groupOffsetTree:_t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:_t()}}function di(e,t){let n=ve(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),ve(e)){e=Ve(e,0,s);continue}const c=Mt(e,i-1,o+1);if(c.some(xi(r)))continue;let l=!1,a=!1;for(const{end:d,start:S,value:b}of c)l?(o>=S||s===b)&&(e=Jn(e,S)):(a=b!==s,l=!0),d>o&&o>=S&&b!==s&&(e=Ve(e,o+1,b));a&&(e=Ve(e,i,s))}return[e,n]}function fi(e){return typeof e.groupIndex<"u"}function pi({offset:e},t){return t===e?0:t<e?-1:1}function Ft(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Uo(t,e,dr),i=e-r,c=s*i+(i-1)*n+o;return c>0?c+n:c}function Ko(e,t){if(!bn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Qo(e,t,n){if(fi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Ko(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function hi(e,t,n,r=0){return r>0&&(t=Math.max(t,Uo(e,r,dr).offset)),Fo(ci(e,t,n,pi),bi)}function gi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,$e.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&ve(s)&&t.length===2){const b=t[0].size,v=t[1].size;i=n.reduce((x,w)=>Ve(Ve(x,w,b),w+1,v),i)}else[i,c]=di(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S}=nr(e.offsetTree,c,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((b,v)=>Ve(b,v,Ft(v,S,o)),_t()),lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S,sizeTree:i}}function mi(e){return bt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Ar(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,c=0,l=0;if(t!==0){l=sn(o,t-1,dr),c=o[l].offset;const a=nt(n,t-1);s=a[0],i=a[1],o.length&&o[l].size===nt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:a,value:d}of Mt(n,t,1/0)){const S=a-s,b=S*i+c+S*r;o.push({index:a,offset:b,size:d}),s=a,c=b,i=d}return{lastIndex:s,lastOffset:c,lastSize:i,offsetTree:o}}function bi(e){return{index:e.index,value:e}}function xi(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 vi={offsetHeight:"height",offsetWidth:"width"},at=me(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Fe(r,0),s=ge(),i=ge(),c=G(0),l=G([]),a=G(void 0),d=G(void 0),S=G(void 0),b=G(void 0),v=G((g,y)=>ft(g,vi[y])),x=G(void 0),w=G(0),p=ui(),f=Fe(L(n,he(l,e,w),lt(gi,p),Ie()),p),u=Fe(L(l,Ie(),lt((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),U(({prev:g})=>g)),[]);J(L(l,ie(g=>g.length>0),he(f,w),U(([g,y,k])=>{const _=g.reduce((O,P,C)=>Ve(O,P,Ft(P,y.offsetTree,k)||C),_t());return{...y,groupIndices:g,groupOffsetTree:_}})),f),J(L(r,he(f),ie(([g,{lastIndex:y}])=>g<y),U(([g,{lastIndex:y,lastSize:k}])=>[{endIndex:y,size:k,startIndex:g}])),n),J(a,d);const R=Fe(L(a,U(g=>g===void 0)),!0);J(L(d,ie(g=>g!==void 0&&ve(_e(f).sizeTree)),U(g=>{const y=_e(S),k=_e(l).length>0;return y?k?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:g,startIndex:1}]:[]:[{endIndex:0,size:g,startIndex:0}]})),n),J(L(b,ie(g=>g!==void 0&&g.length>0&&ve(_e(f).sizeTree)),U(g=>{const y=[];let k=g[0],_=0;for(let O=1;O<g.length;O++){const P=g[O];P!==k&&(y.push({endIndex:O-1,size:k,startIndex:_}),k=P,_=O)}return y.push({endIndex:g.length-1,size:k,startIndex:_}),y})),n),J(L(l,he(S,d),ie(([,g,y])=>g!==void 0&&y!==void 0),U(([g,y,k])=>{const _=[];for(let O=0;O<g.length;O++){const P=g[O],C=g[O+1];_.push({startIndex:P,endIndex:P,size:y}),C!==void 0&&_.push({startIndex:P+1,endIndex:C-1,size:k})}return _})),n);const T=qe(L(n,he(f),lt(({sizes:g},[y,k])=>({changed:k!==g,sizes:k}),{changed:!1,sizes:p}),U(g=>g.changed)));xe(L(c,lt((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),U(g=>g.diff)),g=>{const{groupIndices:y}=_e(f);if(g>0)fe(t,!0),fe(s,g+Ar(g,y));else if(g<0){const k=_e(u);k.length>0&&(g-=Ar(-g,k)),fe(i,g)}}),xe(L(c,he(e)),([g,y])=>{g<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},$e.ERROR)});const I=qe(s);J(L(s,he(f),U(([g,y])=>{const k=y.groupIndices.length>0,_=[],O=y.lastSize;if(k){const P=Ht(y.sizeTree,0);let C=0,j=0;for(;C<g;){const F=y.groupIndices[j],E=y.groupIndices.length===j+1?1/0:y.groupIndices[j+1]-F-1;_.push({endIndex:F,size:P,startIndex:F}),_.push({endIndex:F+1+E-1,size:O,startIndex:F+1}),j++,C+=E+1}const A=bt(y.sizeTree);return C!==g&&A.shift(),A.reduce((F,{k:E,v:B})=>{let N=F.ranges;return F.prevSize!==0&&(N=[...F.ranges,{endIndex:E+g-1,size:F.prevSize,startIndex:F.prevIndex}]),{prevIndex:E+g,prevSize:B,ranges:N}},{prevIndex:g,prevSize:0,ranges:_}).ranges}return bt(y.sizeTree).reduce((P,{k:C,v:j})=>({prevIndex:C+g,prevSize:j,ranges:[...P.ranges,{endIndex:C+g-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const M=qe(L(i,he(f,w),U(([g,{offsetTree:y},k])=>{const _=-g;return Ft(_,y,k)})));return J(L(i,he(f,w),U(([g,y,k])=>{if(y.groupIndices.length>0){if(ve(y.sizeTree))return y;let _=_t();const O=_e(u);let P=0,C=0,j=0;for(;P<-g;){j=O[C];const A=O[C+1]-j-1;C++,P+=A+1}if(_=bt(y.sizeTree).reduce((A,{k:F,v:E})=>Ve(A,Math.max(0,F+g),E),_),P!==-g){const A=Ht(y.sizeTree,j);_=Ve(_,0,A);const F=nt(y.sizeTree,-g+1)[1];_=Ve(_,1,F)}return{...y,sizeTree:_,...nr(y.offsetTree,0,_,k)}}else{const _=bt(y.sizeTree).reduce((O,{k:P,v:C})=>Ve(O,Math.max(0,P+g),C),_t());return{...y,sizeTree:_,...nr(y.offsetTree,0,_,k)}}})),f),{beforeUnshiftWith:I,data:x,defaultItemSize:d,firstItemIndex:c,fixedItemSize:a,fixedGroupSize:S,gap:w,groupIndices:l,heightEstimates:b,itemSize:v,listRefresh:T,shiftWith:i,shiftWithOffset:M,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:R,unshiftWith:s}},ke(ht,ur),{singleton:!0});function Si(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Yo=me(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),c=qe(L(s,U(Si)));return J(L(c,U(l=>l.totalCount)),n),J(L(c,U(l=>l.groupIndices)),e),J(L(ze(o,t,r),ie(([l,a])=>bn(a)),U(([l,a,d])=>nt(a.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ie(),U(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(at,We)),gt=me(([{log:e}])=>{const t=G(!1),n=qe(L(t,ie(r=>r),Ie()));return xe(t,r=>{r&&_e(e)("props updated",{},$e.DEBUG)}),{didMount:n,propsReady:t}},ke(ht),{singleton:!0}),yi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!yi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ut=me(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:c,scrollingInProgress:l,scrollTo:a,smoothScrollTargetReached:d,viewportHeight:S},{log:b}])=>{const v=ge(),x=ge(),w=G(0);let p=null,f=null,u=null;function R(){p&&(p(),p=null),u&&(u(),u=null),f&&(clearTimeout(f),f=null),fe(l,!1)}return J(L(v,he(n,S,r,w,c,i,b),he(e,s,o),U(([[T,I,M,g,y,k,_,O],P,C,j])=>{const A=Xo(T),{align:F,behavior:E,offset:B}=A,N=g-1,$=Qo(A,I,N);let V=Ft($,I.offsetTree,P)+k;F==="end"?(V+=C+nt(I.sizeTree,$)[1]-M+j,$===N&&(V+=_)):F==="center"?V+=(C+nt(I.sizeTree,$)[1]-M+j)/2:V-=y,B&&(V+=B);const le=ae=>{R(),ae?(O("retrying to scroll to",{location:T},$e.DEBUG),fe(v,T)):(fe(x,!0),O("list did not change, scroll successful",{},$e.DEBUG))};if(R(),E==="smooth"){let ae=!1;u=xe(t,ye=>{ae=ae||ye}),p=tt(d,()=>{le(ae)})}else p=tt(L(t,wi(150)),le);return f=setTimeout(()=>{R()},1200),fe(l,!0),O("scrolling from index to",{behavior:E,index:$,top:V},$e.DEBUG),{behavior:E,top:V}})),a),{scrollTargetReached:x,scrollToIndex:v,topListHeight:w}},ke(at,We,ht),{singleton:!0});function wi(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function fr(e,t){e==0?t():requestAnimationFrame(()=>{fr(e-1,t)})}function pr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kt=me(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const c=G(!0),l=G(0),a=G(!0);return J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),c),J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),a),xe(L(ze(t,i),he(c,n,e,a),ie(([[,d],S,{sizeTree:b},v,x])=>d&&(!ve(b)||lr(v))&&!S&&!x),he(l)),([,d])=>{tt(o,()=>{fe(a,!0)}),fr(4,()=>{tt(r,()=>{fe(c,!0)}),fe(s,d)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:l,scrolledToInitialItem:c}},ke(at,We,Ut,gt),{singleton:!0});function Zo(e,t){return Math.abs(e-t)<1.01}const Wt="up",At="down",Ci="none",Ii={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ki=0,Qt=me(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=G(!1),c=G(!0),l=ge(),a=ge(),d=G(4),S=G(ki),b=Fe(L(Zn(L(se(o),vt(1),it(!0)),L(se(o),vt(1),it(!1),Pr(100))),Ie()),!1),v=Fe(L(Zn(L(n,it(!0)),L(n,it(!1),Pr(200))),Ie()),!1);J(L(ze(se(o),se(S)),U(([u,R])=>u<=R),Ie()),c),J(L(c,ct(50)),a);const x=qe(L(ze(r,se(s),se(t),se(e),se(d)),lt((u,[{scrollHeight:R,scrollTop:T},I,M,g,y])=>{const k=T+I-R>-y,_={scrollHeight:R,scrollTop:T,viewportHeight:I};if(k){let P,C;return T>u.state.scrollTop?(P="SCROLLED_DOWN",C=u.state.scrollTop-T):(P="SIZE_DECREASED",C=u.state.scrollTop-T||u.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:C,state:_}}let O;return _.scrollHeight>u.state.scrollHeight?O="SIZE_INCREASED":I<u.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":T<u.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:_}},Ii),Ie((u,R)=>u&&u.atBottom===R.atBottom))),w=Fe(L(r,lt((u,{scrollHeight:R,scrollTop:T,viewportHeight:I})=>{if(Zo(u.scrollHeight,R))return{changed:!1,jump:0,scrollHeight:R,scrollTop:T};{const M=R-(T+I)<1;return u.scrollTop!==T&&M?{changed:!0,jump:u.scrollTop-T,scrollHeight:R,scrollTop:T}:{changed:!0,jump:0,scrollHeight:R,scrollTop:T}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(u=>u.changed),U(u=>u.jump)),0);J(L(x,U(u=>u.atBottom)),i),J(L(i,ct(50)),l);const p=G(At);J(L(r,U(({scrollTop:u})=>u),Ie(),lt((u,R)=>_e(v)?{direction:u.direction,prevScrollTop:R}:{direction:R<u.prevScrollTop?Wt:At,prevScrollTop:R},{direction:At,prevScrollTop:0}),U(u=>u.direction)),p),J(L(r,ct(50),it(Ci)),p);const f=G(0);return J(L(b,ie(u=>!u),it(0)),f),J(L(o,ct(100),he(b),ie(([u,R])=>R),lt(([u,R],[T])=>[R,T],[0,0]),U(([u,R])=>R-u)),f),{atBottomState:x,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:a,atTopThreshold:S,isAtBottom:i,isAtTop:c,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:p,scrollVelocity:f}},ke(We)),Dt="top",$t="bottom",Lr="none";function Gr(e,t,n){return typeof e=="number"?n===Wt&&t===Dt||n===At&&t===$t?e:0:n===Wt?t===Dt?e.main:e.reverse:t===$t?e.main:e.reverse}function Hr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const hr=me(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=G(0),c=G(0),l=G(0),a=Fe(L(ze(se(r),se(o),se(n),se(s,Nt),se(l),se(i),se(t),se(e),se(c)),U(([d,S,b,[v,x],w,p,f,u,R])=>{const T=d-u,I=p+f,M=Math.max(b-T,0);let g=Lr;const y=Hr(R,Dt),k=Hr(R,$t);return v-=u,v+=b+f,x+=b+f,x-=u,v>d+I-y&&(g=Wt),x<d-M+S+k&&(g=At),g!==Lr?[Math.max(T-b-Gr(w,Dt,g)-y,0),T-M-f+S+Gr(w,$t,g)+k]:null}),ie(d=>d!=null),Ie(Nt)),[0,0]);return{increaseViewportBy:c,listBoundary:s,overscan:l,topListHeight:i,visibleRange:a}},ke(We),{singleton:!0});function Ri(e,t,n){if(bn(t)){const r=Ko(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 rn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:c,lastSize:l}=o;let a=0,d=0;if(e.length>0){a=e[0].offset;const w=e[e.length-1];d=w.offset+w.size}const S=n-i,b=c+S*l+(S-1)*r,v=a,x=b-d;return{bottom:d,firstItemIndex:s,items:Nr(e,o,s),offsetBottom:x,offsetTop:a,top:v,topItems:Nr(t,o,s),topListHeight:t.reduce((w,p)=>p.size+w,0),totalCount:n}}function Jo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const c=e+i,l=pr(t,c),a=Array.from({length:c}).map((d,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return rn(a,[],c,o,n,r)}function Nr(e,t,n){if(e.length===0)return[];if(!bn(t))return e.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Mt(t.groupOffsetTree,r,o);let c,l=0;for(const a of e){(!c||c.end<a.index)&&(c=i.shift(),l=t.groupIndices.indexOf(c.start));let d;a.index===c.start?d={index:l,type:"group"}:d={groupIndex:l,index:a.index-(l+1)+n},s.push({...d,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}function Fr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const Ct=me(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:c,visibleRange:l},{initialTopMostItemIndex:a,scrolledToInitialItem:d},{topListHeight:S},b,{didMount:v},{recalcInProgress:x}])=>{const w=G([]),p=G(0),f=ge(),u=G(0);J(s.topItemsIndexes,w);const R=Fe(L(ze(v,x,se(l,Nt),se(o),se(r),se(a),d,se(w),se(t),se(n),se(u),e),ie(([g,y,,k,,,,,,,,_])=>{const O=_&&_.length!==k;return g&&!y&&!O}),U(([,,[g,y],k,_,O,P,C,j,A,F,E])=>{var B,N,$,V;const le=_,{offsetTree:ae,sizeTree:ye}=le,we=_e(p);if(k===0)return{...Mn,totalCount:k};if(g===0&&y===0)return we===0?{...Mn,totalCount:k}:Jo(we,O,_,j,A,E||[]);if(ve(ye))return we>0?null:rn(Ri(pr(O,k),le,E),[],k,A,le,j);const Z=[];if(C.length>0){const D=C[0],X=C[C.length-1];let re=0;for(const te of Mt(ye,D,X)){const ue=te.value,oe=Math.max(te.start,D),be=Math.min(te.end,X);for(let pe=oe;pe<=be;pe++)Z.push({data:E==null?void 0:E[pe],index:pe,offset:re,size:ue}),re+=ue}}if(!P)return rn([],Z,k,A,le,j);const Q=C.length>0?C[C.length-1]+1:0,z=hi(ae,g,y,Q);if(z.length===0)return null;const K=k-1,ee=mn([],D=>{for(const X of z){const re=X.value;let te=re.offset,ue=X.start;const oe=re.size;if(re.offset<g){ue+=Math.floor((g-re.offset+A)/(oe+A));const pe=ue-X.start;te+=pe*oe+pe*A}ue<Q&&(te+=(Q-ue)*oe,ue=Q);const be=Math.min(X.end,K);for(let pe=ue;pe<=be&&!(te>=y);pe++)D.push({data:E==null?void 0:E[pe],index:pe,offset:te,size:oe}),te+=oe+A}}),H=Fr(F,Dt),ne=Fr(F,$t);if(ee.length>0&&(H>0||ne>0)){const D=ee[0],X=ee[ee.length-1];if(H>0&&D.index>Q){const re=Math.min(H,D.index-Q),te=[];let ue=D.offset;for(let oe=D.index-1;oe>=D.index-re;oe--){const be=(N=(B=Mt(ye,oe,oe)[0])==null?void 0:B.value)!=null?N:D.size;ue-=be+A,te.unshift({data:E==null?void 0:E[oe],index:oe,offset:ue,size:be})}ee.unshift(...te)}if(ne>0&&X.index<K){const re=Math.min(ne,K-X.index);let te=X.offset+X.size+A;for(let ue=X.index+1;ue<=X.index+re;ue++){const oe=(V=($=Mt(ye,ue,ue)[0])==null?void 0:$.value)!=null?V:X.size;ee.push({data:E==null?void 0:E[ue],index:ue,offset:te,size:oe}),te+=oe+A}}}return rn(ee,Z,k,A,le,j)}),ie(g=>g!==null),Ie()),Mn);J(L(e,ie(lr),U(g=>g==null?void 0:g.length)),o),J(L(R,U(g=>g.topListHeight)),S),J(S,c),J(L(R,U(g=>[g.top,g.bottom])),i),J(L(R,U(g=>g.items)),f);const T=qe(L(R,ie(({items:g})=>g.length>0),he(o,e),ie(([{items:g},y])=>g[g.length-1].originalIndex===y-1),U(([,g,y])=>[g-1,y]),Ie(Nt),U(([g])=>g))),I=qe(L(R,ct(200),ie(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),U(({items:g})=>g[0].index),Ie())),M=qe(L(R,ie(({items:g})=>g.length>0),U(({items:g})=>{let y=0,k=g.length-1;for(;g[y].type==="group"&&y<k;)y++;for(;g[k].type==="group"&&k>y;)k--;return{endIndex:g[k].index,startIndex:g[y].index}}),Ie(qo)));return{endReached:T,initialItemCount:p,itemsRendered:f,listState:R,minOverscanItemCount:u,rangeChanged:M,startReached:I,topItemsIndexes:w,...b}},ke(at,Yo,hr,Kt,Ut,Qt,gt,ur),{singleton:!0}),es=me(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Fe(L(ze(n,e,r,t,o),U(([c,l,a,d,S])=>c+l+a+d+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,Ct),{singleton:!0}),Ti=me(([{viewportHeight:e},{totalListHeight:t}])=>{const n=G(!1),r=Fe(L(ze(n,e,t),ie(([o])=>o),U(([,o,s])=>Math.max(0,o-s)),ct(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,es),{singleton:!0}),ts=me(()=>({context:G(null)})),_i=({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,ns=me(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:c,viewportHeight:l},{scrollToIndex:a}])=>{const d=ge();return J(L(d,he(t,l,n,s,o,r,c),he(e),U(([[S,b,v,x,w,p,f,u],R])=>{const{align:T,behavior:I,calculateViewLocation:M=_i,done:g,...y}=S,k=Qo(S,b,x-1),_=Ft(k,b.offsetTree,R)+w+p,O=_+nt(b.sizeTree,k)[1],P=u+p,C=u+v-f,j=M({itemBottom:O,itemTop:_,locationParams:{align:T,behavior:I,...y},viewportBottom:C,viewportTop:P});return j?g&&tt(L(i,ie(A=>!A),vt(_e(i)?1:2)),g):g==null||g(),j}),ie(S=>S!==null)),a),{scrollIntoView:d}},ke(at,We,Ut,Ct,ht),{singleton:!0});function Wr(e){return e?e==="smooth"?"smooth":"auto":!1}const Mi=(e,t)=>typeof e=="function"?Wr(e(t)):t&&Wr(e),Ei=me(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:l,propsReady:a},{log:d},{scrollingInProgress:S},{context:b},{scrollIntoView:v}])=>{const x=G(!1),w=ge();let p=null;function f(I){fe(i,{align:"end",behavior:I,index:"LAST"})}xe(L(ze(L(se(t),vt(1)),l),he(se(x),s,c,S),U(([[I,M],g,y,k,_])=>{let O=M&&k,P="auto";return O&&(P=Mi(g,y||_),O=O&&!!P),{followOutputBehavior:P,shouldFollow:O,totalCount:I}}),ie(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:M})=>{p&&(p(),p=null),_e(n)?requestAnimationFrame(()=>{_e(d)("following output to ",{totalCount:M},$e.DEBUG),f(I)}):p=tt(e,()=>{_e(d)("following output to ",{totalCount:M},$e.DEBUG),f(I),p=null})});function u(I){const M=tt(o,g=>{I&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(_e(d)("scrolling to bottom due to increased size",{},$e.DEBUG),f("auto"))});setTimeout(M,100)}xe(L(ze(se(x),t,a),ie(([I,,M])=>I&&M),lt(({value:I},[,M])=>({refreshed:I===M,value:M}),{refreshed:!1,value:0}),ie(({refreshed:I})=>I),he(x,t)),([,I])=>{_e(c)&&u(I!==!1)}),xe(w,()=>{u(_e(x)!==!1)}),xe(ze(se(x),o),([I,M])=>{I&&!M.atBottom&&M.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const R=G(null),T=ge();return J(Zn(L(se(r),U(I=>{var M;return(M=I==null?void 0:I.length)!=null?M:0})),L(se(t))),T),xe(L(ze(L(T,vt(1)),l),he(se(R),c,S,b),U(([[I,M],g,y,k,_])=>M&&y&&(g==null?void 0:g({context:_,totalCount:I,scrollingInProgress:k}))),ie(I=>!!I),ct(0)),I=>{p&&(p(),p=null),_e(n)?requestAnimationFrame(()=>{_e(d)("scrolling into view",{}),fe(v,I)}):p=tt(e,()=>{_e(d)("scrolling into view",{}),fe(v,I),p=null})}),{autoscrollToBottom:w,followOutput:x,scrollIntoViewOnChange:R}},ke(at,Qt,Ut,Kt,gt,ht,We,ts,ns)),ji=me(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(J(L(c,he(s),ie(([,l])=>l!==0),he(o,r,t,n,e),U(([[,l],a,d,S,b,v=[]])=>Jo(l,a,d,S,b,v))),i),{}),ke(at,Kt,Ct,gt),{singleton:!0}),Oi=me(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=G(0);return xe(L(e,he(r),ie(([,o])=>o!==0),U(([,o])=>({top:o}))),o=>{tt(L(n,vt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{fe(t,o)})})}),{initialScrollTop:r}},ke(gt,We,Ct),{singleton:!0}),rs=me(([{scrollVelocity:e}])=>{const t=G(!1),n=ge(),r=G(!1);return J(L(e,he(r,t,n),ie(([o,s])=>!!s),U(([o,s,i,c])=>{const{enter:l,exit:a}=s;if(i){if(a(o,c))return!1}else if(l(o,c))return!0;return i}),Ie()),t),xe(L(ze(t,e,n),he(r)),([[o,s,i],c])=>{o&&c&&c.change&&c.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Qt),{singleton:!0}),gr=me(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=G(!1),i=G(void 0);return J(L(ze(n,r),U(([{scrollHeight:c,scrollTop:l,viewportHeight:a},{offsetTop:d}])=>({scrollHeight:c,scrollTop:Math.max(0,l-d),viewportHeight:a}))),e),J(L(t,he(r),U(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),Pi=me(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:l}])=>{const a=ge(),d=G(void 0),S=G(null),b=G(null);return J(c,S),J(l,b),xe(L(a,he(t,r,i,S,b,n)),([v,x,w,p,f,u,R])=>{const T=mi(x.sizeTree);p&&f!==null&&u!==null&&(w=f.scrollTop-u.offsetTop),w-=R,v({ranges:T,scrollTop:w})}),J(L(d,ie(lr),U(Bi)),o),J(L(s,he(d),ie(([,v])=>v!==void 0),Ie(),U(([,v])=>v.ranges)),e),{getState:a,restoreStateFrom:d}},ke(at,We,Kt,gt,gr));function Bi(e){return{align:"start",index:0,offset:e.scrollTop}}const zi=me(([{topItemsIndexes:e}])=>{const t=G(0);return J(L(t,ie(n=>n>=0),U(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(Ct));function os(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Ai=os(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Li=me(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:c},{listState:l},{beforeUnshiftWith:a,gap:d,shiftWithOffset:S,sizes:b},{log:v},{recalcInProgress:x}])=>{const w=qe(L(l,he(i),lt(([,f,u,R],[{bottom:T,items:I,offsetBottom:M,totalCount:g},y])=>{const k=T+M;let _=0;return u===g&&f.length>0&&I.length>0&&(I[0].originalIndex===0&&f[0].originalIndex===0||(_=k-R,_!==0&&(_+=y))),[_,I,g,k]},[0,[],0,0]),ie(([f])=>f!==0),he(r,c,n,o,v,x),ie(([,f,u,R,,,T])=>!T&&!R&&f!==0&&u===Wt),U(([[f],,,,,u])=>(u("Upward scrolling compensation",{amount:f},$e.DEBUG),f))));function p(f){f>0?(fe(t,{behavior:"auto",top:-f}),fe(e,0)):(fe(e,0),fe(t,{behavior:"auto",top:-f}))}return xe(L(w,he(e,s)),([f,u,R])=>{R&&Ai()?fe(e,u-f):p(-f)}),xe(L(ze(Fe(s,!1),e,x),ie(([f,u,R])=>!f&&!R&&u!==0),U(([f,u])=>u),ct(1)),p),J(L(S,U(f=>({top:-f}))),t),xe(L(a,he(b,d),U(([f,{groupIndices:u,lastSize:R,sizeTree:T},I])=>{function M(g){return g*(R+I)}if(u.length===0)return M(f);{let g=0;const y=Ht(T,0);let k=0,_=0;for(;k<f;){k++,g+=y;let O=u.length===_+1?1/0:u[_+1]-u[_]-1;k+O>f&&(g-=y,O=f-k+1),k+=O,g+=M(O),_++}return g}})),f=>{fe(e,f),requestAnimationFrame(()=>{fe(t,{top:f}),requestAnimationFrame(()=>{fe(e,0),fe(x,!1)})})}),{deviation:e}},ke(We,Qt,Ct,at,ht,ur)),Gi=me(([e,t,n,r,o,s,i,c,l,a,d])=>({...e,...t,...n,...r,...o,...s,...i,...c,...l,...a,...d}),ke(hr,ji,gt,rs,es,Oi,Ti,gr,ns,ht,ts)),ss=me(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:c,itemSize:l,sizeRanges:a,sizes:d,statefulTotalCount:S,totalCount:b,trackItemSizes:v},{initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:p},f,u,R,T,{scrollToIndex:I},M,{topItemCount:g},{groupCounts:y},k])=>{const{listState:_,minOverscanItemCount:O,topItemsIndexes:P,rangeChanged:C,...j}=T;return J(C,k.scrollSeekRangeChanged),J(L(k.windowViewportRect,U(A=>A.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:p,sizeRanges:a,topItemCount:g,topItemsIndexes:P,totalCount:b,...R,groupIndices:i,itemSize:l,listState:_,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:S,trackItemSizes:v,rangeChanged:C,...j,...k,...f,sizes:d,...u}},ke(at,Kt,We,Pi,Ei,Ct,Ut,Li,zi,Yo,Gi));function Hi(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 Jt=typeof document<"u"?h.useLayoutEffect:h.useEffect;function is(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=h.createContext({});function l(p,f){p.propsReady&&fe(p.propsReady,!1);for(const u of r){const R=p[t.required[u]];fe(R,f[u])}for(const u of o)if(u in f){const R=p[t.optional[u]];fe(R,f[u])}p.propsReady&&fe(p.propsReady,!0)}function a(p){return s.reduce((f,u)=>(f[u]=R=>{const T=p[t.methods[u]];fe(T,R)},f),{})}function d(p){return i.reduce((f,u)=>(f[u]=ti(p[t.events[u]]),f),{})}const S=h.forwardRef((p,f)=>{const{children:u,...R}=p,[T]=h.useState(()=>mn(ri(e),g=>{l(g,R)})),[I]=h.useState(Or(d,T));Jt(()=>{for(const g of i)g in R&&xe(I[g],R[g]);return()=>{Object.values(I).map(ar)}},[R,I,T]),Jt(()=>{l(T,R)}),h.useImperativeHandle(f,jr(a(T)));const M=n;return m.jsx(c.Provider,{value:T,children:n?m.jsx(M,{...Hi([...r,...o,...i],R),children:u}):u})}),b=p=>{const f=h.useContext(c);return h.useCallback(u=>{fe(f[p],u)},[f,p])},v=p=>{const f=h.useContext(c)[p],u=h.useCallback(R=>xe(f,R),[f]);return h.useSyncExternalStore(u,()=>_e(f),()=>_e(f))},x=p=>{const f=h.useContext(c)[p],[u,R]=h.useState(Or(_e,f));return Jt(()=>xe(f,T=>{T!==u&&R(jr(T))}),[f,u]),u},w=h.version.startsWith("18")?v:x;return{Component:S,useEmitter:(p,f)=>{const u=h.useContext(c)[p];Jt(()=>xe(u,f),[f,u])},useEmitterValue:w,usePublisher:b}}const ls=h.createContext(void 0),as=h.createContext(void 0),cs=typeof document<"u"?h.useLayoutEffect:h.useEffect;function En(e){return"self"in e}function Ni(e){return"body"in e}function us(e,t,n,r=Ot,o,s){const i=h.useRef(null),c=h.useRef(null),l=h.useRef(null),a=h.useCallback(b=>{let v,x,w;const p=b.target;if(Ni(p)||En(p)){const u=En(p)?p:p.defaultView;w=s?u.scrollX:u.scrollY,v=s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight,x=s?u.innerWidth:u.innerHeight}else w=s?p.scrollLeft:p.scrollTop,v=s?p.scrollWidth:p.scrollHeight,x=s?p.offsetWidth:p.offsetHeight;const f=()=>{e({scrollHeight:v,scrollTop:Math.max(w,0),viewportHeight:x})};b.suppressFlushSync?f():Bs.flushSync(f),c.current!==null&&(w===c.current||w<=0||w===v-x)&&(c.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);h.useEffect(()=>{const b=o||i.current;return r(o||i.current),a({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",a,{passive:!0}),()=>{r(null),b.removeEventListener("scroll",a)}},[i,a,n,r,o]);function d(b){const v=i.current;if(!v||(s?"offsetWidth"in v&&v.offsetWidth===0:"offsetHeight"in v&&v.offsetHeight===0))return;const x=b.behavior==="smooth";let w,p,f;En(v)?(p=Math.max(ft(v.document.documentElement,s?"width":"height"),s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight),w=s?v.innerWidth:v.innerHeight,f=s?window.scrollX:window.scrollY):(p=v[s?"scrollWidth":"scrollHeight"],w=ft(v,s?"width":"height"),f=v[s?"scrollLeft":"scrollTop"]);const u=p-w;if(b.top=Math.ceil(Math.max(Math.min(u,b.top),0)),Zo(w,p)||b.top===f){e({scrollHeight:p,scrollTop:f,viewportHeight:w}),x&&t(!0);return}x?(c.current=b.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,t(!0)},1e3)):c.current=null,s&&(b={behavior:b.behavior,left:b.top}),v.scrollTo(b)}function S(b){s&&(b={behavior:b.behavior,left:b.top}),i.current.scrollBy(b)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:d}}const jn="-webkit-sticky",Dr="sticky",mr=os(()=>{if(typeof document>"u")return Dr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Dr});function br(e){return e}const Fi=me(()=>{const e=G(c=>`Item ${c}`),t=G(c=>`Group ${c}`),n=G({}),r=G(br),o=G("div"),s=G(Ot),i=(c,l=null)=>Fe(L(n,U(a=>a[c]),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")}}),Wi=me(([e,t])=>({...e,...t}),ke(ss,Fi)),Di=({height:e})=>m.jsx("div",{style:{height:e}}),$i={overflowAnchor:"none",position:mr(),zIndex:1},ds={overflowAnchor:"none"},Vi={...ds,display:"inline-block",height:"100%"},$r=h.memo(function({showTopList:e=!1}){const t=ce("listState"),n=Ke("sizeRanges"),r=ce("useWindowScroll"),o=ce("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),c=o||r?s:i,l=ce("itemContent"),a=ce("context"),d=ce("groupContent"),S=ce("trackItemSizes"),b=ce("itemSize"),v=ce("log"),x=Ke("gap"),w=ce("horizontalDirection"),{callbackRef:p}=ii(n,b,S,e?Ot:c,v,x,o,w,ce("skipAnimationFrameInResizeObserver")),[f,u]=h.useState(0);xr("deviation",j=>{f!==j&&u(j)});const R=ce("EmptyPlaceholder"),T=ce("ScrollSeekPlaceholder")||Di,I=ce("ListComponent"),M=ce("ItemComponent"),g=ce("GroupComponent"),y=ce("computeItemKey"),k=ce("isSeeking"),_=ce("groupIndices").length>0,O=ce("alignToBottom"),P=ce("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:f!==0?f:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&R?m.jsx(R,{...Ne(R,a)}):m.jsx(I,{...Ne(I,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:C,children:(e?t.topItems:t.items).map(j=>{const A=j.originalIndex,F=y(A+t.firstItemIndex,j.data,a);return k?h.createElement(T,{...Ne(T,a),height:j.size,index:j.index,key:F,type:j.type||"item",...j.type==="group"?{}:{groupIndex:j.groupIndex}}):j.type==="group"?h.createElement(g,{...Ne(g,a),"data-index":A,"data-item-index":j.index,"data-known-size":j.size,key:F,style:$i},d(j.index,a)):h.createElement(M,{...Ne(M,a),...Qi(M,j.data),"data-index":A,"data-item-group-index":j.groupIndex,"data-item-index":j.index,"data-known-size":j.size,key:F,style:w?Vi:ds},_?l(j.index,j.groupIndex,j.data,a):l(j.index,j.data,a))})})}),qi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ui={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ki={position:mr(),top:0,width:"100%",zIndex:1};function Ne(e,t){if(typeof e!="string")return{context:t}}function Qi(e,t){return{item:typeof e=="string"?void 0:t}}const Yi=h.memo(function(){const e=ce("HeaderComponent"),t=Ke("headerHeight"),n=ce("HeaderFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),Xi=h.memo(function(){const e=ce("FooterComponent"),t=Ke("footerHeight"),n=ce("HeaderFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null});function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return h.memo(function({children:r,style:o,context:s,...i}){const c=n("scrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:v,scrollToCallback:x}=us(c,a,l,d,void 0,S);return e("scrollTo",x),e("scrollBy",b),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...S?Ui:qi,...o},tabIndex:0,...i,...Ne(l,s),children:r})})}function ps({useEmitter:e,useEmitterValue:t,usePublisher:n}){return h.memo(function({children:r,style:o,context:s,...i}){const c=n("windowScrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("totalListHeight"),S=t("deviation"),b=t("customScrollParent"),v=h.useRef(null),x=t("scrollerRef"),{scrollByCallback:w,scrollerRef:p,scrollToCallback:f}=us(c,a,l,x,b);return cs(()=>{var u;return p.current=b||((u=v.current)==null?void 0:u.ownerDocument.defaultView),()=>{p.current=null}},[p,b]),e("windowScrollTo",f),e("scrollBy",w),m.jsx(l,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+S}:{}},...i,...Ne(l,s),children:r})})}const Zi=({children:e})=>{const t=h.useContext(ls),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=ce("alignToBottom"),s=ce("horizontalDirection"),i=h.useMemo(()=>Go(n,l=>ft(l,s?"width":"height")),[n,s]),c=wt(i,!0,ce("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:c,style:xn(o),children:e})},Ji=({children:e})=>{const t=h.useContext(ls),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=ce("customScrollParent"),s=No(n,o,ce("skipAnimationFrameInResizeObserver")),i=ce("alignToBottom");return h.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})},el=({children:e})=>{const t=ce("TopItemListComponent")||"div",n=ce("headerHeight"),r={...Ki,marginTop:`${n}px`},o=ce("context");return m.jsx(t,{style:r,...Ne(t,o),children:e})},tl=h.memo(function(e){const t=ce("useWindowScroll"),n=ce("topItemsIndexes").length>0,r=ce("customScrollParent"),o=ce("context");return m.jsxs(r||t?ol:rl,{...e,context:o,children:[n&&m.jsx(el,{children:m.jsx($r,{showTopList:!0})}),m.jsxs(r||t?Ji:Zi,{children:[m.jsx(Yi,{}),m.jsx($r,{}),m.jsx(Xi,{})]})]})}),{Component:nl,useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}=is(Wi,{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"}},tl),rl=fs({useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}),ol=ps({useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}),sl=nl,il=me(()=>{const e=G(a=>m.jsxs("td",{children:["Item $",a]})),t=G(null),n=G(a=>m.jsxs("td",{colSpan:1e3,children:["Group ",a]})),r=G(null),o=G(null),s=G({}),i=G(br),c=G(Ot),l=(a,d=null)=>Fe(L(s,U(S=>S[a]),Ie()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:c,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(ss,il);mr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ll={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:qr,floor:ln,max:Lt,min:On,round:Ur}=Math;function Kr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function al(e){return{...ll,items:e}}function en(e,t){return e&&e.width===t.width&&e.height===t.height}function cl(e,t){return e&&e.column===t.column&&e.row===t.row}const ul=me(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:c,scrollTo:l,scrollTop:a,smoothScrollTargetReached:d,viewportHeight:S},b,v,{didMount:x,propsReady:w},{customScrollParent:p,useWindowScroll:f,windowScrollContainerState:u,windowScrollTo:R,windowViewportRect:T},I])=>{const M=G(0),g=G(0),y=G(Vr),k=G({height:0,width:0}),_=G({height:0,width:0}),O=ge(),P=ge(),C=G(0),j=G(null),A=G({column:0,row:0}),F=ge(),E=ge(),B=G(!1),N=G(0),$=G(!0),V=G(!1),le=G(!1);xe(L(x,he(N),ie(([z,K])=>!!K)),()=>{fe($,!1)}),xe(L(ze(x,$,_,k,N,V),ie(([z,K,ee,H,,ne])=>z&&!K&&ee.height!==0&&H.height!==0&&!ne)),([,,,,z])=>{fe(V,!0),fr(1,()=>{fe(O,z)}),tt(L(a),()=>{fe(t,[0,0]),fe($,!0)})}),J(L(E,ie(z=>z!=null&&z.scrollTop>0),it(0)),g),xe(L(x,he(E),ie(([,z])=>z!=null)),([,z])=>{z&&(fe(k,z.viewport),fe(_,z.item),fe(A,z.gap),z.scrollTop>0&&(fe(B,!0),tt(L(a,vt(1)),K=>{fe(B,!1)}),fe(l,{top:z.scrollTop})))}),J(L(k,U(({height:z})=>z)),S),J(L(ze(se(k,en),se(_,en),se(A,(z,K)=>z&&z.column===K.column&&z.row===K.row),se(a)),U(([z,K,ee,H])=>({gap:ee,item:K,scrollTop:H,viewport:z}))),F),J(L(ze(se(M),r,se(A,cl),se(_,en),se(k,en),se(j),se(g),se(B),se($),se(N)),ie(([,,,,,,,z])=>!z),U(([z,[K,ee],H,ne,D,X,re,,te,ue])=>{const{column:oe,row:be}=H,{height:pe,width:Se}=ne,{width:Re}=D;if(re===0&&(z===0||Re===0))return Vr;if(Se===0){const ut=pr(ue,z),Pt=ut+Math.max(re-1,0);return al(Kr(ut,Pt,X))}const Be=hs(Re,Se,oe);let je,Ge;te?K===0&&ee===0&&re>0?(je=0,Ge=re-1):(je=Be*ln((K+be)/(pe+be)),Ge=Be*qr((ee+be)/(pe+be))-1,Ge=On(z-1,Lt(Ge,Be-1)),je=On(Ge,Lt(0,je))):(je=0,Ge=-1);const rt=Kr(je,Ge,X),{bottom:De,top:Pe}=Qr(D,H,ne,rt),Xe=qr(z/Be),Ue=Xe*pe+(Xe-1)*be-De;return{bottom:De,itemHeight:pe,items:rt,itemWidth:Se,offsetBottom:Ue,offsetTop:Pe,top:Pe}})),y),J(L(j,ie(z=>z!==null),U(z=>z.length)),M),J(L(ze(k,_,y,A),ie(([z,K,{items:ee}])=>ee.length>0&&K.height!==0&&z.height!==0),U(([z,K,{items:ee},H])=>{const{bottom:ne,top:D}=Qr(z,H,K,ee);return[D,ne]}),Ie(Nt)),t);const ae=G(!1);J(L(a,he(ae),U(([z,K])=>K||z!==0)),ae);const ye=qe(L(ze(y,M),ie(([{items:z}])=>z.length>0),he(ae),ie(([[z,K],ee])=>{const H=z.items[z.items.length-1].index===K-1;return(ee||z.bottom>0&&z.itemHeight>0&&z.offsetBottom===0&&z.items.length===K)&&H}),U(([[,z]])=>z-1),Ie())),we=qe(L(se(y),ie(({items:z})=>z.length>0&&z[0].index===0),it(0),Ie())),Z=qe(L(se(y),he(B),ie(([{items:z},K])=>z.length>0&&!K),U(([{items:z}])=>({endIndex:z[z.length-1].index,startIndex:z[0].index})),Ie(qo),ct(0)));J(Z,v.scrollSeekRangeChanged),J(L(O,he(k,_,M,A),U(([z,K,ee,H,ne])=>{const D=Xo(z),{align:X,behavior:re,offset:te}=D;let ue=D.index;ue==="LAST"&&(ue=H-1),ue=Lt(0,ue,On(H-1,ue));let oe=rr(K,ne,ee,ue);return X==="end"?oe=Ur(oe-K.height+ee.height):X==="center"&&(oe=Ur(oe-K.height/2+ee.height/2)),te&&(oe+=te),{behavior:re,top:oe}})),l);const Q=Fe(L(y,U(z=>z.offsetBottom+z.bottom)),0);return J(L(T,U(z=>({height:z.visibleHeight,width:z.visibleWidth}))),k),{customScrollParent:p,data:j,deviation:C,footerHeight:o,gap:A,headerHeight:s,increaseViewportBy:e,initialItemCount:g,itemDimensions:_,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:c,scrollHeight:P,scrollTo:l,scrollToIndex:O,scrollTop:a,smoothScrollTargetReached:d,totalCount:M,useWindowScroll:f,viewportDimensions:k,windowScrollContainerState:u,windowScrollTo:R,windowViewportRect:T,...v,gridState:y,horizontalDirection:le,initialTopMostItemIndex:N,totalListHeight:Q,...b,endReached:ye,propsReady:w,rangeChanged:Z,startReached:we,stateChanged:F,stateRestoreInProgress:B,...I}},ke(hr,We,Qt,rs,gt,gr,ht));function hs(e,t,n){return Lt(1,ln((e+n)/(ln(t)+n)))}function Qr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=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=hs(e.width,n.width,t.column),s=ln(r/o),i=s*n.height+Lt(0,s-1)*t.row;return i>0?i+t.row:i}const dl=me(()=>{const e=G(S=>`Item ${S}`),t=G({}),n=G(null),r=G("virtuoso-grid-item"),o=G("virtuoso-grid-list"),s=G(br),i=G("div"),c=G(Ot),l=(S,b=null)=>Fe(L(t,U(v=>v[S]),Ie()),b),a=G(!1),d=G(!1);return J(se(d),a),{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:a,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),fl=me(([e,t])=>({...e,...t}),ke(ul,dl)),pl=h.memo(function(){const e=Te("gridState"),t=Te("listClassName"),n=Te("itemClassName"),r=Te("itemContent"),o=Te("computeItemKey"),s=Te("isSeeking"),i=Qe("scrollHeight"),c=Te("ItemComponent"),l=Te("ListComponent"),a=Te("ScrollSeekPlaceholder"),d=Te("context"),S=Qe("itemDimensions"),b=Qe("gap"),v=Te("log"),x=Te("stateRestoreInProgress"),w=Qe("reportReadyState"),p=wt(h.useMemo(()=>f=>{const u=f.parentElement.parentElement.scrollHeight;i(u);const R=f.firstChild;if(R){const{height:T,width:I}=R.getBoundingClientRect();S({height:T,width:I})}b({column:Yr("column-gap",getComputedStyle(f).columnGap,v),row:Yr("row-gap",getComputedStyle(f).rowGap,v)})},[i,S,b,v]),!0,!1);return cs(()=>{e.itemHeight>0&&e.itemWidth>0&&w(!0)},[e]),x?null:m.jsx(l,{className:t,ref:p,...Ne(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const u=o(f.index,f.data,d);return s?m.jsx(a,{...Ne(a,d),height:e.itemHeight,index:f.index,width:e.itemWidth},u):h.createElement(c,{...Ne(c,d),className:n,"data-index":f.index,key:u},r(f.index,f.data,d))})})}),hl=h.memo(function(){const e=Te("HeaderComponent"),t=Qe("headerHeight"),n=Te("headerFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),gl=h.memo(function(){const e=Te("FooterComponent"),t=Qe("footerHeight"),n=Te("headerFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),ml=({children:e})=>{const t=h.useContext(as),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=wt(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return h.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})},bl=({children:e})=>{const t=h.useContext(as),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Te("customScrollParent"),s=No(n,o,!1);return h.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})},xl=h.memo(function({...e}){const t=Te("useWindowScroll"),n=Te("customScrollParent"),r=n||t?Sl:vl,o=n||t?bl:ml,s=Te("context");return m.jsx(r,{...e,...Ne(r,s),children:m.jsxs(o,{children:[m.jsx(hl,{}),m.jsx(pl,{}),m.jsx(gl,{})]})})}),{useEmitter:gs,useEmitterValue:Te,usePublisher:Qe}=is(fl,{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"}},xl),vl=fs({useEmitter:gs,useEmitterValue:Te,usePublisher:Qe}),Sl=ps({useEmitter:gs,useEmitterValue:Te,usePublisher:Qe});function Yr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,$e.WARN),t==="normal"?0:parseInt(t??"0",10)}const vn=h.createContext(void 0);function Ce(e,t){const n=h.useContext(vn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return pn(n,e,t)}function an(){const e=h.useContext(vn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const yl="_run_zzb61_3",wl="_runWrap_zzb61_7",Cl="_highlight_zzb61_13",Il="_highlightleft_zzb61_14",kl="_highlightright_zzb61_15",Rl="_highlightcenter_zzb61_16",Tl="_underline_zzb61_48",_l="_underlineleft_zzb61_49",Ml="_underlineright_zzb61_50",El="_underlinecenter_zzb61_51",st={run:yl,runWrap:wl,highlight:Cl,highlightleft:Il,highlightright:kl,highlightcenter:Rl,underline:Tl,underlineleft:_l,underlineright:Ml,underlinecenter:El},Xr=e=>Symbol.iterator in e,Zr=e=>"entries"in e,Jr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},jl=(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 Ol(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Xr(e)&&Xr(t)?Zr(e)&&Zr(t)?Jr(e,t):jl(e,t):Jr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Vt(e){const t=h.useRef(void 0);return n=>{const r=e(n);return Ol(t.current,r)?t.current:t.current=r}}function Pl(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 Bl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const zl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),ms=h.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=Ce(k=>k.setClipIndex),i=Ce(k=>k.seek),c=q(k=>k.setCurrentGlobalRunIndex),l=an(),a=q(k=>k.rangeStartGI),d=q(k=>k.rangeEndGI),S=q(k=>k.setRange),b=a!=null&&d!=null,v=h.useCallback(k=>{var E;const _=(E=k.target)==null?void 0:E.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g),P=O-r;if(P<0||P>=t.length)return;const C=t[P],j=C.text??"";if(!j.trim()||!/[가-힣a-zA-Z0-9]/.test(j))return;c(O,"program");const A=C.audioChunkIndex,F=C.audioTimeMs;A!=null&&F!=null&&(s(A),i(F))},[t,r,i,s,c]),x=h.useRef(null),w=h.useRef(!1),p=h.useCallback(k=>{var C;const _=(C=k.target)==null?void 0:C.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g),P=O-r;P<0||P>=t.length||(w.current=!1,x.current&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(O,O),w.current=!0,x.current=null)},800))},[t,r,S,l]),f=h.useCallback(()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},[]),u=h.useCallback(()=>{f()},[f]),R=f,T=f,I=q(k=>k.clearRange),M=h.useCallback(k=>{var P;if(w.current){w.current=!1;return}const _=(P=k.target)==null?void 0:P.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g);isNaN(O)||b&&a!=null&&d!=null&&(I(),k.stopPropagation())},[b,a,d,I]),g=o,y=r+t.length-1;return m.jsx("span",{onClick:M,onDoubleClick:v,onPointerDown:p,onPointerUp:u,onPointerCancel:R,onPointerLeave:T,children:g.map((k,_)=>m.jsx(Ll,{ns:n,group:k,runs:t,paraLastG:y,rangeStartGI:a,rangeEndGI:d},`${n}/grp:${_}-${k.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Al=h.memo(function(){const t=h.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=Y(Vt(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}),Ll=h.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const c=h.useCallback(p=>{const f=p.currentGlobalRunIndex;return f!=null&&f>=n.startG&&f<=n.endG},[n]),l=q(Vt(c)),a=h.useCallback(p=>l?{showPointer:p.showPointer,pointerStyle:p.pointerStyle,pointerColor:p.pointerColor}:zl,[l]),d=Y(Vt(a)),S=n.r0??0,b=n.len??Math.max(0,n.endG-n.startG+1),v=l&&d.showPointer&&d.pointerStyle!=="underline",x=l&&d.showPointer&&d.pointerStyle==="underline",w=v||x?{"--hl-color":d.pointerColor,"--ul-color":d.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:b}).map((p,f)=>{const R=r[S+f],T=n.startG+f,I=`${t}/run:${T}`,M=!!R.split&&T!==o;let g=`${st.runWrap}`;return v&&(b===1?g+=` ${st.highlight}`:f===0?g+=` ${st.highlightleft}`:f+1===b?g+=` ${st.highlightright}`:g+=` ${st.highlightcenter}`),x&&(b===1?g+=` ${st.underline}`:f===0?g+=` ${st.underlineleft}`:f+1===b?g+=` ${st.underlineright}`:g+=` ${st.underlinecenter}`),m.jsxs(h.Fragment,{children:[m.jsx("span",{className:g,style:w,children:m.jsx(Gl,{gi:n.startG,g:T,run:R,active:l,pointerCfg:d,isInRange:s!=null&&i!=null&&T>=s&&T<=i})}),M&&m.jsx(Al,{})]},I)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Gl=h.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const c=h.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 a=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=a;const d=a.startsWith("#")?Pl(a):Bl(a);d&&(.299*d.r+.587*d.g+.114*d.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:st.run,style:c,"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 Hl({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var a;const i=e.list?e.list.level*24:0,c=((a=e.list)==null?void 0:a.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??c;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(ms,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Nl=h.memo(Hl,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Fl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return to(e,!1);case"upperalpha":case"upperlatin":return to(e,!0);case"lowerroman":return eo(e,!1);case"upperroman":return eo(e,!0);case"decimalenclosedcircle":return Wl(e);default:return String(e)}}function Wl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function eo(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function to(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function 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=Fl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Dl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function $l(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 Vl(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 ql="_scroller_kqkmq_3",Ul={scroller:ql},Kl=h.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${Ul.scroller}${t?" "+t:""}`,style:n,...r})}),or=e=>/[가-힣a-zA-Z0-9]/.test(e),Ql=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Yl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,c=1/0,l=1/0,a=-1,d=1/0,S=1/0;const b=e.querySelectorAll("[data-g]");for(let v=0;v<b.length;v++){const x=b[v];if(!x||!x.isConnected)continue;const w=Ql(x);if(!w||!or(w))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 R=Math.abs(p.top-s);(R<d||R===d&&(p.top<S||a!==-1&&Number(x.dataset.g)<a))&&(d=R,a=Number(x.dataset.g),S=p.top);continue}const f=Number(x.dataset.g);if(Number.isNaN(f))continue;p.top<l-n?(l=p.top,c=p.top,i=f):p.top<=l+n&&(p.top<c||p.top===c&&(i===-1||f<i))&&(c=p.top,i=f);const u=Math.abs(p.top-s);(u<d||u===d&&(p.top<S||a!==-1&&f<a))&&(d=u,a=f,S=p.top)}return i!==-1?i:a}const bs=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},no=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of o){const l=c.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const a=Number(c.dataset.g);Number.isNaN(a)||(a<s&&(s=a),a>i&&(i=a))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Xl=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),c=s.height*n,l=i.top-(s.top+c);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Zl(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(!Xl(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Zl(e,o);const i=cn(e,t);if(!i)return!1;const c=e.getBoundingClientRect(),l=i.getBoundingClientRect(),a=c.height*n,d=c.top+a,S=l.top-d;return Math.abs(S)<=1},dt=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=h.createContext(null);function xs(){const e=h.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Je(e,t){const n=h.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return pn(n,e,t)}const vs=()=>{const e=q(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,")"]})},Jl="_navBtn_1fciy_2",ea="_disabled_1fciy_26",ta="_label_1fciy_32",Et={navBtn:Jl,disabled:ea,label:ta};var Ss={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ro=h.createContext&&h.createContext(Ss),na=["attr","size","title"];function ra(e,t){if(e==null)return{};var n=oa(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 oa(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function un(){return un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},un.apply(this,arguments)}function oo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(r){sa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sa(e,t,n){return t=ia(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ia(e){var t=la(e,"string");return typeof t=="symbol"?t:t+""}function la(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 ys(e){return e&&e.map((t,n)=>h.createElement(t.tag,dn({key:n},t.attr),ys(t.child)))}function Ye(e){return t=>h.createElement(aa,un({attr:dn({},e.attr)},t),ys(e.child))}function aa(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ra(e,na),c=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),h.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),s&&h.createElement("title",null,s),e.children)};return ro!==void 0?h.createElement(ro.Consumer,null,n=>t(n)):t(Ss)}function so(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function io(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const ca=({isIcon:e=!0})=>{const t=q(i=>i.isCanPrev),n=q(i=>i.onSectionNav),r=!t,o=h.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.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:Et.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(so,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=q(i=>i.isCanNext),n=q(i=>i.onSectionNav),r=!t,o=h.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(io,{size:18}),m.jsx("span",{className:Et.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(io,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ws(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 ua({section:e,blocks:t,nsPrefix:n}){const r=h.useMemo(()=>{const k=[],_=vr();return t.forEach((O,P)=>{O.type==="paragraph"&&(k[P]=Sr(O,_))}),k},[t]),o=q(k=>{var _;return((_=k.layout)==null?void 0:_.prefix)??[]}),s=q(k=>{var _;return((_=k.derivedNav)==null?void 0:_.splitGroupsPerBlock)??[]}),i=Y(k=>k.marginX),c=Y(k=>k.viewportHeight),l=h.useRef({start:0,end:0}),a=h.useCallback(k=>{const _=t[k],O=`${n}blk-${_.id}`;if(_.type==="image"){const{src:j,alt:A,width:F,height:E}=_,B=F&&E?`${F} / ${E}`:"4 / 3",N=k>=l.current.start&&k<=l.current.end,$=c>80?Math.floor((c-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:$,aspectRatio:B},children:m.jsx("img",{src:j,alt:A||"",loading:N?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),A&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:A})]})}const P=r[k]??void 0,C=s[k];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Nl,{block:_,computedMarker:P,ns:O,baseIndex:o[k],sectionId:e.section_id,preGroups:C})})},[t,r,o,n,e,s,c]),d=h.useRef(null),S=h.useCallback(k=>{d.current=k},[]),b=h.useMemo(()=>h.memo(k=>{const{style:_,children:O,...P}=k;return m.jsx("div",{...P,style:_,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:O})})}),[i]),v=h.useRef(null),x=h.useMemo(()=>t.map(k=>k.id),[t]),[w,p]=h.useState(!1);h.useEffect(()=>{p(!1)},[t]);const f=h.useCallback(()=>{p(!0)},[]),u=h.useCallback(()=>{if(!w)return m.jsx("div",{style:{height:40}});const k=e.quiz,_=Math.max(80,Math.floor(c*.5));return k&&k.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(vs,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{isIcon:!1})}),m.jsx("div",{style:{height:_,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[w,e,c]),R=h.useMemo(()=>({Item:b,Header:()=>m.jsx("div",{style:{height:40}}),Footer:u,Scroller:Kl}),[u,b]),T=h.useCallback(k=>x[k],[x]),I=xt(),[M]=h.useState(()=>I.getState().progress.currentGlobalRunIndex??0),g=h.useMemo(()=>{if(!o.length)return 0;const k=o[o.length-1],_=Math.max(0,Math.min(M,k));return ws(o,_)},[o,M]);console.log("SectionRenderVirtuoso확인");const y=xt();return h.useEffect(()=>{let k=!1;return(async()=>{let _=d.current;if(!_){for(let j=0;j<20;j++){if(await new Promise(A=>setTimeout(A,50)),k)return;if(_=d.current,_)break}if(!_)return}const O=y.getState().progress.currentGlobalRunIndex,P=y.getState().progress.setSectionLoading,C=O!=null&&O>=0?O:0;await bs(_,C),!k&&(await dt(),await dt(),await dt(),await dt(),!k&&P(!1))})(),()=>{k=!0}},[d,y]),m.jsxs(m.Fragment,{children:[m.jsx(sl,{ref:v,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:T,totalCount:t.length,itemContent:a,initialTopMostItemIndex:g,increaseViewportBy:{top:200,bottom:200},endReached:f,components:R,scrollerRef:S}),m.jsx(da,{scrollContainerRef:d,virtRef:v,prefix:o})]})}const da=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=q(C=>C.setCurrentGlobalRunIndex),o=q(C=>C.registerSectionScrollApi),s=q(C=>C.currentGlobalRunIndex),i=Ce(C=>C.scrollLock),c=Ce(C=>C.syncToGI),l=yt(),a=h.useRef(!1),d=h.useRef(null),S=h.useRef(null),b=h.useRef(null),v=h.useRef(-1),x=h.useCallback(()=>{if(i)return;d.current=null;const C=S.current;if(!C)return;const j=Yl(C,5);j!==-1&&j!==v.current&&(v.current=j,c(j),r(j,"scroll"))},[i,c,r]),w=h.useCallback(C=>{S.current=C,d.current==null&&(d.current=requestAnimationFrame(x))},[x]),p=h.useCallback(C=>{S.current=C,b.current!=null&&(window.clearTimeout(b.current),b.current=null),b.current=window.setTimeout(()=>{b.current=null,x();const j=v.current;if(j===-1)return;const A=C.scrollTop,F=C.scrollHeight-C.clientHeight,E=F>0?A/F:0;let B=0;const N=C.querySelector(`[data-g="${j}"]`);if(N){const $=C.getBoundingClientRect();B=(N.getBoundingClientRect().top-$.top)/$.height}l.getState().emit({type:"scroll",payload:{scrollTop:A,scrollRatio:E,anchorGI:j,anchorOffsetRatio:B}})},100)},[x,l]),f=h.useRef(!1),u=h.useCallback(C=>{i||a.current&&(f.current||(w(C),p(C)))},[i,w,p]),R=h.useRef(void 0),T=h.useRef(void 0),I=h.useRef(void 0),M=h.useRef(void 0);h.useEffect(()=>{const C=e.current;if(C)return R.current=()=>{a.current=!0},T.current=()=>{a.current=!0},I.current=()=>{a.current=!0},M.current=()=>u(C),C.addEventListener("wheel",R.current,{passive:!0}),C.addEventListener("touchmove",T.current,{passive:!0}),window.addEventListener("keydown",I.current,{passive:!0}),C.addEventListener("scroll",M.current,{passive:!0}),()=>{C.removeEventListener("wheel",R.current),C.removeEventListener("touchmove",T.current),window.removeEventListener("keydown",I.current),C.removeEventListener("scroll",M.current),d.current!=null&&cancelAnimationFrame(d.current),b.current!=null&&(clearTimeout(b.current),b.current=null)}},[u,e]),h.useEffect(()=>{const C=e.current;if(!C||!i)return;const j=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},A=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},F=B=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(B.key)&&(B.preventDefault(),B.stopPropagation(),a.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",j,{passive:!1}),C.addEventListener("touchmove",A,{passive:!1}),window.addEventListener("keydown",F,{passive:!1}),()=>{C.removeEventListener("wheel",j),C.removeEventListener("touchmove",A),window.removeEventListener("keydown",F),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const g=h.useRef({first:-1,last:-1}),y=h.useRef(!1),k=h.useCallback(()=>{const C=e.current;if(!C)return;const j=no(C),A=(j==null?void 0:j.first)??-1,F=(j==null?void 0:j.last)??-1;g.current={first:A,last:F}},[e]),_=h.useRef(!1),O=h.useCallback(()=>{const C=e.current;if(!C||_.current)return;_.current=!0;const j=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:j,behavior:"instant"})})},[e]);h.useEffect(()=>{!y.current&&i&&(_.current=!1,k()),y.current=i},[i,k]),h.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:j,last:A}=g.current;if(j===-1||A===-1){O();return}if(C.scrollTop<=1){(async()=>{try{f.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{f.current=!1}k()})();return}if(s<j||s>A){async function E(){if(!C)return;const B=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:B})}E().then(B=>{B?k():O()})}},[i,s,O,k,e]);const P=h.useCallback(()=>{const C=e.current;if(!C)return;function j(Z,Q,z=.2,K=.8){const ee=Z.querySelector(`[data-g="${Q}"]`);if(!ee)return!1;const H=Z.getBoundingClientRect(),ne=ee.getBoundingClientRect();if(ne.height<=0||H.height<=0)return!1;const D=(ne.top+ne.height/2-H.top)/H.height;return D>=z&&D<=K}const A=Z=>Z==="instant"?"auto":Z,F=Z=>{const Q=C.scrollTop,z=C.scrollHeight-C.clientHeight,K=z>0?Q/z:0;let ee=0;const H=C.querySelector(`[data-g="${Z}"]`);if(H){const ne=C.getBoundingClientRect();ee=(H.getBoundingClientRect().top-ne.top)/ne.height}l.getState().emit({type:"scroll",payload:{scrollTop:Q,scrollRatio:K,anchorGI:Z,anchorOffsetRatio:ee}})},E=async(Z,Q="smooth")=>{var K;const z=ws(n,Z);(K=t.current)==null||K.scrollToIndex({index:z,align:"start",behavior:A(Q)}),await bs(C,Z)},B=()=>new Promise(Z=>requestAnimationFrame(()=>Z())),N=async Z=>{if(j(C,Z,.1,.7))return F(Z),!0;f.current=!0;const Q=C.querySelector(`[data-g="${Z}"]`),z=C.getBoundingClientRect();let K=C.scrollTop<=1?0:.1;if(Q){const H=Q.getBoundingClientRect();K=((H.top+H.height/2-z.top)/z.height>.5,.15)}const ee=!!Q;return ee?(await Pn(C,Z,{behavior:"smooth",topPaddingRatio:K}),await B()):ee||await E(Z,"auto"),f.current=!1,F(Z),j(C,Z,.1,.7)},$=async Z=>N(Z);return{ensureVisibleGI:N,scrollToGI:$,getVisibleRange:()=>no(C),getScrollTop:()=>C.scrollTop,setScrollTop:Z=>{C.scrollTop=Z},getAnchorOffsetRatio:Z=>{const Q=C.querySelector(`[data-g="${Z}"]`);if(!Q)return 0;const z=Q.getBoundingClientRect(),K=C.getBoundingClientRect();return(z.top-K.top)/K.height},scrollToGIAtOffset:async(Z,Q)=>{await $(Z),await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(re)));const z=C.querySelector(`[data-g="${Z}"]`);if(!z)return;const K=z.getBoundingClientRect(),ee=C.getBoundingClientRect(),H=ee.height>0?ee.height/C.clientHeight:1,ne=(K.top-ee.top)/H,D=Q*C.clientHeight,X=ne-D;C.scrollTop=C.scrollTop+X}}},[e,t,n,l]);return h.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(P()),()=>o(void 0)),[P,o]),null};function fa(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 pa(){const e=q(x=>x.section),t=Y(x=>x.theme),n=Y(x=>x.fontFamily),r=Y(x=>x.fontSizePx),o=Y(x=>x.lineHeight),s=on[t],{blocks:i,nsPrefix:c}=h.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=hn(),a=h.useCallback(()=>{const{isSettingsOpen:x,setSettingsOpen:w,toggleOverlays:p}=l.getState();x?w(!1):p()},[l]),{onClick:d,onDoubleClick:S}=Us({onSingle:a,onDouble:()=>{},delay:250,shouldIgnoreTarget:fa}),b=h.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]),v=h.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:d,onDoubleClick:S,style:b,children:m.jsx("div",{style:v,children:m.jsx(ua,{section:e,blocks:i,nsPrefix:c})})})}function ha(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 ga(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 ma(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 ba(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 xa(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 va="_wrap_1hfub_4",Sa="_visible_1hfub_25",ya="_compact_1hfub_31",wa="_row2_1hfub_34",Ca="_controls_1hfub_44",Ia="_row1_1hfub_52",ka="_groupExpand_1hfub_80",Ra="_groupPlayback_1hfub_81",Ta="_groupSpeed_1hfub_82",_a="_groupFeatures_1hfub_83",Ma="_groupNav_1hfub_84",Ea="_btn_1hfub_116",ja="_btnForbidden_1hfub_141",Oa="_btnActive_1hfub_147",Pa="_label_1hfub_158",Ba="_compactBtn_1hfub_168",Oe={wrap:va,visible:Sa,compact:ya,row2:wa,controls:Ca,row1:Ia,groupExpand:ka,groupPlayback:Ra,groupSpeed:Ta,groupFeatures:_a,groupNav:Ma,btn:Ea,btnForbidden:ja,btnActive:Oa,label:Pa,compactBtn:Ba},za=h.memo(function(){const t=h.useRef(null),n=h.useContext(St),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=Ce(y=>y.status),s=Ce(y=>y.currentTimeMs),i=Ce(y=>y.currentClip),c=Ce(y=>y.playbackKind),l=Y(y=>y.muteAudio),a=Y(y=>y.audioSpeed),d=Ce(y=>y.getClipSrc),S=Ce(y=>y._onTime),b=Ce(y=>y._onEnded),v=Ce(y=>y._onError),x=q(y=>y.setCurrentGlobalRunIndex),w=q(y=>y.getSectionScrollApi),p=q(y=>y.snapToReadable),f=q(y=>y.edgeReadable),u=h.useRef(null),R=h.useRef(null),T=h.useRef(!1),I=h.useRef(null);h.useEffect(()=>{c==="real"&&(T.current=!0)},[c]);const M=h.useMemo(()=>{const y=d(i);if(!y)return null;try{return new URL(y,window.location.href).href}catch{return y}},[i,d]);h.useEffect(()=>{T.current=!0},[M]),h.useEffect(()=>{const y=t.current;if(!y)return;const k=()=>{if(y.paused||y.ended)return;const P=y.currentTime*1e3;T.current&&P===0||(P>0&&(T.current=!1),S(P))},_=()=>{var C,j;b();const P=f(1);typeof P=="number"&&P>=0&&(x(P,"audio"),(j=(C=w())==null?void 0:C.ensureVisibleGI)==null||j.call(C,P))},O=P=>{const C=P.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),v()};return y.addEventListener("timeupdate",k),y.addEventListener("ended",_),y.addEventListener("error",O),()=>{y.removeEventListener("timeupdate",k),y.removeEventListener("ended",_),y.removeEventListener("error",O)}},[S,b,v,f,x,w]),h.useEffect(()=>{if(r)return;const y=t.current;if(!y)return;if(!M){try{y.pause()}catch(P){console.log("pause error",P)}R.current=null;return}const k=y.currentSrc||y.src||null,_=!k||k!==M;if(_){try{y.pause()}catch(P){console.log("pause error",P)}y.src=M;try{y.load()}catch(P){console.log("load error",P)}R.current=M}y.muted=!!l,y.volume=1,y.playbackRate=typeof a=="number"?a:1;const O=async()=>{_&&await new Promise(P=>{let C=!1;const j=()=>{C||(C=!0,y.removeEventListener("loadedmetadata",j),y.removeEventListener("canplay",j),P())};y.addEventListener("loadedmetadata",j),y.addEventListener("canplay",j),y.readyState>=1&&j()});try{await y.play()}catch(P){console.warn("el.play() failed",P)}};if(o==="loading"||o==="playing")O();else try{y.pause()}catch(P){console.log("pause error",P)}},[M,l,o,a,r]),h.useEffect(()=>{if(r)return;const y=t.current;if(!y||c!=="real")return;const k=s/1e3;if(Number.isFinite(k)){if(y.readyState<1){u.current=s;const _=()=>{if(u.current!=null){const O=u.current/1e3;try{y.currentTime=O}catch(P){console.log("currentTime보정 오류",P)}u.current=null}y.removeEventListener("loadedmetadata",_),y.removeEventListener("canplay",_)};y.addEventListener("loadedmetadata",_),y.addEventListener("canplay",_);return}if(Math.abs(y.currentTime-k)>.2)try{y.currentTime=k}catch(_){console.log("currentTime보정오류",_)}}},[s,c,r]);const g=Ce(y=>y.getGIFromCT);return h.useEffect(()=>{var _,O;if(r||c!=="real"||o!=="playing"&&o!=="loading")return;const y=g(i,s);if(y<0)return;const k=p(y);k!==I.current&&(I.current=k,x(k,"audio"),k%5===0&&((O=(_=w())==null?void 0:_.ensureVisibleGI)==null||O.call(_,k)))},[o,i,s,c,g,p,x,w,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Aa(){return m.jsx(za,{})}const La="_scrubberWrap_uw0cd_2",Ga="_labels_uw0cd_9",Ha="_index_uw0cd_15",Na="_controls_uw0cd_19",Fa="_percent_uw0cd_25",Wa="_range_uw0cd_46",kt={scrubberWrap:La,labels:Ga,index:Ha,controls:Na,percent:Fa,range:Wa};function Da(){const e=Y(I=>I.isDev),t=q(I=>I.currentGlobalRunIndex),n=q(I=>I.totalRuns),r=q(I=>I.setCurrentGlobalRunIndex),o=q(I=>I.getSectionScrollApi),s=q(I=>I.giToPercentTotal),i=q(I=>I.percentToGITotal),c=q(I=>I.snapToReadable),l=Ce(I=>I.scrollLock),a=Ce(I=>I.pause),d=Ce(I=>I.play),S=Ce(I=>I.syncToGI),[b,v]=h.useState(()=>s(t||0));h.useEffect(()=>{v(s(t||0))},[t,s]);const x=h.useRef(!1),w=h.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),p=h.useCallback(()=>{l&&(a(),x.current=!0)},[l,a]),f=h.useCallback(I=>{v(Number(I.currentTarget.value))},[]),u=h.useCallback(async()=>{const I=i(b),M=c(I);a(),r(M,"scrubber-commit"),S(M);const g=o();g!=null&&g.ensureVisibleGI&&await g.ensureVisibleGI(M),x.current&&(x.current=!1,d())},[b,i,c,a,r,S,o,d]),R=h.useMemo(()=>({"--pct":`${b}%`}),[b]),T=h.useMemo(()=>Math.round(b),[b]);return m.jsxs("div",{className:kt.scrubberWrap,children:[e&&m.jsx("div",{className:kt.labels,children:m.jsxs("span",{className:kt.index,children:[w," / ",n||0]})}),m.jsxs("div",{className:kt.controls,children:[m.jsx("input",{type:"range",className:kt.range,min:0,max:100,step:.5,value:b,style:R,onMouseDown:p,onTouchStart:p,onChange:f,onMouseUp:()=>{u()},onTouchEnd:()=>{u()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void u():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:kt.percent,children:[T,"%"]})]})]})}const $a=h.memo(Da),Va=h.memo(function(){const t=h.useContext(St),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=Ce(y=>y.playbackKind),o=Ce(y=>y.status),s=Ce(y=>y.fake),i=Y(y=>y.audioSpeed),c=Ce(y=>y.pause),l=q(y=>y.totalRuns),a=q(y=>y.currentGlobalRunIndex),d=q(y=>y.setCurrentGlobalRunIndex),S=q(y=>y.getSectionScrollApi),b=q(y=>y.nextReadableFrom),v=q(y=>y.edgeReadable),x=h.useRef(null),w=h.useRef(null),p=h.useRef(0),f=h.useRef(-1),u=!n&&r==="fake"&&o==="playing",R=Math.max(1,(s==null?void 0:s.totalWords)??1),T=h.useMemo(()=>{const y=200*i;return R/y*6e4},[R,i]),I=h.useMemo(()=>!l||l<=1||T<=0?0:(l-1)/T,[l,T]);h.useEffect(()=>{if(!u)return;const y=Math.max(0,Math.min(a??0,Math.max(0,(l??1)-1)));p.current=y,f.current=y,w.current=null},[u,a,l]);const M=h.useRef(-1);h.useEffect(()=>{if(!l){M.current=-1;return}const y=v(1);M.current=y??-1},[v,l]);const g=h.useCallback(y=>{(async()=>{var F,E;if(!u){x.current=null;return}if(!l||l<=1||I<=0){x.current=null;return}const k=w.current;w.current=y;const _=k==null?0:Math.max(0,y-k),O=l-1;p.current=Math.min(O,p.current+I*_);const P=Math.floor(p.current),C=S(),j=b(P,1);if(j==null){const B=M.current>=0?M.current:P;B!==f.current&&(f.current=B,d(B,"audio"),await((F=C==null?void 0:C.ensureVisibleGI)==null?void 0:F.call(C,B))),c(),x.current=null;return}const A=j;A!==f.current&&(f.current=A,d(A,"audio"),A%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,A))),x.current=requestAnimationFrame(g)})().catch(console.error)},[u,l,I,b,d,S,c]);return h.useEffect(()=>(u?x.current==null&&(x.current=requestAnimationFrame(g)):(x.current&&(cancelAnimationFrame(x.current),x.current=null),w.current=null),()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[u,g]),null}),qa=h.memo(function(){return m.jsx(Va,{})}),Ua="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",Ka="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",Qa="_WPMSpeedButtonsWrap_r3byt_1",Ya="_btnWrap_r3byt_7",Xa="_label_r3byt_14",Za="_iconBtn_r3byt_22",Bt={WPMSpeedButtonsWrap:Qa,btnWrap:Ya,label:Xa,iconBtn:Za},lo=350,Ja=40,ec=.85,tc=h.memo(function(){const t=Y(b=>b.audioSpeed),n=Y(b=>b.incAudioSpeed),r=Y(b=>b.decAudioSpeed),o=h.useRef(null),s=h.useRef(lo),i=h.useRef(null),c=h.useCallback(b=>{const v=t;if(b==="inc"){if(v>=2)return!1;n()}else{if(v<=.3)return!1;r()}return!0},[t,n,r]),l=h.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),a=h.useCallback(()=>{i.current&&(s.current=Math.max(Ja,Math.floor(s.current*ec)),o.current=window.setTimeout(()=>{c(i.current)?a():l()},s.current))},[c,l]),d=h.useCallback(b=>{if(i.current)return;i.current=b,s.current=lo,c(b)&&a();const x=()=>l();window.addEventListener("mouseup",x,{once:!0}),window.addEventListener("touchend",x,{once:!0})},[a,c,l]);h.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return m.jsx("div",{onMouseLeave:l,className:Bt.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Bt.btnWrap,children:[m.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>d("dec"),onTouchStart:b=>{b.preventDefault(),d("dec")},onMouseUp:l,children:m.jsx("img",{src:Ua,alt:"느리게"})}),m.jsx("div",{className:Bt.label,style:{minWidth:"44px",textAlign:"center"},children:m.jsx("div",{children:S})}),m.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>d("inc"),onTouchStart:b=>{b.preventDefault(),d("inc")},onMouseUp:l,children:m.jsx("img",{src:Ka,alt:"빠르게"})})]})})}),nc="_StepBtn_15t0r_1",rc={StepBtn:nc};function oc(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 sc(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 ao({direction:e}){const t=q(S=>S.currentGlobalRunIndex),n=q(S=>S.totalRuns),r=q(S=>S.hasReadableInDir),o=q(S=>S.computeStepTarget),s=q(S=>S.setCurrentGlobalRunIndex),i=Ce(S=>S.syncToGI),c=q(S=>S.getSectionScrollApi),l=h.useCallback(async S=>{var x,w;const b=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),v=o(b,S);s(v,"scrubber-step"),i(v),await((w=(x=c())==null?void 0:x.ensureVisibleGI)==null?void 0:w.call(x,v))},[t,n,o,s,i,c]),a=h.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),b=!n||!r(S,1),v=!n||!r(S,-1);return e==="left"?v:b},[e,n,t,r]),d=h.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return m.jsx("button",{className:rc.StepBtn,type:"button",onClick:d,disabled:a,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(oc,{}):m.jsx(sc,{})})}const ic="_GCPlayBtn_n54mc_1",lc="_playing_n54mc_34",co={GCPlayBtn:ic,playing:lc},ac=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${co.GCPlayBtn} ${r?co.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function cc(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 uc(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 dc(){const e=Y(I=>I.showOverlays),t=q(I=>I.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=Y(I=>I.muteAudio),s=Y(I=>I.showPointer),i=Y(I=>I.showSplit),c=Y(I=>I.toggleMuteAudio),l=Y(I=>I.toggleShowPointer),a=Y(I=>I.toggleShowSplit),d=Y(I=>I.overlayCompactMode),S=Y(I=>I.toggleOverlayCompactMode),b=an(),v=xt();h.useEffect(()=>{const I=b.getState(),{syncToGI:M,useFake:g,useReal:y}=I,k=I.playbackKind,_=v.getState().progress.currentGlobalRunIndex??0;if(!r){k!=="fake"&&g();return}o?k!=="fake"&&(console.log("이부분일까?"),g()):k!=="real"&&(M(_),y())},[r,o,v,b]);const x=Ce(I=>I.play),w=Ce(I=>I.pause),p=Ce(I=>I.status),f=h.useCallback(I=>{I.stopPropagation(),p==="playing"||p==="loading"?w():x()},[p,x,w]),u=an(),R=xt(),T=h.useCallback(async I=>{var B,N;if(I.stopPropagation(),p==="playing"||p==="loading"){w();return}const{progress:M}=R.getState(),{currentGlobalRunIndex:g,snapToReadable:y,edgeReadable:k,setCurrentGlobalRunIndex:_,getSectionScrollApi:O}=M,P=u.getState(),C=P.currentClip,j=O==null?void 0:O(),A=typeof g=="number"?g:0,F=typeof y=="function"?y(A):A,E=typeof k=="function"?k(1):null;if(E!=null&&F>=E){_==null||_(E,"audio"),await((B=j==null?void 0:j.ensureVisibleGI)==null?void 0:B.call(j,E)),P.syncToGI(E);return}_==null||_(F,"audio"),await((N=j==null?void 0:j.ensureVisibleGI)==null?void 0:N.call(j,F)),P.syncToGI(F),x(C)},[p,w,x,u,R]);return m.jsxs("div",{className:`${Oe.wrap} ${e?Oe.visible:""} ${d?Oe.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!d&&m.jsx($a,{}),m.jsx("div",{style:d?{display:"none"}:void 0,children:r&&!o?m.jsx(Aa,{}):m.jsx(qa,{})}),m.jsxs("div",{className:Oe.controls,children:[m.jsxs("div",{className:Oe.row1,children:[m.jsx("div",{className:Oe.groupExpand,children:m.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:Oe.compactBtn,title:d?"오버레이 확대":"오버레이 축소",children:d?m.jsx(uc,{size:24}):m.jsx(cc,{size:24})})}),m.jsxs("div",{className:Oe.groupPlayback,children:[m.jsx(ao,{direction:"left"}),m.jsx(ac,{size:34,isPlaying:p==="playing",onClick:o?T:f,title:p==="playing"?"일시정지":"재생"}),m.jsx(ao,{direction:"right"})]}),m.jsx("div",{className:Oe.groupSpeed,children:m.jsx(tc,{})})]}),m.jsxs("div",{className:Oe.row2,children:[m.jsxs("div",{className:Oe.groupFeatures,children:[r&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},className:`${Oe.btn} ${o?"":Oe.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(ha,{size:18}):m.jsx(ga,{size:18}),m.jsx("span",{className:Oe.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${Oe.btn} ${s?Oe.btnActive:""}`,title:"포인터 표시",children:[m.jsx(ma,{size:18}),m.jsx("span",{className:Oe.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},disabled:!n,className:`${Oe.btn} ${i?Oe.btnActive:""} ${n?"":Oe.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ba,{size:18}),m.jsx("span",{className:Oe.label,children:"끊어읽기"})]})]}),m.jsxs("div",{className:Oe.groupNav,children:[m.jsx(ca,{}),m.jsx(fn,{})]})]})]})]})}const fc=h.memo(dc);function pc(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 hc="_host_v5qx1_3",gc="_topbar_v5qx1_11",mc="_visible_v5qx1_32",bc="_backBtn_v5qx1_37",xc="_title_v5qx1_58",vc="_settingsBtn_v5qx1_67",Rt={host:hc,topbar:gc,visible:mc,backBtn:bc,title:xc,settingsBtn:vc};function Sc(){const e=Y(a=>a.showOverlays),t=Y(a=>a.overlayCompactMode),n=q(a=>a.onViewerClose),o=q(a=>a.section).ast.title,s=Y(a=>a.setSettingsOpen),i=Y(a=>a.setShowOverlays),c=h.useCallback(()=>{n==null||n()},[n]),l=h.useCallback(()=>{s(!0),i(!1)},[s,i]);return m.jsx("div",{className:Rt.host,children:m.jsxs("div",{className:`${Rt.topbar} ${e&&!t?Rt.visible:""}`,children:[m.jsx("button",{type:"button",className:Rt.backBtn,onClick:c,"aria-label":"뒤로가기",children:m.jsx(xa,{size:28})}),m.jsx("div",{className:Rt.title,children:m.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),m.jsx("button",{type:"button",className:Rt.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:m.jsx(pc,{size:28})})]})})}const yc=h.memo(Sc),wc="_wrap_62su0_7",Cc="_wrapHidden_62su0_29",Ic="_wrapVisible_62su0_35",kc="_scrollArea_62su0_71",Rc="_row_62su0_81",Tc="_label_62su0_89",_c="_btn_62su0_95",Mc="_btnActive_62su0_106",Ec="_btnSmall_62su0_110",jc="_pill_62su0_122",Oc="_themeCircle_62su0_133",Pc="_themeCircleActive_62su0_146",Bc="_stepRow_62su0_151",zc="_stepLabel_62su0_159",Ac="_levelBox_62su0_172",Lc="_inlineFlex_62su0_177",Ee={wrap:wc,wrapHidden:Cc,wrapVisible:Ic,scrollArea:kc,row:Rc,label:Tc,btn:_c,btnActive:Mc,btnSmall:Ec,pill:jc,themeCircle:Oc,themeCircleActive:Pc,stepRow:Bc,stepLabel:zc,levelBox:Ac,inlineFlex:Lc};function Gc({visible:e}){const t=Y(g=>g.mode),n=Y(g=>g.setMode),r=Y(g=>g.theme),o=Y(g=>g.setTheme),s=Y(g=>g.fontFamily),i=Y(g=>g.setFontFamily),c=Y(g=>g.resetToDefaults),l=Y(g=>g.getFontLevel()),a=Y(g=>g.getLineLevel()),d=Y(g=>g.getMarginLevel()),S=Y(g=>g.setFontLevel),b=Y(g=>g.setLineLevel),v=Y(g=>g.setMarginLevel),x=Y(g=>g.pointerStyle),w=Y(g=>g.setPointerStyle),p=Y(g=>g.pointerColor),f=Y(g=>g.setPointerColor),u=Y(g=>g.breakMarks),R=Y(g=>g.toggleBreakMark),T=Y(g=>g.getBreakGapLevel()),I=Y(g=>g.setBreakGapLevel),M=`${Ee.wrap} ${e?Ee.wrapVisible:Ee.wrapHidden}`;return m.jsxs("div",{className:M,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Ee.scrollArea,children:[m.jsx(zt,{label:"열람방식",children:m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx(Tt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(Tt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(zt,{label:"테마",children:m.jsx("div",{className:Ee.inlineFlex,children:Object.keys(on).map(g=>{const y=g,k=on[y];return m.jsx("button",{type:"button",onClick:()=>o(y),className:`${Ee.themeCircle} ${r===g?Ee.themeCircleActive:""}`,style:{background:k.bg,color:k.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),m.jsx(zt,{label:"글꼴",children:m.jsx("div",{className:Ee.inlineFlex,children:Ao.map(g=>m.jsx(Tt,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),m.jsx(tn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),m.jsx(tn,{label:"줄 간격",level:a,min:1,max:7,onDec:()=>b(Math.max(1,a-1)),onInc:()=>b(Math.min(7,a+1))}),m.jsx(tn,{label:"여백",level:d,min:1,max:5,onDec:()=>v(Math.max(1,d-1)),onInc:()=>v(Math.min(5,d+1))}),m.jsx(zt,{label:"포인터",children:m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx(Tt,{active:x==="highlight",onClick:()=>w("highlight"),children:"형광펜"}),m.jsx(Tt,{active:x==="underline",onClick:()=>w("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:p,onChange:g=>f(g.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(zt,{label:"끊기표시",children:m.jsx("div",{className:Ee.inlineFlex,children:m.jsx(Tt,{active:u.slash,onClick:()=>R("slash"),children:"슬래쉬"})})}),m.jsx(tn,{label:"끊기간격",level:T,min:1,max:5,onDec:()=>I(Math.max(1,T-1)),onInc:()=>I(Math.min(5,T+1))})]}),m.jsx("div",{className:Ee.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:c,className:Ee.pill,children:"보기 설정 초기화"})})]})}function zt({label:e,children:t}){return m.jsxs("div",{className:Ee.row,children:[m.jsx("label",{className:Ee.label,children:e}),t]})}function Tt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${Ee.btn} ${e?Ee.btnActive:""}`,children:r})}function tn({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,c=t>=r;return m.jsxs("div",{className:Ee.stepRow,children:[m.jsx("label",{className:Ee.stepLabel,children:e}),m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:Ee.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:Ee.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:c,className:Ee.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Hc=h.memo(function(){const t=Y(i=>i.showOverlays),n=Y(i=>i.isSettingsOpen),r=q(i=>i.rangeStartGI),o=q(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(yc,{}),m.jsx(fc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Gc,{visible:!t&&n})})]})}),Nc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,c,l)=>{let a=i;if(c){const d=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());a=b=>{const v=i(b);if(!d(S,v)){const x=S;c(S=v,x)}},l!=null&&l.fireImmediately&&c(S,S)}return o(a)}),e(t,n,r)},Fc=Nc;function Wc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Dc(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 $c(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Dc((r==null?void 0:r.text)??"");return t}function Vc(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=v=>{if(!n)return null;const{g2ct:x}=n;if(!x)return null;const w=x[v];if(w)return{clip:w.clip,t:w.t};for(let p=1;p<=100&&v-p>=0;p++){const f=x[v-p];if(f)return{clip:f.clip,t:f.t}}for(let p=1;p<=100;p++){const f=x[v+p];if(f)return{clip:f.clip,t:f.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,c=0;const l=Math.max(1,$c(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const v=o(e.initialIndex);v&&(i=v.clip,c=v.t,r=void 0)}const a=s.length>0,d=a?"paused":"idle",S=a?"real":"fake",b=a?null:{totalWords:l};return qt(Fc((v,x)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,c),status:d,scrollLock:!1,playbackKind:S,fake:b,useFake:()=>v(w=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:w.status==="playing"})),useReal:()=>v(w=>({playbackKind:"real",fake:{totalWords:l},scrollLock:w.status==="playing"})),injectMap:w=>{if(n=w,typeof r=="number"){const p=o(r);p&&v(f=>({currentClip:Math.max(0,Math.min(p.clip,Math.max(0,f.clips.length-1))),currentTimeMs:Math.max(0,p.t)})),r=void 0}},setClipAndMs:(w,p)=>v(f=>{const u=Math.max(0,f.clips.length-1);return{currentClip:Math.max(0,Math.min(w,u)),currentTimeMs:Math.max(0,p),status:f.status,scrollLock:f.scrollLock}}),setClips:w=>v(p=>{const f=Array.isArray(w)?w:[],u=f.length>0;return{clips:f,currentClip:0,currentTimeMs:0,status:u?"paused":"idle",playbackKind:u?"real":"fake",fake:u?null:p.fake??{totalWords:l},scrollLock:!1}}),clear:()=>v(w=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:w.fake??{totalWords:l},scrollLock:!1})),play:(w,p)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),v(f=>{if(f.playbackKind==="fake")return{status:"playing",scrollLock:!0};const u=typeof w=="number"?w:f.currentClip,R=typeof p=="number"?p:f.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(u,Math.max(0,f.clips.length-1))),currentTimeMs:R,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),v({status:"paused",scrollLock:!1})},seek:w=>v(p=>({currentTimeMs:Math.max(0,w),status:p.status})),stop:()=>v({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>v(w=>{if(w.playbackKind==="fake")return w;const p=Math.max(0,w.clips.length-1);return{currentClip:Math.min(w.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>v(w=>w.playbackKind==="fake"?w:{currentClip:Math.max(0,w.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:w=>v(p=>p.playbackKind==="fake"||w<0||w>=p.clips.length?p:{currentClip:w,currentTimeMs:0}),getClipSrc:w=>{const p=x();if(!p.clips.length)return null;const f=typeof w=="number"?w:p.currentClip;return Wc(p.clips[f])},getGIFromCT:(w,p)=>{if(!n)return-1;const f=n.byClip[w];if(!f||f.length===0)return-1;let u=0,R=f.length-1,T=0;for(;u<=R;){const I=u+R>>1;f[I].t<=p?(T=I,u=I+1):R=I-1}return f[Math.max(0,Math.min(T,f.length-1))].g},getCTFromGI:w=>{if(!n)return null;const{g2ct:p}=n;if(!p)return null;let f=p[w];if(!f){let u=w-1;const R=Math.max(0,w-100);for(;u>=R;){if(p[u]){f=p[u];break}u--}if(!f){let T=w+1;const I=w+100;for(;p[T]==null&&T<=I;)T++;p[T]&&(f=p[T])}}return f?{clip:f.clip,timeMs:f.t}:null},getMetaByGI:w=>{const p=x().getCTFromGI(w);return p?{clipIndex:p.clip,timeMs:p.timeMs}:null},syncToGI:w=>{const p=x().getMetaByGI(w);p&&x().setClipAndMs(p.clipIndex,p.timeMs)},_onTime:w=>v({currentTimeMs:w,status:"playing",scrollLock:!0}),_onEnded:()=>v(w=>{if(w.playbackKind==="fake")return{status:"ended",scrollLock:!1};const p=Math.max(0,w.clips.length-1);return w.currentClip>=p?{status:"ended",scrollLock:!1}:{currentClip:Math.min(w.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>v({status:"error",scrollLock:!1}),_setStatusOnly:w=>v({status:w})})))}function qc({children:e,initialState:t}){const n=h.useContext(St)??void 0,r=h.useMemo(()=>Vc({...t,recorderStore:n}),[t,n]);return m.jsx(vn.Provider,{value:r,children:e})}function Uc(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 c of r){if((c==null?void 0:c.type)==="image")continue;const l=(c==null?void 0:c.runs)??[];for(let a=0;a<l.length;a++){const d=l[a],S=o+a;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:S}),n[S]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(c=>c.sort((l,a)=>l.t-a.t)),{byClip:t,g2ct:n}}function Kc(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 Qc(e){const t=Dl(e),n=$l(t),r=t.reduce((d,S)=>d+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],c=[];return e.forEach((d,S)=>{var p;if(d.type!=="paragraph")return;const b=n[S]??0,v=d.runs??[];for(let f=0;f<v.length;f++){const u=((p=v[f])==null?void 0:p.text)||"";or(u)&&(s[b+f]=1)}const w=Vl(v,b).map(f=>{var I;const u=f.startG-b,R=f.endG-f.startG+1;let T=-1;for(let M=0;M<R;M++){const g=((I=v[u+M])==null?void 0:I.text)??"";if(or(g)){T=f.startG+M;break}}return{startG:f.startG,endG:f.endG,r0:u,len:R,firstReadableGI:T,splitIndex:f.splitIndex}});c[S]=w;for(const f of w){const u=i.length;for(let R=f.startG;R<=f.endG;R++)o[R]=u;i.push(f)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:c},layout:{prefix:n,totalRuns:r}}}function Yc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:c,initialIndex:l,mountTime:a}=e,d=c.totalRuns??0,S=typeof l=="number"?l:d>0?0:-1,b=S>=0?Kc(i.readableGi,S,d):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:b,lastUpdateBy:"program",totalRuns:d,pageIndex:0,sectionLoading:!0,_loadingStartTime:a,_scrollApi:void 0,derivedNav:i,layout:c,rangeStartGI:null,rangeEndGI:null}}function Xc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,eventBridgeStore:c}=e,l=t.ast.blocks,{nav:a,layout:d}=Qc(l),S=Date.now(),b=Yc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:a,layout:d,initialIndex:n,mountTime:S});return c&&queueMicrotask(()=>{c.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),c.getState().emit({type:"loading_start",payload:{}},S)}),qt((v,x)=>{const w=E=>{v(B=>B.progress._scrollApi===E?B:{progress:{...B.progress,_scrollApi:E}})},p=()=>x().progress._scrollApi,f=E=>{v(B=>{const N=B.progress;if(N.totalRuns===E)return B;const $=N.currentGlobalRunIndex<0&&E>0;return{progress:{...N,totalRuns:E,currentGlobalRunIndex:$?0:N.currentGlobalRunIndex,lastUpdateBy:$?"program":N.lastUpdateBy}}})},u=(E,B="program")=>{const N=x().progress.currentGlobalRunIndex,$=x().progress,V=$.totalRuns>0?Math.max(-1,Math.min(E,$.totalRuns-1)):E;N===V&&$.lastUpdateBy===B||(v(le=>({progress:{...le.progress,currentGlobalRunIndex:V,lastUpdateBy:B}})),N!==V&&c&&c.getState().emit({type:"global_index_change",payload:{globalIndex:V}}))},R=E=>{const{sectionLoading:B,_loadingStartTime:N}=x().progress;if(B===E)return;const $=Date.now();if(E)v(V=>({progress:{...V.progress,sectionLoading:!0,_loadingStartTime:$}})),c&&c.getState().emit({type:"loading_start",payload:{}});else{const le=(N?$-N:0)/1e3;v(ae=>({progress:{...ae.progress,sectionLoading:!1,_loadingStartTime:null}})),c&&c.getState().emit({type:"loading_end",payload:{duration:le}})}},T=E=>{v(B=>({progress:{...B.progress,pageIndex:E}}))},I=(E,B)=>{const $=x().progress.rangeStartGI==null;if(v(V=>({progress:{...V.progress,rangeStartGI:Math.min(E,B),rangeEndGI:Math.max(E,B)}})),c){const V=y();c.getState().emit({type:$?"range_select":"range_change",payload:{startGI:Math.min(E,B),endGI:Math.max(E,B),text:V}})}},M=()=>{v(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}})),c&&c.getState().emit({type:"range_clear",payload:{}})},g=E=>{const{rangeStartGI:B,rangeEndGI:N}=x().progress;B==null||N==null||(E<B?v($=>({progress:{...$.progress,rangeStartGI:E}})):E>N?v($=>({progress:{...$.progress,rangeEndGI:E}})):M())},y=()=>{var ye;const{rangeStartGI:E,rangeEndGI:B,section:N,layout:$}=x().progress;if(E==null||B==null||!$)return"";const V=((ye=N.ast)==null?void 0:ye.blocks)??[],le=$.prefix,ae=[];for(let we=0;we<V.length;we++){const Z=V[we];if(Z.type!=="paragraph")continue;const Q=Z.runs??[],z=le[we]??0;for(let K=0;K<Q.length;K++){const ee=z+K;ee>=E&&ee<=B&&ae.push(Q[K].text??"")}}return ae.join("")},k=E=>{const{totalRuns:B,derivedNav:N}=x().progress,$=N==null?void 0:N.readableGi;if(!$||B<=0)return E;const V=B,le=Math.max(0,Math.min(E,V-1));if($[le])return le;let ae=le-1,ye=le+1;for(;ae>=0||ye<V;){if(ye<V&&$[ye])return ye;if(ae>=0&&$[ae])return ae;ye+=1,ae-=1}return le},_=(E,B)=>{const{totalRuns:N,derivedNav:$}=x().progress,V=$==null?void 0:$.readableGi;if(!V||N<=0)return null;if(B>0){for(let le=Math.min(Math.max(E,0),N-1);le<N;le+=1)if(V[le])return le}else for(let le=Math.min(Math.max(E,0),N-1);le>=0;le-=1)if(V[le])return le;return null},O=E=>{const{totalRuns:B,derivedNav:N}=x().progress,$=N==null?void 0:N.readableGi;if(!$||B<=0)return null;if(E>0){for(let V=B-1;V>=0;V-=1)if($[V])return V}else for(let V=0;V<B;V+=1)if($[V])return V;return null};return{progress:{...b,registerSectionScrollApi:w,getSectionScrollApi:p,setTotalRuns:f,setCurrentGlobalRunIndex:u,setSectionLoading:R,setPageIndex:T,setRange:I,clearRange:M,extendRange:g,getRangeText:y,snapToReadable:k,nextReadableFrom:_,edgeReadable:O,hasReadableInDir:(E,B)=>_(E+(B>0?1:-1),B)!=null,computeStepTarget:(E,B)=>{const{totalRuns:N,derivedNav:$}=x().progress;if(!N||N<=0)return E;const V=($==null?void 0:$.groups)??[],le=$==null?void 0:$.giToGroupIdx;if(!V.length||!le){const z=N-1;return k(Math.max(0,Math.min(E+B,z)))}let ae=le[E]??-1;if(ae<0||ae>=V.length)for(let Q=0;Q<V.length;Q+=1){const z=V[Q];if(E>=z.startG&&E<=z.endG){ae=Q;break}}if(ae<0||ae>=V.length)return O(B)??k(E);const ye=Q=>Q>=0&&Q<V.length&&(V[Q].firstReadableGI??-1)>=0;let we=ae+B;for(;we>=0&&we<V.length&&!ye(we);)we+=B;if(we<0||we>=V.length)return O(B)??k(E+B);const Z=V[we].firstReadableGI;return Z>=0?Z:k(E+B)},giToPercentTotal:E=>{const B=x().progress.totalRuns;return!B||B<=1?0:Math.max(0,Math.min(E,B-1))/(B-1)*100},percentToGITotal:E=>{const B=x().progress.totalRuns;if(!B||B<=1)return 0;const N=Math.max(0,Math.min(E,100)),$=Math.round(N/100*(B-1));return Math.max(0,Math.min($,B-1))}}}})}function Zc({children:e,initialState:t}){const n=h.useContext(St),r=h.useMemo(()=>Xc({...t,eventBridgeStore:n}),[t,n]);return m.jsx(ir.Provider,{value:r,children:e})}function Jc({children:e,initialState:t}){const n=h.useContext(St)??void 0,r=h.useRef(Qs({init:t,recorderStore:n}));return m.jsx(sr.Provider,{value:r.current,children:e})}const eu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=q(u=>u.section),o=h.useMemo(()=>{var u;return((u=r.ast)==null?void 0:u.blocks)??[]},[r]),s=Y(u=>u.marginX),i=Y(u=>u.lineHeight),c=Y(u=>u.fontSizePx),l=Y(u=>u.fontFamily),a=Y(u=>u.viewportHeight),d=q(u=>{var R;return((R=u.layout)==null?void 0:R.prefix)??[]}),S=q(u=>{var R;return((R=u.derivedNav)==null?void 0:R.splitGroupsPerBlock)??[]}),b=e[t],v=h.useMemo(()=>{const u=[];return o.forEach((R,T)=>{(R.type==="paragraph"||R.type==="image")&&u.push(T)}),u},[o]),x=h.useMemo(()=>{if(!b)return[];const u=[];for(let R=b.startBlock;R<=b.endBlock;R++){const T=v[R];T!=null&&u.push(T)}return u},[b,v]),w=h.useMemo(()=>{const u=[];for(const R of x){const T=o[R];(T==null?void 0:T.type)==="paragraph"&&u.push({b:T,originalBlockIndex:R})}return u},[x,o]),p=h.useMemo(()=>{const u=[],R=vr();return w.forEach((T,I)=>{u[I]=Sr(T.b,R)}),u},[w]),f=(u,R,T)=>{if(!u||u.length===0)return[];const I=[];for(const M of u){const g=M.startG,y=M.endG;if(y<R||g>T)continue;const k=Math.max(g,R),_=Math.min(y,T),O=k-g|0,P=Math.max(0,_-k+1);if(P<=0)continue;const C=(M.r0??0)+O;I.push({...M,startG:k,endG:_,r0:C,len:P})}return I};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:c,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((u,R)=>{var Q;const T=o[u],I=R===0,M=R===x.length-1,g={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},y=`sec-${r.section_id}/blk-${T.id??u}`;if(T.type==="image"){const{src:z,alt:K,width:ee,height:H}=T,ne=ee&&H?`${ee} / ${H}`:"4 / 3",D=a>80?Math.floor((a-80)*.6):void 0;return m.jsx("div",{style:g,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:D,aspectRatio:ne},children:m.jsx("img",{src:z,alt:K||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),K&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:K})]})},y)}const k=T,_=w.findIndex(z=>z.originalBlockIndex===u),O=_>=0?p[_]:void 0,P=k.runs??[],C=P.length;let j=0,A=Math.max(0,C-1);I&&b.startOffsetInBlock!=null&&(j=Math.min(Math.max(0,b.startOffsetInBlock),A)),M&&b.endOffsetInBlock!=null&&(A=Math.max(j,Math.min(b.endOffsetInBlock,A)));const F=j>0,E=d[u]??0,B=S[u]??[],N=E+j,$=E+A;let V=f(B,N,$);const le=E+j;V=V.map(z=>{const K=Math.max(0,(z.startG??N)-le),ee=z.len??Math.max(1,(z.endG??$)-(z.startG??N)+1);return{...z,r0:K,len:ee}});const ae=j<=A?P.slice(j,A+1):[],ye=k.list?k.list.level*24:0,we=((Q=k.list)==null?void 0:Q.kind)==="bullet"?k.list.glyph??"•":void 0,Z=F?void 0:O??we;return m.jsx("div",{style:g,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:k.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[k.list&&Z?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:Z||""}):null,m.jsx(ms,{preGroups:V,runs:ae,ns:y,baseIndex:le,sectionId:String(r.section_id)})]})},y)})})]})})},uo=.5;function tu(e,t){const n=h.useRef(null),r=h.useRef(null),o=h.useRef(!1);h.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 a=l[0],{width:d,height:S}=a.contentRect,b=r.current;if(!b){r.current={w:d,h:S};return}Math.abs(b.w-d)<uo&&Math.abs(b.h-S)<uo||(r.current={w:d,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const c=()=>s();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function nu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:c=120,verticalTolerance:l=40,velocityThreshold:a=.6,singleDelayMs:d=250,doubleClickWindowMs:S=300,suppressAfterSwipeMs:b=250,onDragMove:v,onDragEnd:x,pageTransitionThreshold:w}=e,p=w??c,f=Math.min(20,c),u=ot.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),R=()=>{u.current.singleTimer!=null&&(window.clearTimeout(u.current.singleTimer),u.current.singleTimer=null)},T=()=>{var j;const C=((j=document==null?void 0:document.body)==null?void 0:j.style)??null;C&&u.current.prevUserSelect!=null&&(C.userSelect=u.current.prevUserSelect,u.current.prevUserSelect=null),u.current.capturedEl&&u.current.pid!=null&&typeof u.current.capturedEl.hasPointerCapture=="function"&&u.current.capturedEl.hasPointerCapture(u.current.pid)&&u.current.capturedEl.releasePointerCapture(u.current.pid),u.current.capturedEl=null},I=ot.useCallback(C=>{const j=i??s;j!=null&&j(C.target)||(u.current.pid=C.pointerId,u.current.startX=C.clientX,u.current.startY=C.clientY,u.current.startT=C.timeStamp,u.current.swiping=!1,u.current.canceledClick=!1,u.current.capturedEl=C.currentTarget)},[i,s]),M=ot.useCallback(C=>{var B;if(u.current.pid==null||C.pointerId!==u.current.pid)return;const j=C.clientX-u.current.startX,A=C.clientY-u.current.startY,F=Math.abs(j),E=Math.abs(A);if(!u.current.swiping){if(F>=f&&E<=l&&F>E){u.current.swiping=!0,u.current.canceledClick=!0;const N=u.current.capturedEl;if(N&&typeof N.setPointerCapture=="function")try{N.setPointerCapture(C.pointerId)}catch{}const $=((B=document==null?void 0:document.body)==null?void 0:B.style)??null;$&&(u.current.prevUserSelect=$.userSelect??null,$.userSelect="none"),C.preventDefault()}return}v==null||v(j),C.preventDefault()},[l,v,f]),g=ot.useCallback(C=>{if(u.current.pid==null||C.pointerId!==u.current.pid)return;const j=C.timeStamp-u.current.startT,A=C.clientX-u.current.startX;if(u.current.swiping){const F=Math.abs(A)/Math.max(1,j);Math.abs(A)>=p||F>=a?A<0?n():t():x==null||x(),u.current.lastSwipeAt=C.timeStamp}else C.timeStamp-u.current.lastUpT;T(),u.current.lastUpT=C.timeStamp,u.current.pid=null,u.current.swiping=!1},[p,a,n,t,S,x]),y=ot.useCallback(()=>{u.current.swiping&&(x==null||x()),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[x]),k=ot.useCallback(C=>{var j,A;(A=(j=u.current.capturedEl)==null?void 0:j.hasPointerCapture)!=null&&A.call(j,C.pointerId)||u.current.pid!=null&&u.current.swiping&&(x==null||x(),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1)},[x]),_=ot.useCallback(()=>{u.current.pid!=null&&u.current.swiping&&(x==null||x()),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[x]),O=ot.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}r&&u.current.singleTimer==null&&(u.current.singleTimer=window.setTimeout(()=>{u.current.singleTimer=null,r(C)},d))}},[r,s,d,b]),P=ot.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}R(),o==null||o(C)}},[o,s,b]);return ot.useEffect(()=>()=>{R(),T()},[]),{onPointerDown:I,onPointerMove:M,onPointerUp:g,onPointerCancel:y,onPointerLeave:k,onLostPointerCapture:_,onClick:O,onDoubleClick:P}}var Bn,fo;function Cs(){if(fo)return Bn;fo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,po;function ru(){if(po)return zn;po=1;var e=typeof Yt=="object"&&Yt&&Yt.Object===Object&&Yt;return zn=e,zn}var An,ho;function Is(){if(ho)return An;ho=1;var e=ru(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,go;function ou(){if(go)return Ln;go=1;var e=Is(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,mo;function su(){if(mo)return Gn;mo=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,bo;function iu(){if(bo)return Hn;bo=1;var e=su(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,xo;function ks(){if(xo)return Nn;xo=1;var e=Is(),t=e.Symbol;return Nn=t,Nn}var Fn,vo;function lu(){if(vo)return Fn;vo=1;var e=ks(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var c=n.call(i,o),l=i[o];try{i[o]=void 0;var a=!0}catch{}var d=r.call(i);return a&&(c?i[o]=l:delete i[o]),d}return Fn=s,Fn}var Wn,So;function au(){if(So)return Wn;So=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Wn=n,Wn}var Dn,yo;function cu(){if(yo)return Dn;yo=1;var e=ks(),t=lu(),n=au(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(c){return c==null?c===void 0?o:r:s&&s in Object(c)?t(c):n(c)}return Dn=i,Dn}var $n,wo;function uu(){if(wo)return $n;wo=1;function e(t){return t!=null&&typeof t=="object"}return $n=e,$n}var Vn,Co;function du(){if(Co)return Vn;Co=1;var e=cu(),t=uu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Vn=r,Vn}var qn,Io;function fu(){if(Io)return qn;Io=1;var e=iu(),t=Cs(),n=du(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt;function l(a){if(typeof a=="number")return a;if(n(a))return r;if(t(a)){var d=typeof a.valueOf=="function"?a.valueOf():a;a=t(d)?d+"":d}if(typeof a!="string")return a===0?a:+a;a=e(a);var S=s.test(a);return S||i.test(a)?c(a.slice(2),S?2:8):o.test(a)?r:+a}return qn=l,qn}var Un,ko;function pu(){if(ko)return Un;ko=1;var e=Cs(),t=ou(),n=fu(),r="Expected a function",o=Math.max,s=Math.min;function i(c,l,a){var d,S,b,v,x,w,p=0,f=!1,u=!1,R=!0;if(typeof c!="function")throw new TypeError(r);l=n(l)||0,e(a)&&(f=!!a.leading,u="maxWait"in a,b=u?o(n(a.maxWait)||0,l):b,R="trailing"in a?!!a.trailing:R);function T(C){var j=d,A=S;return d=S=void 0,p=C,v=c.apply(A,j),v}function I(C){return p=C,x=setTimeout(y,l),f?T(C):v}function M(C){var j=C-w,A=C-p,F=l-j;return u?s(F,b-A):F}function g(C){var j=C-w,A=C-p;return w===void 0||j>=l||j<0||u&&A>=b}function y(){var C=t();if(g(C))return k(C);x=setTimeout(y,M(C))}function k(C){return x=void 0,R&&d?T(C):(d=S=void 0,v)}function _(){x!==void 0&&clearTimeout(x),p=0,d=w=S=x=void 0}function O(){return x===void 0?v:k(t())}function P(){var C=t(),j=g(C);if(d=arguments,S=this,w=C,j){if(x===void 0)return I(w);if(u)return clearTimeout(x),x=setTimeout(y,l),T(w)}return x===void 0&&(x=setTimeout(y,l)),v}return P.cancel=_,P.flush=O,P}return Un=i,Un}var hu=pu();const gu=Po(hu);function mu(e,t=200,n,r){const o=h.useRef(e),s=h.useRef(n);h.useEffect(()=>{o.current=e},[e]),h.useEffect(()=>{s.current=n},[n]);const i=h.useMemo(()=>{const c=gu((...a)=>{o.current(...a)},t,r),l=((...a)=>{var d;(d=s.current)==null||d.call(s),c(...a)});return l.cancel=c.cancel.bind(c),l.flush=c.flush.bind(c),l},[t,r]);return h.useEffect(()=>()=>i.cancel(),[i]),i}const Rs=new Map,Ts=e=>Rs.get(e)??0,bu=e=>{const t=Ts(e)+1;return Rs.set(e,t),t};class _s extends Error{constructor(){super("calcPages canceled due to a newer invocation");Cr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const et=(e,t)=>{if(e!==Ts(t))throw new _s},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},Ro=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 c=s.getClientRects(),l=c.length?c[c.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},xu=(e,t,n)=>{if(n<16)return async(o=24)=>{et(e,t)};let r=0;return async(o=24)=>{r++,r%o===0&&(et(e,t),await new Promise(s=>requestAnimationFrame(()=>s())),et(e,t))}};async function vu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:c,lineHeight:l,showSplit:a,breakGapPx:d=0,showSlash:S,paragraphMarkers:b,playbackScale:v=1,viewportHeight:x=0,instanceId:w="default"}){var f,u,R;const p=bu(w);et(p,w);try{const T=Math.abs(v-1)>.001,I=1/v;T&&(t.style.transform=`scale(${I})`,t.style.transformOrigin="top left");const M=Math.max(0,e.offsetWidth||0),g=Math.max(0,Math.min(M,o));t.style.maxWidth=`${g}px`,et(p,w);let y=Math.round(n.offsetHeight||0);y||(y=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",v.toFixed(4),T?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",M),console.log("[calcPages] pageBoxWidth:",g),console.log("[calcPages] maxPageHeight:",y),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const k=1.5,_=(H,ne)=>ne+H<=y-k,O=getComputedStyle(e),P={letterSpacing:O.letterSpacing,wordSpacing:O.wordSpacing,fontKerning:O.fontKerning||"normal",fontVariantLigatures:O.fontVariantLigatures||"normal",textTransform:O.textTransform||"none",direction:O.direction||"ltr",wordBreak:O.wordBreak||"keep-all",overflowWrap:O.overflowWrap||O.wordWrap||"break-word",hyphens:O.hyphens||"manual"},C=H=>{H.style.letterSpacing=P.letterSpacing||"",H.style.wordSpacing=P.wordSpacing||"",H.style.fontKerning=P.fontKerning||"",H.style.fontVariantLigatures=P.fontVariantLigatures||"",H.style.textTransform=P.textTransform||"",H.style.direction=P.direction||"",H.style.wordBreak=P.wordBreak||"",H.style.wordWrap=P.overflowWrap||"",H.style.overflowWrap=P.overflowWrap||"",H.style.hyphens=P.hyphens||""},j=g,A=Math.max(0,j-2*(s||0));n.innerHTML="";const F=document.createElement("div");F.style.boxSizing="border-box",F.style.width=`${j}px`,F.style.maxWidth=`${j}px`,F.style.margin="0 auto",F.style.display="flex",n.appendChild(F);const E=document.createElement("div");E.style.boxSizing="border-box",E.style.paddingRight=`${s}px`,E.style.paddingLeft=`${s}px`,E.style.width=`${j}px`,E.style.maxWidth=`${j}px`,E.style.margin="0 auto",E.style.display="flex",E.style.justifyContent="center",E.style.height="auto",F.appendChild(E);const B=new Map,N={},$=xu(p,w,r.length),V=(H,ne)=>{const D=document.createElement("p");return D.style.margin="8px 0",D.style.paddingLeft=ne?`${ne}px`:"0",D.style.textAlign=H.textAlign??"start",D.style.whiteSpace="pre-wrap",D.style.lineHeight=String(l),D.style.fontSize=`${c}px`,D.style.boxSizing="border-box",D.style.fontFamily=i??"",D.style.width="100%",C(D),D},le=(H,ne)=>{const D=ne??[],X=document.createDocumentFragment();for(let re=0;re<D.length;re++){const te=D[re],ue=document.createElement("span");ue.dataset.runbox=String(re),ue.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(te==null?void 0:te.text)??"",oe.style.whiteSpace="pre-wrap",te!=null&&te.bold&&(oe.style.fontWeight="700"),te!=null&&te.italic&&(oe.style.fontStyle="italic"),te!=null&&te.underline&&(oe.style.textDecoration="underline"),ue.appendChild(oe),a&&(te!=null&&te.split)&&re!==D.length-1){const be=Math.max(0,(d??0)/2),pe=document.createElement("span");pe.style.display="inline-block",pe.style.width=`${be}px`;const Se=document.createElement("span");if(Se.style.display="inline-block",Se.style.width=`${be}px`,ue.appendChild(pe),S){const Re=document.createElement("span");Re.textContent=" / ",ue.appendChild(Re)}ue.appendChild(Se)}X.appendChild(ue)}H.appendChild(X)},ae=x>80?Math.floor((x-80)*.6):void 0,ye=H=>{const ne=H!=null&&H.width&&(H!=null&&H.height)?`${H.width} / ${H.height}`:"4 / 3",D=document.createElement("div");D.style.margin="12px 0",D.style.textAlign="center",D.style.width=`${A}px`;const X=document.createElement("div");X.style.position="relative",X.style.width="100%",ae&&(X.style.maxHeight=`${ae}px`),X.style.aspectRatio=ne;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",X.appendChild(re),D.appendChild(X),H!=null&&H.alt){const te=document.createElement("div");te.style.fontSize="12px",te.style.color="#6B7280",te.style.marginTop="4px",te.textContent=String(H.alt),C(te),D.appendChild(te)}return D};for(let H=0;H<r.length;H++){et(p,w);const ne=r[H];if(E.dataset.block=String(H),E.innerHTML="",ne.kind==="image"){const Se=ne.block,Re=ye(Se);E.appendChild(Re);const Be=Re.getBoundingClientRect(),{mt:je,mb:Ge}=Kn(Re);N[H]={contentH:Math.ceil(Be.height),mt:je,mb:Ge},await $(24);continue}const D=ne.block,X=D.list?(D.list.level??0)*24:0,re=ne.paraIndex??0,te=b[re]??(((f=D.list)==null?void 0:f.kind)==="bullet"?((u=D.list)==null?void 0:u.glyph)??"•":void 0);if(!!(D.list&&te)){const Se=V(D,X);Se.dataset.variant="with";const Re=V(D,X);Re.dataset.variant="no";const Be=document.createElement("span");Be.textContent=`${te} `,Be.style.minWidth="16px",Be.style.display="inline-block",Be.style.whiteSpace="nowrap",Be.style.userSelect="none",Se.appendChild(Be),le(Se,D.runs),le(Re,D.runs);const je=document.createDocumentFragment();je.appendChild(Se),je.appendChild(Re),E.appendChild(je)}else{const Se=V(D,X);Se.dataset.variant="with",le(Se,D.runs),E.appendChild(Se)}const oe=E.querySelector('p[data-variant="with"]'),be=E.querySelector('p[data-variant="no"]'),pe=be??oe;if(oe&&pe){const Se=Ro(oe),Re=Ro(pe),{mt:Be,mb:je}=Kn(oe),{mt:Ge,mb:rt}=Kn(pe),De=((R=D.runs)==null?void 0:R.length)??0,Pe=be?Re:Se,Xe=be?Ge:Be,Ue=be?rt:je;if(H<3){const ut=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${H}: height=${ut.toFixed(2)}, lastBottom=[${Se.slice(-3).map(Pt=>Pt.toFixed(1)).join(",")}], runs=${De}`)}B.set(H,{runsLen:De,lastBottomWith:Se,lastBottomNo:Pe,mtWith:Be,mbWith:je,mtNo:Xe,mbNo:Ue})}await $(24)}et(p,w),E.innerHTML="";const we=(H,ne,D,X)=>{if(ne>D)return{top:0,content:0,mb:0};const re=X?H.lastBottomNo:H.lastBottomWith,te=X?H.mtNo:H.mtWith,ue=X?H.mbNo:H.mbWith,oe=X?0:te,be=ne>0?re[ne-1]??0:0,pe=Math.max(0,(re[D]??0)-be);return{top:oe,content:pe,mb:ue}},Z=[];let Q=0,z,K=null,ee=null;for(;Q<r.length;){et(p,w);const H=Q;let ne=0,D=0,X=z;X!=null&&K===Q&&ee!=null&&(X=Math.max(X,ee+1));let re=-1,te;for(;Q<r.length;){if(et(p,w),r[Q].kind==="image"){const Pe=N[Q]??{contentH:0,mt:0,mb:0},Ue=(ne===0?Pe.mt:D+Pe.mt)+Pe.contentH;if(_(Ue,ne)){ne+=Ue,re=Q,te=void 0,D=Pe.mb,Q+=1,z=void 0,K=null,ee=null;continue}if(ne===0){Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{}}),Q+=1,z=void 0,K=null,ee=null,D=0;break}break}const oe=B.get(Q),be=oe.runsLen,pe=Q===H&&X!=null?X:0;if(pe>=be){Q+=1,z=void 0,K=null,ee=null;continue}const Se=pe>0,Re=we(oe,pe,be-1,Se),je=(ne===0?Re.top:D+Re.top)+Re.content;if(_(je,ne)){ne+=je,re=Q,te=be-1,D=Re.mb,Q+=1,z=void 0,K=null,ee=null;continue}let Ge=pe,rt=be-1,De=pe-1;for(;Ge<=rt;){et(p,w);const Pe=Ge+rt>>1,Xe=we(oe,pe,Pe,Se),Ue=(ne===0?Xe.top:D+Xe.top)+Xe.content;_(Ue,ne)?(De=Pe,Ge=Pe+1):rt=Pe-1}if(De>=pe){Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{},endOffsetInBlock:De}),z=De+1,K=Q,ee=De,D=0;break}if(ne>0){Z.push({startBlock:H,endBlock:re>=0?re:Math.min(Q-1,r.length-1),...X!=null?{startOffsetInBlock:X}:{},...te!=null?{endOffsetInBlock:te}:{}}),D=0;break}else{const Pe=pe;Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{},endOffsetInBlock:Pe}),z=Pe+1,K=Q,ee=Pe,D=0;break}}(Z.length===0||Z[Z.length-1].startBlock!==H)&&Z.push({startBlock:H,endBlock:re>=0?re:Math.min(Q-1,r.length-1),...X!=null?{startOffsetInBlock:X}:{},...te!=null?{endOffsetInBlock:te}:{}})}return F.remove(),T&&(t.style.transform="",t.style.transformOrigin=""),et(p,w),{pages:Z,pageByRunIndex:null}}catch(T){throw console.error(T),T}}function To(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 c=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+c}return null}function Su(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let c=i.startBlock;c<=i.endBlock;c++){const l=n[c];if(!l||l.kind!=="paragraph")continue;const a=((o=l.block.runs)==null?void 0:o.length)??0;if(!a)continue;let d=0,S=a-1;c===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,S))),c===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(d,Math.min(i.endOffsetInBlock,S)));const b=r[l.originalIndex]??0,v=b+d,x=b+S;if(e>=v&&e<=x)return s}}return-1}function yu(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 wu(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 Cu(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 Iu(){var wr;const e=h.useId(),t=q(W=>W.section),n=q(W=>W.sectionLoading),r=q(W=>W.rangeStartGI),o=q(W=>W.rangeEndGI),s=r!=null&&o!=null,i=yt(),c=Y(W=>W.theme),l=on[c],a=Y(W=>W.fontFamily),d=Y(W=>W.fontSizePx),S=Y(W=>W.lineHeight),b=Y(W=>W.marginX),v=Y(W=>W.viewportHeight),x=860,w=h.useRef(null),{items:p}=h.useMemo(()=>{var W;return Cu(((W=t==null?void 0:t.ast)==null?void 0:W.blocks)??[])},[t]),f=h.useMemo(()=>{const W=[],Me=vr();return p.forEach(Ae=>{if(Ae.kind==="paragraph"){const mt=Ae.paraIndex;W[mt]=Sr(Ae.block,Me)}}),W},[p]),[u,R]=h.useState({pages:[],pageByRunIndex:null}),T=q(W=>W.pageIndex),I=q(W=>W.setPageIndex),M=h.useRef(0),g=h.useRef(null),[y,k]=h.useState(!1),[_,O]=h.useState(null),[P,C]=h.useState(!1),j=h.useMemo(()=>({flex:1,fontFamily:a,background:l.bg,color:l.fg,fontSize:d,lineHeight:S,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[a,l.bg,l.fg,d,S]),{showSplit:A,breakGapPx:F,slash:E}=Y(Vt(W=>{var Me;return{showSplit:W.showSplit,breakGapPx:W.breakGapPx??0,slash:((Me=W.breakMarks)==null?void 0:Me.slash)??!1}})),B=xt();h.useEffect(()=>{u&&u.pages.length&&(console.log("그래서 총 페이지",u.pages.length),(async()=>{const W=B.getState().progress.setSectionLoading;await dt(),await dt(),await dt(),await dt(),console.log("recalc종료"),W(!1)})())},[u,B]);const N=h.useCallback(()=>{console.log("@@@@@@recalc호출");const W=w.current,Me=oe.current,Ae=be.current;if(console.log("showSplit",A),!W||!Me||!Ae||p.length===0){R({pages:[],pageByRunIndex:null}),I(0);return}(async()=>{const mt=performance.now();try{const Ze=i.getState().playbackScale,{pages:It,pageByRunIndex:Es}=await vu({viewHost:W,measureRoot:Me,contentArea:Ae,items:p,cfgMaxWidth:x,marginX:b,fontFamily:a,fontSizePx:d,lineHeight:S,showSplit:A,breakGapPx:F,showSlash:E,paragraphMarkers:f,playbackScale:Ze,viewportHeight:v,instanceId:e}),js=performance.now();console.log(`✅ calcPages 완료: ${(js-mt).toFixed(1)} ms (${It.length} pages)`),R({pages:It,pageByRunIndex:Es}),I(0)}catch(Ze){if(Ze instanceof _s){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Ze)}})()},[I,p,x,b,a,d,S,A,F,E,f,i,v,e]),$=q(W=>W.setCurrentGlobalRunIndex),V=q(W=>{var Me;return((Me=W.layout)==null?void 0:Me.prefix)??[]}),le=Ce(W=>W.syncToGI),ae=h.useCallback(W=>{const Me=u.pages.length+1,Ae=T+W;if(Ae<0||Ae>=Me)return;const mt=T===u.pages.length;if(Ae===u.pages.length){I(Ae);return}if(mt&&W===-1){const It=To(u.pages[Ae],p,V);It!=null&&($(It,"scrubber-step"),le(It)),I(Ae);return}const Ze=To(u.pages[Ae],p,V);Ze!=null?($(Ze,"scrubber-step"),le(Ze)):I(Ae)},[T,u.pages,p,V,$,I,le]),ye=h.useCallback(()=>{y||M.current!==0?(O("prev"),k(!1)):ae(-1)},[y,ae]),we=h.useCallback(()=>{y||M.current!==0?(O("next"),k(!1)):ae(1)},[y,ae]),Z=hn(),Q=h.useCallback(()=>{const{isSettingsOpen:W,setSettingsOpen:Me,toggleOverlays:Ae}=Z.getState();W?Me(!1):Ae()},[Z]),z=u.pages.length+1,K=((wr=w.current)==null?void 0:wr.clientWidth)||400,ee=h.useCallback(W=>{var Ze;const Me=g.current;if(!Me)return;const Ae=((Ze=w.current)==null?void 0:Ze.clientWidth)||1,mt=W/Ae*33.333;Me.style.transform=`translate3d(${-33.333+mt}%, 0, 0)`},[]),H=h.useCallback(W=>{T===0&&W>0||T>=z-1&&W<0||(M.current=W,ee(W),y||k(!0))},[T,z,ee,y]),ne=h.useCallback(()=>{M.current=0,k(!1);const W=g.current;W&&(W.style.transition="transform 250ms ease-out",W.style.transform="translate3d(-33.333%, 0, 0)")},[]),D=h.useCallback(W=>{if(W.target!==W.currentTarget||W.propertyName!=="transform")return;const Me=_;C(!0),O(null),M.current=0,Me==="prev"?ae(-1):Me==="next"&&ae(1)},[_,ae]);h.useLayoutEffect(()=>{P&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{C(!1)})})},[P]);const X=an(),re=h.useCallback(W=>s||wu(W)?!0:yu(W),[s]),te=h.useCallback(W=>{const Me=X.getState().status;return Me==="playing"||Me==="loading"?!0:re(W)},[X,re]),ue=nu({onPrev:ye,onNext:we,onSingle:Q,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:te,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:H,onDragEnd:ne,pageTransitionThreshold:K*.5}),oe=h.useRef(null),be=h.useRef(null),pe=h.useCallback(()=>{const W=B.getState().progress.setSectionLoading;W(!0)},[B]),Se=h.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Re=mu(N,200,pe,Se),Be=h.useRef("");h.useEffect(()=>{if(v<=0)return;const W=`${a}|${d}|${S}|${b}|${A}|${F}|${E}|${v}|${t==null?void 0:t.section_id}`;Be.current!==W&&(Be.current=W,console.log("debounceRecalc 취소"),Re.cancel(),pe(),N())},[Re,N,pe,a,d,S,b,A,F,E,v,t==null?void 0:t.section_id]),tu([w],Re);const je=q(W=>W.registerSectionScrollApi);h.useEffect(()=>(je({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:ae}),()=>je(void 0)),[je,ae]);const Ge=t.quiz&&t.quiz.length>0,rt=u.pages.length>0&&T===u.pages.length,De=T>0?T-1:null,Pe=T<z-1?T+1:null,Xe=h.useMemo(()=>_==="prev"?"translate3d(0%, 0, 0)":_==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[_]),Ue=W=>n?null:W===u.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Ge&&m.jsx(vs,{}),m.jsx(fn,{isIcon:!1})]}):m.jsx(eu,{pages:u.pages,pageIndex:W,maxWidth:x}),ut={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Pt=!P&&(!y||_!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:w,style:{...j,touchAction:"pan-y"},...ue,children:[m.jsxs("div",{ref:g,style:{display:"flex",width:"300%",height:"100%",transform:Xe,transition:Pt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:_?D:void 0,children:[m.jsx("div",{style:ut,children:De!==null&&Ue(De)}),m.jsx("div",{style:ut,children:Ue(T)}),m.jsx("div",{style:ut,children:Pe!==null&&Ue(Pe)})]}),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:a,fontSize:d,lineHeight:S,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:be,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(ku,{pages:u.pages,items:p,onGotoPage:I,currentPageIndex:T,isOnExtraPage:rt})]})}const ku=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=q(a=>a.currentGlobalRunIndex),i=q(a=>a.lastUpdateBy),c=q(a=>{var d;return((d=a.layout)==null?void 0:d.prefix)??[]}),l=h.useRef(null);return h.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const a=Su(s,e,t,c);a>=0&&a!==r&&n(a)},[s,e,t,c,n,r,o,i]),m.jsx(m.Fragment,{})},Ru="_wrapper_dbk3n_1",Tu="_spinner_dbk3n_10",_o={wrapper:Ru,spinner:Tu};function _u({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${_o.wrapper}`,children:m.jsx("div",{className:_o.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Mu(){const e=q(Vt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(_u,{})})}const Eu="_Overlay_ybic8_3",ju="_Dialog_ybic8_15",Ou="_Body_ybic8_25",Pu="_Header_ybic8_32",Bu="_Paging_ybic8_39",zu="_Remaining_ybic8_48",Au="_RemainingDanger_ybic8_55",Lu="_NextBtn_ybic8_59",Gu="_CloseBtn_ybic8_96",Hu="_Question_ybic8_113",Nu="_Score_ybic8_123",Fu="_Image_ybic8_130",Wu="_Options_ybic8_140",Du="_OptionBtn_ybic8_145",$u="_OptionBtnActive_ybic8_165",Vu="_Footer_ybic8_172",qu="_OptionBtnCorrect_ybic8_195",Uu="_Judge_ybic8_201",Ku="_Correct_ybic8_212",Qu="_Incorrect_ybic8_215",Yu="_ResultHeader_ybic8_220",Xu="_ResultActions_ybic8_233",Zu="_CloseBtnSoft_ybic8_239",Ju="_SummaryGrid_ybic8_249",ed="_StatCard_ybic8_257",td="_StatLabel_ybic8_265",nd="_StatValue_ybic8_270",rd="_StatSub_ybic8_277",de={Overlay:Eu,Dialog:ju,Body:Ou,Header:Pu,Paging:Bu,Remaining:zu,RemainingDanger:Au,NextBtn:Lu,CloseBtn:Gu,Question:Hu,Score:Nu,Image:Fu,Options:Wu,OptionBtn:Du,OptionBtnActive:$u,Footer:Vu,OptionBtnCorrect:qu,Judge:Uu,Correct:Ku,Incorrect:Qu,ResultHeader:Yu,ResultActions:Xu,CloseBtnSoft:Zu,SummaryGrid:Ju,StatCard:ed,StatLabel:td,StatValue:nd,StatSub:rd};function od(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Ms(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function sd(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 id=h.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),c=Je(p=>p.remainingSec),l=Je(p=>p.uiReveal),a=Je(p=>p.startedAt),d=Je(p=>p.finishedAt),S=Je(p=>p.perQ),b=xs();h.useEffect(()=>{if(t==="idle"||t!=="doing"||c==null)return;const p=window.setInterval(()=>b.getState().tick(),1e3);return()=>window.clearInterval(p)},[t,c,b]);const v=t==="doing"?n[r[o]]:void 0,x=t==="doing"&&v?s[v.qid]??[]:[],w=h.useMemo(()=>{if(t==="idle"||t!=="finished")return;const p=r.map(E=>n[E]),f=p.length,u=p.reduce((E,B)=>E+(B.score??0),0),R=p.reduce((E,B)=>{const N=S[B.qid];return E+(N!=null&&N.isCorrect?B.score??0:0)},0),T=p.map(E=>S[E.qid]).filter(E=>!!E),I=typeof a=="number"&&typeof d=="number"?Math.max(0,d-a):T.reduce((E,B)=>E+(B.ms??0),0),M=f>0?Math.round(I/f):0,g=[...T].sort((E,B)=>E.ms-B.ms),y=g[0],k=g[g.length-1],_=T.filter(E=>!E.multi),O=T.filter(E=>E.multi),P=_.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,j=T.filter(E=>E.timedOut).length,A=T.filter(E=>E.revealed).length,F=T.filter(E=>!E.isCorrect).sort((E,B)=>B.ms-E.ms).slice(0,3);return{total:f,correct:i,rate:f?Math.round(i/f*100):0,timeMsTotal:I,avgMs:M,totalScore:u,gainedScore:R,fastest:y,slowest:k,singles:{total:_.length,correct:P},multis:{total:O.length,correct:C},timedOut:j,revealed:A,wrongTop3:F}},[t,r,n,S,a,d,i]);return t==="idle"?null:m.jsx("div",{className:de.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:de.Dialog,children:t==="doing"&&v?m.jsx(ld,{q:v,index:o,total:r.length,selected:x,uiReveal:l,onSelect:p=>{if(l)return;const f=b.getState();Ms(v)?f.selectToggle(p):f.selectSingle(p)},onBeforeNext:()=>b.getState().setReveal(!0),onNext:()=>b.getState().afterRevealNext(),remainingSec:c,onClose:()=>b.getState().close()}):m.jsx(ad,{total:r.length,correct:i,summary:w,onClose:()=>b.getState().close()})})})});function ld(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:c,onNext:l,remainingSec:a,onClose:d}=e,S=Ms(t),b=h.useMemo(()=>{const p=t.options.map((f,u)=>({opt:f,i:u}));for(let f=p.length-1;f>0;f--){const u=Math.floor(Math.random()*(f+1));[p[f],p[u]]=[p[u],p[f]]}return p},[t.options]),v=h.useMemo(()=>od(t),[t]),x=h.useMemo(()=>sd(t),[t]),w=h.useMemo(()=>{const p=[...o].sort((f,u)=>f-u);if(p.length!==x.length)return!1;for(let f=0;f<p.length;f++)if(p[f]!==x[f])return!1;return!0},[o,x]);return m.jsxs("div",{className:de.Body,children:[m.jsxs("div",{className:de.Header,children:[m.jsx("div",{className:de.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:d,className:de.CloseBtn,children:"X"})]}),m.jsx("div",{className:de.Question,children:t.question}),m.jsx("div",{className:de.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),m.jsx("div",{className:`${de.Judge}${s?w?` ${de.Correct}`:` ${de.Incorrect}`:""}`,"aria-live":"polite",children:s?w?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:de.Image,children:v&&m.jsx("img",{src:v,alt:""})}),m.jsx("div",{className:de.Options,children:b.map(({opt:p,i:f})=>{const u=o.includes(f),R=x.includes(f),T=[de.OptionBtn,u?de.OptionBtnActive:"",s&&R?de.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(f),className:T,disabled:s,children:p},f)})}),m.jsx("div",{className:de.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:de.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:c,className:`${de.NextBtn}`,children:["Submit",typeof a=="number"&&m.jsx("span",{className:`${de.Remaining} ${a<=5?de.RemainingDanger:""}`,children:` (${a} s )`})]})})]})}function Mo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function ad(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:de.Body,children:[m.jsx("div",{className:de.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:de.SummaryGrid,role:"list",children:[m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"정답률"}),m.jsxs("div",{className:de.StatValue,children:[s,"%"]}),m.jsx("div",{className:de.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"총 점수"}),m.jsx("div",{className:de.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:de.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:de.StatValue,children:Mo(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:de.StatSub,children:`평균 ${Mo(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:de.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:de.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:de.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:de.CloseBtnSoft,children:"닫기"})})]})}function cd(e){return e.map((t,n)=>n)}function ud(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 Eo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:cd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function dd(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Eo(e);return qt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const c=Eo(i);o(c)},openFromSection:i=>{i&&s().hydrateFromSection(i);const c=s();if(!c.quizzes.length)return;const l=c.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 c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid,d=c.answers[a]??[],S=d.includes(i)?d.filter(b=>b!==i):[...d,i].sort((b,v)=>b-v);o({answers:{...c.answers,[a]:S}})},selectSingle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid;o({answers:{...c.answers,[a]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const c=i.order[i.currentIndex],l=i.quizzes[c],a=l.qid,d=(i.answers[a]??[]).slice().sort((p,f)=>p-f),S=Yn(l),b=ud(d,S),v=i.questionStartedAt?Date.now()-i.questionStartedAt:0,x=i.perQ[a],w={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:d,correctIdxes:S,isCorrect:b,ms:v,revealed:(x==null?void 0:x.revealed)??!1,timedOut:(x==null?void 0:x.timedOut)??!1};if(o({correctCount:i.correctCount+(b?1:0),perQ:{...i.perQ,[a]:w}}),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 c=s();if(c.phase==="doing"){if(i){const l=c.quizzes[c.order[c.currentIndex]],a=l.qid,d=c.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...c.perQ,[a]: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 c=i.currentIndex+1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const c=i.currentIndex-1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].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 c=i.remainingSec-1;if(c<=0){const l=i.quizzes[i.order[i.currentIndex]],a=l.qid,d=i.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[a]:S}})}else o({remainingSec:c})}}))}function fd({children:e,initialState:t}){const n=h.useMemo(()=>dd(t.section),[t]),r=h.useRef(t.onQuizComplete);return h.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),h.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const c=r.current;if(!c)return;const{sectionId:l,quizzes:a,order:d,perQ:S,startedAt:b,finishedAt:v}=s,x=d.map(M=>a[M]),w=x.length,p=x.filter(M=>{var g;return(g=S[M.qid])==null?void 0:g.isCorrect}).length,f=x.reduce((M,g)=>M+(g.score??0),0),u=x.reduce((M,g)=>{const y=S[g.qid];return M+(y!=null&&y.isCorrect?g.score??0:0)},0),R=typeof b=="number"&&typeof v=="number"?Math.max(0,v-b):0,T=x.map(M=>{const g=S[M.qid];return{qid:M.qid,index:M.index,question:M.question,score:M.score??0,isCorrect:(g==null?void 0:g.isCorrect)??!1,selected:(g==null?void 0:g.selected)??[],correctIdxes:(g==null?void 0:g.correctIdxes)??[],ms:(g==null?void 0:g.ms)??0,timedOut:(g==null?void 0:g.timedOut)??!1}}),I={sectionId:l??"",total:w,correct:p,rate:w>0?Math.round(p/w*100):0,totalScore:f,gainedScore:u,timeMsTotal:R,perQuestion:T};c(I)}});return()=>o()},[n]),m.jsx(yr.Provider,{value:n,children:e})}const jo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function pd({containerRef:e}){const t=yt(),n=hn(),r=h.useRef(null);return h.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const c=new ResizeObserver(()=>{const l=o.clientWidth,a=o.clientHeight;(l!==s||a!==i)&&(s=l,i=a,n.getState().setViewportSize(l,a),t.getState().emit({type:"viewport_resize",payload:{width:l,height:a}}))});return c.observe(o),()=>c.disconnect()},[t,n,e]),h.useEffect(()=>{const o=n.getState();r.current={};for(const i of jo)r.current[i]=o[i];const s=n.subscribe(i=>{const c=r.current;if(c)for(const l of jo){const a=c[l],d=i[l];a!==d&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:d}}):t.getState().emit({type:"settings_change",payload:{key:l,value:d}}),c[l]=d)}});return()=>{s(),r.current=null}},[t,n]),null}function hd(){const e=yt(),t=hn(),n=xt(),r=h.useContext(zo),o=h.useContext(vn),s=h.useCallback(l=>{const{viewerState:a}=l;if(a){a.mode&&t.getState().setMode(a.mode);const{...S}=a;t.setState(S)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(a==null?void 0:a.mode)==="scroll"||!(a!=null&&a.mode)){const S=()=>{const b=n.getState().progress.getSectionScrollApi();if(!b)return!1;if(l.scrollY===0)b.setScrollTop(0);else if(b.scrollToGIAtOffset){const v=l.anchorGI??l.globalIndex;if(typeof v=="number"){const x=l.anchorOffsetRatio??0;b.scrollToGIAtOffset(v,x)}}return!0};if(!S()){let b=0;const v=setInterval(()=>{(S()||++b>=10)&&clearInterval(v)},50)}}},[t,n]),i=h.useCallback(()=>{var x,w,p;const l=t.getState(),a=n.getState().progress,d=(x=a.getSectionScrollApi)==null?void 0:x.call(a),S=a.currentGlobalRunIndex??0,b=((w=d==null?void 0:d.getScrollTop)==null?void 0:w.call(d))??0,v=((p=d==null?void 0:d.getAnchorOffsetRatio)==null?void 0:p.call(d,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,overlayCompactMode:l.overlayCompactMode,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:b,anchorGI:S,anchorOffsetRatio:v,currentPage:a.pageIndex??0,sectionId:a.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),c=h.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:a}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(a,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:S,anchorOffsetRatio:b}=l.payload,v=n.getState().progress.getSectionScrollApi();v&&(d===0?v.setScrollTop(0):v.scrollToGIAtOffset&&typeof S=="number"&&v.scrollToGIAtOffset(S,b));break}case"settings_change":{const{key:a,value:d}=l.payload,S=t.getState();a in S&&typeof S[a]!="function"&&t.setState({[a]:d});break}case"mode_change":{const{mode:a}=l.payload;t.getState().setMode(a);break}case"audio_control":{if(!o)break;const{action:a}=l.payload;switch(a){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:a}=l.payload;n.getState().progress.setPageIndex(a);break}case"range_select":case"range_change":{const{startGI:a,endGI:d}=l.payload;console.log(`[DirectPlayback] ${l.type}: GI ${a}~${d}`),n.getState().progress.setRange(a,d);const S=n.getState().progress;console.log(`[DirectPlayback] after setRange: rangeStartGI=${S.rangeStartGI}, rangeEndGI=${S.rangeEndGI}`);break}case"range_clear":{console.log("[DirectPlayback] range_clear"),n.getState().progress.clearRange();break}case"translate_request":case"translate_loading_start":case"translate_loading_end":case"translate_modal_close":break;case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return h.useLayoutEffect(()=>r?(r.current={dispatch:c,applySnapshot:s,getSnapshot:i,isReady:()=>!n.getState().progress.sectionLoading,waitUntilReady:()=>new Promise(a=>{if(!n.getState().progress.sectionLoading){a();return}const d=n.subscribe(S=>{S.progress.sectionLoading||(d(),a())})})},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,c,s,i,n]),h.useLayoutEffect(()=>e.subscribe((a,d)=>{a.isPlaybackMode&&!d.isPlaybackMode?(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)):!a.isPlaybackMode&&d.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,c,s]),null}const gd=({containerRef:e,onTranslate:t})=>{const n=q(b=>b.rangeStartGI),r=q(b=>b.rangeEndGI),o=q(b=>b.getRangeText),s=q(b=>b.clearRange),i=yt(),c=n!=null&&r!=null,[l,a]=h.useState(null);h.useEffect(()=>{if(!c)return;const b=e.current;if(!b)return;let v=!0;const x=new ResizeObserver(()=>{if(v){v=!1;return}s()});return x.observe(b),()=>x.disconnect()},[c,s,e]),h.useEffect(()=>{if(!c||n==null||r==null){a(null);return}const b=()=>{const x=e.current;if(!x)return;const w=x.getBoundingClientRect(),f=1/(i.getState().playbackScale||1),u=x.querySelector(`[data-g="${r}"]`);if(!u){a({x:w.width*f/2,y:80});return}const R=u.getBoundingClientRect(),T=x.querySelector(`[data-g="${n}"]`),I=T==null?void 0:T.getBoundingClientRect();let M=(R.left+R.width/2-w.left)*f;I&&(M=((I.left+R.right)/2-w.left)*f);const g=160,y=50,k=16,_=12,O=w.width*f,P=Math.max(k+g/2,Math.min(M,O-k-g/2)),C=(((I==null?void 0:I.top)??R.top)-w.top)*f-y-_;let j=C;C<k&&(j=(R.bottom-w.top)*f+_),a({x:P,y:j})};b();const v=e.current;return v&&v.addEventListener("scroll",b,!0),()=>{v&&v.removeEventListener("scroll",b,!0)}},[c,n,r,e,i]);const d=h.useCallback(()=>{const b=o();b&&navigator.clipboard.writeText(b).catch(v=>{console.error("복사 실패:",v)}),s()},[o,s]),S=h.useCallback(()=>{const b=o();b&&t&&t(b)},[o,t]);return!c||!l?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"absolute",left:l.x,top:l.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:d,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:S,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},md="_handleStart_1ihf3_16 _handle_1ihf3_1",bd="_handleEnd_1ihf3_21 _handle_1ihf3_1",Oo={handleStart:md,handleEnd:bd},xd=({containerRef:e})=>{const t=q(f=>f.rangeStartGI),n=q(f=>f.rangeEndGI),r=q(f=>f.setRange),o=yt(),s=t!=null&&n!=null,[i,c]=h.useState(null),[l,a]=h.useState(null),d=h.useRef(null),S=h.useRef(null);h.useEffect(()=>{if(!s||t==null||n==null){c(null),a(null);return}const f=()=>{const R=e.current;if(!R)return;const T=R.getBoundingClientRect(),M=1/(o.getState().playbackScale||1),g=R.querySelector(`[data-g="${t}"]`),y=R.querySelector(`[data-g="${n}"]`);if(g){const k=g.getBoundingClientRect();c({x:(k.left-T.left)*M,y:(k.bottom-T.top)*M})}else c(null);if(y){const k=y.getBoundingClientRect();a({x:(k.right-T.left)*M,y:(k.bottom-T.top)*M})}else a(null)};f();const u=e.current;return u&&u.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{u&&u.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s,t,n,e,o]);const b=h.useCallback((f,u)=>{var T;const R=document.elementsFromPoint(f,u);for(const I of R){const M=(T=I.getAttribute)==null?void 0:T.call(I,"data-g");if(M!=null)return parseInt(M,10)}return null},[]),v=h.useCallback(f=>u=>{u.preventDefault(),u.stopPropagation(),d.current=f,S.current=f==="start"?t:n,u.target.setPointerCapture(u.pointerId)},[t,n]),x=h.useCallback(f=>{if(!d.current||t==null||n==null)return;const u=b(f.clientX,f.clientY);u!=null&&(d.current==="start"?u<=n?r(u,n):(r(n,u),d.current="end"):u>=t?r(t,u):(r(u,t),d.current="start"))},[t,n,r,b]),w=h.useCallback(f=>{d.current=null,S.current=null,f.target.releasePointerCapture(f.pointerId)},[]);return s?m.jsxs(m.Fragment,{children:[i&&m.jsx("div",{className:Oo.handleStart,"data-range-handle":"start",style:{left:i.x-26,top:i.y},onPointerDown:v("start"),onPointerMove:x,onPointerUp:w,onPointerCancel:w}),l&&m.jsx("div",{className:Oo.handleEnd,"data-range-handle":"end",style:{left:l.x,top:l.y},onPointerDown:v("end"),onPointerMove:x,onPointerUp:w,onPointerCancel:w})]}):null};function vd(){const e=q(o=>o.rangeStartGI),t=q(o=>o.rangeEndGI),n=q(o=>o.clearRange),r=e!=null&&t!=null;return h.useEffect(()=>{if(!r)return;const o=s=>{var c;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(c=i.closest("[data-g]"))==null?void 0:c.getAttribute("data-g");if(l){const a=parseInt(l,10),d=Math.min(e,t),S=Math.max(e,t);if(a>=d&&a<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Sd=({isOpen:e,onClose:t,text:n})=>e?m.jsx("div",{style:{position:"absolute",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,yd=(e,t,n)=>Math.min(n,Math.max(t,e));function wd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:c,onViewerEvent:l,viewerRef:a,isPlaybackMode:d=!1,playbackScale:S,isDev:b=!1}){const v=String((e==null?void 0:e.section_id)??"0"),x=h.useMemo(()=>{var T,I;const u=((T=e==null?void 0:e.ast)==null?void 0:T.blocks)??[];let R=0;for(const M of u)(M==null?void 0:M.type)!=="image"&&(R+=((I=M==null?void 0:M.runs)==null?void 0:I.length)??0);return R},[e]),w=h.useMemo(()=>typeof n=="number"?yd(n,x>0?0:-1,Math.max(x-1,-1)):(x>0,0),[n,x]),p=h.useMemo(()=>({section:e,initialIndex:w,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,w,r,o,s,i]),f=h.useMemo(()=>{const u=(e==null?void 0:e.audios)??[],R=u.length>0?Uc(e):void 0;return{clips:u,map:R,initialIndex:w,section:e}},[e,w]);return m.jsx(qs,{onViewerEvent:l,isPlaybackMode:d,playbackScale:S,viewerRef:a,children:m.jsx(Jc,{initialState:{...t,isDev:b},children:m.jsx(Zc,{initialState:p,children:m.jsx(qc,{initialState:f,children:m.jsx(fd,{initialState:{section:e,onQuizComplete:c},children:m.jsx(Cd,{})},v)},v)},v)})})}function Cd(){const e=Y(b=>b.mode),t=h.useRef(null),n=yt(),r=xt(),[o,s]=h.useState(!1),[i,c]=h.useState(),l=h.useCallback(b=>{c(b),s(!0);const{rangeStartGI:v,rangeEndGI:x}=r.getState().progress;n.getState().emit({type:"translate_request",payload:{text:b,startGI:v??0,endGI:x??0}})},[n,r]),a=h.useCallback(()=>{s(!1),c(void 0),n.getState().emit({type:"translate_modal_close",payload:{}})},[n]),d=b=>{b.preventDefault()},S=b=>{b.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:d,onDragStart:S,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(pa,{}):m.jsx(Iu,{}),m.jsx(gd,{containerRef:t,onTranslate:l}),m.jsx(xd,{containerRef:t}),m.jsx(Hc,{}),m.jsx(id,{}),m.jsx(Mu,{}),m.jsx(vd,{}),m.jsx(Sd,{isOpen:o,onClose:a,text:i}),m.jsx(pd,{containerRef:t}),m.jsx(hd,{})]})}exports.CRViewer=wd;
|
|
34
|
+
*/var _r;function Hs(){return _r||(_r=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=h,n=Bo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,l=t.useDebugValue;Cn.useSyncExternalStoreWithSelector=function(a,d,S,b,v){var x=s(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=c(function(){function f(M){if(!u){if(u=!0,R=M,M=b(M),v!==void 0&&w.hasValue){var g=w.value;if(v(g,M))return T=g}return T=M}if(g=T,r(R,M))return g;var y=b(M);return v!==void 0&&v(g,y)?(R=M,g):(R=M,T=y)}var u=!1,R,T,I=S===void 0?null:S;return[function(){return f(d())},I===null?void 0:function(){return f(I())}]},[d,S,b,v]);var p=o(a,x[0],x[1]);return i(function(){w.hasValue=!0,w.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 Mr;function Ns(){return Mr||(Mr=1,process.env.NODE_ENV==="production"?Xt.exports=Gs():Xt.exports=Hs()),Xt.exports}var Fs=Ns();const Ws=Po(Fs),Er=e=>{let t;const n=new Set,r=(a,d)=>{const S=typeof a=="function"?a(t):a;if(!Object.is(S,t)){const b=t;t=d??(typeof S!="object"||S===null)?S:Object.assign({},t,S),n.forEach(v=>v(t,b))}},o=()=>t,c={setState:r,getState:o,getInitialState:()=>l,subscribe:a=>(n.add(a),()=>n.delete(a))},l=t=e(r,o,c);return c},qt=(e=>e?Er(e):Er),{useSyncExternalStoreWithSelector:Ds}=Ws,$s=e=>e;function pn(e,t=$s,n){const r=Ds(e.subscribe,e.getState,e.getInitialState,t,n);return h.useDebugValue(r),r}function Y(e,t){const n=h.useContext(sr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return pn(n,e,t)}function hn(){const e=h.useContext(sr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const St=h.createContext(void 0),zo=h.createContext(void 0);function Vs(){return qt((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 qs({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=h.useMemo(()=>Vs(),[]);return h.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),h.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),h.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),h.useLayoutEffect(()=>()=>{o&&(o.current=null)},[o]),m.jsx(St.Provider,{value:s,children:m.jsx(zo.Provider,{value:o,children:e})})}function yt(){const e=h.useContext(St);if(!e)throw new Error("useViewerEventBridgeStoreApi must be used inside <ViewerEventBridgeProvider>");return e}const ir=h.createContext(void 0);function xt(){const e=h.useContext(ir);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function q(e,t){const n=h.useContext(ir);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return pn(n,o=>e(o.progress),t)}function Us({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=h.useRef(null);h.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=h.useCallback(c=>{if(!(r!=null&&r(c.target))&&c.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(c)},n)}},[n,e,r]),i=h.useCallback(c=>{r!=null&&r(c.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const on={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)),Ks=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},Ao=[{label:"고딕체",value:"'Noto Sans KR', sans-serif"},{label:"명조체",value:"'Noto Serif KR', serif"},{label:"바탕체",value:"'Nanum Myeongjo', serif"}],He={mode:"page",theme:"light",fontFamily:Ao.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 Qs(e){const{init:t,recorderStore:n}=e??{};return qt((r,o)=>({...He,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>{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:He.mode,theme:He.theme,fontFamily:He.fontFamily,fontSizePx:He.fontSizePx,lineHeight:He.lineHeight,marginX:He.marginX,marginY:He.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:He.pointerStyle,pointerColor:He.pointerColor,breakMarks:He.breakMarks,breakGapPx:He.breakGapPx,muteAudio:He.muteAudio,audioSpeed:He.audioSpeed,showPointer:He.showPointer,showSplit:He.showSplit})),maps:{MARGIN_MAP: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:()=>Ks(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 gn=0,pt=1,jt=2,Lo=4;function jr(e){return()=>e}function Ys(e){e()}function Go(e,t){return n=>e(t(n))}function Or(e,t){return()=>e(t)}function Xs(e,t){return n=>e(t,n)}function lr(e){return e!==void 0}function Zs(...e){return()=>{e.map(Ys)}}function Ot(){}function mn(e,t){return t(e),e}function Js(e,t){return t(e)}function ke(...e){return e}function xe(e,t){return e(pt,t)}function fe(e,t){e(gn,t)}function ar(e){e(jt)}function _e(e){return e(Lo)}function J(e,t){return xe(e,Xs(t,gn))}function tt(e,t){const n=e(pt,r=>{n(),t(r)});return n}function Pr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Ho(e,t){return e===t}function Ie(e=Ho){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function ie(e){return t=>n=>{e(n)&&t(n)}}function U(e){return t=>Go(t,e)}function it(e){return t=>()=>{t(e)}}function L(e,...t){const n=ei(...t);return((r,o)=>{switch(r){case jt:ar(e);return;case pt:return xe(e,n(o))}})}function lt(e,t){return n=>r=>{n(t=e(t,r))}}function vt(e){return t=>n=>{e>0?e--:t(n)}}function ct(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function he(...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 c=Math.pow(2,i);xe(s,l=>{const a=n;n=n|c,t[i]=l,a!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const c=()=>{s([i].concat(t))};n===o?c():r=c}}function ei(...e){return t=>e.reduceRight(Js,t)}function ti(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case pt:return s?n===s?void 0:(r(),n=s,t=xe(e,s),t):(r(),Ot);case jt:r(),n=null;return}}}function G(e){let t=e;const n=ge();return((r,o)=>{switch(r){case gn:t=o;break;case pt:{o(t);break}case Lo:return t}return n(r,o)})}function Fe(e,t){return mn(G(t),n=>J(e,n))}function ge(){const e=[];return((t,n)=>{switch(t){case gn:e.slice().forEach(r=>{r(n)});return;case jt:e.splice(0,e.length);return;case pt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function qe(e){return mn(ge(),t=>J(e,t))}function me(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:ni(),singleton:n}}const ni=()=>Symbol();function ri(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const c=r(o.map(l=>n(l)));return i&&t.set(s,c),c};return n(e)}function ze(...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 c=Math.pow(2,i);xe(s,l=>{n[i]=l,r=r|c,r===o&&fe(t,n)})}),function(s,i){switch(s){case jt:{ar(t);return}case pt:return r===o&&i(n),xe(t,i)}}}function se(e,t=Ho){return L(e,Ie(t))}function Zn(...e){return function(t,n){switch(t){case jt:return;case pt:return Zs(...e.map(r=>xe(r,n)))}}}var $e=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))($e||{});const oi={0:"debug",3:"error",1:"log",2:"warn"},si=()=>typeof globalThis>"u"?window:globalThis,ht=me(()=>{const e=G(3);return{log:G((t,n,r=1)=>{var o;const s=(o=si().VIRTUOSO_LOG_LEVEL)!=null?o:_e(e);r>=s&&console[oi[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function wt(e,t,n){return cr(e,t,n).callbackRef}function cr(e,t,n){const r=h.useRef(null);let o=i=>{};const s=h.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const c=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?c():requestAnimationFrame(c)}):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 ii(e,t,n,r,o,s,i,c,l){const a=h.useCallback(d=>{const S=li(d.children,t,c?"offsetWidth":"offsetHeight",o);let b=d.parentElement;for(;!b.dataset.virtuosoScroller;)b=b.parentElement;const v=b.lastElementChild.dataset.viewportType==="window";let x;v&&(x=b.ownerDocument.defaultView);const w=i?c?i.scrollLeft:i.scrollTop:v?c?x.scrollX||x.document.documentElement.scrollLeft:x.scrollY||x.document.documentElement.scrollTop:c?b.scrollLeft:b.scrollTop,p=i?c?i.scrollWidth:i.scrollHeight:v?c?x.document.documentElement.scrollWidth:x.document.documentElement.scrollHeight:c?b.scrollWidth:b.scrollHeight,f=i?c?i.offsetWidth:i.offsetHeight:v?c?x.innerWidth:x.innerHeight:c?b.offsetWidth:b.offsetHeight;r({scrollHeight:p,scrollTop:Math.max(w,0),viewportHeight:f}),s==null||s(c?Br("column-gap",getComputedStyle(d).columnGap,o):Br("row-gap",getComputedStyle(d).rowGap,o)),S!==null&&e(S)},[e,t,o,s,i,r,c]);return cr(a,n,l)}function li(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const c=e.item(i);if(c.dataset.index===void 0)continue;const l=parseInt(c.dataset.index),a=parseFloat(c.dataset.knownSize),d=t(c,n);if(d===0&&r("Zero-sized element, this should not happen",{child:c},$e.ERROR),d===a)continue;const S=s[s.length-1];s.length===0||S.size!==d||S.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function Br(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,$e.WARN),t==="normal"?0:parseInt(t??"0",10)}function No(e,t,n){const r=h.useRef(null),o=h.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const a=l.getBoundingClientRect(),d=a.width;let S,b;if(t){const v=t.getBoundingClientRect(),x=a.top-v.top;b=v.height-Math.max(0,x),S=x+t.scrollTop}else{const v=i.current.ownerDocument.defaultView;b=v.innerHeight-Math.max(0,a.top),S=a.top+v.scrollY}r.current={offsetTop:S,visibleHeight:b,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=cr(o,!0,n),c=h.useCallback(()=>{o(i.current)},[o,i]);return h.useEffect(()=>{var l;if(t){t.addEventListener("scroll",c);const a=new ResizeObserver(()=>{requestAnimationFrame(c)});return a.observe(t),()=>{t.removeEventListener("scroll",c),a.unobserve(t)}}else{const a=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return a==null||a.addEventListener("scroll",c),a==null||a.addEventListener("resize",c),()=>{a==null||a.removeEventListener("scroll",c),a==null||a.removeEventListener("resize",c)}}},[c,t,i]),s}const We=me(()=>{const e=ge(),t=ge(),n=G(0),r=ge(),o=G(0),s=ge(),i=ge(),c=G(0),l=G(0),a=G(0),d=G(0),S=ge(),b=ge(),v=G(!1),x=G(!1),w=G(!1);return J(L(e,U(({scrollTop:p})=>p)),t),J(L(e,U(({scrollHeight:p})=>p)),i),J(t,o),{deviation:n,fixedFooterHeight:a,fixedHeaderHeight:l,footerHeight:d,headerHeight:c,horizontalDirection:x,scrollBy:b,scrollContainerState:e,scrollHeight:i,scrollingInProgress:v,scrollTo:S,scrollTop:t,skipAnimationFrameInResizeObserver:w,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Gt={lvl:0};function Fo(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:c,value:l}=t(e[i]);s.push({end:c-1,start:r,value:o}),r=c,o=l}return s.push({end:1/0,start:r,value:o}),s}function ve(e){return e===Gt}function Ht(e,t){if(!ve(e))return t===e.k?e.v:t<e.k?Ht(e.l,t):Ht(e.r,t)}function nt(e,t,n="k"){if(ve(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 Ve(e,t,n){return ve(e)?$o(t,n,1):t===e.k?Le(e,{k:t,v:n}):t<e.k?zr(Le(e,{l:Ve(e.l,t,n)})):zr(Le(e,{r:Ve(e.r,t,n)}))}function _t(){return Gt}function Mt(e,t,n){if(ve(e))return[];const r=nt(e,t)[0];return ai(er(e,r,n))}function Jn(e,t){if(ve(e))return Gt;const{k:n,l:r,r:o}=e;if(t===n){if(ve(r))return o;if(ve(o))return r;{const[s,i]=Do(r);return nn(Le(e,{k:s,l:Wo(r),v:i}))}}else return t<n?nn(Le(e,{l:Jn(r,t)})):nn(Le(e,{r:Jn(o,t)}))}function bt(e){return ve(e)?[]:[...bt(e.l),{k:e.k,v:e.v},...bt(e.r)]}function er(e,t,n){if(ve(e))return[];const{k:r,l:o,r:s,v:i}=e;let c=[];return r>t&&(c=c.concat(er(o,t,n))),r>=t&&r<=n&&c.push({k:r,v:i}),r<=n&&(c=c.concat(er(s,t,n))),c}function nn(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(Le(e,{lvl:n-1}));if(!ve(t)&&!ve(t.r))return Le(t.r,{l:Le(t,{r:t.r.l}),lvl:n,r:Le(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(_n(e))return tr(Le(e,{lvl:n-1}));if(!ve(r)&&!ve(r.l)){const o=r.l,s=_n(o)?r.lvl-1:r.lvl;return Le(o,{l:Le(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:tr(Le(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Le(e,t){return $o(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 Wo(e){return ve(e.r)?e.l:nn(Le(e,{r:Wo(e.r)}))}function _n(e){return ve(e)||e.lvl>e.r.lvl}function Do(e){return ve(e.r)?[e.k,e.v]:Do(e.r)}function $o(e,t,n,r=Gt,o=Gt){return{k:e,l:r,lvl:n,r:o,v:t}}function zr(e){return tr(Vo(e))}function Vo(e){const{l:t}=e;return!ve(t)&&t.lvl===e.lvl?Le(t,{r:Le(e,{l:t.r})}):e}function tr(e){const{lvl:t,r:n}=e;return!ve(n)&&!ve(n.r)&&n.lvl===t&&n.r.lvl===t?Le(n,{l:Le(e,{r:n.l}),lvl:t+1}):e}function ai(e){return Fo(e,({k:t,v:n})=>({index:t,value:n}))}function qo(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function Nt(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const ur=me(()=>({recalcInProgress:G(!1)}),[],{singleton:!0});function Uo(e,t,n){return e[sn(e,t,n)]}function sn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],c=n(i,t);if(c===0)return s;if(c===-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 ci(e,t,n,r){const o=sn(e,t,r),s=sn(e,n,r,o);return e.slice(o,s+1)}function ft(e,t){return Math.round(e.getBoundingClientRect()[t])}function bn(e){return!ve(e.groupOffsetTree)}function dr({index:e},t){return t===e?0:t<e?-1:1}function ui(){return{groupIndices:[],groupOffsetTree:_t(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:_t()}}function di(e,t){let n=ve(e)?0:1/0;for(const r of t){const{endIndex:o,size:s,startIndex:i}=r;if(n=Math.min(n,i),ve(e)){e=Ve(e,0,s);continue}const c=Mt(e,i-1,o+1);if(c.some(xi(r)))continue;let l=!1,a=!1;for(const{end:d,start:S,value:b}of c)l?(o>=S||s===b)&&(e=Jn(e,S)):(a=b!==s,l=!0),d>o&&o>=S&&b!==s&&(e=Ve(e,o+1,b));a&&(e=Ve(e,i,s))}return[e,n]}function fi(e){return typeof e.groupIndex<"u"}function pi({offset:e},t){return t===e?0:t<e?-1:1}function Ft(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=Uo(t,e,dr),i=e-r,c=s*i+(i-1)*n+o;return c>0?c+n:c}function Ko(e,t){if(!bn(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Qo(e,t,n){if(fi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Ko(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function hi(e,t,n,r=0){return r>0&&(t=Math.max(t,Uo(e,r,dr).offset)),Fo(ci(e,t,n,pi),bi)}function gi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,$e.DEBUG);const s=e.sizeTree;let i=s,c=0;if(n.length>0&&ve(s)&&t.length===2){const b=t[0].size,v=t[1].size;i=n.reduce((x,w)=>Ve(Ve(x,w,b),w+1,v),i)}else[i,c]=di(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S}=nr(e.offsetTree,c,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((b,v)=>Ve(b,v,Ft(v,S,o)),_t()),lastIndex:l,lastOffset:a,lastSize:d,offsetTree:S,sizeTree:i}}function mi(e){return bt(e).map(({k:t,v:n},r,o)=>{const s=o[r+1];return{endIndex:s?s.k-1:1/0,size:n,startIndex:t}})}function Ar(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function nr(e,t,n,r){let o=e,s=0,i=0,c=0,l=0;if(t!==0){l=sn(o,t-1,dr),c=o[l].offset;const a=nt(n,t-1);s=a[0],i=a[1],o.length&&o[l].size===nt(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:a,value:d}of Mt(n,t,1/0)){const S=a-s,b=S*i+c+S*r;o.push({index:a,offset:b,size:d}),s=a,c=b,i=d}return{lastIndex:s,lastOffset:c,lastSize:i,offsetTree:o}}function bi(e){return{index:e.index,value:e}}function xi(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 vi={offsetHeight:"height",offsetWidth:"width"},at=me(([{log:e},{recalcInProgress:t}])=>{const n=ge(),r=ge(),o=Fe(r,0),s=ge(),i=ge(),c=G(0),l=G([]),a=G(void 0),d=G(void 0),S=G(void 0),b=G(void 0),v=G((g,y)=>ft(g,vi[y])),x=G(void 0),w=G(0),p=ui(),f=Fe(L(n,he(l,e,w),lt(gi,p),Ie()),p),u=Fe(L(l,Ie(),lt((g,y)=>({current:y,prev:g.current}),{current:[],prev:[]}),U(({prev:g})=>g)),[]);J(L(l,ie(g=>g.length>0),he(f,w),U(([g,y,k])=>{const _=g.reduce((O,P,C)=>Ve(O,P,Ft(P,y.offsetTree,k)||C),_t());return{...y,groupIndices:g,groupOffsetTree:_}})),f),J(L(r,he(f),ie(([g,{lastIndex:y}])=>g<y),U(([g,{lastIndex:y,lastSize:k}])=>[{endIndex:y,size:k,startIndex:g}])),n),J(a,d);const R=Fe(L(a,U(g=>g===void 0)),!0);J(L(d,ie(g=>g!==void 0&&ve(_e(f).sizeTree)),U(g=>{const y=_e(S),k=_e(l).length>0;return y?k?[{endIndex:0,size:y,startIndex:0},{endIndex:1,size:g,startIndex:1}]:[]:[{endIndex:0,size:g,startIndex:0}]})),n),J(L(b,ie(g=>g!==void 0&&g.length>0&&ve(_e(f).sizeTree)),U(g=>{const y=[];let k=g[0],_=0;for(let O=1;O<g.length;O++){const P=g[O];P!==k&&(y.push({endIndex:O-1,size:k,startIndex:_}),k=P,_=O)}return y.push({endIndex:g.length-1,size:k,startIndex:_}),y})),n),J(L(l,he(S,d),ie(([,g,y])=>g!==void 0&&y!==void 0),U(([g,y,k])=>{const _=[];for(let O=0;O<g.length;O++){const P=g[O],C=g[O+1];_.push({startIndex:P,endIndex:P,size:y}),C!==void 0&&_.push({startIndex:P+1,endIndex:C-1,size:k})}return _})),n);const T=qe(L(n,he(f),lt(({sizes:g},[y,k])=>({changed:k!==g,sizes:k}),{changed:!1,sizes:p}),U(g=>g.changed)));xe(L(c,lt((g,y)=>({diff:g.prev-y,prev:y}),{diff:0,prev:0}),U(g=>g.diff)),g=>{const{groupIndices:y}=_e(f);if(g>0)fe(t,!0),fe(s,g+Ar(g,y));else if(g<0){const k=_e(u);k.length>0&&(g-=Ar(-g,k)),fe(i,g)}}),xe(L(c,he(e)),([g,y])=>{g<0&&y("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:c},$e.ERROR)});const I=qe(s);J(L(s,he(f),U(([g,y])=>{const k=y.groupIndices.length>0,_=[],O=y.lastSize;if(k){const P=Ht(y.sizeTree,0);let C=0,j=0;for(;C<g;){const F=y.groupIndices[j],E=y.groupIndices.length===j+1?1/0:y.groupIndices[j+1]-F-1;_.push({endIndex:F,size:P,startIndex:F}),_.push({endIndex:F+1+E-1,size:O,startIndex:F+1}),j++,C+=E+1}const A=bt(y.sizeTree);return C!==g&&A.shift(),A.reduce((F,{k:E,v:B})=>{let N=F.ranges;return F.prevSize!==0&&(N=[...F.ranges,{endIndex:E+g-1,size:F.prevSize,startIndex:F.prevIndex}]),{prevIndex:E+g,prevSize:B,ranges:N}},{prevIndex:g,prevSize:0,ranges:_}).ranges}return bt(y.sizeTree).reduce((P,{k:C,v:j})=>({prevIndex:C+g,prevSize:j,ranges:[...P.ranges,{endIndex:C+g-1,size:P.prevSize,startIndex:P.prevIndex}]}),{prevIndex:0,prevSize:O,ranges:[]}).ranges})),n);const M=qe(L(i,he(f,w),U(([g,{offsetTree:y},k])=>{const _=-g;return Ft(_,y,k)})));return J(L(i,he(f,w),U(([g,y,k])=>{if(y.groupIndices.length>0){if(ve(y.sizeTree))return y;let _=_t();const O=_e(u);let P=0,C=0,j=0;for(;P<-g;){j=O[C];const A=O[C+1]-j-1;C++,P+=A+1}if(_=bt(y.sizeTree).reduce((A,{k:F,v:E})=>Ve(A,Math.max(0,F+g),E),_),P!==-g){const A=Ht(y.sizeTree,j);_=Ve(_,0,A);const F=nt(y.sizeTree,-g+1)[1];_=Ve(_,1,F)}return{...y,sizeTree:_,...nr(y.offsetTree,0,_,k)}}else{const _=bt(y.sizeTree).reduce((O,{k:P,v:C})=>Ve(O,Math.max(0,P+g),C),_t());return{...y,sizeTree:_,...nr(y.offsetTree,0,_,k)}}})),f),{beforeUnshiftWith:I,data:x,defaultItemSize:d,firstItemIndex:c,fixedItemSize:a,fixedGroupSize:S,gap:w,groupIndices:l,heightEstimates:b,itemSize:v,listRefresh:T,shiftWith:i,shiftWithOffset:M,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:R,unshiftWith:s}},ke(ht,ur),{singleton:!0});function Si(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Yo=me(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=ge(),i=ge(),c=qe(L(s,U(Si)));return J(L(c,U(l=>l.totalCount)),n),J(L(c,U(l=>l.groupIndices)),e),J(L(ze(o,t,r),ie(([l,a])=>bn(a)),U(([l,a,d])=>nt(a.groupOffsetTree,Math.max(l-d,0),"v")[0]),Ie(),U(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},ke(at,We)),gt=me(([{log:e}])=>{const t=G(!1),n=qe(L(t,ie(r=>r),Ie()));return xe(t,r=>{r&&_e(e)("props updated",{},$e.DEBUG)}),{didMount:n,propsReady:t}},ke(ht),{singleton:!0}),yi=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Xo(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!yi)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Ut=me(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:c,scrollingInProgress:l,scrollTo:a,smoothScrollTargetReached:d,viewportHeight:S},{log:b}])=>{const v=ge(),x=ge(),w=G(0);let p=null,f=null,u=null;function R(){p&&(p(),p=null),u&&(u(),u=null),f&&(clearTimeout(f),f=null),fe(l,!1)}return J(L(v,he(n,S,r,w,c,i,b),he(e,s,o),U(([[T,I,M,g,y,k,_,O],P,C,j])=>{const A=Xo(T),{align:F,behavior:E,offset:B}=A,N=g-1,$=Qo(A,I,N);let V=Ft($,I.offsetTree,P)+k;F==="end"?(V+=C+nt(I.sizeTree,$)[1]-M+j,$===N&&(V+=_)):F==="center"?V+=(C+nt(I.sizeTree,$)[1]-M+j)/2:V-=y,B&&(V+=B);const le=ae=>{R(),ae?(O("retrying to scroll to",{location:T},$e.DEBUG),fe(v,T)):(fe(x,!0),O("list did not change, scroll successful",{},$e.DEBUG))};if(R(),E==="smooth"){let ae=!1;u=xe(t,ye=>{ae=ae||ye}),p=tt(d,()=>{le(ae)})}else p=tt(L(t,wi(150)),le);return f=setTimeout(()=>{R()},1200),fe(l,!0),O("scrolling from index to",{behavior:E,index:$,top:V},$e.DEBUG),{behavior:E,top:V}})),a),{scrollTargetReached:x,scrollToIndex:v,topListHeight:w}},ke(at,We,ht),{singleton:!0});function wi(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function fr(e,t){e==0?t():requestAnimationFrame(()=>{fr(e-1,t)})}function pr(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Kt=me(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const c=G(!0),l=G(0),a=G(!0);return J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),c),J(L(i,he(l),ie(([d,S])=>!!S),it(!1)),a),xe(L(ze(t,i),he(c,n,e,a),ie(([[,d],S,{sizeTree:b},v,x])=>d&&(!ve(b)||lr(v))&&!S&&!x),he(l)),([,d])=>{tt(o,()=>{fe(a,!0)}),fr(4,()=>{tt(r,()=>{fe(c,!0)}),fe(s,d)})}),{initialItemFinalLocationReached:a,initialTopMostItemIndex:l,scrolledToInitialItem:c}},ke(at,We,Ut,gt),{singleton:!0});function Zo(e,t){return Math.abs(e-t)<1.01}const Wt="up",At="down",Ci="none",Ii={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},ki=0,Qt=me(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=G(!1),c=G(!0),l=ge(),a=ge(),d=G(4),S=G(ki),b=Fe(L(Zn(L(se(o),vt(1),it(!0)),L(se(o),vt(1),it(!1),Pr(100))),Ie()),!1),v=Fe(L(Zn(L(n,it(!0)),L(n,it(!1),Pr(200))),Ie()),!1);J(L(ze(se(o),se(S)),U(([u,R])=>u<=R),Ie()),c),J(L(c,ct(50)),a);const x=qe(L(ze(r,se(s),se(t),se(e),se(d)),lt((u,[{scrollHeight:R,scrollTop:T},I,M,g,y])=>{const k=T+I-R>-y,_={scrollHeight:R,scrollTop:T,viewportHeight:I};if(k){let P,C;return T>u.state.scrollTop?(P="SCROLLED_DOWN",C=u.state.scrollTop-T):(P="SIZE_DECREASED",C=u.state.scrollTop-T||u.scrollTopDelta),{atBottom:!0,atBottomBecause:P,scrollTopDelta:C,state:_}}let O;return _.scrollHeight>u.state.scrollHeight?O="SIZE_INCREASED":I<u.state.viewportHeight?O="VIEWPORT_HEIGHT_DECREASING":T<u.state.scrollTop?O="SCROLLING_UPWARDS":O="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:O,state:_}},Ii),Ie((u,R)=>u&&u.atBottom===R.atBottom))),w=Fe(L(r,lt((u,{scrollHeight:R,scrollTop:T,viewportHeight:I})=>{if(Zo(u.scrollHeight,R))return{changed:!1,jump:0,scrollHeight:R,scrollTop:T};{const M=R-(T+I)<1;return u.scrollTop!==T&&M?{changed:!0,jump:u.scrollTop-T,scrollHeight:R,scrollTop:T}:{changed:!0,jump:0,scrollHeight:R,scrollTop:T}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),ie(u=>u.changed),U(u=>u.jump)),0);J(L(x,U(u=>u.atBottom)),i),J(L(i,ct(50)),l);const p=G(At);J(L(r,U(({scrollTop:u})=>u),Ie(),lt((u,R)=>_e(v)?{direction:u.direction,prevScrollTop:R}:{direction:R<u.prevScrollTop?Wt:At,prevScrollTop:R},{direction:At,prevScrollTop:0}),U(u=>u.direction)),p),J(L(r,ct(50),it(Ci)),p);const f=G(0);return J(L(b,ie(u=>!u),it(0)),f),J(L(o,ct(100),he(b),ie(([u,R])=>R),lt(([u,R],[T])=>[R,T],[0,0]),U(([u,R])=>R-u)),f),{atBottomState:x,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:a,atTopThreshold:S,isAtBottom:i,isAtTop:c,isScrolling:b,lastJumpDueToItemResize:w,scrollDirection:p,scrollVelocity:f}},ke(We)),Dt="top",$t="bottom",Lr="none";function Gr(e,t,n){return typeof e=="number"?n===Wt&&t===Dt||n===At&&t===$t?e:0:n===Wt?t===Dt?e.main:e.reverse:t===$t?e.main:e.reverse}function Hr(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const hr=me(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=ge(),i=G(0),c=G(0),l=G(0),a=Fe(L(ze(se(r),se(o),se(n),se(s,Nt),se(l),se(i),se(t),se(e),se(c)),U(([d,S,b,[v,x],w,p,f,u,R])=>{const T=d-u,I=p+f,M=Math.max(b-T,0);let g=Lr;const y=Hr(R,Dt),k=Hr(R,$t);return v-=u,v+=b+f,x+=b+f,x-=u,v>d+I-y&&(g=Wt),x<d-M+S+k&&(g=At),g!==Lr?[Math.max(T-b-Gr(w,Dt,g)-y,0),T-M-f+S+Gr(w,$t,g)+k]:null}),ie(d=>d!=null),Ie(Nt)),[0,0]);return{increaseViewportBy:c,listBoundary:s,overscan:l,topListHeight:i,visibleRange:a}},ke(We),{singleton:!0});function Ri(e,t,n){if(bn(t)){const r=Ko(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 rn(e,t,n,r,o,s){const{lastIndex:i,lastOffset:c,lastSize:l}=o;let a=0,d=0;if(e.length>0){a=e[0].offset;const w=e[e.length-1];d=w.offset+w.size}const S=n-i,b=c+S*l+(S-1)*r,v=a,x=b-d;return{bottom:d,firstItemIndex:s,items:Nr(e,o,s),offsetBottom:x,offsetTop:a,top:v,topItems:Nr(t,o,s),topListHeight:t.reduce((w,p)=>p.size+w,0),totalCount:n}}function Jo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const c=e+i,l=pr(t,c),a=Array.from({length:c}).map((d,S)=>({data:s[S+l],index:S+l,offset:0,size:0}));return rn(a,[],c,o,n,r)}function Nr(e,t,n){if(e.length===0)return[];if(!bn(t))return e.map(a=>({...a,index:a.index+n,originalIndex:a.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=Mt(t.groupOffsetTree,r,o);let c,l=0;for(const a of e){(!c||c.end<a.index)&&(c=i.shift(),l=t.groupIndices.indexOf(c.start));let d;a.index===c.start?d={index:l,type:"group"}:d={groupIndex:l,index:a.index-(l+1)+n},s.push({...d,data:a.data,offset:a.offset,originalIndex:a.index,size:a.size})}return s}function Fr(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const Ct=me(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:c,visibleRange:l},{initialTopMostItemIndex:a,scrolledToInitialItem:d},{topListHeight:S},b,{didMount:v},{recalcInProgress:x}])=>{const w=G([]),p=G(0),f=ge(),u=G(0);J(s.topItemsIndexes,w);const R=Fe(L(ze(v,x,se(l,Nt),se(o),se(r),se(a),d,se(w),se(t),se(n),se(u),e),ie(([g,y,,k,,,,,,,,_])=>{const O=_&&_.length!==k;return g&&!y&&!O}),U(([,,[g,y],k,_,O,P,C,j,A,F,E])=>{var B,N,$,V;const le=_,{offsetTree:ae,sizeTree:ye}=le,we=_e(p);if(k===0)return{...Mn,totalCount:k};if(g===0&&y===0)return we===0?{...Mn,totalCount:k}:Jo(we,O,_,j,A,E||[]);if(ve(ye))return we>0?null:rn(Ri(pr(O,k),le,E),[],k,A,le,j);const Z=[];if(C.length>0){const D=C[0],X=C[C.length-1];let re=0;for(const te of Mt(ye,D,X)){const ue=te.value,oe=Math.max(te.start,D),be=Math.min(te.end,X);for(let pe=oe;pe<=be;pe++)Z.push({data:E==null?void 0:E[pe],index:pe,offset:re,size:ue}),re+=ue}}if(!P)return rn([],Z,k,A,le,j);const Q=C.length>0?C[C.length-1]+1:0,z=hi(ae,g,y,Q);if(z.length===0)return null;const K=k-1,ee=mn([],D=>{for(const X of z){const re=X.value;let te=re.offset,ue=X.start;const oe=re.size;if(re.offset<g){ue+=Math.floor((g-re.offset+A)/(oe+A));const pe=ue-X.start;te+=pe*oe+pe*A}ue<Q&&(te+=(Q-ue)*oe,ue=Q);const be=Math.min(X.end,K);for(let pe=ue;pe<=be&&!(te>=y);pe++)D.push({data:E==null?void 0:E[pe],index:pe,offset:te,size:oe}),te+=oe+A}}),H=Fr(F,Dt),ne=Fr(F,$t);if(ee.length>0&&(H>0||ne>0)){const D=ee[0],X=ee[ee.length-1];if(H>0&&D.index>Q){const re=Math.min(H,D.index-Q),te=[];let ue=D.offset;for(let oe=D.index-1;oe>=D.index-re;oe--){const be=(N=(B=Mt(ye,oe,oe)[0])==null?void 0:B.value)!=null?N:D.size;ue-=be+A,te.unshift({data:E==null?void 0:E[oe],index:oe,offset:ue,size:be})}ee.unshift(...te)}if(ne>0&&X.index<K){const re=Math.min(ne,K-X.index);let te=X.offset+X.size+A;for(let ue=X.index+1;ue<=X.index+re;ue++){const oe=(V=($=Mt(ye,ue,ue)[0])==null?void 0:$.value)!=null?V:X.size;ee.push({data:E==null?void 0:E[ue],index:ue,offset:te,size:oe}),te+=oe+A}}}return rn(ee,Z,k,A,le,j)}),ie(g=>g!==null),Ie()),Mn);J(L(e,ie(lr),U(g=>g==null?void 0:g.length)),o),J(L(R,U(g=>g.topListHeight)),S),J(S,c),J(L(R,U(g=>[g.top,g.bottom])),i),J(L(R,U(g=>g.items)),f);const T=qe(L(R,ie(({items:g})=>g.length>0),he(o,e),ie(([{items:g},y])=>g[g.length-1].originalIndex===y-1),U(([,g,y])=>[g-1,y]),Ie(Nt),U(([g])=>g))),I=qe(L(R,ct(200),ie(({items:g,topItems:y})=>g.length>0&&g[0].originalIndex===y.length),U(({items:g})=>g[0].index),Ie())),M=qe(L(R,ie(({items:g})=>g.length>0),U(({items:g})=>{let y=0,k=g.length-1;for(;g[y].type==="group"&&y<k;)y++;for(;g[k].type==="group"&&k>y;)k--;return{endIndex:g[k].index,startIndex:g[y].index}}),Ie(qo)));return{endReached:T,initialItemCount:p,itemsRendered:f,listState:R,minOverscanItemCount:u,rangeChanged:M,startReached:I,topItemsIndexes:w,...b}},ke(at,Yo,hr,Kt,Ut,Qt,gt,ur),{singleton:!0}),es=me(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=ge(),i=Fe(L(ze(n,e,r,t,o),U(([c,l,a,d,S])=>c+l+a+d+S.offsetBottom+S.bottom)),0);return J(se(i),s),{totalListHeight:i,totalListHeightChanged:s}},ke(We,Ct),{singleton:!0}),Ti=me(([{viewportHeight:e},{totalListHeight:t}])=>{const n=G(!1),r=Fe(L(ze(n,e,t),ie(([o])=>o),U(([,o,s])=>Math.max(0,o-s)),ct(0),Ie()),0);return{alignToBottom:n,paddingTopAddition:r}},ke(We,es),{singleton:!0}),ts=me(()=>({context:G(null)})),_i=({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,ns=me(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:c,viewportHeight:l},{scrollToIndex:a}])=>{const d=ge();return J(L(d,he(t,l,n,s,o,r,c),he(e),U(([[S,b,v,x,w,p,f,u],R])=>{const{align:T,behavior:I,calculateViewLocation:M=_i,done:g,...y}=S,k=Qo(S,b,x-1),_=Ft(k,b.offsetTree,R)+w+p,O=_+nt(b.sizeTree,k)[1],P=u+p,C=u+v-f,j=M({itemBottom:O,itemTop:_,locationParams:{align:T,behavior:I,...y},viewportBottom:C,viewportTop:P});return j?g&&tt(L(i,ie(A=>!A),vt(_e(i)?1:2)),g):g==null||g(),j}),ie(S=>S!==null)),a),{scrollIntoView:d}},ke(at,We,Ut,Ct,ht),{singleton:!0});function Wr(e){return e?e==="smooth"?"smooth":"auto":!1}const Mi=(e,t)=>typeof e=="function"?Wr(e(t)):t&&Wr(e),Ei=me(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:c},{didMount:l,propsReady:a},{log:d},{scrollingInProgress:S},{context:b},{scrollIntoView:v}])=>{const x=G(!1),w=ge();let p=null;function f(I){fe(i,{align:"end",behavior:I,index:"LAST"})}xe(L(ze(L(se(t),vt(1)),l),he(se(x),s,c,S),U(([[I,M],g,y,k,_])=>{let O=M&&k,P="auto";return O&&(P=Mi(g,y||_),O=O&&!!P),{followOutputBehavior:P,shouldFollow:O,totalCount:I}}),ie(({shouldFollow:I})=>I)),({followOutputBehavior:I,totalCount:M})=>{p&&(p(),p=null),_e(n)?requestAnimationFrame(()=>{_e(d)("following output to ",{totalCount:M},$e.DEBUG),f(I)}):p=tt(e,()=>{_e(d)("following output to ",{totalCount:M},$e.DEBUG),f(I),p=null})});function u(I){const M=tt(o,g=>{I&&!g.atBottom&&g.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(_e(d)("scrolling to bottom due to increased size",{},$e.DEBUG),f("auto"))});setTimeout(M,100)}xe(L(ze(se(x),t,a),ie(([I,,M])=>I&&M),lt(({value:I},[,M])=>({refreshed:I===M,value:M}),{refreshed:!1,value:0}),ie(({refreshed:I})=>I),he(x,t)),([,I])=>{_e(c)&&u(I!==!1)}),xe(w,()=>{u(_e(x)!==!1)}),xe(ze(se(x),o),([I,M])=>{I&&!M.atBottom&&M.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const R=G(null),T=ge();return J(Zn(L(se(r),U(I=>{var M;return(M=I==null?void 0:I.length)!=null?M:0})),L(se(t))),T),xe(L(ze(L(T,vt(1)),l),he(se(R),c,S,b),U(([[I,M],g,y,k,_])=>M&&y&&(g==null?void 0:g({context:_,totalCount:I,scrollingInProgress:k}))),ie(I=>!!I),ct(0)),I=>{p&&(p(),p=null),_e(n)?requestAnimationFrame(()=>{_e(d)("scrolling into view",{}),fe(v,I)}):p=tt(e,()=>{_e(d)("scrolling into view",{}),fe(v,I),p=null})}),{autoscrollToBottom:w,followOutput:x,scrollIntoViewOnChange:R}},ke(at,Qt,Ut,Kt,gt,ht,We,ts,ns)),ji=me(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:c}])=>(J(L(c,he(s),ie(([,l])=>l!==0),he(o,r,t,n,e),U(([[,l],a,d,S,b,v=[]])=>Jo(l,a,d,S,b,v))),i),{}),ke(at,Kt,Ct,gt),{singleton:!0}),Oi=me(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=G(0);return xe(L(e,he(r),ie(([,o])=>o!==0),U(([,o])=>({top:o}))),o=>{tt(L(n,vt(1),ie(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{fe(t,o)})})}),{initialScrollTop:r}},ke(gt,We,Ct),{singleton:!0}),rs=me(([{scrollVelocity:e}])=>{const t=G(!1),n=ge(),r=G(!1);return J(L(e,he(r,t,n),ie(([o,s])=>!!s),U(([o,s,i,c])=>{const{enter:l,exit:a}=s;if(i){if(a(o,c))return!1}else if(l(o,c))return!0;return i}),Ie()),t),xe(L(ze(t,e,n),he(r)),([[o,s,i],c])=>{o&&c&&c.change&&c.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},ke(Qt),{singleton:!0}),gr=me(([{scrollContainerState:e,scrollTo:t}])=>{const n=ge(),r=ge(),o=ge(),s=G(!1),i=G(void 0);return J(L(ze(n,r),U(([{scrollHeight:c,scrollTop:l,viewportHeight:a},{offsetTop:d}])=>({scrollHeight:c,scrollTop:Math.max(0,l-d),viewportHeight:a}))),e),J(L(t,he(r),U(([c,{offsetTop:l}])=>({...c,top:c.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},ke(We)),Pi=me(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:c,windowViewportRect:l}])=>{const a=ge(),d=G(void 0),S=G(null),b=G(null);return J(c,S),J(l,b),xe(L(a,he(t,r,i,S,b,n)),([v,x,w,p,f,u,R])=>{const T=mi(x.sizeTree);p&&f!==null&&u!==null&&(w=f.scrollTop-u.offsetTop),w-=R,v({ranges:T,scrollTop:w})}),J(L(d,ie(lr),U(Bi)),o),J(L(s,he(d),ie(([,v])=>v!==void 0),Ie(),U(([,v])=>v.ranges)),e),{getState:a,restoreStateFrom:d}},ke(at,We,Kt,gt,gr));function Bi(e){return{align:"start",index:0,offset:e.scrollTop}}const zi=me(([{topItemsIndexes:e}])=>{const t=G(0);return J(L(t,ie(n=>n>=0),U(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},ke(Ct));function os(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Ai=os(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Li=me(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:c},{listState:l},{beforeUnshiftWith:a,gap:d,shiftWithOffset:S,sizes:b},{log:v},{recalcInProgress:x}])=>{const w=qe(L(l,he(i),lt(([,f,u,R],[{bottom:T,items:I,offsetBottom:M,totalCount:g},y])=>{const k=T+M;let _=0;return u===g&&f.length>0&&I.length>0&&(I[0].originalIndex===0&&f[0].originalIndex===0||(_=k-R,_!==0&&(_+=y))),[_,I,g,k]},[0,[],0,0]),ie(([f])=>f!==0),he(r,c,n,o,v,x),ie(([,f,u,R,,,T])=>!T&&!R&&f!==0&&u===Wt),U(([[f],,,,,u])=>(u("Upward scrolling compensation",{amount:f},$e.DEBUG),f))));function p(f){f>0?(fe(t,{behavior:"auto",top:-f}),fe(e,0)):(fe(e,0),fe(t,{behavior:"auto",top:-f}))}return xe(L(w,he(e,s)),([f,u,R])=>{R&&Ai()?fe(e,u-f):p(-f)}),xe(L(ze(Fe(s,!1),e,x),ie(([f,u,R])=>!f&&!R&&u!==0),U(([f,u])=>u),ct(1)),p),J(L(S,U(f=>({top:-f}))),t),xe(L(a,he(b,d),U(([f,{groupIndices:u,lastSize:R,sizeTree:T},I])=>{function M(g){return g*(R+I)}if(u.length===0)return M(f);{let g=0;const y=Ht(T,0);let k=0,_=0;for(;k<f;){k++,g+=y;let O=u.length===_+1?1/0:u[_+1]-u[_]-1;k+O>f&&(g-=y,O=f-k+1),k+=O,g+=M(O),_++}return g}})),f=>{fe(e,f),requestAnimationFrame(()=>{fe(t,{top:f}),requestAnimationFrame(()=>{fe(e,0),fe(x,!1)})})}),{deviation:e}},ke(We,Qt,Ct,at,ht,ur)),Gi=me(([e,t,n,r,o,s,i,c,l,a,d])=>({...e,...t,...n,...r,...o,...s,...i,...c,...l,...a,...d}),ke(hr,ji,gt,rs,es,Oi,Ti,gr,ns,ht,ts)),ss=me(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:c,itemSize:l,sizeRanges:a,sizes:d,statefulTotalCount:S,totalCount:b,trackItemSizes:v},{initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:p},f,u,R,T,{scrollToIndex:I},M,{topItemCount:g},{groupCounts:y},k])=>{const{listState:_,minOverscanItemCount:O,topItemsIndexes:P,rangeChanged:C,...j}=T;return J(C,k.scrollSeekRangeChanged),J(L(k.windowViewportRect,U(A=>A.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:y,heightEstimates:c,initialItemFinalLocationReached:x,initialTopMostItemIndex:w,scrolledToInitialItem:p,sizeRanges:a,topItemCount:g,topItemsIndexes:P,totalCount:b,...R,groupIndices:i,itemSize:l,listState:_,minOverscanItemCount:O,scrollToIndex:I,statefulTotalCount:S,trackItemSizes:v,rangeChanged:C,...j,...k,...f,sizes:d,...u}},ke(at,Kt,We,Pi,Ei,Ct,Ut,Li,zi,Yo,Gi));function Hi(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 Jt=typeof document<"u"?h.useLayoutEffect:h.useEffect;function is(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),c=h.createContext({});function l(p,f){p.propsReady&&fe(p.propsReady,!1);for(const u of r){const R=p[t.required[u]];fe(R,f[u])}for(const u of o)if(u in f){const R=p[t.optional[u]];fe(R,f[u])}p.propsReady&&fe(p.propsReady,!0)}function a(p){return s.reduce((f,u)=>(f[u]=R=>{const T=p[t.methods[u]];fe(T,R)},f),{})}function d(p){return i.reduce((f,u)=>(f[u]=ti(p[t.events[u]]),f),{})}const S=h.forwardRef((p,f)=>{const{children:u,...R}=p,[T]=h.useState(()=>mn(ri(e),g=>{l(g,R)})),[I]=h.useState(Or(d,T));Jt(()=>{for(const g of i)g in R&&xe(I[g],R[g]);return()=>{Object.values(I).map(ar)}},[R,I,T]),Jt(()=>{l(T,R)}),h.useImperativeHandle(f,jr(a(T)));const M=n;return m.jsx(c.Provider,{value:T,children:n?m.jsx(M,{...Hi([...r,...o,...i],R),children:u}):u})}),b=p=>{const f=h.useContext(c);return h.useCallback(u=>{fe(f[p],u)},[f,p])},v=p=>{const f=h.useContext(c)[p],u=h.useCallback(R=>xe(f,R),[f]);return h.useSyncExternalStore(u,()=>_e(f),()=>_e(f))},x=p=>{const f=h.useContext(c)[p],[u,R]=h.useState(Or(_e,f));return Jt(()=>xe(f,T=>{T!==u&&R(jr(T))}),[f,u]),u},w=h.version.startsWith("18")?v:x;return{Component:S,useEmitter:(p,f)=>{const u=h.useContext(c)[p];Jt(()=>xe(u,f),[f,u])},useEmitterValue:w,usePublisher:b}}const ls=h.createContext(void 0),as=h.createContext(void 0),cs=typeof document<"u"?h.useLayoutEffect:h.useEffect;function En(e){return"self"in e}function Ni(e){return"body"in e}function us(e,t,n,r=Ot,o,s){const i=h.useRef(null),c=h.useRef(null),l=h.useRef(null),a=h.useCallback(b=>{let v,x,w;const p=b.target;if(Ni(p)||En(p)){const u=En(p)?p:p.defaultView;w=s?u.scrollX:u.scrollY,v=s?u.document.documentElement.scrollWidth:u.document.documentElement.scrollHeight,x=s?u.innerWidth:u.innerHeight}else w=s?p.scrollLeft:p.scrollTop,v=s?p.scrollWidth:p.scrollHeight,x=s?p.offsetWidth:p.offsetHeight;const f=()=>{e({scrollHeight:v,scrollTop:Math.max(w,0),viewportHeight:x})};b.suppressFlushSync?f():Bs.flushSync(f),c.current!==null&&(w===c.current||w<=0||w===v-x)&&(c.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);h.useEffect(()=>{const b=o||i.current;return r(o||i.current),a({suppressFlushSync:!0,target:b}),b.addEventListener("scroll",a,{passive:!0}),()=>{r(null),b.removeEventListener("scroll",a)}},[i,a,n,r,o]);function d(b){const v=i.current;if(!v||(s?"offsetWidth"in v&&v.offsetWidth===0:"offsetHeight"in v&&v.offsetHeight===0))return;const x=b.behavior==="smooth";let w,p,f;En(v)?(p=Math.max(ft(v.document.documentElement,s?"width":"height"),s?v.document.documentElement.scrollWidth:v.document.documentElement.scrollHeight),w=s?v.innerWidth:v.innerHeight,f=s?window.scrollX:window.scrollY):(p=v[s?"scrollWidth":"scrollHeight"],w=ft(v,s?"width":"height"),f=v[s?"scrollLeft":"scrollTop"]);const u=p-w;if(b.top=Math.ceil(Math.max(Math.min(u,b.top),0)),Zo(w,p)||b.top===f){e({scrollHeight:p,scrollTop:f,viewportHeight:w}),x&&t(!0);return}x?(c.current=b.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,c.current=null,t(!0)},1e3)):c.current=null,s&&(b={behavior:b.behavior,left:b.top}),v.scrollTo(b)}function S(b){s&&(b={behavior:b.behavior,left:b.top}),i.current.scrollBy(b)}return{scrollByCallback:S,scrollerRef:i,scrollToCallback:d}}const jn="-webkit-sticky",Dr="sticky",mr=os(()=>{if(typeof document>"u")return Dr;const e=document.createElement("div");return e.style.position=jn,e.style.position===jn?jn:Dr});function br(e){return e}const Fi=me(()=>{const e=G(c=>`Item ${c}`),t=G(c=>`Group ${c}`),n=G({}),r=G(br),o=G("div"),s=G(Ot),i=(c,l=null)=>Fe(L(n,U(a=>a[c]),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")}}),Wi=me(([e,t])=>({...e,...t}),ke(ss,Fi)),Di=({height:e})=>m.jsx("div",{style:{height:e}}),$i={overflowAnchor:"none",position:mr(),zIndex:1},ds={overflowAnchor:"none"},Vi={...ds,display:"inline-block",height:"100%"},$r=h.memo(function({showTopList:e=!1}){const t=ce("listState"),n=Ke("sizeRanges"),r=ce("useWindowScroll"),o=ce("customScrollParent"),s=Ke("windowScrollContainerState"),i=Ke("scrollContainerState"),c=o||r?s:i,l=ce("itemContent"),a=ce("context"),d=ce("groupContent"),S=ce("trackItemSizes"),b=ce("itemSize"),v=ce("log"),x=Ke("gap"),w=ce("horizontalDirection"),{callbackRef:p}=ii(n,b,S,e?Ot:c,v,x,o,w,ce("skipAnimationFrameInResizeObserver")),[f,u]=h.useState(0);xr("deviation",j=>{f!==j&&u(j)});const R=ce("EmptyPlaceholder"),T=ce("ScrollSeekPlaceholder")||Di,I=ce("ListComponent"),M=ce("ItemComponent"),g=ce("GroupComponent"),y=ce("computeItemKey"),k=ce("isSeeking"),_=ce("groupIndices").length>0,O=ce("alignToBottom"),P=ce("initialItemFinalLocationReached"),C=e?{}:{boxSizing:"border-box",...w?{display:"inline-block",height:"100%",marginLeft:f!==0?f:O?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:O?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...P?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&R?m.jsx(R,{...Ne(R,a)}):m.jsx(I,{...Ne(I,a),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:p,style:C,children:(e?t.topItems:t.items).map(j=>{const A=j.originalIndex,F=y(A+t.firstItemIndex,j.data,a);return k?h.createElement(T,{...Ne(T,a),height:j.size,index:j.index,key:F,type:j.type||"item",...j.type==="group"?{}:{groupIndex:j.groupIndex}}):j.type==="group"?h.createElement(g,{...Ne(g,a),"data-index":A,"data-item-index":j.index,"data-known-size":j.size,key:F,style:$i},d(j.index,a)):h.createElement(M,{...Ne(M,a),...Qi(M,j.data),"data-index":A,"data-item-group-index":j.groupIndex,"data-item-index":j.index,"data-known-size":j.size,key:F,style:w?Vi:ds},_?l(j.index,j.groupIndex,j.data,a):l(j.index,j.data,a))})})}),qi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Ui={outline:"none",overflowX:"auto",position:"relative"},xn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Ki={position:mr(),top:0,width:"100%",zIndex:1};function Ne(e,t){if(typeof e!="string")return{context:t}}function Qi(e,t){return{item:typeof e=="string"?void 0:t}}const Yi=h.memo(function(){const e=ce("HeaderComponent"),t=Ke("headerHeight"),n=ce("HeaderFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),Xi=h.memo(function(){const e=ce("FooterComponent"),t=Ke("footerHeight"),n=ce("HeaderFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,ce("skipAnimationFrameInResizeObserver")),o=ce("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null});function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return h.memo(function({children:r,style:o,context:s,...i}){const c=n("scrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("scrollerRef"),S=t("horizontalDirection")||!1,{scrollByCallback:b,scrollerRef:v,scrollToCallback:x}=us(c,a,l,d,void 0,S);return e("scrollTo",x),e("scrollBy",b),m.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:v,style:{...S?Ui:qi,...o},tabIndex:0,...i,...Ne(l,s),children:r})})}function ps({useEmitter:e,useEmitterValue:t,usePublisher:n}){return h.memo(function({children:r,style:o,context:s,...i}){const c=n("windowScrollContainerState"),l=t("ScrollerComponent"),a=n("smoothScrollTargetReached"),d=t("totalListHeight"),S=t("deviation"),b=t("customScrollParent"),v=h.useRef(null),x=t("scrollerRef"),{scrollByCallback:w,scrollerRef:p,scrollToCallback:f}=us(c,a,l,x,b);return cs(()=>{var u;return p.current=b||((u=v.current)==null?void 0:u.ownerDocument.defaultView),()=>{p.current=null}},[p,b]),e("windowScrollTo",f),e("scrollBy",w),m.jsx(l,{ref:v,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+S}:{}},...i,...Ne(l,s),children:r})})}const Zi=({children:e})=>{const t=h.useContext(ls),n=Ke("viewportHeight"),r=Ke("fixedItemHeight"),o=ce("alignToBottom"),s=ce("horizontalDirection"),i=h.useMemo(()=>Go(n,l=>ft(l,s?"width":"height")),[n,s]),c=wt(i,!0,ce("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),m.jsx("div",{"data-viewport-type":"element",ref:c,style:xn(o),children:e})},Ji=({children:e})=>{const t=h.useContext(ls),n=Ke("windowViewportRect"),r=Ke("fixedItemHeight"),o=ce("customScrollParent"),s=No(n,o,ce("skipAnimationFrameInResizeObserver")),i=ce("alignToBottom");return h.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})},el=({children:e})=>{const t=ce("TopItemListComponent")||"div",n=ce("headerHeight"),r={...Ki,marginTop:`${n}px`},o=ce("context");return m.jsx(t,{style:r,...Ne(t,o),children:e})},tl=h.memo(function(e){const t=ce("useWindowScroll"),n=ce("topItemsIndexes").length>0,r=ce("customScrollParent"),o=ce("context");return m.jsxs(r||t?ol:rl,{...e,context:o,children:[n&&m.jsx(el,{children:m.jsx($r,{showTopList:!0})}),m.jsxs(r||t?Ji:Zi,{children:[m.jsx(Yi,{}),m.jsx($r,{}),m.jsx(Xi,{})]})]})}),{Component:nl,useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}=is(Wi,{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"}},tl),rl=fs({useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}),ol=ps({useEmitter:xr,useEmitterValue:ce,usePublisher:Ke}),sl=nl,il=me(()=>{const e=G(a=>m.jsxs("td",{children:["Item $",a]})),t=G(null),n=G(a=>m.jsxs("td",{colSpan:1e3,children:["Group ",a]})),r=G(null),o=G(null),s=G({}),i=G(br),c=G(Ot),l=(a,d=null)=>Fe(L(s,U(S=>S[a]),Ie()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:c,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(ss,il);mr();const Vr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ll={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:qr,floor:ln,max:Lt,min:On,round:Ur}=Math;function Kr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function al(e){return{...ll,items:e}}function en(e,t){return e&&e.width===t.width&&e.height===t.height}function cl(e,t){return e&&e.column===t.column&&e.row===t.row}const ul=me(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:c,scrollTo:l,scrollTop:a,smoothScrollTargetReached:d,viewportHeight:S},b,v,{didMount:x,propsReady:w},{customScrollParent:p,useWindowScroll:f,windowScrollContainerState:u,windowScrollTo:R,windowViewportRect:T},I])=>{const M=G(0),g=G(0),y=G(Vr),k=G({height:0,width:0}),_=G({height:0,width:0}),O=ge(),P=ge(),C=G(0),j=G(null),A=G({column:0,row:0}),F=ge(),E=ge(),B=G(!1),N=G(0),$=G(!0),V=G(!1),le=G(!1);xe(L(x,he(N),ie(([z,K])=>!!K)),()=>{fe($,!1)}),xe(L(ze(x,$,_,k,N,V),ie(([z,K,ee,H,,ne])=>z&&!K&&ee.height!==0&&H.height!==0&&!ne)),([,,,,z])=>{fe(V,!0),fr(1,()=>{fe(O,z)}),tt(L(a),()=>{fe(t,[0,0]),fe($,!0)})}),J(L(E,ie(z=>z!=null&&z.scrollTop>0),it(0)),g),xe(L(x,he(E),ie(([,z])=>z!=null)),([,z])=>{z&&(fe(k,z.viewport),fe(_,z.item),fe(A,z.gap),z.scrollTop>0&&(fe(B,!0),tt(L(a,vt(1)),K=>{fe(B,!1)}),fe(l,{top:z.scrollTop})))}),J(L(k,U(({height:z})=>z)),S),J(L(ze(se(k,en),se(_,en),se(A,(z,K)=>z&&z.column===K.column&&z.row===K.row),se(a)),U(([z,K,ee,H])=>({gap:ee,item:K,scrollTop:H,viewport:z}))),F),J(L(ze(se(M),r,se(A,cl),se(_,en),se(k,en),se(j),se(g),se(B),se($),se(N)),ie(([,,,,,,,z])=>!z),U(([z,[K,ee],H,ne,D,X,re,,te,ue])=>{const{column:oe,row:be}=H,{height:pe,width:Se}=ne,{width:Re}=D;if(re===0&&(z===0||Re===0))return Vr;if(Se===0){const ut=pr(ue,z),Pt=ut+Math.max(re-1,0);return al(Kr(ut,Pt,X))}const Be=hs(Re,Se,oe);let je,Ge;te?K===0&&ee===0&&re>0?(je=0,Ge=re-1):(je=Be*ln((K+be)/(pe+be)),Ge=Be*qr((ee+be)/(pe+be))-1,Ge=On(z-1,Lt(Ge,Be-1)),je=On(Ge,Lt(0,je))):(je=0,Ge=-1);const rt=Kr(je,Ge,X),{bottom:De,top:Pe}=Qr(D,H,ne,rt),Xe=qr(z/Be),Ue=Xe*pe+(Xe-1)*be-De;return{bottom:De,itemHeight:pe,items:rt,itemWidth:Se,offsetBottom:Ue,offsetTop:Pe,top:Pe}})),y),J(L(j,ie(z=>z!==null),U(z=>z.length)),M),J(L(ze(k,_,y,A),ie(([z,K,{items:ee}])=>ee.length>0&&K.height!==0&&z.height!==0),U(([z,K,{items:ee},H])=>{const{bottom:ne,top:D}=Qr(z,H,K,ee);return[D,ne]}),Ie(Nt)),t);const ae=G(!1);J(L(a,he(ae),U(([z,K])=>K||z!==0)),ae);const ye=qe(L(ze(y,M),ie(([{items:z}])=>z.length>0),he(ae),ie(([[z,K],ee])=>{const H=z.items[z.items.length-1].index===K-1;return(ee||z.bottom>0&&z.itemHeight>0&&z.offsetBottom===0&&z.items.length===K)&&H}),U(([[,z]])=>z-1),Ie())),we=qe(L(se(y),ie(({items:z})=>z.length>0&&z[0].index===0),it(0),Ie())),Z=qe(L(se(y),he(B),ie(([{items:z},K])=>z.length>0&&!K),U(([{items:z}])=>({endIndex:z[z.length-1].index,startIndex:z[0].index})),Ie(qo),ct(0)));J(Z,v.scrollSeekRangeChanged),J(L(O,he(k,_,M,A),U(([z,K,ee,H,ne])=>{const D=Xo(z),{align:X,behavior:re,offset:te}=D;let ue=D.index;ue==="LAST"&&(ue=H-1),ue=Lt(0,ue,On(H-1,ue));let oe=rr(K,ne,ee,ue);return X==="end"?oe=Ur(oe-K.height+ee.height):X==="center"&&(oe=Ur(oe-K.height/2+ee.height/2)),te&&(oe+=te),{behavior:re,top:oe}})),l);const Q=Fe(L(y,U(z=>z.offsetBottom+z.bottom)),0);return J(L(T,U(z=>({height:z.visibleHeight,width:z.visibleWidth}))),k),{customScrollParent:p,data:j,deviation:C,footerHeight:o,gap:A,headerHeight:s,increaseViewportBy:e,initialItemCount:g,itemDimensions:_,overscan:n,restoreStateFrom:E,scrollBy:i,scrollContainerState:c,scrollHeight:P,scrollTo:l,scrollToIndex:O,scrollTop:a,smoothScrollTargetReached:d,totalCount:M,useWindowScroll:f,viewportDimensions:k,windowScrollContainerState:u,windowScrollTo:R,windowViewportRect:T,...v,gridState:y,horizontalDirection:le,initialTopMostItemIndex:N,totalListHeight:Q,...b,endReached:ye,propsReady:w,rangeChanged:Z,startReached:we,stateChanged:F,stateRestoreInProgress:B,...I}},ke(hr,We,Qt,rs,gt,gr,ht));function hs(e,t,n){return Lt(1,ln((e+n)/(ln(t)+n)))}function Qr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=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=hs(e.width,n.width,t.column),s=ln(r/o),i=s*n.height+Lt(0,s-1)*t.row;return i>0?i+t.row:i}const dl=me(()=>{const e=G(S=>`Item ${S}`),t=G({}),n=G(null),r=G("virtuoso-grid-item"),o=G("virtuoso-grid-list"),s=G(br),i=G("div"),c=G(Ot),l=(S,b=null)=>Fe(L(t,U(v=>v[S]),Ie()),b),a=G(!1),d=G(!1);return J(se(d),a),{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:a,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:c,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),fl=me(([e,t])=>({...e,...t}),ke(ul,dl)),pl=h.memo(function(){const e=Te("gridState"),t=Te("listClassName"),n=Te("itemClassName"),r=Te("itemContent"),o=Te("computeItemKey"),s=Te("isSeeking"),i=Qe("scrollHeight"),c=Te("ItemComponent"),l=Te("ListComponent"),a=Te("ScrollSeekPlaceholder"),d=Te("context"),S=Qe("itemDimensions"),b=Qe("gap"),v=Te("log"),x=Te("stateRestoreInProgress"),w=Qe("reportReadyState"),p=wt(h.useMemo(()=>f=>{const u=f.parentElement.parentElement.scrollHeight;i(u);const R=f.firstChild;if(R){const{height:T,width:I}=R.getBoundingClientRect();S({height:T,width:I})}b({column:Yr("column-gap",getComputedStyle(f).columnGap,v),row:Yr("row-gap",getComputedStyle(f).rowGap,v)})},[i,S,b,v]),!0,!1);return cs(()=>{e.itemHeight>0&&e.itemWidth>0&&w(!0)},[e]),x?null:m.jsx(l,{className:t,ref:p,...Ne(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const u=o(f.index,f.data,d);return s?m.jsx(a,{...Ne(a,d),height:e.itemHeight,index:f.index,width:e.itemWidth},u):h.createElement(c,{...Ne(c,d),className:n,"data-index":f.index,key:u},r(f.index,f.data,d))})})}),hl=h.memo(function(){const e=Te("HeaderComponent"),t=Qe("headerHeight"),n=Te("headerFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),gl=h.memo(function(){const e=Te("FooterComponent"),t=Qe("footerHeight"),n=Te("headerFooterTag"),r=wt(h.useMemo(()=>s=>{t(ft(s,"height"))},[t]),!0,!1),o=Te("context");return e?m.jsx(n,{ref:r,children:m.jsx(e,{...Ne(e,o)})}):null}),ml=({children:e})=>{const t=h.useContext(as),n=Qe("itemDimensions"),r=Qe("viewportDimensions"),o=wt(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return h.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})},bl=({children:e})=>{const t=h.useContext(as),n=Qe("windowViewportRect"),r=Qe("itemDimensions"),o=Te("customScrollParent"),s=No(n,o,!1);return h.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})},xl=h.memo(function({...e}){const t=Te("useWindowScroll"),n=Te("customScrollParent"),r=n||t?Sl:vl,o=n||t?bl:ml,s=Te("context");return m.jsx(r,{...e,...Ne(r,s),children:m.jsxs(o,{children:[m.jsx(hl,{}),m.jsx(pl,{}),m.jsx(gl,{})]})})}),{useEmitter:gs,useEmitterValue:Te,usePublisher:Qe}=is(fl,{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"}},xl),vl=fs({useEmitter:gs,useEmitterValue:Te,usePublisher:Qe}),Sl=ps({useEmitter:gs,useEmitterValue:Te,usePublisher:Qe});function Yr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,$e.WARN),t==="normal"?0:parseInt(t??"0",10)}const vn=h.createContext(void 0);function Ce(e,t){const n=h.useContext(vn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return pn(n,e,t)}function an(){const e=h.useContext(vn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const yl="_run_zzb61_3",wl="_runWrap_zzb61_7",Cl="_highlight_zzb61_13",Il="_highlightleft_zzb61_14",kl="_highlightright_zzb61_15",Rl="_highlightcenter_zzb61_16",Tl="_underline_zzb61_48",_l="_underlineleft_zzb61_49",Ml="_underlineright_zzb61_50",El="_underlinecenter_zzb61_51",st={run:yl,runWrap:wl,highlight:Cl,highlightleft:Il,highlightright:kl,highlightcenter:Rl,underline:Tl,underlineleft:_l,underlineright:Ml,underlinecenter:El},Xr=e=>Symbol.iterator in e,Zr=e=>"entries"in e,Jr=(e,t)=>{const n=e instanceof Map?e:new Map(e.entries()),r=t instanceof Map?t:new Map(t.entries());if(n.size!==r.size)return!1;for(const[o,s]of n)if(!r.has(o)||!Object.is(s,r.get(o)))return!1;return!0},jl=(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 Ol(e,t){return Object.is(e,t)?!0:typeof e!="object"||e===null||typeof t!="object"||t===null||Object.getPrototypeOf(e)!==Object.getPrototypeOf(t)?!1:Xr(e)&&Xr(t)?Zr(e)&&Zr(t)?Jr(e,t):jl(e,t):Jr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Vt(e){const t=h.useRef(void 0);return n=>{const r=e(n);return Ol(t.current,r)?t.current:t.current=r}}function Pl(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 Bl(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const zl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),ms=h.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=Ce(k=>k.setClipIndex),i=Ce(k=>k.seek),c=q(k=>k.setCurrentGlobalRunIndex),l=an(),a=q(k=>k.rangeStartGI),d=q(k=>k.rangeEndGI),S=q(k=>k.setRange),b=a!=null&&d!=null,v=h.useCallback(k=>{var E;const _=(E=k.target)==null?void 0:E.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g),P=O-r;if(P<0||P>=t.length)return;const C=t[P],j=C.text??"";if(!j.trim()||!/[가-힣a-zA-Z0-9]/.test(j))return;c(O,"program");const A=C.audioChunkIndex,F=C.audioTimeMs;A!=null&&F!=null&&(s(A),i(F))},[t,r,i,s,c]),x=h.useRef(null),w=h.useRef(!1),p=h.useCallback(k=>{var C;const _=(C=k.target)==null?void 0:C.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g),P=O-r;P<0||P>=t.length||(w.current=!1,x.current&&(window.clearTimeout(x.current),x.current=null),x.current=window.setTimeout(()=>{l.getState().status!=="playing"&&(S(O,O),w.current=!0,x.current=null)},800))},[t,r,S,l]),f=h.useCallback(()=>{x.current&&(window.clearTimeout(x.current),x.current=null)},[]),u=h.useCallback(()=>{f()},[f]),R=f,T=f,I=q(k=>k.clearRange),M=h.useCallback(k=>{var P;if(w.current){w.current=!1;return}const _=(P=k.target)==null?void 0:P.closest("[data-g]");if(!_)return;const O=Number(_.dataset.g);isNaN(O)||b&&a!=null&&d!=null&&(I(),k.stopPropagation())},[b,a,d,I]),g=o,y=r+t.length-1;return m.jsx("span",{onClick:M,onDoubleClick:v,onPointerDown:p,onPointerUp:u,onPointerCancel:R,onPointerLeave:T,children:g.map((k,_)=>m.jsx(Ll,{ns:n,group:k,runs:t,paraLastG:y,rangeStartGI:a,rangeEndGI:d},`${n}/grp:${_}-${k.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Al=h.memo(function(){const t=h.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=Y(Vt(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}),Ll=h.memo(function({ns:t,group:n,runs:r,paraLastG:o,rangeStartGI:s,rangeEndGI:i}){const c=h.useCallback(p=>{const f=p.currentGlobalRunIndex;return f!=null&&f>=n.startG&&f<=n.endG},[n]),l=q(Vt(c)),a=h.useCallback(p=>l?{showPointer:p.showPointer,pointerStyle:p.pointerStyle,pointerColor:p.pointerColor}:zl,[l]),d=Y(Vt(a)),S=n.r0??0,b=n.len??Math.max(0,n.endG-n.startG+1),v=l&&d.showPointer&&d.pointerStyle!=="underline",x=l&&d.showPointer&&d.pointerStyle==="underline",w=v||x?{"--hl-color":d.pointerColor,"--ul-color":d.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return m.jsx(m.Fragment,{children:Array.from({length:b}).map((p,f)=>{const R=r[S+f],T=n.startG+f,I=`${t}/run:${T}`,M=!!R.split&&T!==o;let g=`${st.runWrap}`;return v&&(b===1?g+=` ${st.highlight}`:f===0?g+=` ${st.highlightleft}`:f+1===b?g+=` ${st.highlightright}`:g+=` ${st.highlightcenter}`),x&&(b===1?g+=` ${st.underline}`:f===0?g+=` ${st.underlineleft}`:f+1===b?g+=` ${st.underlineright}`:g+=` ${st.underlinecenter}`),m.jsxs(h.Fragment,{children:[m.jsx("span",{className:g,style:w,children:m.jsx(Gl,{gi:n.startG,g:T,run:R,active:l,pointerCfg:d,isInRange:s!=null&&i!=null&&T>=s&&T<=i})}),M&&m.jsx(Al,{})]},I)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns&&e.rangeStartGI===t.rangeStartGI&&e.rangeEndGI===t.rangeEndGI),Gl=h.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s,isInRange:i}){const c=h.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 a=s.pointerColor;if(s.pointerStyle!=="underline"){l.backgroundColor=a;const d=a.startsWith("#")?Pl(a):Bl(a);d&&(.299*d.r+.587*d.g+.114*d.b)/255<.6&&(l.color="#fff")}}return i&&(l.boxShadow="inset 0 0 0 100px rgba(59, 130, 246, 0.3)"),l},[r.bold,r.italic,r.underline,o,s,i]);return m.jsx("span",{className:st.run,style:c,"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 Hl({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var a;const i=e.list?e.list.level*24:0,c=((a=e.list)==null?void 0:a.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??c;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(ms,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Nl=h.memo(Hl,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Fl(e,t){switch((t||"decimal").toLowerCase().replace(/[\s_-]+/g,"")){case"decimal":return String(e);case"decimalleadingzero":return e<10?`0${e}`:String(e);case"loweralpha":case"lowerlatin":return to(e,!1);case"upperalpha":case"upperlatin":return to(e,!0);case"lowerroman":return eo(e,!1);case"upperroman":return eo(e,!0);case"decimalenclosedcircle":return Wl(e);default:return String(e)}}function Wl(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function eo(e,t=!0){if(e<=0)return"";const n=[[1e3,"M"],[900,"CM"],[500,"D"],[400,"CD"],[100,"C"],[90,"XC"],[50,"L"],[40,"XL"],[10,"X"],[9,"IX"],[5,"V"],[4,"IV"],[1,"I"]];let r=e,o="";for(const[s,i]of n)for(;r>=s;)o+=i,r-=s;return t?o:o.toLowerCase()}function to(e,t=!1){let n=e,r="";for(;n>0;)n--,r=String.fromCharCode(97+n%26)+r,n=Math.floor(n/26);return t?r.toUpperCase():r}function 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=Fl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function Dl(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function $l(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 Vl(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 ql="_scroller_kqkmq_3",Ul={scroller:ql},Kl=h.forwardRef(function({className:t,style:n,...r},o){return m.jsx("div",{ref:o,className:`${Ul.scroller}${t?" "+t:""}`,style:n,...r})}),or=e=>/[가-힣a-zA-Z0-9]/.test(e),Ql=e=>((e==null?void 0:e.textContent)??"").trim(),cn=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Yl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,c=1/0,l=1/0,a=-1,d=1/0,S=1/0;const b=e.querySelectorAll("[data-g]");for(let v=0;v<b.length;v++){const x=b[v];if(!x||!x.isConnected)continue;const w=Ql(x);if(!w||!or(w))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 R=Math.abs(p.top-s);(R<d||R===d&&(p.top<S||a!==-1&&Number(x.dataset.g)<a))&&(d=R,a=Number(x.dataset.g),S=p.top);continue}const f=Number(x.dataset.g);if(Number.isNaN(f))continue;p.top<l-n?(l=p.top,c=p.top,i=f):p.top<=l+n&&(p.top<c||p.top===c&&(i===-1||f<i))&&(c=p.top,i=f);const u=Math.abs(p.top-s);(u<d||u===d&&(p.top<S||a!==-1&&f<a))&&(d=u,a=f,S=p.top)}return i!==-1?i:a}const bs=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=cn(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=cn(e,t)}return s},no=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const c of o){const l=c.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const a=Number(c.dataset.g);Number.isNaN(a)||(a<s&&(s=a),a>i&&(i=a))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},Xl=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=cn(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),c=s.height*n,l=i.top-(s.top+c);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function Zl(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(!Xl(e,t,{topPaddingRatio:n,behavior:r}))return!1;await Zl(e,o);const i=cn(e,t);if(!i)return!1;const c=e.getBoundingClientRect(),l=i.getBoundingClientRect(),a=c.height*n,d=c.top+a,S=l.top-d;return Math.abs(S)<=1},dt=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),yr=h.createContext(null);function xs(){const e=h.useContext(yr);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Je(e,t){const n=h.useContext(yr);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return pn(n,e,t)}const vs=()=>{const e=q(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,")"]})},Jl="_navBtn_1fciy_2",ea="_disabled_1fciy_26",ta="_label_1fciy_32",Et={navBtn:Jl,disabled:ea,label:ta};var Ss={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},ro=h.createContext&&h.createContext(Ss),na=["attr","size","title"];function ra(e,t){if(e==null)return{};var n=oa(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 oa(e,t){if(e==null)return{};var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)){if(t.indexOf(r)>=0)continue;n[r]=e[r]}return n}function un(){return un=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},un.apply(this,arguments)}function oo(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function dn(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?oo(Object(n),!0).forEach(function(r){sa(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):oo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function sa(e,t,n){return t=ia(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ia(e){var t=la(e,"string");return typeof t=="symbol"?t:t+""}function la(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 ys(e){return e&&e.map((t,n)=>h.createElement(t.tag,dn({key:n},t.attr),ys(t.child)))}function Ye(e){return t=>h.createElement(aa,un({attr:dn({},e.attr)},t),ys(e.child))}function aa(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=ra(e,na),c=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),h.createElement("svg",un({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:dn(dn({color:e.color||n.color},n.style),e.style),height:c,width:c,xmlns:"http://www.w3.org/2000/svg"}),s&&h.createElement("title",null,s),e.children)};return ro!==void 0?h.createElement(ro.Consumer,null,n=>t(n)):t(Ss)}function so(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M18.464 2.114a.998.998 0 0 0-1.033.063l-13 9a1.003 1.003 0 0 0 0 1.645l13 9A1 1 0 0 0 19 21V3a1 1 0 0 0-.536-.886zM17 19.091 6.757 12 17 4.909v14.182z"},child:[]}]})(e)}function io(e){return Ye({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M5.536 21.886a1.004 1.004 0 0 0 1.033-.064l13-9a1 1 0 0 0 0-1.644l-13-9A.998.998 0 0 0 5 3v18a1 1 0 0 0 .536.886zM7 4.909 17.243 12 7 19.091V4.909z"},child:[]}]})(e)}const ca=({isIcon:e=!0})=>{const t=q(i=>i.isCanPrev),n=q(i=>i.onSectionNav),r=!t,o=h.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("prev"))},[t,n]),s=t?"이전 섹션으로":"이전 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.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:Et.label,children:"이전"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"첫섹션입니다":m.jsxs(m.Fragment,{children:[m.jsx(so,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},fn=({isIcon:e=!0})=>{const t=q(i=>i.isCanNext),n=q(i=>i.onSectionNav),r=!t,o=h.useCallback(i=>{i.stopPropagation(),i.preventDefault(),t&&(n==null||n("next"))},[t,n]),s=t?"다음 섹션으로":"다음 섹션 없음";return e?m.jsxs("button",{type:"button",className:`${Et.navBtn} ${r?Et.disabled:""}`,disabled:r,title:s,onMouseDown:o,onClick:i=>i.stopPropagation(),onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},children:[m.jsx(io,{size:18}),m.jsx("span",{className:Et.label,children:"다음"})]}):m.jsx("button",{type:"button",disabled:r,title:s,onClick:o,onKeyDown:i=>{(i.key==="Enter"||i.key===" ")&&o(i)},style:{width:300,background:r?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:r?"not-allowed":"pointer",boxShadow:r?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:r?.5:1},children:r?"마지막섹션입니다":m.jsxs(m.Fragment,{children:["NextSection",m.jsx(io,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ws(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 ua({section:e,blocks:t,nsPrefix:n}){const r=h.useMemo(()=>{const k=[],_=vr();return t.forEach((O,P)=>{O.type==="paragraph"&&(k[P]=Sr(O,_))}),k},[t]),o=q(k=>{var _;return((_=k.layout)==null?void 0:_.prefix)??[]}),s=q(k=>{var _;return((_=k.derivedNav)==null?void 0:_.splitGroupsPerBlock)??[]}),i=Y(k=>k.marginX),c=Y(k=>k.viewportHeight),l=h.useRef({start:0,end:0}),a=h.useCallback(k=>{const _=t[k],O=`${n}blk-${_.id}`;if(_.type==="image"){const{src:j,alt:A,width:F,height:E}=_,B=F&&E?`${F} / ${E}`:"4 / 3",N=k>=l.current.start&&k<=l.current.end,$=c>80?Math.floor((c-80)*.6):void 0;return m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:$,aspectRatio:B},children:m.jsx("img",{src:j,alt:A||"",loading:N?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),A&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:A})]})}const P=r[k]??void 0,C=s[k];return m.jsx("div",{style:{maxWidth:860,display:"flex"},children:m.jsx(Nl,{block:_,computedMarker:P,ns:O,baseIndex:o[k],sectionId:e.section_id,preGroups:C})})},[t,r,o,n,e,s,c]),d=h.useRef(null),S=h.useCallback(k=>{d.current=k},[]),b=h.useMemo(()=>h.memo(k=>{const{style:_,children:O,...P}=k;return m.jsx("div",{...P,style:_,children:m.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:O})})}),[i]),v=h.useRef(null),x=h.useMemo(()=>t.map(k=>k.id),[t]),[w,p]=h.useState(!1);h.useEffect(()=>{p(!1)},[t]);const f=h.useCallback(()=>{p(!0)},[]),u=h.useCallback(()=>{if(!w)return m.jsx("div",{style:{height:40}});const k=e.quiz,_=Math.max(80,Math.floor(c*.5));return k&&k.length?m.jsxs("div",{style:{display:"block"},children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(vs,{})}),m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{isIcon:!1})}),m.jsx("div",{style:{height:_,width:"100%"}})]}):m.jsxs("div",{children:[m.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:m.jsx(fn,{isIcon:!1})}),m.jsx("div",{style:{height:40}})]})},[w,e,c]),R=h.useMemo(()=>({Item:b,Header:()=>m.jsx("div",{style:{height:40}}),Footer:u,Scroller:Kl}),[u,b]),T=h.useCallback(k=>x[k],[x]),I=xt(),[M]=h.useState(()=>I.getState().progress.currentGlobalRunIndex??0),g=h.useMemo(()=>{if(!o.length)return 0;const k=o[o.length-1],_=Math.max(0,Math.min(M,k));return ws(o,_)},[o,M]);console.log("SectionRenderVirtuoso확인");const y=xt();return h.useEffect(()=>{let k=!1;return(async()=>{let _=d.current;if(!_){for(let j=0;j<20;j++){if(await new Promise(A=>setTimeout(A,50)),k)return;if(_=d.current,_)break}if(!_)return}const O=y.getState().progress.currentGlobalRunIndex,P=y.getState().progress.setSectionLoading,C=O!=null&&O>=0?O:0;await bs(_,C),!k&&(await dt(),await dt(),await dt(),await dt(),!k&&P(!1))})(),()=>{k=!0}},[d,y]),m.jsxs(m.Fragment,{children:[m.jsx(sl,{ref:v,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:T,totalCount:t.length,itemContent:a,initialTopMostItemIndex:g,increaseViewportBy:{top:200,bottom:200},endReached:f,components:R,scrollerRef:S}),m.jsx(da,{scrollContainerRef:d,virtRef:v,prefix:o})]})}const da=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=q(C=>C.setCurrentGlobalRunIndex),o=q(C=>C.registerSectionScrollApi),s=q(C=>C.currentGlobalRunIndex),i=Ce(C=>C.scrollLock),c=Ce(C=>C.syncToGI),l=yt(),a=h.useRef(!1),d=h.useRef(null),S=h.useRef(null),b=h.useRef(null),v=h.useRef(-1),x=h.useCallback(()=>{if(i)return;d.current=null;const C=S.current;if(!C)return;const j=Yl(C,5);j!==-1&&j!==v.current&&(v.current=j,c(j),r(j,"scroll"))},[i,c,r]),w=h.useCallback(C=>{S.current=C,d.current==null&&(d.current=requestAnimationFrame(x))},[x]),p=h.useCallback(C=>{S.current=C,b.current!=null&&(window.clearTimeout(b.current),b.current=null),b.current=window.setTimeout(()=>{b.current=null,x();const j=v.current;if(j===-1)return;const A=C.scrollTop,F=C.scrollHeight-C.clientHeight,E=F>0?A/F:0;let B=0;const N=C.querySelector(`[data-g="${j}"]`);if(N){const $=C.getBoundingClientRect();B=(N.getBoundingClientRect().top-$.top)/$.height}l.getState().emit({type:"scroll",payload:{scrollTop:A,scrollRatio:E,anchorGI:j,anchorOffsetRatio:B}})},100)},[x,l]),f=h.useRef(!1),u=h.useCallback(C=>{i||a.current&&(f.current||(w(C),p(C)))},[i,w,p]),R=h.useRef(void 0),T=h.useRef(void 0),I=h.useRef(void 0),M=h.useRef(void 0);h.useEffect(()=>{const C=e.current;if(C)return R.current=()=>{a.current=!0},T.current=()=>{a.current=!0},I.current=()=>{a.current=!0},M.current=()=>u(C),C.addEventListener("wheel",R.current,{passive:!0}),C.addEventListener("touchmove",T.current,{passive:!0}),window.addEventListener("keydown",I.current,{passive:!0}),C.addEventListener("scroll",M.current,{passive:!0}),()=>{C.removeEventListener("wheel",R.current),C.removeEventListener("touchmove",T.current),window.removeEventListener("keydown",I.current),C.removeEventListener("scroll",M.current),d.current!=null&&cancelAnimationFrame(d.current),b.current!=null&&(clearTimeout(b.current),b.current=null)}},[u,e]),h.useEffect(()=>{const C=e.current;if(!C||!i)return;const j=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},A=B=>{B.preventDefault(),B.stopPropagation(),a.current=!1},F=B=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(B.key)&&(B.preventDefault(),B.stopPropagation(),a.current=!1)},E={overscrollBehavior:C.style.overscrollBehavior,touchAction:C.style.touchAction};return C.style.overscrollBehavior="contain",C.style.touchAction="none",C.addEventListener("wheel",j,{passive:!1}),C.addEventListener("touchmove",A,{passive:!1}),window.addEventListener("keydown",F,{passive:!1}),()=>{C.removeEventListener("wheel",j),C.removeEventListener("touchmove",A),window.removeEventListener("keydown",F),C.style.overscrollBehavior=E.overscrollBehavior,C.style.touchAction=E.touchAction}},[i,e]);const g=h.useRef({first:-1,last:-1}),y=h.useRef(!1),k=h.useCallback(()=>{const C=e.current;if(!C)return;const j=no(C),A=(j==null?void 0:j.first)??-1,F=(j==null?void 0:j.last)??-1;g.current={first:A,last:F}},[e]),_=h.useRef(!1),O=h.useCallback(()=>{const C=e.current;if(!C||_.current)return;_.current=!0;const j=Math.min(C.scrollTop+Math.floor(C.clientHeight*.6),C.scrollHeight-C.clientHeight);requestAnimationFrame(()=>{C.scrollTo({top:j,behavior:"instant"})})},[e]);h.useEffect(()=>{!y.current&&i&&(_.current=!1,k()),y.current=i},[i,k]),h.useEffect(()=>{if(i!==!0)return;const C=e.current;if(!C)return;const{first:j,last:A}=g.current;if(j===-1||A===-1){O();return}if(C.scrollTop<=1){(async()=>{try{f.current=!0,await Pn(C,s,{behavior:"smooth",topPaddingRatio:.2})}finally{f.current=!1}k()})();return}if(s<j||s>A){async function E(){if(!C)return;const B=C.scrollTop<=1?0:.2;return await Pn(C,s,{behavior:"smooth",topPaddingRatio:B})}E().then(B=>{B?k():O()})}},[i,s,O,k,e]);const P=h.useCallback(()=>{const C=e.current;if(!C)return;function j(Z,Q,z=.2,K=.8){const ee=Z.querySelector(`[data-g="${Q}"]`);if(!ee)return!1;const H=Z.getBoundingClientRect(),ne=ee.getBoundingClientRect();if(ne.height<=0||H.height<=0)return!1;const D=(ne.top+ne.height/2-H.top)/H.height;return D>=z&&D<=K}const A=Z=>Z==="instant"?"auto":Z,F=Z=>{const Q=C.scrollTop,z=C.scrollHeight-C.clientHeight,K=z>0?Q/z:0;let ee=0;const H=C.querySelector(`[data-g="${Z}"]`);if(H){const ne=C.getBoundingClientRect();ee=(H.getBoundingClientRect().top-ne.top)/ne.height}l.getState().emit({type:"scroll",payload:{scrollTop:Q,scrollRatio:K,anchorGI:Z,anchorOffsetRatio:ee}})},E=async(Z,Q="smooth")=>{var K;const z=ws(n,Z);(K=t.current)==null||K.scrollToIndex({index:z,align:"start",behavior:A(Q)}),await bs(C,Z)},B=()=>new Promise(Z=>requestAnimationFrame(()=>Z())),N=async Z=>{if(j(C,Z,.1,.7))return F(Z),!0;f.current=!0;const Q=C.querySelector(`[data-g="${Z}"]`),z=C.getBoundingClientRect();let K=C.scrollTop<=1?0:.1;if(Q){const H=Q.getBoundingClientRect();K=((H.top+H.height/2-z.top)/z.height>.5,.15)}const ee=!!Q;return ee?(await Pn(C,Z,{behavior:"smooth",topPaddingRatio:K}),await B()):ee||await E(Z,"auto"),f.current=!1,F(Z),j(C,Z,.1,.7)},$=async Z=>N(Z);return{ensureVisibleGI:N,scrollToGI:$,getVisibleRange:()=>no(C),getScrollTop:()=>C.scrollTop,setScrollTop:Z=>{C.scrollTop=Z},getAnchorOffsetRatio:Z=>{const Q=C.querySelector(`[data-g="${Z}"]`);if(!Q)return 0;const z=Q.getBoundingClientRect(),K=C.getBoundingClientRect();return(z.top-K.top)/K.height},scrollToGIAtOffset:async(Z,Q)=>{await $(Z),await new Promise(re=>requestAnimationFrame(()=>requestAnimationFrame(re)));const z=C.querySelector(`[data-g="${Z}"]`);if(!z)return;const K=z.getBoundingClientRect(),ee=C.getBoundingClientRect(),H=ee.height>0?ee.height/C.clientHeight:1,ne=(K.top-ee.top)/H,D=Q*C.clientHeight,X=ne-D;C.scrollTop=C.scrollTop+X}}},[e,t,n,l]);return h.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(P()),()=>o(void 0)),[P,o]),null};function fa(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 pa(){const e=q(x=>x.section),t=Y(x=>x.theme),n=Y(x=>x.fontFamily),r=Y(x=>x.fontSizePx),o=Y(x=>x.lineHeight),s=on[t],{blocks:i,nsPrefix:c}=h.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=hn(),a=h.useCallback(()=>{const{isSettingsOpen:x,setSettingsOpen:w,toggleOverlays:p}=l.getState();x?w(!1):p()},[l]),{onClick:d,onDoubleClick:S}=Us({onSingle:a,onDouble:()=>{},delay:250,shouldIgnoreTarget:fa}),b=h.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]),v=h.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),m.jsx("div",{onClick:d,onDoubleClick:S,style:b,children:m.jsx("div",{style:v,children:m.jsx(ua,{section:e,blocks:i,nsPrefix:c})})})}function ha(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 ga(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 ma(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 ba(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 xa(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 va="_wrap_1hfub_4",Sa="_visible_1hfub_25",ya="_compact_1hfub_31",wa="_row2_1hfub_34",Ca="_controls_1hfub_44",Ia="_row1_1hfub_52",ka="_groupExpand_1hfub_80",Ra="_groupPlayback_1hfub_81",Ta="_groupSpeed_1hfub_82",_a="_groupFeatures_1hfub_83",Ma="_groupNav_1hfub_84",Ea="_btn_1hfub_116",ja="_btnForbidden_1hfub_141",Oa="_btnActive_1hfub_147",Pa="_label_1hfub_158",Ba="_compactBtn_1hfub_168",Oe={wrap:va,visible:Sa,compact:ya,row2:wa,controls:Ca,row1:Ia,groupExpand:ka,groupPlayback:Ra,groupSpeed:Ta,groupFeatures:_a,groupNav:Ma,btn:Ea,btnForbidden:ja,btnActive:Oa,label:Pa,compactBtn:Ba},za=h.memo(function(){const t=h.useRef(null),n=h.useContext(St),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=Ce(y=>y.status),s=Ce(y=>y.currentTimeMs),i=Ce(y=>y.currentClip),c=Ce(y=>y.playbackKind),l=Y(y=>y.muteAudio),a=Y(y=>y.audioSpeed),d=Ce(y=>y.getClipSrc),S=Ce(y=>y._onTime),b=Ce(y=>y._onEnded),v=Ce(y=>y._onError),x=q(y=>y.setCurrentGlobalRunIndex),w=q(y=>y.getSectionScrollApi),p=q(y=>y.snapToReadable),f=q(y=>y.edgeReadable),u=h.useRef(null),R=h.useRef(null),T=h.useRef(!1),I=h.useRef(null);h.useEffect(()=>{c==="real"&&(T.current=!0)},[c]);const M=h.useMemo(()=>{const y=d(i);if(!y)return null;try{return new URL(y,window.location.href).href}catch{return y}},[i,d]);h.useEffect(()=>{T.current=!0},[M]),h.useEffect(()=>{const y=t.current;if(!y)return;const k=()=>{if(y.paused||y.ended)return;const P=y.currentTime*1e3;T.current&&P===0||(P>0&&(T.current=!1),S(P))},_=()=>{var C,j;b();const P=f(1);typeof P=="number"&&P>=0&&(x(P,"audio"),(j=(C=w())==null?void 0:C.ensureVisibleGI)==null||j.call(C,P))},O=P=>{const C=P.currentTarget;console.warn("Audio error",{networkState:C.networkState,readyState:C.readyState}),v()};return y.addEventListener("timeupdate",k),y.addEventListener("ended",_),y.addEventListener("error",O),()=>{y.removeEventListener("timeupdate",k),y.removeEventListener("ended",_),y.removeEventListener("error",O)}},[S,b,v,f,x,w]),h.useEffect(()=>{if(r)return;const y=t.current;if(!y)return;if(!M){try{y.pause()}catch(P){console.log("pause error",P)}R.current=null;return}const k=y.currentSrc||y.src||null,_=!k||k!==M;if(_){try{y.pause()}catch(P){console.log("pause error",P)}y.src=M;try{y.load()}catch(P){console.log("load error",P)}R.current=M}y.muted=!!l,y.volume=1,y.playbackRate=typeof a=="number"?a:1;const O=async()=>{_&&await new Promise(P=>{let C=!1;const j=()=>{C||(C=!0,y.removeEventListener("loadedmetadata",j),y.removeEventListener("canplay",j),P())};y.addEventListener("loadedmetadata",j),y.addEventListener("canplay",j),y.readyState>=1&&j()});try{await y.play()}catch(P){console.warn("el.play() failed",P)}};if(o==="loading"||o==="playing")O();else try{y.pause()}catch(P){console.log("pause error",P)}},[M,l,o,a,r]),h.useEffect(()=>{if(r)return;const y=t.current;if(!y||c!=="real")return;const k=s/1e3;if(Number.isFinite(k)){if(y.readyState<1){u.current=s;const _=()=>{if(u.current!=null){const O=u.current/1e3;try{y.currentTime=O}catch(P){console.log("currentTime보정 오류",P)}u.current=null}y.removeEventListener("loadedmetadata",_),y.removeEventListener("canplay",_)};y.addEventListener("loadedmetadata",_),y.addEventListener("canplay",_);return}if(Math.abs(y.currentTime-k)>.2)try{y.currentTime=k}catch(_){console.log("currentTime보정오류",_)}}},[s,c,r]);const g=Ce(y=>y.getGIFromCT);return h.useEffect(()=>{var _,O;if(r||c!=="real"||o!=="playing"&&o!=="loading")return;const y=g(i,s);if(y<0)return;const k=p(y);k!==I.current&&(I.current=k,x(k,"audio"),k%5===0&&((O=(_=w())==null?void 0:_.ensureVisibleGI)==null||O.call(_,k)))},[o,i,s,c,g,p,x,w,r]),m.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Aa(){return m.jsx(za,{})}const La="_scrubberWrap_uw0cd_2",Ga="_labels_uw0cd_9",Ha="_index_uw0cd_15",Na="_controls_uw0cd_19",Fa="_percent_uw0cd_25",Wa="_range_uw0cd_46",kt={scrubberWrap:La,labels:Ga,index:Ha,controls:Na,percent:Fa,range:Wa};function Da(){const e=Y(I=>I.isDev),t=q(I=>I.currentGlobalRunIndex),n=q(I=>I.totalRuns),r=q(I=>I.setCurrentGlobalRunIndex),o=q(I=>I.getSectionScrollApi),s=q(I=>I.giToPercentTotal),i=q(I=>I.percentToGITotal),c=q(I=>I.snapToReadable),l=Ce(I=>I.scrollLock),a=Ce(I=>I.pause),d=Ce(I=>I.play),S=Ce(I=>I.syncToGI),[b,v]=h.useState(()=>s(t||0));h.useEffect(()=>{v(s(t||0))},[t,s]);const x=h.useRef(!1),w=h.useMemo(()=>Math.max(0,Math.min(t??0,Math.max(0,(n??1)-1)))+1,[t,n]),p=h.useCallback(()=>{l&&(a(),x.current=!0)},[l,a]),f=h.useCallback(I=>{v(Number(I.currentTarget.value))},[]),u=h.useCallback(async()=>{const I=i(b),M=c(I);a(),r(M,"scrubber-commit"),S(M);const g=o();g!=null&&g.ensureVisibleGI&&await g.ensureVisibleGI(M),x.current&&(x.current=!1,d())},[b,i,c,a,r,S,o,d]),R=h.useMemo(()=>({"--pct":`${b}%`}),[b]),T=h.useMemo(()=>Math.round(b),[b]);return m.jsxs("div",{className:kt.scrubberWrap,children:[e&&m.jsx("div",{className:kt.labels,children:m.jsxs("span",{className:kt.index,children:[w," / ",n||0]})}),m.jsxs("div",{className:kt.controls,children:[m.jsx("input",{type:"range",className:kt.range,min:0,max:100,step:.5,value:b,style:R,onMouseDown:p,onTouchStart:p,onChange:f,onMouseUp:()=>{u()},onTouchEnd:()=>{u()},onKeyUp:I=>I.key==="Enter"||I.key===" "?void u():void 0,"aria-label":"진행률"}),m.jsxs("span",{className:kt.percent,children:[T,"%"]})]})]})}const $a=h.memo(Da),Va=h.memo(function(){const t=h.useContext(St),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=Ce(y=>y.playbackKind),o=Ce(y=>y.status),s=Ce(y=>y.fake),i=Y(y=>y.audioSpeed),c=Ce(y=>y.pause),l=q(y=>y.totalRuns),a=q(y=>y.currentGlobalRunIndex),d=q(y=>y.setCurrentGlobalRunIndex),S=q(y=>y.getSectionScrollApi),b=q(y=>y.nextReadableFrom),v=q(y=>y.edgeReadable),x=h.useRef(null),w=h.useRef(null),p=h.useRef(0),f=h.useRef(-1),u=!n&&r==="fake"&&o==="playing",R=Math.max(1,(s==null?void 0:s.totalWords)??1),T=h.useMemo(()=>{const y=200*i;return R/y*6e4},[R,i]),I=h.useMemo(()=>!l||l<=1||T<=0?0:(l-1)/T,[l,T]);h.useEffect(()=>{if(!u)return;const y=Math.max(0,Math.min(a??0,Math.max(0,(l??1)-1)));p.current=y,f.current=y,w.current=null},[u,a,l]);const M=h.useRef(-1);h.useEffect(()=>{if(!l){M.current=-1;return}const y=v(1);M.current=y??-1},[v,l]);const g=h.useCallback(y=>{(async()=>{var F,E;if(!u){x.current=null;return}if(!l||l<=1||I<=0){x.current=null;return}const k=w.current;w.current=y;const _=k==null?0:Math.max(0,y-k),O=l-1;p.current=Math.min(O,p.current+I*_);const P=Math.floor(p.current),C=S(),j=b(P,1);if(j==null){const B=M.current>=0?M.current:P;B!==f.current&&(f.current=B,d(B,"audio"),await((F=C==null?void 0:C.ensureVisibleGI)==null?void 0:F.call(C,B))),c(),x.current=null;return}const A=j;A!==f.current&&(f.current=A,d(A,"audio"),A%5===0&&await((E=C==null?void 0:C.ensureVisibleGI)==null?void 0:E.call(C,A))),x.current=requestAnimationFrame(g)})().catch(console.error)},[u,l,I,b,d,S,c]);return h.useEffect(()=>(u?x.current==null&&(x.current=requestAnimationFrame(g)):(x.current&&(cancelAnimationFrame(x.current),x.current=null),w.current=null),()=>{x.current&&(cancelAnimationFrame(x.current),x.current=null)}),[u,g]),null}),qa=h.memo(function(){return m.jsx(Va,{})}),Ua="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",Ka="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",Qa="_WPMSpeedButtonsWrap_r3byt_1",Ya="_btnWrap_r3byt_7",Xa="_label_r3byt_14",Za="_iconBtn_r3byt_22",Bt={WPMSpeedButtonsWrap:Qa,btnWrap:Ya,label:Xa,iconBtn:Za},lo=350,Ja=40,ec=.85,tc=h.memo(function(){const t=Y(b=>b.audioSpeed),n=Y(b=>b.incAudioSpeed),r=Y(b=>b.decAudioSpeed),o=h.useRef(null),s=h.useRef(lo),i=h.useRef(null),c=h.useCallback(b=>{const v=t;if(b==="inc"){if(v>=2)return!1;n()}else{if(v<=.3)return!1;r()}return!0},[t,n,r]),l=h.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),a=h.useCallback(()=>{i.current&&(s.current=Math.max(Ja,Math.floor(s.current*ec)),o.current=window.setTimeout(()=>{c(i.current)?a():l()},s.current))},[c,l]),d=h.useCallback(b=>{if(i.current)return;i.current=b,s.current=lo,c(b)&&a();const x=()=>l();window.addEventListener("mouseup",x,{once:!0}),window.addEventListener("touchend",x,{once:!0})},[a,c,l]);h.useEffect(()=>l,[l]);const S=`${(t*100).toFixed(0)}%`;return m.jsx("div",{onMouseLeave:l,className:Bt.WPMSpeedButtonsWrap,children:m.jsxs("div",{className:Bt.btnWrap,children:[m.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 느리게",onMouseDown:()=>d("dec"),onTouchStart:b=>{b.preventDefault(),d("dec")},onMouseUp:l,children:m.jsx("img",{src:Ua,alt:"느리게"})}),m.jsx("div",{className:Bt.label,style:{minWidth:"44px",textAlign:"center"},children:m.jsx("div",{children:S})}),m.jsx("button",{className:Bt.iconBtn,type:"button",title:"속도 빠르게",onMouseDown:()=>d("inc"),onTouchStart:b=>{b.preventDefault(),d("inc")},onMouseUp:l,children:m.jsx("img",{src:Ka,alt:"빠르게"})})]})})}),nc="_StepBtn_15t0r_1",rc={StepBtn:nc};function oc(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 sc(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 ao({direction:e}){const t=q(S=>S.currentGlobalRunIndex),n=q(S=>S.totalRuns),r=q(S=>S.hasReadableInDir),o=q(S=>S.computeStepTarget),s=q(S=>S.setCurrentGlobalRunIndex),i=Ce(S=>S.syncToGI),c=q(S=>S.getSectionScrollApi),l=h.useCallback(async S=>{var x,w;const b=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),v=o(b,S);s(v,"scrubber-step"),i(v),await((w=(x=c())==null?void 0:x.ensureVisibleGI)==null?void 0:w.call(x,v))},[t,n,o,s,i,c]),a=h.useMemo(()=>{const S=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),b=!n||!r(S,1),v=!n||!r(S,-1);return e==="left"?v:b},[e,n,t,r]),d=h.useCallback(()=>{l(e==="left"?-1:1)},[e,l]);return m.jsx("button",{className:rc.StepBtn,type:"button",onClick:d,disabled:a,title:e==="left"?"이전":"다음",children:e==="left"?m.jsx(oc,{}):m.jsx(sc,{})})}const ic="_GCPlayBtn_n54mc_1",lc="_playing_n54mc_34",co={GCPlayBtn:ic,playing:lc},ac=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>m.jsx("button",{className:`${co.GCPlayBtn} ${r?co.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function cc(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 uc(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 dc(){const e=Y(I=>I.showOverlays),t=q(I=>I.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=Y(I=>I.muteAudio),s=Y(I=>I.showPointer),i=Y(I=>I.showSplit),c=Y(I=>I.toggleMuteAudio),l=Y(I=>I.toggleShowPointer),a=Y(I=>I.toggleShowSplit),d=Y(I=>I.overlayCompactMode),S=Y(I=>I.toggleOverlayCompactMode),b=an(),v=xt();h.useEffect(()=>{const I=b.getState(),{syncToGI:M,useFake:g,useReal:y}=I,k=I.playbackKind,_=v.getState().progress.currentGlobalRunIndex??0;if(!r){k!=="fake"&&g();return}o?k!=="fake"&&(console.log("이부분일까?"),g()):k!=="real"&&(M(_),y())},[r,o,v,b]);const x=Ce(I=>I.play),w=Ce(I=>I.pause),p=Ce(I=>I.status),f=h.useCallback(I=>{I.stopPropagation(),p==="playing"||p==="loading"?w():x()},[p,x,w]),u=an(),R=xt(),T=h.useCallback(async I=>{var B,N;if(I.stopPropagation(),p==="playing"||p==="loading"){w();return}const{progress:M}=R.getState(),{currentGlobalRunIndex:g,snapToReadable:y,edgeReadable:k,setCurrentGlobalRunIndex:_,getSectionScrollApi:O}=M,P=u.getState(),C=P.currentClip,j=O==null?void 0:O(),A=typeof g=="number"?g:0,F=typeof y=="function"?y(A):A,E=typeof k=="function"?k(1):null;if(E!=null&&F>=E){_==null||_(E,"audio"),await((B=j==null?void 0:j.ensureVisibleGI)==null?void 0:B.call(j,E)),P.syncToGI(E);return}_==null||_(F,"audio"),await((N=j==null?void 0:j.ensureVisibleGI)==null?void 0:N.call(j,F)),P.syncToGI(F),x(C)},[p,w,x,u,R]);return m.jsxs("div",{className:`${Oe.wrap} ${e?Oe.visible:""} ${d?Oe.compact:""}`,onClick:I=>{I.stopPropagation()},onTouchStart:I=>{I.stopPropagation()},children:[!d&&m.jsx($a,{}),m.jsx("div",{style:d?{display:"none"}:void 0,children:r&&!o?m.jsx(Aa,{}):m.jsx(qa,{})}),m.jsxs("div",{className:Oe.controls,children:[m.jsxs("div",{className:Oe.row1,children:[m.jsx("div",{className:Oe.groupExpand,children:m.jsx("button",{type:"button",onClick:I=>{I.stopPropagation(),S()},className:Oe.compactBtn,title:d?"오버레이 확대":"오버레이 축소",children:d?m.jsx(uc,{size:24}):m.jsx(cc,{size:24})})}),m.jsxs("div",{className:Oe.groupPlayback,children:[m.jsx(ao,{direction:"left"}),m.jsx(ac,{size:34,isPlaying:p==="playing",onClick:o?T:f,title:p==="playing"?"일시정지":"재생"}),m.jsx(ao,{direction:"right"})]}),m.jsx("div",{className:Oe.groupSpeed,children:m.jsx(tc,{})})]}),m.jsxs("div",{className:Oe.row2,children:[m.jsxs("div",{className:Oe.groupFeatures,children:[r&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),c()},className:`${Oe.btn} ${o?"":Oe.btnActive}`,title:"오디오북 음소거 전환",children:[o?m.jsx(ha,{size:18}):m.jsx(ga,{size:18}),m.jsx("span",{className:Oe.label,children:"오디오북"})]}),m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),l()},className:`${Oe.btn} ${s?Oe.btnActive:""}`,title:"포인터 표시",children:[m.jsx(ma,{size:18}),m.jsx("span",{className:Oe.label,children:"포인터"})]}),n&&m.jsxs("button",{type:"button",onClick:I=>{I.stopPropagation(),a()},disabled:!n,className:`${Oe.btn} ${i?Oe.btnActive:""} ${n?"":Oe.btnForbidden}`,title:"끊어읽기 표시",children:[m.jsx(ba,{size:18}),m.jsx("span",{className:Oe.label,children:"끊어읽기"})]})]}),m.jsxs("div",{className:Oe.groupNav,children:[m.jsx(ca,{}),m.jsx(fn,{})]})]})]})]})}const fc=h.memo(dc);function pc(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 hc="_host_v5qx1_3",gc="_topbar_v5qx1_11",mc="_visible_v5qx1_32",bc="_backBtn_v5qx1_37",xc="_title_v5qx1_58",vc="_settingsBtn_v5qx1_67",Rt={host:hc,topbar:gc,visible:mc,backBtn:bc,title:xc,settingsBtn:vc};function Sc(){const e=Y(a=>a.showOverlays),t=Y(a=>a.overlayCompactMode),n=q(a=>a.onViewerClose),o=q(a=>a.section).ast.title,s=Y(a=>a.setSettingsOpen),i=Y(a=>a.setShowOverlays),c=h.useCallback(()=>{n==null||n()},[n]),l=h.useCallback(()=>{s(!0),i(!1)},[s,i]);return m.jsx("div",{className:Rt.host,children:m.jsxs("div",{className:`${Rt.topbar} ${e&&!t?Rt.visible:""}`,children:[m.jsx("button",{type:"button",className:Rt.backBtn,onClick:c,"aria-label":"뒤로가기",children:m.jsx(xa,{size:28})}),m.jsx("div",{className:Rt.title,children:m.jsx("span",{className:"truncate",children:o||"섹션 없음"})}),m.jsx("button",{type:"button",className:Rt.settingsBtn,onClick:l,"aria-label":"뷰어 설정",children:m.jsx(pc,{size:28})})]})})}const yc=h.memo(Sc),wc="_wrap_62su0_7",Cc="_wrapHidden_62su0_29",Ic="_wrapVisible_62su0_35",kc="_scrollArea_62su0_71",Rc="_row_62su0_81",Tc="_label_62su0_89",_c="_btn_62su0_95",Mc="_btnActive_62su0_106",Ec="_btnSmall_62su0_110",jc="_pill_62su0_122",Oc="_themeCircle_62su0_133",Pc="_themeCircleActive_62su0_146",Bc="_stepRow_62su0_151",zc="_stepLabel_62su0_159",Ac="_levelBox_62su0_172",Lc="_inlineFlex_62su0_177",Ee={wrap:wc,wrapHidden:Cc,wrapVisible:Ic,scrollArea:kc,row:Rc,label:Tc,btn:_c,btnActive:Mc,btnSmall:Ec,pill:jc,themeCircle:Oc,themeCircleActive:Pc,stepRow:Bc,stepLabel:zc,levelBox:Ac,inlineFlex:Lc};function Gc({visible:e}){const t=Y(g=>g.mode),n=Y(g=>g.setMode),r=Y(g=>g.theme),o=Y(g=>g.setTheme),s=Y(g=>g.fontFamily),i=Y(g=>g.setFontFamily),c=Y(g=>g.resetToDefaults),l=Y(g=>g.getFontLevel()),a=Y(g=>g.getLineLevel()),d=Y(g=>g.getMarginLevel()),S=Y(g=>g.setFontLevel),b=Y(g=>g.setLineLevel),v=Y(g=>g.setMarginLevel),x=Y(g=>g.pointerStyle),w=Y(g=>g.setPointerStyle),p=Y(g=>g.pointerColor),f=Y(g=>g.setPointerColor),u=Y(g=>g.breakMarks),R=Y(g=>g.toggleBreakMark),T=Y(g=>g.getBreakGapLevel()),I=Y(g=>g.setBreakGapLevel),M=`${Ee.wrap} ${e?Ee.wrapVisible:Ee.wrapHidden}`;return m.jsxs("div",{className:M,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[m.jsxs("div",{className:Ee.scrollArea,children:[m.jsx(zt,{label:"열람방식",children:m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx(Tt,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),m.jsx(Tt,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),m.jsx(zt,{label:"테마",children:m.jsx("div",{className:Ee.inlineFlex,children:Object.keys(on).map(g=>{const y=g,k=on[y];return m.jsx("button",{type:"button",onClick:()=>o(y),className:`${Ee.themeCircle} ${r===g?Ee.themeCircleActive:""}`,style:{background:k.bg,color:k.fg,fontFamily:s},title:String(g),"aria-label":`테마: ${String(g)}`,children:"A"},`${g}_tc_button`)})})}),m.jsx(zt,{label:"글꼴",children:m.jsx("div",{className:Ee.inlineFlex,children:Ao.map(g=>m.jsx(Tt,{active:s===g.value,onClick:()=>i(g.value),title:g.value,children:g.label},g.label))})}),m.jsx(tn,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>S(Math.max(1,l-1)),onInc:()=>S(Math.min(12,l+1))}),m.jsx(tn,{label:"줄 간격",level:a,min:1,max:7,onDec:()=>b(Math.max(1,a-1)),onInc:()=>b(Math.min(7,a+1))}),m.jsx(tn,{label:"여백",level:d,min:1,max:5,onDec:()=>v(Math.max(1,d-1)),onInc:()=>v(Math.min(5,d+1))}),m.jsx(zt,{label:"포인터",children:m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx(Tt,{active:x==="highlight",onClick:()=>w("highlight"),children:"형광펜"}),m.jsx(Tt,{active:x==="underline",onClick:()=>w("underline"),children:"밑줄"}),m.jsx("input",{type:"color",value:p,onChange:g=>f(g.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),m.jsx(zt,{label:"끊기표시",children:m.jsx("div",{className:Ee.inlineFlex,children:m.jsx(Tt,{active:u.slash,onClick:()=>R("slash"),children:"슬래쉬"})})}),m.jsx(tn,{label:"끊기간격",level:T,min:1,max:5,onDec:()=>I(Math.max(1,T-1)),onInc:()=>I(Math.min(5,T+1))})]}),m.jsx("div",{className:Ee.inlineFlex,style:{justifyContent:"center"},children:m.jsx("button",{type:"button",onClick:c,className:Ee.pill,children:"보기 설정 초기화"})})]})}function zt({label:e,children:t}){return m.jsxs("div",{className:Ee.row,children:[m.jsx("label",{className:Ee.label,children:e}),t]})}function Tt({active:e,onClick:t,title:n,children:r}){return m.jsx("button",{type:"button",onClick:t,title:n,className:`${Ee.btn} ${e?Ee.btnActive:""}`,children:r})}function tn({label:e,level:t,min:n,max:r,onDec:o,onInc:s}){const i=t<=n,c=t>=r;return m.jsxs("div",{className:Ee.stepRow,children:[m.jsx("label",{className:Ee.stepLabel,children:e}),m.jsxs("div",{className:Ee.inlineFlex,children:[m.jsx("button",{type:"button",onClick:o,disabled:i,className:Ee.btnSmall,"aria-label":"감소",children:"−"}),m.jsx("div",{className:Ee.levelBox,children:t}),m.jsx("button",{type:"button",onClick:s,disabled:c,className:Ee.btnSmall,"aria-label":"증가",children:"+"})]})]})}const Hc=h.memo(function(){const t=Y(i=>i.showOverlays),n=Y(i=>i.isSettingsOpen),r=q(i=>i.rangeStartGI),o=q(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(yc,{}),m.jsx(fc,{}),m.jsx("div",{style:{pointerEvents:"auto"},children:m.jsx(Gc,{visible:!t&&n})})]})}),Nc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,c,l)=>{let a=i;if(c){const d=(l==null?void 0:l.equalityFn)||Object.is;let S=i(r.getState());a=b=>{const v=i(b);if(!d(S,v)){const x=S;c(S=v,x)}},l!=null&&l.fireImmediately&&c(S,S)}return o(a)}),e(t,n,r)},Fc=Nc;function Wc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Dc(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 $c(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Dc((r==null?void 0:r.text)??"");return t}function Vc(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=v=>{if(!n)return null;const{g2ct:x}=n;if(!x)return null;const w=x[v];if(w)return{clip:w.clip,t:w.t};for(let p=1;p<=100&&v-p>=0;p++){const f=x[v-p];if(f)return{clip:f.clip,t:f.t}}for(let p=1;p<=100;p++){const f=x[v+p];if(f)return{clip:f.clip,t:f.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,c=0;const l=Math.max(1,$c(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const v=o(e.initialIndex);v&&(i=v.clip,c=v.t,r=void 0)}const a=s.length>0,d=a?"paused":"idle",S=a?"real":"fake",b=a?null:{totalWords:l};return qt(Fc((v,x)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,c),status:d,scrollLock:!1,playbackKind:S,fake:b,useFake:()=>v(w=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:w.status==="playing"})),useReal:()=>v(w=>({playbackKind:"real",fake:{totalWords:l},scrollLock:w.status==="playing"})),injectMap:w=>{if(n=w,typeof r=="number"){const p=o(r);p&&v(f=>({currentClip:Math.max(0,Math.min(p.clip,Math.max(0,f.clips.length-1))),currentTimeMs:Math.max(0,p.t)})),r=void 0}},setClipAndMs:(w,p)=>v(f=>{const u=Math.max(0,f.clips.length-1);return{currentClip:Math.max(0,Math.min(w,u)),currentTimeMs:Math.max(0,p),status:f.status,scrollLock:f.scrollLock}}),setClips:w=>v(p=>{const f=Array.isArray(w)?w:[],u=f.length>0;return{clips:f,currentClip:0,currentTimeMs:0,status:u?"paused":"idle",playbackKind:u?"real":"fake",fake:u?null:p.fake??{totalWords:l},scrollLock:!1}}),clear:()=>v(w=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:w.fake??{totalWords:l},scrollLock:!1})),play:(w,p)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),v(f=>{if(f.playbackKind==="fake")return{status:"playing",scrollLock:!0};const u=typeof w=="number"?w:f.currentClip,R=typeof p=="number"?p:f.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(u,Math.max(0,f.clips.length-1))),currentTimeMs:R,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),v({status:"paused",scrollLock:!1})},seek:w=>v(p=>({currentTimeMs:Math.max(0,w),status:p.status})),stop:()=>v({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>v(w=>{if(w.playbackKind==="fake")return w;const p=Math.max(0,w.clips.length-1);return{currentClip:Math.min(w.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>v(w=>w.playbackKind==="fake"?w:{currentClip:Math.max(0,w.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:w=>v(p=>p.playbackKind==="fake"||w<0||w>=p.clips.length?p:{currentClip:w,currentTimeMs:0}),getClipSrc:w=>{const p=x();if(!p.clips.length)return null;const f=typeof w=="number"?w:p.currentClip;return Wc(p.clips[f])},getGIFromCT:(w,p)=>{if(!n)return-1;const f=n.byClip[w];if(!f||f.length===0)return-1;let u=0,R=f.length-1,T=0;for(;u<=R;){const I=u+R>>1;f[I].t<=p?(T=I,u=I+1):R=I-1}return f[Math.max(0,Math.min(T,f.length-1))].g},getCTFromGI:w=>{if(!n)return null;const{g2ct:p}=n;if(!p)return null;let f=p[w];if(!f){let u=w-1;const R=Math.max(0,w-100);for(;u>=R;){if(p[u]){f=p[u];break}u--}if(!f){let T=w+1;const I=w+100;for(;p[T]==null&&T<=I;)T++;p[T]&&(f=p[T])}}return f?{clip:f.clip,timeMs:f.t}:null},getMetaByGI:w=>{const p=x().getCTFromGI(w);return p?{clipIndex:p.clip,timeMs:p.timeMs}:null},syncToGI:w=>{const p=x().getMetaByGI(w);p&&x().setClipAndMs(p.clipIndex,p.timeMs)},_onTime:w=>v({currentTimeMs:w,status:"playing",scrollLock:!0}),_onEnded:()=>v(w=>{if(w.playbackKind==="fake")return{status:"ended",scrollLock:!1};const p=Math.max(0,w.clips.length-1);return w.currentClip>=p?{status:"ended",scrollLock:!1}:{currentClip:Math.min(w.currentClip+1,p),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>v({status:"error",scrollLock:!1}),_setStatusOnly:w=>v({status:w})})))}function qc({children:e,initialState:t}){const n=h.useContext(St)??void 0,r=h.useMemo(()=>Vc({...t,recorderStore:n}),[t,n]);return m.jsx(vn.Provider,{value:r,children:e})}function Uc(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 c of r){if((c==null?void 0:c.type)==="image")continue;const l=(c==null?void 0:c.runs)??[];for(let a=0;a<l.length;a++){const d=l[a],S=o+a;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:S}),n[S]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(c=>c.sort((l,a)=>l.t-a.t)),{byClip:t,g2ct:n}}function Kc(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 Qc(e){const t=Dl(e),n=$l(t),r=t.reduce((d,S)=>d+(S||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],c=[];return e.forEach((d,S)=>{var p;if(d.type!=="paragraph")return;const b=n[S]??0,v=d.runs??[];for(let f=0;f<v.length;f++){const u=((p=v[f])==null?void 0:p.text)||"";or(u)&&(s[b+f]=1)}const w=Vl(v,b).map(f=>{var I;const u=f.startG-b,R=f.endG-f.startG+1;let T=-1;for(let M=0;M<R;M++){const g=((I=v[u+M])==null?void 0:I.text)??"";if(or(g)){T=f.startG+M;break}}return{startG:f.startG,endG:f.endG,r0:u,len:R,firstReadableGI:T,splitIndex:f.splitIndex}});c[S]=w;for(const f of w){const u=i.length;for(let R=f.startG;R<=f.endG;R++)o[R]=u;i.push(f)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:c},layout:{prefix:n,totalRuns:r}}}function Yc(e){const{section:t,onViewerClose:n,onSectionNav:r,isCanPrev:o,isCanNext:s,nav:i,layout:c,initialIndex:l,mountTime:a}=e,d=c.totalRuns??0,S=typeof l=="number"?l:d>0?0:-1,b=S>=0?Kc(i.readableGi,S,d):-1;return{section:t,sectionId:t.section_id,onViewerClose:n,onSectionNav:r,isCanPrev:o??!1,isCanNext:s??!1,currentGlobalRunIndex:b,lastUpdateBy:"program",totalRuns:d,pageIndex:0,sectionLoading:!0,_loadingStartTime:a,_scrollApi:void 0,derivedNav:i,layout:c,rangeStartGI:null,rangeEndGI:null}}function Xc(e){const{section:t,initialIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,eventBridgeStore:c}=e,l=t.ast.blocks,{nav:a,layout:d}=Qc(l),S=Date.now(),b=Yc({section:t,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i,nav:a,layout:d,initialIndex:n,mountTime:S});return c&&queueMicrotask(()=>{c.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},S),c.getState().emit({type:"loading_start",payload:{}},S)}),qt((v,x)=>{const w=E=>{v(B=>B.progress._scrollApi===E?B:{progress:{...B.progress,_scrollApi:E}})},p=()=>x().progress._scrollApi,f=E=>{v(B=>{const N=B.progress;if(N.totalRuns===E)return B;const $=N.currentGlobalRunIndex<0&&E>0;return{progress:{...N,totalRuns:E,currentGlobalRunIndex:$?0:N.currentGlobalRunIndex,lastUpdateBy:$?"program":N.lastUpdateBy}}})},u=(E,B="program")=>{const N=x().progress.currentGlobalRunIndex,$=x().progress,V=$.totalRuns>0?Math.max(-1,Math.min(E,$.totalRuns-1)):E;N===V&&$.lastUpdateBy===B||(v(le=>({progress:{...le.progress,currentGlobalRunIndex:V,lastUpdateBy:B}})),N!==V&&c&&c.getState().emit({type:"global_index_change",payload:{globalIndex:V}}))},R=E=>{const{sectionLoading:B,_loadingStartTime:N}=x().progress;if(B===E)return;const $=Date.now();if(E)v(V=>({progress:{...V.progress,sectionLoading:!0,_loadingStartTime:$}})),c&&c.getState().emit({type:"loading_start",payload:{}});else{const le=(N?$-N:0)/1e3;v(ae=>({progress:{...ae.progress,sectionLoading:!1,_loadingStartTime:null}})),c&&c.getState().emit({type:"loading_end",payload:{duration:le}})}},T=E=>{v(B=>({progress:{...B.progress,pageIndex:E}}))},I=(E,B)=>{const $=x().progress.rangeStartGI==null;if(v(V=>({progress:{...V.progress,rangeStartGI:Math.min(E,B),rangeEndGI:Math.max(E,B)}})),c){const V=y();c.getState().emit({type:$?"range_select":"range_change",payload:{startGI:Math.min(E,B),endGI:Math.max(E,B),text:V}})}},M=()=>{v(E=>({progress:{...E.progress,rangeStartGI:null,rangeEndGI:null}})),c&&c.getState().emit({type:"range_clear",payload:{}})},g=E=>{const{rangeStartGI:B,rangeEndGI:N}=x().progress;B==null||N==null||(E<B?v($=>({progress:{...$.progress,rangeStartGI:E}})):E>N?v($=>({progress:{...$.progress,rangeEndGI:E}})):M())},y=()=>{var ye;const{rangeStartGI:E,rangeEndGI:B,section:N,layout:$}=x().progress;if(E==null||B==null||!$)return"";const V=((ye=N.ast)==null?void 0:ye.blocks)??[],le=$.prefix,ae=[];for(let we=0;we<V.length;we++){const Z=V[we];if(Z.type!=="paragraph")continue;const Q=Z.runs??[],z=le[we]??0;for(let K=0;K<Q.length;K++){const ee=z+K;ee>=E&&ee<=B&&ae.push(Q[K].text??"")}}return ae.join("")},k=E=>{const{totalRuns:B,derivedNav:N}=x().progress,$=N==null?void 0:N.readableGi;if(!$||B<=0)return E;const V=B,le=Math.max(0,Math.min(E,V-1));if($[le])return le;let ae=le-1,ye=le+1;for(;ae>=0||ye<V;){if(ye<V&&$[ye])return ye;if(ae>=0&&$[ae])return ae;ye+=1,ae-=1}return le},_=(E,B)=>{const{totalRuns:N,derivedNav:$}=x().progress,V=$==null?void 0:$.readableGi;if(!V||N<=0)return null;if(B>0){for(let le=Math.min(Math.max(E,0),N-1);le<N;le+=1)if(V[le])return le}else for(let le=Math.min(Math.max(E,0),N-1);le>=0;le-=1)if(V[le])return le;return null},O=E=>{const{totalRuns:B,derivedNav:N}=x().progress,$=N==null?void 0:N.readableGi;if(!$||B<=0)return null;if(E>0){for(let V=B-1;V>=0;V-=1)if($[V])return V}else for(let V=0;V<B;V+=1)if($[V])return V;return null};return{progress:{...b,registerSectionScrollApi:w,getSectionScrollApi:p,setTotalRuns:f,setCurrentGlobalRunIndex:u,setSectionLoading:R,setPageIndex:T,setRange:I,clearRange:M,extendRange:g,getRangeText:y,snapToReadable:k,nextReadableFrom:_,edgeReadable:O,hasReadableInDir:(E,B)=>_(E+(B>0?1:-1),B)!=null,computeStepTarget:(E,B)=>{const{totalRuns:N,derivedNav:$}=x().progress;if(!N||N<=0)return E;const V=($==null?void 0:$.groups)??[],le=$==null?void 0:$.giToGroupIdx;if(!V.length||!le){const z=N-1;return k(Math.max(0,Math.min(E+B,z)))}let ae=le[E]??-1;if(ae<0||ae>=V.length)for(let Q=0;Q<V.length;Q+=1){const z=V[Q];if(E>=z.startG&&E<=z.endG){ae=Q;break}}if(ae<0||ae>=V.length)return O(B)??k(E);const ye=Q=>Q>=0&&Q<V.length&&(V[Q].firstReadableGI??-1)>=0;let we=ae+B;for(;we>=0&&we<V.length&&!ye(we);)we+=B;if(we<0||we>=V.length)return O(B)??k(E+B);const Z=V[we].firstReadableGI;return Z>=0?Z:k(E+B)},giToPercentTotal:E=>{const B=x().progress.totalRuns;return!B||B<=1?0:Math.max(0,Math.min(E,B-1))/(B-1)*100},percentToGITotal:E=>{const B=x().progress.totalRuns;if(!B||B<=1)return 0;const N=Math.max(0,Math.min(E,100)),$=Math.round(N/100*(B-1));return Math.max(0,Math.min($,B-1))}}}})}function Zc({children:e,initialState:t}){const n=h.useContext(St),r=h.useMemo(()=>Xc({...t,eventBridgeStore:n}),[t,n]);return m.jsx(ir.Provider,{value:r,children:e})}function Jc({children:e,initialState:t}){const n=h.useContext(St)??void 0,r=h.useRef(Qs({init:t,recorderStore:n}));return m.jsx(sr.Provider,{value:r.current,children:e})}const eu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=q(u=>u.section),o=h.useMemo(()=>{var u;return((u=r.ast)==null?void 0:u.blocks)??[]},[r]),s=Y(u=>u.marginX),i=Y(u=>u.lineHeight),c=Y(u=>u.fontSizePx),l=Y(u=>u.fontFamily),a=Y(u=>u.viewportHeight),d=q(u=>{var R;return((R=u.layout)==null?void 0:R.prefix)??[]}),S=q(u=>{var R;return((R=u.derivedNav)==null?void 0:R.splitGroupsPerBlock)??[]}),b=e[t],v=h.useMemo(()=>{const u=[];return o.forEach((R,T)=>{(R.type==="paragraph"||R.type==="image")&&u.push(T)}),u},[o]),x=h.useMemo(()=>{if(!b)return[];const u=[];for(let R=b.startBlock;R<=b.endBlock;R++){const T=v[R];T!=null&&u.push(T)}return u},[b,v]),w=h.useMemo(()=>{const u=[];for(const R of x){const T=o[R];(T==null?void 0:T.type)==="paragraph"&&u.push({b:T,originalBlockIndex:R})}return u},[x,o]),p=h.useMemo(()=>{const u=[],R=vr();return w.forEach((T,I)=>{u[I]=Sr(T.b,R)}),u},[w]),f=(u,R,T)=>{if(!u||u.length===0)return[];const I=[];for(const M of u){const g=M.startG,y=M.endG;if(y<R||g>T)continue;const k=Math.max(g,R),_=Math.min(y,T),O=k-g|0,P=Math.max(0,_-k+1);if(P<=0)continue;const C=(M.r0??0)+O;I.push({...M,startG:k,endG:_,r0:C,len:P})}return I};return m.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"flex",alignItems:"stretch",justifyContent:"center",fontFamily:l,fontSize:c,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((u,R)=>{var Q;const T=o[u],I=R===0,M=R===x.length-1,g={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},y=`sec-${r.section_id}/blk-${T.id??u}`;if(T.type==="image"){const{src:z,alt:K,width:ee,height:H}=T,ne=ee&&H?`${ee} / ${H}`:"4 / 3",D=a>80?Math.floor((a-80)*.6):void 0;return m.jsx("div",{style:g,children:m.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[m.jsx("div",{style:{position:"relative",width:"100%",maxHeight:D,aspectRatio:ne},children:m.jsx("img",{src:z,alt:K||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),K&&m.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:K})]})},y)}const k=T,_=w.findIndex(z=>z.originalBlockIndex===u),O=_>=0?p[_]:void 0,P=k.runs??[],C=P.length;let j=0,A=Math.max(0,C-1);I&&b.startOffsetInBlock!=null&&(j=Math.min(Math.max(0,b.startOffsetInBlock),A)),M&&b.endOffsetInBlock!=null&&(A=Math.max(j,Math.min(b.endOffsetInBlock,A)));const F=j>0,E=d[u]??0,B=S[u]??[],N=E+j,$=E+A;let V=f(B,N,$);const le=E+j;V=V.map(z=>{const K=Math.max(0,(z.startG??N)-le),ee=z.len??Math.max(1,(z.endG??$)-(z.startG??N)+1);return{...z,r0:K,len:ee}});const ae=j<=A?P.slice(j,A+1):[],ye=k.list?k.list.level*24:0,we=((Q=k.list)==null?void 0:Q.kind)==="bullet"?k.list.glyph??"•":void 0,Z=F?void 0:O??we;return m.jsx("div",{style:g,children:m.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:ye,textAlign:k.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[k.list&&Z?m.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:Z||""}):null,m.jsx(ms,{preGroups:V,runs:ae,ns:y,baseIndex:le,sectionId:String(r.section_id)})]})},y)})})]})})},uo=.5;function tu(e,t){const n=h.useRef(null),r=h.useRef(null),o=h.useRef(!1);h.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 a=l[0],{width:d,height:S}=a.contentRect,b=r.current;if(!b){r.current={w:d,h:S};return}Math.abs(b.w-d)<uo&&Math.abs(b.h-S)<uo||(r.current={w:d,h:S},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const c=()=>s();return window.addEventListener("resize",c),()=>{window.removeEventListener("resize",c),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function nu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,shouldIgnoreSwipe:i,horizontalThreshold:c=120,verticalTolerance:l=40,velocityThreshold:a=.6,singleDelayMs:d=250,doubleClickWindowMs:S=300,suppressAfterSwipeMs:b=250,onDragMove:v,onDragEnd:x,pageTransitionThreshold:w}=e,p=w??c,f=Math.min(20,c),u=ot.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),R=()=>{u.current.singleTimer!=null&&(window.clearTimeout(u.current.singleTimer),u.current.singleTimer=null)},T=()=>{var j;const C=((j=document==null?void 0:document.body)==null?void 0:j.style)??null;C&&u.current.prevUserSelect!=null&&(C.userSelect=u.current.prevUserSelect,u.current.prevUserSelect=null),u.current.capturedEl&&u.current.pid!=null&&typeof u.current.capturedEl.hasPointerCapture=="function"&&u.current.capturedEl.hasPointerCapture(u.current.pid)&&u.current.capturedEl.releasePointerCapture(u.current.pid),u.current.capturedEl=null},I=ot.useCallback(C=>{const j=i??s;j!=null&&j(C.target)||(u.current.pid=C.pointerId,u.current.startX=C.clientX,u.current.startY=C.clientY,u.current.startT=C.timeStamp,u.current.swiping=!1,u.current.canceledClick=!1,u.current.capturedEl=C.currentTarget)},[i,s]),M=ot.useCallback(C=>{var B;if(u.current.pid==null||C.pointerId!==u.current.pid)return;const j=C.clientX-u.current.startX,A=C.clientY-u.current.startY,F=Math.abs(j),E=Math.abs(A);if(!u.current.swiping){if(F>=f&&E<=l&&F>E){u.current.swiping=!0,u.current.canceledClick=!0;const N=u.current.capturedEl;if(N&&typeof N.setPointerCapture=="function")try{N.setPointerCapture(C.pointerId)}catch{}const $=((B=document==null?void 0:document.body)==null?void 0:B.style)??null;$&&(u.current.prevUserSelect=$.userSelect??null,$.userSelect="none"),C.preventDefault()}return}v==null||v(j),C.preventDefault()},[l,v,f]),g=ot.useCallback(C=>{if(u.current.pid==null||C.pointerId!==u.current.pid)return;const j=C.timeStamp-u.current.startT,A=C.clientX-u.current.startX;if(u.current.swiping){const F=Math.abs(A)/Math.max(1,j);Math.abs(A)>=p||F>=a?A<0?n():t():x==null||x(),u.current.lastSwipeAt=C.timeStamp}else C.timeStamp-u.current.lastUpT;T(),u.current.lastUpT=C.timeStamp,u.current.pid=null,u.current.swiping=!1},[p,a,n,t,S,x]),y=ot.useCallback(()=>{u.current.swiping&&(x==null||x()),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[x]),k=ot.useCallback(C=>{var j,A;(A=(j=u.current.capturedEl)==null?void 0:j.hasPointerCapture)!=null&&A.call(j,C.pointerId)||u.current.pid!=null&&u.current.swiping&&(x==null||x(),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1)},[x]),_=ot.useCallback(()=>{u.current.pid!=null&&u.current.swiping&&(x==null||x()),T(),u.current.pid=null,u.current.swiping=!1,u.current.canceledClick=!1},[x]),O=ot.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}r&&u.current.singleTimer==null&&(u.current.singleTimer=window.setTimeout(()=>{u.current.singleTimer=null,r(C)},d))}},[r,s,d,b]),P=ot.useCallback(C=>{if(!(s!=null&&s(C.target))&&!(C.timeStamp-u.current.lastSwipeAt<b)){if(u.current.canceledClick){u.current.canceledClick=!1;return}R(),o==null||o(C)}},[o,s,b]);return ot.useEffect(()=>()=>{R(),T()},[]),{onPointerDown:I,onPointerMove:M,onPointerUp:g,onPointerCancel:y,onPointerLeave:k,onLostPointerCapture:_,onClick:O,onDoubleClick:P}}var Bn,fo;function Cs(){if(fo)return Bn;fo=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Bn=e,Bn}var zn,po;function ru(){if(po)return zn;po=1;var e=typeof Yt=="object"&&Yt&&Yt.Object===Object&&Yt;return zn=e,zn}var An,ho;function Is(){if(ho)return An;ho=1;var e=ru(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return An=n,An}var Ln,go;function ou(){if(go)return Ln;go=1;var e=Is(),t=function(){return e.Date.now()};return Ln=t,Ln}var Gn,mo;function su(){if(mo)return Gn;mo=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,bo;function iu(){if(bo)return Hn;bo=1;var e=su(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Hn=n,Hn}var Nn,xo;function ks(){if(xo)return Nn;xo=1;var e=Is(),t=e.Symbol;return Nn=t,Nn}var Fn,vo;function lu(){if(vo)return Fn;vo=1;var e=ks(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var c=n.call(i,o),l=i[o];try{i[o]=void 0;var a=!0}catch{}var d=r.call(i);return a&&(c?i[o]=l:delete i[o]),d}return Fn=s,Fn}var Wn,So;function au(){if(So)return Wn;So=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Wn=n,Wn}var Dn,yo;function cu(){if(yo)return Dn;yo=1;var e=ks(),t=lu(),n=au(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(c){return c==null?c===void 0?o:r:s&&s in Object(c)?t(c):n(c)}return Dn=i,Dn}var $n,wo;function uu(){if(wo)return $n;wo=1;function e(t){return t!=null&&typeof t=="object"}return $n=e,$n}var Vn,Co;function du(){if(Co)return Vn;Co=1;var e=cu(),t=uu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Vn=r,Vn}var qn,Io;function fu(){if(Io)return qn;Io=1;var e=iu(),t=Cs(),n=du(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,c=parseInt;function l(a){if(typeof a=="number")return a;if(n(a))return r;if(t(a)){var d=typeof a.valueOf=="function"?a.valueOf():a;a=t(d)?d+"":d}if(typeof a!="string")return a===0?a:+a;a=e(a);var S=s.test(a);return S||i.test(a)?c(a.slice(2),S?2:8):o.test(a)?r:+a}return qn=l,qn}var Un,ko;function pu(){if(ko)return Un;ko=1;var e=Cs(),t=ou(),n=fu(),r="Expected a function",o=Math.max,s=Math.min;function i(c,l,a){var d,S,b,v,x,w,p=0,f=!1,u=!1,R=!0;if(typeof c!="function")throw new TypeError(r);l=n(l)||0,e(a)&&(f=!!a.leading,u="maxWait"in a,b=u?o(n(a.maxWait)||0,l):b,R="trailing"in a?!!a.trailing:R);function T(C){var j=d,A=S;return d=S=void 0,p=C,v=c.apply(A,j),v}function I(C){return p=C,x=setTimeout(y,l),f?T(C):v}function M(C){var j=C-w,A=C-p,F=l-j;return u?s(F,b-A):F}function g(C){var j=C-w,A=C-p;return w===void 0||j>=l||j<0||u&&A>=b}function y(){var C=t();if(g(C))return k(C);x=setTimeout(y,M(C))}function k(C){return x=void 0,R&&d?T(C):(d=S=void 0,v)}function _(){x!==void 0&&clearTimeout(x),p=0,d=w=S=x=void 0}function O(){return x===void 0?v:k(t())}function P(){var C=t(),j=g(C);if(d=arguments,S=this,w=C,j){if(x===void 0)return I(w);if(u)return clearTimeout(x),x=setTimeout(y,l),T(w)}return x===void 0&&(x=setTimeout(y,l)),v}return P.cancel=_,P.flush=O,P}return Un=i,Un}var hu=pu();const gu=Po(hu);function mu(e,t=200,n,r){const o=h.useRef(e),s=h.useRef(n);h.useEffect(()=>{o.current=e},[e]),h.useEffect(()=>{s.current=n},[n]);const i=h.useMemo(()=>{const c=gu((...a)=>{o.current(...a)},t,r),l=((...a)=>{var d;(d=s.current)==null||d.call(s),c(...a)});return l.cancel=c.cancel.bind(c),l.flush=c.flush.bind(c),l},[t,r]);return h.useEffect(()=>()=>i.cancel(),[i]),i}const Rs=new Map,Ts=e=>Rs.get(e)??0,bu=e=>{const t=Ts(e)+1;return Rs.set(e,t),t};class _s extends Error{constructor(){super("calcPages canceled due to a newer invocation");Cr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const et=(e,t)=>{if(e!==Ts(t))throw new _s},Kn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},Ro=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 c=s.getClientRects(),l=c.length?c[c.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},xu=(e,t,n)=>{if(n<16)return async(o=24)=>{et(e,t)};let r=0;return async(o=24)=>{r++,r%o===0&&(et(e,t),await new Promise(s=>requestAnimationFrame(()=>s())),et(e,t))}};async function vu({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:c,lineHeight:l,showSplit:a,breakGapPx:d=0,showSlash:S,paragraphMarkers:b,playbackScale:v=1,viewportHeight:x=0,instanceId:w="default"}){var f,u,R;const p=bu(w);et(p,w);try{const T=Math.abs(v-1)>.001,I=1/v;T&&(t.style.transform=`scale(${I})`,t.style.transformOrigin="top left");const M=Math.max(0,e.offsetWidth||0),g=Math.max(0,Math.min(M,o));t.style.maxWidth=`${g}px`,et(p,w);let y=Math.round(n.offsetHeight||0);y||(y=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",v.toFixed(4),T?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",M),console.log("[calcPages] pageBoxWidth:",g),console.log("[calcPages] maxPageHeight:",y),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const k=1.5,_=(H,ne)=>ne+H<=y-k,O=getComputedStyle(e),P={letterSpacing:O.letterSpacing,wordSpacing:O.wordSpacing,fontKerning:O.fontKerning||"normal",fontVariantLigatures:O.fontVariantLigatures||"normal",textTransform:O.textTransform||"none",direction:O.direction||"ltr",wordBreak:O.wordBreak||"keep-all",overflowWrap:O.overflowWrap||O.wordWrap||"break-word",hyphens:O.hyphens||"manual"},C=H=>{H.style.letterSpacing=P.letterSpacing||"",H.style.wordSpacing=P.wordSpacing||"",H.style.fontKerning=P.fontKerning||"",H.style.fontVariantLigatures=P.fontVariantLigatures||"",H.style.textTransform=P.textTransform||"",H.style.direction=P.direction||"",H.style.wordBreak=P.wordBreak||"",H.style.wordWrap=P.overflowWrap||"",H.style.overflowWrap=P.overflowWrap||"",H.style.hyphens=P.hyphens||""},j=g,A=Math.max(0,j-2*(s||0));n.innerHTML="";const F=document.createElement("div");F.style.boxSizing="border-box",F.style.width=`${j}px`,F.style.maxWidth=`${j}px`,F.style.margin="0 auto",F.style.display="flex",n.appendChild(F);const E=document.createElement("div");E.style.boxSizing="border-box",E.style.paddingRight=`${s}px`,E.style.paddingLeft=`${s}px`,E.style.width=`${j}px`,E.style.maxWidth=`${j}px`,E.style.margin="0 auto",E.style.display="flex",E.style.justifyContent="center",E.style.height="auto",F.appendChild(E);const B=new Map,N={},$=xu(p,w,r.length),V=(H,ne)=>{const D=document.createElement("p");return D.style.margin="8px 0",D.style.paddingLeft=ne?`${ne}px`:"0",D.style.textAlign=H.textAlign??"start",D.style.whiteSpace="pre-wrap",D.style.lineHeight=String(l),D.style.fontSize=`${c}px`,D.style.boxSizing="border-box",D.style.fontFamily=i??"",D.style.width="100%",C(D),D},le=(H,ne)=>{const D=ne??[],X=document.createDocumentFragment();for(let re=0;re<D.length;re++){const te=D[re],ue=document.createElement("span");ue.dataset.runbox=String(re),ue.style.whiteSpace="pre-wrap";const oe=document.createElement("span");if(oe.dataset.run=String(re),oe.textContent=(te==null?void 0:te.text)??"",oe.style.whiteSpace="pre-wrap",te!=null&&te.bold&&(oe.style.fontWeight="700"),te!=null&&te.italic&&(oe.style.fontStyle="italic"),te!=null&&te.underline&&(oe.style.textDecoration="underline"),ue.appendChild(oe),a&&(te!=null&&te.split)&&re!==D.length-1){const be=Math.max(0,(d??0)/2),pe=document.createElement("span");pe.style.display="inline-block",pe.style.width=`${be}px`;const Se=document.createElement("span");if(Se.style.display="inline-block",Se.style.width=`${be}px`,ue.appendChild(pe),S){const Re=document.createElement("span");Re.textContent=" / ",ue.appendChild(Re)}ue.appendChild(Se)}X.appendChild(ue)}H.appendChild(X)},ae=x>80?Math.floor((x-80)*.6):void 0,ye=H=>{const ne=H!=null&&H.width&&(H!=null&&H.height)?`${H.width} / ${H.height}`:"4 / 3",D=document.createElement("div");D.style.margin="12px 0",D.style.textAlign="center",D.style.width=`${A}px`;const X=document.createElement("div");X.style.position="relative",X.style.width="100%",ae&&(X.style.maxHeight=`${ae}px`),X.style.aspectRatio=ne;const re=document.createElement("div");if(re.style.position="absolute",re.style.inset="0",re.style.width="100%",re.style.height="100%",X.appendChild(re),D.appendChild(X),H!=null&&H.alt){const te=document.createElement("div");te.style.fontSize="12px",te.style.color="#6B7280",te.style.marginTop="4px",te.textContent=String(H.alt),C(te),D.appendChild(te)}return D};for(let H=0;H<r.length;H++){et(p,w);const ne=r[H];if(E.dataset.block=String(H),E.innerHTML="",ne.kind==="image"){const Se=ne.block,Re=ye(Se);E.appendChild(Re);const Be=Re.getBoundingClientRect(),{mt:je,mb:Ge}=Kn(Re);N[H]={contentH:Math.ceil(Be.height),mt:je,mb:Ge},await $(24);continue}const D=ne.block,X=D.list?(D.list.level??0)*24:0,re=ne.paraIndex??0,te=b[re]??(((f=D.list)==null?void 0:f.kind)==="bullet"?((u=D.list)==null?void 0:u.glyph)??"•":void 0);if(!!(D.list&&te)){const Se=V(D,X);Se.dataset.variant="with";const Re=V(D,X);Re.dataset.variant="no";const Be=document.createElement("span");Be.textContent=`${te} `,Be.style.minWidth="16px",Be.style.display="inline-block",Be.style.whiteSpace="nowrap",Be.style.userSelect="none",Se.appendChild(Be),le(Se,D.runs),le(Re,D.runs);const je=document.createDocumentFragment();je.appendChild(Se),je.appendChild(Re),E.appendChild(je)}else{const Se=V(D,X);Se.dataset.variant="with",le(Se,D.runs),E.appendChild(Se)}const oe=E.querySelector('p[data-variant="with"]'),be=E.querySelector('p[data-variant="no"]'),pe=be??oe;if(oe&&pe){const Se=Ro(oe),Re=Ro(pe),{mt:Be,mb:je}=Kn(oe),{mt:Ge,mb:rt}=Kn(pe),De=((R=D.runs)==null?void 0:R.length)??0,Pe=be?Re:Se,Xe=be?Ge:Be,Ue=be?rt:je;if(H<3){const ut=oe.getBoundingClientRect().height;console.log(`[calcPages] para ${H}: height=${ut.toFixed(2)}, lastBottom=[${Se.slice(-3).map(Pt=>Pt.toFixed(1)).join(",")}], runs=${De}`)}B.set(H,{runsLen:De,lastBottomWith:Se,lastBottomNo:Pe,mtWith:Be,mbWith:je,mtNo:Xe,mbNo:Ue})}await $(24)}et(p,w),E.innerHTML="";const we=(H,ne,D,X)=>{if(ne>D)return{top:0,content:0,mb:0};const re=X?H.lastBottomNo:H.lastBottomWith,te=X?H.mtNo:H.mtWith,ue=X?H.mbNo:H.mbWith,oe=X?0:te,be=ne>0?re[ne-1]??0:0,pe=Math.max(0,(re[D]??0)-be);return{top:oe,content:pe,mb:ue}},Z=[];let Q=0,z,K=null,ee=null;for(;Q<r.length;){et(p,w);const H=Q;let ne=0,D=0,X=z;X!=null&&K===Q&&ee!=null&&(X=Math.max(X,ee+1));let re=-1,te;for(;Q<r.length;){if(et(p,w),r[Q].kind==="image"){const Pe=N[Q]??{contentH:0,mt:0,mb:0},Ue=(ne===0?Pe.mt:D+Pe.mt)+Pe.contentH;if(_(Ue,ne)){ne+=Ue,re=Q,te=void 0,D=Pe.mb,Q+=1,z=void 0,K=null,ee=null;continue}if(ne===0){Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{}}),Q+=1,z=void 0,K=null,ee=null,D=0;break}break}const oe=B.get(Q),be=oe.runsLen,pe=Q===H&&X!=null?X:0;if(pe>=be){Q+=1,z=void 0,K=null,ee=null;continue}const Se=pe>0,Re=we(oe,pe,be-1,Se),je=(ne===0?Re.top:D+Re.top)+Re.content;if(_(je,ne)){ne+=je,re=Q,te=be-1,D=Re.mb,Q+=1,z=void 0,K=null,ee=null;continue}let Ge=pe,rt=be-1,De=pe-1;for(;Ge<=rt;){et(p,w);const Pe=Ge+rt>>1,Xe=we(oe,pe,Pe,Se),Ue=(ne===0?Xe.top:D+Xe.top)+Xe.content;_(Ue,ne)?(De=Pe,Ge=Pe+1):rt=Pe-1}if(De>=pe){Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{},endOffsetInBlock:De}),z=De+1,K=Q,ee=De,D=0;break}if(ne>0){Z.push({startBlock:H,endBlock:re>=0?re:Math.min(Q-1,r.length-1),...X!=null?{startOffsetInBlock:X}:{},...te!=null?{endOffsetInBlock:te}:{}}),D=0;break}else{const Pe=pe;Z.push({startBlock:H,endBlock:Q,...X!=null?{startOffsetInBlock:X}:{},endOffsetInBlock:Pe}),z=Pe+1,K=Q,ee=Pe,D=0;break}}(Z.length===0||Z[Z.length-1].startBlock!==H)&&Z.push({startBlock:H,endBlock:re>=0?re:Math.min(Q-1,r.length-1),...X!=null?{startOffsetInBlock:X}:{},...te!=null?{endOffsetInBlock:te}:{}})}return F.remove(),T&&(t.style.transform="",t.style.transformOrigin=""),et(p,w),{pages:Z,pageByRunIndex:null}}catch(T){throw console.error(T),T}}function To(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 c=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+c}return null}function Su(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let c=i.startBlock;c<=i.endBlock;c++){const l=n[c];if(!l||l.kind!=="paragraph")continue;const a=((o=l.block.runs)==null?void 0:o.length)??0;if(!a)continue;let d=0,S=a-1;c===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,S))),c===i.endBlock&&i.endOffsetInBlock!=null&&(S=Math.max(d,Math.min(i.endOffsetInBlock,S)));const b=r[l.originalIndex]??0,v=b+d,x=b+S;if(e>=v&&e<=x)return s}}return-1}function yu(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 wu(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 Cu(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 Iu(){var wr;const e=h.useId(),t=q(W=>W.section),n=q(W=>W.sectionLoading),r=q(W=>W.rangeStartGI),o=q(W=>W.rangeEndGI),s=r!=null&&o!=null,i=yt(),c=Y(W=>W.theme),l=on[c],a=Y(W=>W.fontFamily),d=Y(W=>W.fontSizePx),S=Y(W=>W.lineHeight),b=Y(W=>W.marginX),v=Y(W=>W.viewportHeight),x=860,w=h.useRef(null),{items:p}=h.useMemo(()=>{var W;return Cu(((W=t==null?void 0:t.ast)==null?void 0:W.blocks)??[])},[t]),f=h.useMemo(()=>{const W=[],Me=vr();return p.forEach(Ae=>{if(Ae.kind==="paragraph"){const mt=Ae.paraIndex;W[mt]=Sr(Ae.block,Me)}}),W},[p]),[u,R]=h.useState({pages:[],pageByRunIndex:null}),T=q(W=>W.pageIndex),I=q(W=>W.setPageIndex),M=h.useRef(0),g=h.useRef(null),[y,k]=h.useState(!1),[_,O]=h.useState(null),[P,C]=h.useState(!1),j=h.useMemo(()=>({flex:1,fontFamily:a,background:l.bg,color:l.fg,fontSize:d,lineHeight:S,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",boxSizing:"border-box"}),[a,l.bg,l.fg,d,S]),{showSplit:A,breakGapPx:F,slash:E}=Y(Vt(W=>{var Me;return{showSplit:W.showSplit,breakGapPx:W.breakGapPx??0,slash:((Me=W.breakMarks)==null?void 0:Me.slash)??!1}})),B=xt();h.useEffect(()=>{u&&u.pages.length&&(console.log("그래서 총 페이지",u.pages.length),(async()=>{const W=B.getState().progress.setSectionLoading;await dt(),await dt(),await dt(),await dt(),console.log("recalc종료"),W(!1)})())},[u,B]);const N=h.useCallback(()=>{console.log("@@@@@@recalc호출");const W=w.current,Me=oe.current,Ae=be.current;if(console.log("showSplit",A),!W||!Me||!Ae||p.length===0){R({pages:[],pageByRunIndex:null}),I(0);return}(async()=>{const mt=performance.now();try{const Ze=i.getState().playbackScale,{pages:It,pageByRunIndex:Es}=await vu({viewHost:W,measureRoot:Me,contentArea:Ae,items:p,cfgMaxWidth:x,marginX:b,fontFamily:a,fontSizePx:d,lineHeight:S,showSplit:A,breakGapPx:F,showSlash:E,paragraphMarkers:f,playbackScale:Ze,viewportHeight:v,instanceId:e}),js=performance.now();console.log(`✅ calcPages 완료: ${(js-mt).toFixed(1)} ms (${It.length} pages)`),R({pages:It,pageByRunIndex:Es}),I(0)}catch(Ze){if(Ze instanceof _s){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",Ze)}})()},[I,p,x,b,a,d,S,A,F,E,f,i,v,e]),$=q(W=>W.setCurrentGlobalRunIndex),V=q(W=>{var Me;return((Me=W.layout)==null?void 0:Me.prefix)??[]}),le=Ce(W=>W.syncToGI),ae=h.useCallback(W=>{const Me=u.pages.length+1,Ae=T+W;if(Ae<0||Ae>=Me)return;const mt=T===u.pages.length;if(Ae===u.pages.length){I(Ae);return}if(mt&&W===-1){const It=To(u.pages[Ae],p,V);It!=null&&($(It,"scrubber-step"),le(It)),I(Ae);return}const Ze=To(u.pages[Ae],p,V);Ze!=null?($(Ze,"scrubber-step"),le(Ze)):I(Ae)},[T,u.pages,p,V,$,I,le]),ye=h.useCallback(()=>{y||M.current!==0?(O("prev"),k(!1)):ae(-1)},[y,ae]),we=h.useCallback(()=>{y||M.current!==0?(O("next"),k(!1)):ae(1)},[y,ae]),Z=hn(),Q=h.useCallback(()=>{const{isSettingsOpen:W,setSettingsOpen:Me,toggleOverlays:Ae}=Z.getState();W?Me(!1):Ae()},[Z]),z=u.pages.length+1,K=((wr=w.current)==null?void 0:wr.clientWidth)||400,ee=h.useCallback(W=>{var Ze;const Me=g.current;if(!Me)return;const Ae=((Ze=w.current)==null?void 0:Ze.clientWidth)||1,mt=W/Ae*33.333;Me.style.transform=`translate3d(${-33.333+mt}%, 0, 0)`},[]),H=h.useCallback(W=>{T===0&&W>0||T>=z-1&&W<0||(M.current=W,ee(W),y||k(!0))},[T,z,ee,y]),ne=h.useCallback(()=>{M.current=0,k(!1);const W=g.current;W&&(W.style.transition="transform 250ms ease-out",W.style.transform="translate3d(-33.333%, 0, 0)")},[]),D=h.useCallback(W=>{if(W.target!==W.currentTarget||W.propertyName!=="transform")return;const Me=_;C(!0),O(null),M.current=0,Me==="prev"?ae(-1):Me==="next"&&ae(1)},[_,ae]);h.useLayoutEffect(()=>{P&&requestAnimationFrame(()=>{requestAnimationFrame(()=>{C(!1)})})},[P]);const X=an(),re=h.useCallback(W=>s||wu(W)?!0:yu(W),[s]),te=h.useCallback(W=>{const Me=X.getState().status;return Me==="playing"||Me==="loading"?!0:re(W)},[X,re]),ue=nu({onPrev:ye,onNext:we,onSingle:Q,onDouble:()=>{},shouldIgnoreTarget:re,shouldIgnoreSwipe:te,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250,onDragMove:H,onDragEnd:ne,pageTransitionThreshold:K*.5}),oe=h.useRef(null),be=h.useRef(null),pe=h.useCallback(()=>{const W=B.getState().progress.setSectionLoading;W(!0)},[B]),Se=h.useMemo(()=>({trailing:!0,leading:!1,maxWait:1e3}),[]),Re=mu(N,200,pe,Se),Be=h.useRef("");h.useEffect(()=>{if(v<=0)return;const W=`${a}|${d}|${S}|${b}|${A}|${F}|${E}|${v}|${t==null?void 0:t.section_id}`;Be.current!==W&&(Be.current=W,console.log("debounceRecalc 취소"),Re.cancel(),pe(),N())},[Re,N,pe,a,d,S,b,A,F,E,v,t==null?void 0:t.section_id]),tu([w],Re);const je=q(W=>W.registerSectionScrollApi);h.useEffect(()=>(je({ensureVisibleGI:()=>Promise.resolve(!0),scrollToGI:()=>Promise.resolve(!0),getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:()=>Promise.resolve(),stepPage:ae}),()=>je(void 0)),[je,ae]);const Ge=t.quiz&&t.quiz.length>0,rt=u.pages.length>0&&T===u.pages.length,De=T>0?T-1:null,Pe=T<z-1?T+1:null,Xe=h.useMemo(()=>_==="prev"?"translate3d(0%, 0, 0)":_==="next"?"translate3d(-66.666%, 0, 0)":"translate3d(-33.333%, 0, 0)",[_]),Ue=W=>n?null:W===u.pages.length?m.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:16,width:"100%",height:"100%"},children:[Ge&&m.jsx(vs,{}),m.jsx(fn,{isIcon:!1})]}):m.jsx(eu,{pages:u.pages,pageIndex:W,maxWidth:x}),ut={width:"33.333%",height:"100%",flexShrink:0,display:"flex",alignItems:"stretch",justifyContent:"center",overflow:"hidden",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},Pt=!P&&(!y||_!==null);return console.log("여기리랜더"),m.jsxs("div",{ref:w,style:{...j,touchAction:"pan-y"},...ue,children:[m.jsxs("div",{ref:g,style:{display:"flex",width:"300%",height:"100%",transform:Xe,transition:Pt?"transform 250ms ease-out":"none",willChange:"transform",boxSizing:"border-box",backfaceVisibility:"hidden",WebkitBackfaceVisibility:"hidden"},onTransitionEnd:_?D:void 0,children:[m.jsx("div",{style:ut,children:De!==null&&Ue(De)}),m.jsx("div",{style:ut,children:Ue(T)}),m.jsx("div",{style:ut,children:Pe!==null&&Ue(Pe)})]}),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:a,fontSize:d,lineHeight:S,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:be,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),m.jsx(ku,{pages:u.pages,items:p,onGotoPage:I,currentPageIndex:T,isOnExtraPage:rt})]})}const ku=({pages:e,items:t,onGotoPage:n,currentPageIndex:r,isOnExtraPage:o})=>{const s=q(a=>a.currentGlobalRunIndex),i=q(a=>a.lastUpdateBy),c=q(a=>{var d;return((d=a.layout)==null?void 0:d.prefix)??[]}),l=h.useRef(null);return h.useEffect(()=>{if(s==null||e.length===0||o&&!(i==="scrubber-live"||i==="scrubber-commit")||l.current===s)return;l.current=s;const a=Su(s,e,t,c);a>=0&&a!==r&&n(a)},[s,e,t,c,n,r,o,i]),m.jsx(m.Fragment,{})},Ru="_wrapper_dbk3n_1",Tu="_spinner_dbk3n_10",_o={wrapper:Ru,spinner:Tu};function _u({size:e=28,speed:t=.8}){return m.jsx("div",{className:`${_o.wrapper}`,children:m.jsx("div",{className:_o.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function Mu(){const e=q(Vt(t=>t.sectionLoading===!0));return m.jsx(m.Fragment,{children:e===!0&&m.jsx(_u,{})})}const Eu="_Overlay_ybic8_3",ju="_Dialog_ybic8_15",Ou="_Body_ybic8_25",Pu="_Header_ybic8_32",Bu="_Paging_ybic8_39",zu="_Remaining_ybic8_48",Au="_RemainingDanger_ybic8_55",Lu="_NextBtn_ybic8_59",Gu="_CloseBtn_ybic8_96",Hu="_Question_ybic8_113",Nu="_Score_ybic8_123",Fu="_Image_ybic8_130",Wu="_Options_ybic8_140",Du="_OptionBtn_ybic8_145",$u="_OptionBtnActive_ybic8_165",Vu="_Footer_ybic8_172",qu="_OptionBtnCorrect_ybic8_195",Uu="_Judge_ybic8_201",Ku="_Correct_ybic8_212",Qu="_Incorrect_ybic8_215",Yu="_ResultHeader_ybic8_220",Xu="_ResultActions_ybic8_233",Zu="_CloseBtnSoft_ybic8_239",Ju="_SummaryGrid_ybic8_249",ed="_StatCard_ybic8_257",td="_StatLabel_ybic8_265",nd="_StatValue_ybic8_270",rd="_StatSub_ybic8_277",de={Overlay:Eu,Dialog:ju,Body:Ou,Header:Pu,Paging:Bu,Remaining:zu,RemainingDanger:Au,NextBtn:Lu,CloseBtn:Gu,Question:Hu,Score:Nu,Image:Fu,Options:Wu,OptionBtn:Du,OptionBtnActive:$u,Footer:Vu,OptionBtnCorrect:qu,Judge:Uu,Correct:Ku,Incorrect:Qu,ResultHeader:Yu,ResultActions:Xu,CloseBtnSoft:Zu,SummaryGrid:Ju,StatCard:ed,StatLabel:td,StatValue:nd,StatSub:rd};function od(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function Ms(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function sd(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 id=h.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),c=Je(p=>p.remainingSec),l=Je(p=>p.uiReveal),a=Je(p=>p.startedAt),d=Je(p=>p.finishedAt),S=Je(p=>p.perQ),b=xs();h.useEffect(()=>{if(t==="idle"||t!=="doing"||c==null)return;const p=window.setInterval(()=>b.getState().tick(),1e3);return()=>window.clearInterval(p)},[t,c,b]);const v=t==="doing"?n[r[o]]:void 0,x=t==="doing"&&v?s[v.qid]??[]:[],w=h.useMemo(()=>{if(t==="idle"||t!=="finished")return;const p=r.map(E=>n[E]),f=p.length,u=p.reduce((E,B)=>E+(B.score??0),0),R=p.reduce((E,B)=>{const N=S[B.qid];return E+(N!=null&&N.isCorrect?B.score??0:0)},0),T=p.map(E=>S[E.qid]).filter(E=>!!E),I=typeof a=="number"&&typeof d=="number"?Math.max(0,d-a):T.reduce((E,B)=>E+(B.ms??0),0),M=f>0?Math.round(I/f):0,g=[...T].sort((E,B)=>E.ms-B.ms),y=g[0],k=g[g.length-1],_=T.filter(E=>!E.multi),O=T.filter(E=>E.multi),P=_.filter(E=>E.isCorrect).length,C=O.filter(E=>E.isCorrect).length,j=T.filter(E=>E.timedOut).length,A=T.filter(E=>E.revealed).length,F=T.filter(E=>!E.isCorrect).sort((E,B)=>B.ms-E.ms).slice(0,3);return{total:f,correct:i,rate:f?Math.round(i/f*100):0,timeMsTotal:I,avgMs:M,totalScore:u,gainedScore:R,fastest:y,slowest:k,singles:{total:_.length,correct:P},multis:{total:O.length,correct:C},timedOut:j,revealed:A,wrongTop3:F}},[t,r,n,S,a,d,i]);return t==="idle"?null:m.jsx("div",{className:de.Overlay,role:"dialog","aria-modal":"true",children:m.jsx("div",{className:de.Dialog,children:t==="doing"&&v?m.jsx(ld,{q:v,index:o,total:r.length,selected:x,uiReveal:l,onSelect:p=>{if(l)return;const f=b.getState();Ms(v)?f.selectToggle(p):f.selectSingle(p)},onBeforeNext:()=>b.getState().setReveal(!0),onNext:()=>b.getState().afterRevealNext(),remainingSec:c,onClose:()=>b.getState().close()}):m.jsx(ad,{total:r.length,correct:i,summary:w,onClose:()=>b.getState().close()})})})});function ld(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:c,onNext:l,remainingSec:a,onClose:d}=e,S=Ms(t),b=h.useMemo(()=>{const p=t.options.map((f,u)=>({opt:f,i:u}));for(let f=p.length-1;f>0;f--){const u=Math.floor(Math.random()*(f+1));[p[f],p[u]]=[p[u],p[f]]}return p},[t.options]),v=h.useMemo(()=>od(t),[t]),x=h.useMemo(()=>sd(t),[t]),w=h.useMemo(()=>{const p=[...o].sort((f,u)=>f-u);if(p.length!==x.length)return!1;for(let f=0;f<p.length;f++)if(p[f]!==x[f])return!1;return!0},[o,x]);return m.jsxs("div",{className:de.Body,children:[m.jsxs("div",{className:de.Header,children:[m.jsx("div",{className:de.Paging,children:`Quiz (${n+1}/${r})`}),m.jsx("button",{type:"button",onClick:d,className:de.CloseBtn,children:"X"})]}),m.jsx("div",{className:de.Question,children:t.question}),m.jsx("div",{className:de.Score,children:` (${t.score}점${S?" ,모두선택":""})`}),m.jsx("div",{className:`${de.Judge}${s?w?` ${de.Correct}`:` ${de.Incorrect}`:""}`,"aria-live":"polite",children:s?w?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),m.jsx("div",{className:de.Image,children:v&&m.jsx("img",{src:v,alt:""})}),m.jsx("div",{className:de.Options,children:b.map(({opt:p,i:f})=>{const u=o.includes(f),R=x.includes(f),T=[de.OptionBtn,u?de.OptionBtnActive:"",s&&R?de.OptionBtnCorrect:""].filter(Boolean).join(" ");return m.jsx("button",{type:"button",onClick:()=>i(f),className:T,disabled:s,children:p},f)})}),m.jsx("div",{className:de.Footer,children:s?m.jsx("button",{type:"button",onClick:l,className:de.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):m.jsxs("button",{type:"button",onClick:c,className:`${de.NextBtn}`,children:["Submit",typeof a=="number"&&m.jsx("span",{className:`${de.Remaining} ${a<=5?de.RemainingDanger:""}`,children:` (${a} s )`})]})})]})}function Mo(e){return e==null?"-":`${Math.round(e/1e3)}s`}function ad(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:de.Body,children:[m.jsx("div",{className:de.ResultHeader,children:"결과 요약"}),m.jsxs("div",{className:de.SummaryGrid,role:"list",children:[m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"정답률"}),m.jsxs("div",{className:de.StatValue,children:[s,"%"]}),m.jsx("div",{className:de.StatSub,children:`정답수 ${n}/문제수${t}`})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"총 점수"}),m.jsx("div",{className:de.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),m.jsx("div",{className:de.StatSub,children:"획득점수/최대점수"})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"총 소요 시간"}),m.jsx("div",{className:de.StatValue,children:Mo(r==null?void 0:r.timeMsTotal)}),m.jsx("div",{className:de.StatSub,children:`평균 ${Mo(r==null?void 0:r.avgMs)}`})]}),m.jsxs("div",{className:de.StatCard,role:"listitem",children:[m.jsx("div",{className:de.StatLabel,children:"타입오버 퀴즈수"}),m.jsx("div",{className:de.StatValue,children:r?`${r.timedOut}`:"-"}),m.jsx("div",{className:de.StatSub,children:"timeout"})]})]}),m.jsx("div",{className:de.ResultActions,children:m.jsx("button",{type:"button",onClick:o,className:de.CloseBtnSoft,children:"닫기"})})]})}function cd(e){return e.map((t,n)=>n)}function ud(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 Eo(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:cd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function dd(e){const t={phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}},n=Eo(e);return qt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const c=Eo(i);o(c)},openFromSection:i=>{i&&s().hydrateFromSection(i);const c=s();if(!c.quizzes.length)return;const l=c.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 c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid,d=c.answers[a]??[],S=d.includes(i)?d.filter(b=>b!==i):[...d,i].sort((b,v)=>b-v);o({answers:{...c.answers,[a]:S}})},selectSingle:i=>{const c=s();if(c.phase!=="doing"||c.uiReveal)return;const a=c.quizzes[c.order[c.currentIndex]].qid;o({answers:{...c.answers,[a]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const c=i.order[i.currentIndex],l=i.quizzes[c],a=l.qid,d=(i.answers[a]??[]).slice().sort((p,f)=>p-f),S=Yn(l),b=ud(d,S),v=i.questionStartedAt?Date.now()-i.questionStartedAt:0,x=i.perQ[a],w={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:d,correctIdxes:S,isCorrect:b,ms:v,revealed:(x==null?void 0:x.revealed)??!1,timedOut:(x==null?void 0:x.timedOut)??!1};if(o({correctCount:i.correctCount+(b?1:0),perQ:{...i.perQ,[a]:w}}),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 c=s();if(c.phase==="doing"){if(i){const l=c.quizzes[c.order[c.currentIndex]],a=l.qid,d=c.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...c.perQ,[a]: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 c=i.currentIndex+1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const c=i.currentIndex-1;o({currentIndex:c,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[c]].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 c=i.remainingSec-1;if(c<=0){const l=i.quizzes[i.order[i.currentIndex]],a=l.qid,d=i.perQ[a],S={qid:a,index:l.index,question:l.question,score:l.score??0,multi:Qn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??Yn(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[a]:S}})}else o({remainingSec:c})}}))}function fd({children:e,initialState:t}){const n=h.useMemo(()=>dd(t.section),[t]),r=h.useRef(t.onQuizComplete);return h.useEffect(()=>{r.current=t.onQuizComplete},[t.onQuizComplete]),h.useEffect(()=>{const o=n.subscribe((s,i)=>{if(i.phase!=="finished"&&s.phase==="finished"){const c=r.current;if(!c)return;const{sectionId:l,quizzes:a,order:d,perQ:S,startedAt:b,finishedAt:v}=s,x=d.map(M=>a[M]),w=x.length,p=x.filter(M=>{var g;return(g=S[M.qid])==null?void 0:g.isCorrect}).length,f=x.reduce((M,g)=>M+(g.score??0),0),u=x.reduce((M,g)=>{const y=S[g.qid];return M+(y!=null&&y.isCorrect?g.score??0:0)},0),R=typeof b=="number"&&typeof v=="number"?Math.max(0,v-b):0,T=x.map(M=>{const g=S[M.qid];return{qid:M.qid,index:M.index,question:M.question,score:M.score??0,isCorrect:(g==null?void 0:g.isCorrect)??!1,selected:(g==null?void 0:g.selected)??[],correctIdxes:(g==null?void 0:g.correctIdxes)??[],ms:(g==null?void 0:g.ms)??0,timedOut:(g==null?void 0:g.timedOut)??!1}}),I={sectionId:l??"",total:w,correct:p,rate:w>0?Math.round(p/w*100):0,totalScore:f,gainedScore:u,timeMsTotal:R,perQuestion:T};c(I)}});return()=>o()},[n]),m.jsx(yr.Provider,{value:n,children:e})}const jo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","showPointer","showSplit","showOverlays","overlayCompactMode","isSettingsOpen"];function pd({containerRef:e}){const t=yt(),n=hn(),r=h.useRef(null);return h.useEffect(()=>{const o=e.current;if(!o)return;let s=o.clientWidth,i=o.clientHeight;n.getState().setViewportSize(s,i);const c=new ResizeObserver(()=>{const l=o.clientWidth,a=o.clientHeight;(l!==s||a!==i)&&(s=l,i=a,n.getState().setViewportSize(l,a),t.getState().emit({type:"viewport_resize",payload:{width:l,height:a}}))});return c.observe(o),()=>c.disconnect()},[t,n,e]),h.useEffect(()=>{const o=n.getState();r.current={};for(const i of jo)r.current[i]=o[i];const s=n.subscribe(i=>{const c=r.current;if(c)for(const l of jo){const a=c[l],d=i[l];a!==d&&(l==="mode"?t.getState().emit({type:"mode_change",payload:{mode:d}}):t.getState().emit({type:"settings_change",payload:{key:l,value:d}}),c[l]=d)}});return()=>{s(),r.current=null}},[t,n]),null}function hd(){const e=yt(),t=hn(),n=xt(),r=h.useContext(zo),o=h.useContext(vn),s=h.useCallback(l=>{const{viewerState:a}=l;if(a){a.mode&&t.getState().setMode(a.mode);const{...S}=a;t.setState(S)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(a==null?void 0:a.mode)==="scroll"||!(a!=null&&a.mode)){const S=()=>{const b=n.getState().progress.getSectionScrollApi();if(!b)return!1;if(l.scrollY===0)b.setScrollTop(0);else if(b.scrollToGIAtOffset){const v=l.anchorGI??l.globalIndex;if(typeof v=="number"){const x=l.anchorOffsetRatio??0;b.scrollToGIAtOffset(v,x)}}return!0};if(!S()){let b=0;const v=setInterval(()=>{(S()||++b>=10)&&clearInterval(v)},50)}}},[t,n]),i=h.useCallback(()=>{var x,w,p;const l=t.getState(),a=n.getState().progress,d=(x=a.getSectionScrollApi)==null?void 0:x.call(a),S=a.currentGlobalRunIndex??0,b=((w=d==null?void 0:d.getScrollTop)==null?void 0:w.call(d))??0,v=((p=d==null?void 0:d.getAnchorOffsetRatio)==null?void 0:p.call(d,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,overlayCompactMode:l.overlayCompactMode,viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight},globalIndex:S,scrollY:b,anchorGI:S,anchorOffsetRatio:v,currentPage:a.pageIndex??0,sectionId:a.sectionId??"",viewportWidth:l.viewportWidth,viewportHeight:l.viewportHeight}},[t,n]),c=h.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:a}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(a,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:S,anchorOffsetRatio:b}=l.payload,v=n.getState().progress.getSectionScrollApi();v&&(d===0?v.setScrollTop(0):v.scrollToGIAtOffset&&typeof S=="number"&&v.scrollToGIAtOffset(S,b));break}case"settings_change":{const{key:a,value:d}=l.payload,S=t.getState();a in S&&typeof S[a]!="function"&&t.setState({[a]:d});break}case"mode_change":{const{mode:a}=l.payload;t.getState().setMode(a);break}case"audio_control":{if(!o)break;const{action:a}=l.payload;switch(a){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:a}=l.payload;n.getState().progress.setPageIndex(a);break}case"range_select":case"range_change":{const{startGI:a,endGI:d}=l.payload;console.log(`[DirectPlayback] ${l.type}: GI ${a}~${d}`),n.getState().progress.setRange(a,d);const S=n.getState().progress;console.log(`[DirectPlayback] after setRange: rangeStartGI=${S.rangeStartGI}, rangeEndGI=${S.rangeEndGI}`);break}case"range_clear":{console.log("[DirectPlayback] range_clear"),n.getState().progress.clearRange();break}case"translate_request":case"translate_loading_start":case"translate_loading_end":case"translate_modal_close":break;case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[DirectPlaybackController] 미처리 이벤트:",l.type)}},[n,t,o]);return h.useLayoutEffect(()=>r?(r.current={dispatch:c,applySnapshot:s,getSnapshot:i,isReady:()=>!n.getState().progress.sectionLoading,waitUntilReady:()=>new Promise(a=>{if(!n.getState().progress.sectionLoading){a();return}const d=n.subscribe(S=>{S.progress.sectionLoading||(d(),a())})})},e.getState().isPlaybackMode&&(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)),()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)}):void 0,[r,e,c,s,i,n]),h.useLayoutEffect(()=>e.subscribe((a,d)=>{a.isPlaybackMode&&!d.isPlaybackMode?(e.getState().setDispatchHandler(c),e.getState().setApplySnapshotHandler(s)):!a.isPlaybackMode&&d.isPlaybackMode&&(e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null))}),[e,c,s]),null}const gd=({containerRef:e,onTranslate:t})=>{const n=q(b=>b.rangeStartGI),r=q(b=>b.rangeEndGI),o=q(b=>b.getRangeText),s=q(b=>b.clearRange),i=yt(),c=n!=null&&r!=null,[l,a]=h.useState(null);h.useEffect(()=>{if(!c)return;const b=e.current;if(!b)return;let v=!0;const x=new ResizeObserver(()=>{if(v){v=!1;return}s()});return x.observe(b),()=>x.disconnect()},[c,s,e]),h.useEffect(()=>{if(!c||n==null||r==null){a(null);return}const b=()=>{const x=e.current;if(!x)return;const w=x.getBoundingClientRect(),f=1/(i.getState().playbackScale||1),u=x.querySelector(`[data-g="${r}"]`);if(!u){a({x:w.width*f/2,y:80});return}const R=u.getBoundingClientRect(),T=x.querySelector(`[data-g="${n}"]`),I=T==null?void 0:T.getBoundingClientRect();let M=(R.left+R.width/2-w.left)*f;I&&(M=((I.left+R.right)/2-w.left)*f);const g=160,y=50,k=16,_=12,O=w.width*f,P=Math.max(k+g/2,Math.min(M,O-k-g/2)),C=(((I==null?void 0:I.top)??R.top)-w.top)*f-y-_;let j=C;C<k&&(j=(R.bottom-w.top)*f+_),a({x:P,y:j})};b();const v=e.current;return v&&v.addEventListener("scroll",b,!0),()=>{v&&v.removeEventListener("scroll",b,!0)}},[c,n,r,e,i]);const d=h.useCallback(()=>{const b=o();b&&navigator.clipboard.writeText(b).catch(v=>{console.error("복사 실패:",v)}),s()},[o,s]),S=h.useCallback(()=>{const b=o();b&&t&&t(b)},[o,t]);return!c||!l?null:m.jsxs("div",{"data-range-menu":!0,style:{position:"absolute",left:l.x,top:l.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:d,style:{padding:"8px 16px",backgroundColor:"#3b82f6",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"복사"}),m.jsx("button",{onClick:S,style:{padding:"8px 16px",backgroundColor:"#10b981",color:"#fff",border:"none",borderRadius:6,fontSize:14,fontWeight:500,cursor:"pointer"},children:"번역"})]})},md="_handleStart_1ihf3_16 _handle_1ihf3_1",bd="_handleEnd_1ihf3_21 _handle_1ihf3_1",Oo={handleStart:md,handleEnd:bd},xd=({containerRef:e})=>{const t=q(f=>f.rangeStartGI),n=q(f=>f.rangeEndGI),r=q(f=>f.setRange),o=yt(),s=t!=null&&n!=null,[i,c]=h.useState(null),[l,a]=h.useState(null),d=h.useRef(null),S=h.useRef(null);h.useEffect(()=>{if(!s||t==null||n==null){c(null),a(null);return}const f=()=>{const R=e.current;if(!R)return;const T=R.getBoundingClientRect(),M=1/(o.getState().playbackScale||1),g=R.querySelector(`[data-g="${t}"]`),y=R.querySelector(`[data-g="${n}"]`);if(g){const k=g.getBoundingClientRect();c({x:(k.left-T.left)*M,y:(k.bottom-T.top)*M})}else c(null);if(y){const k=y.getBoundingClientRect();a({x:(k.right-T.left)*M,y:(k.bottom-T.top)*M})}else a(null)};f();const u=e.current;return u&&u.addEventListener("scroll",f,!0),window.addEventListener("resize",f),()=>{u&&u.removeEventListener("scroll",f,!0),window.removeEventListener("resize",f)}},[s,t,n,e,o]);const b=h.useCallback((f,u)=>{var T;const R=document.elementsFromPoint(f,u);for(const I of R){const M=(T=I.getAttribute)==null?void 0:T.call(I,"data-g");if(M!=null)return parseInt(M,10)}return null},[]),v=h.useCallback(f=>u=>{u.preventDefault(),u.stopPropagation(),d.current=f,S.current=f==="start"?t:n,u.target.setPointerCapture(u.pointerId)},[t,n]),x=h.useCallback(f=>{if(!d.current||t==null||n==null)return;const u=b(f.clientX,f.clientY);u!=null&&(d.current==="start"?u<=n?r(u,n):(r(n,u),d.current="end"):u>=t?r(t,u):(r(u,t),d.current="start"))},[t,n,r,b]),w=h.useCallback(f=>{d.current=null,S.current=null,f.target.releasePointerCapture(f.pointerId)},[]);return s?m.jsxs(m.Fragment,{children:[i&&m.jsx("div",{className:Oo.handleStart,"data-range-handle":"start",style:{left:i.x-26,top:i.y},onPointerDown:v("start"),onPointerMove:x,onPointerUp:w,onPointerCancel:w}),l&&m.jsx("div",{className:Oo.handleEnd,"data-range-handle":"end",style:{left:l.x,top:l.y},onPointerDown:v("end"),onPointerMove:x,onPointerUp:w,onPointerCancel:w})]}):null};function vd(){const e=q(o=>o.rangeStartGI),t=q(o=>o.rangeEndGI),n=q(o=>o.clearRange),r=e!=null&&t!=null;return h.useEffect(()=>{if(!r)return;const o=s=>{var c;const i=s.target;if(!(i.closest("[data-range-menu]")||i.closest("[data-range-handle]"))){if(i.closest("[data-g]")){const l=(c=i.closest("[data-g]"))==null?void 0:c.getAttribute("data-g");if(l){const a=parseInt(l,10),d=Math.min(e,t),S=Math.max(e,t);if(a>=d&&a<=S)return}}n()}};return document.addEventListener("click",o,!0),()=>document.removeEventListener("click",o,!0)},[r,e,t,n]),null}const Sd=({isOpen:e,onClose:t,text:n})=>e?m.jsx("div",{style:{position:"absolute",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,yd=(e,t,n)=>Math.min(n,Math.max(t,e));function wd({section:e,initialViewerState:t,initialProgressRunIndex:n,onViewerClose:r,onSectionNav:o,isCanPrev:s=!1,isCanNext:i=!1,onQuizComplete:c,onViewerEvent:l,viewerRef:a,isPlaybackMode:d=!1,playbackScale:S,isDev:b=!1}){const v=String((e==null?void 0:e.section_id)??"0"),x=h.useMemo(()=>{var T,I;const u=((T=e==null?void 0:e.ast)==null?void 0:T.blocks)??[];let R=0;for(const M of u)(M==null?void 0:M.type)!=="image"&&(R+=((I=M==null?void 0:M.runs)==null?void 0:I.length)??0);return R},[e]),w=h.useMemo(()=>typeof n=="number"?yd(n,x>0?0:-1,Math.max(x-1,-1)):(x>0,0),[n,x]),p=h.useMemo(()=>({section:e,initialIndex:w,onViewerClose:r,onSectionNav:o,isCanPrev:s,isCanNext:i}),[e,w,r,o,s,i]),f=h.useMemo(()=>{const u=(e==null?void 0:e.audios)??[],R=u.length>0?Uc(e):void 0;return{clips:u,map:R,initialIndex:w,section:e}},[e,w]);return m.jsx(qs,{onViewerEvent:l,isPlaybackMode:d,playbackScale:S,viewerRef:a,children:m.jsx(Jc,{initialState:{...t,isDev:b},children:m.jsx(Zc,{initialState:p,children:m.jsx(qc,{initialState:f,children:m.jsx(fd,{initialState:{section:e,onQuizComplete:c},children:m.jsx(Cd,{})},v)},v)},v)})})}function Cd(){const e=Y(b=>b.mode),t=h.useRef(null),n=yt(),r=xt(),[o,s]=h.useState(!1),[i,c]=h.useState(),l=h.useCallback(b=>{c(b),s(!0);const{rangeStartGI:v,rangeEndGI:x}=r.getState().progress;n.getState().emit({type:"translate_request",payload:{text:b,startGI:v??0,endGI:x??0}})},[n,r]),a=h.useCallback(()=>{s(!1),c(void 0),n.getState().emit({type:"translate_modal_close",payload:{}})},[n]),d=b=>{b.preventDefault()},S=b=>{b.preventDefault()};return m.jsxs("div",{ref:t,onContextMenu:d,onDragStart:S,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%",userSelect:"none",WebkitUserSelect:"none",WebkitTouchCallout:"none"},children:[e==="scroll"?m.jsx(pa,{}):m.jsx(Iu,{}),m.jsx(gd,{containerRef:t,onTranslate:l}),m.jsx(xd,{containerRef:t}),m.jsx(Hc,{}),m.jsx(id,{}),m.jsx(Mu,{}),m.jsx(vd,{}),m.jsx(Sd,{isOpen:o,onClose:a,text:i}),m.jsx(pd,{containerRef:t}),m.jsx(hd,{})]})}exports.CRViewer=wd;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { default as CRViewer } from './CR_Viewer';
|
|
2
|
-
export type { CRViewerHandle } from './CR_Viewer';
|
|
2
|
+
export type { CRViewerHandle, CRViewerProps } from './CR_Viewer';
|
|
3
|
+
export type { CRViewerStoreOptions } from './stores/viewer/crViewer.store';
|
|
3
4
|
export type { ViewerMode, ViewerTheme, PointerStyle, CRViewerState, ViewerEventType, AudioSnapshot, AudioControlAction, ViewerEventBase, StoredViewerEvent, GlobalIndexChangeEvent, ScrollEvent, PageChangeEvent, SectionChangeEvent, ModeChangeEvent, SettingsChangeEvent, RenderStartEvent, LoadingStartEvent, LoadingEndEvent, ViewportResizeEvent, AudioControlEvent, ViewerEvent, ViewerEventCallback, StoredEvent, RecordingViewerState, RecordingSnapshot, RecordingChunk, RecordingMeta, } from '@readerseye2/cr_type';
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,aAAa,CAAC;AAClD,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjE,YAAY,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAG3E,YAAY,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,WAAW,EACX,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,aAAa,GACd,MAAM,sBAAsB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,6 +3,12 @@ var Vi = Object.defineProperty;
|
|
|
3
3
|
var qi = (e, t, n) => t in e ? Vi(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
4
4
|
var Ar = (e, t, n) => qi(e, typeof t != "symbol" ? t + "" : t, n);
|
|
5
5
|
import { jsx as x, jsxs as X, Fragment as yt } from "react/jsx-runtime";
|
|
6
|
+
import "@fontsource/noto-sans-kr/400.css";
|
|
7
|
+
import "@fontsource/noto-sans-kr/700.css";
|
|
8
|
+
import "@fontsource/noto-serif-kr/400.css";
|
|
9
|
+
import "@fontsource/noto-serif-kr/700.css";
|
|
10
|
+
import "@fontsource/nanum-myeongjo/400.css";
|
|
11
|
+
import "@fontsource/nanum-myeongjo/700.css";
|
|
6
12
|
import * as dt from "react";
|
|
7
13
|
import N, { createContext as Ft, useContext as Ue, useMemo as ve, useLayoutEffect as Tt, useRef as ie, useEffect as Se, useCallback as Z, createElement as hn, memo as Wt, useState as et, useId as ji } from "react";
|
|
8
14
|
import Ui from "react-dom";
|
|
@@ -439,15 +445,15 @@ const bn = {
|
|
|
439
445
|
}, Ko = [
|
|
440
446
|
{
|
|
441
447
|
label: "고딕체",
|
|
442
|
-
value: "'Noto Sans KR',
|
|
448
|
+
value: "'Noto Sans KR', sans-serif"
|
|
443
449
|
},
|
|
444
450
|
{
|
|
445
451
|
label: "명조체",
|
|
446
|
-
value: "'
|
|
452
|
+
value: "'Noto Serif KR', serif"
|
|
447
453
|
},
|
|
448
454
|
{
|
|
449
455
|
label: "바탕체",
|
|
450
|
-
value: "'
|
|
456
|
+
value: "'Nanum Myeongjo', serif"
|
|
451
457
|
}
|
|
452
458
|
], Ve = {
|
|
453
459
|
mode: "page",
|
|
@@ -8782,7 +8788,7 @@ const Pd = ({ isOpen: e, onClose: t, text: n }) => e ? /* @__PURE__ */ x(
|
|
|
8782
8788
|
)
|
|
8783
8789
|
}
|
|
8784
8790
|
) : null, Bd = (e, t, n) => Math.min(n, Math.max(t, e));
|
|
8785
|
-
function
|
|
8791
|
+
function qd({
|
|
8786
8792
|
section: e,
|
|
8787
8793
|
initialViewerState: t,
|
|
8788
8794
|
initialProgressRunIndex: n,
|
|
@@ -8899,5 +8905,5 @@ function zd() {
|
|
|
8899
8905
|
);
|
|
8900
8906
|
}
|
|
8901
8907
|
export {
|
|
8902
|
-
|
|
8908
|
+
qd as CRViewer
|
|
8903
8909
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@readerseye2/cr_viewer",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -28,6 +28,9 @@
|
|
|
28
28
|
"react-dom": "^18.0.0 || ^19.0.0"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
+
"@fontsource/nanum-myeongjo": "^5.2.11",
|
|
32
|
+
"@fontsource/noto-sans-kr": "^5.2.9",
|
|
33
|
+
"@fontsource/noto-serif-kr": "^5.2.9",
|
|
31
34
|
"@readerseye2/cr_type": "^1.0.84",
|
|
32
35
|
"lodash": "^4.17.21",
|
|
33
36
|
"react-icons": "^5.0.0",
|