@readerseye2/cr_viewer 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CR_Viewer.d.ts +24 -0
- package/dist/CR_Viewer.d.ts.map +1 -0
- package/dist/components/PageSectionWrap.d.ts +15 -0
- package/dist/components/PageSectionWrap.d.ts.map +1 -0
- package/dist/components/PaginationRender.d.ts +11 -0
- package/dist/components/PaginationRender.d.ts.map +1 -0
- package/dist/components/RenderParagraph.d.ts +16 -0
- package/dist/components/RenderParagraph.d.ts.map +1 -0
- package/dist/components/RenderRuns.d.ts +14 -0
- package/dist/components/RenderRuns.d.ts.map +1 -0
- package/dist/components/ScrollSectionWrap.d.ts +2 -0
- package/dist/components/ScrollSectionWrap.d.ts.map +1 -0
- package/dist/components/SectionRendererVirtuoso.d.ts +7 -0
- package/dist/components/SectionRendererVirtuoso.d.ts.map +1 -0
- package/dist/components/btns/MoveSectionBtns.d.ts +18 -0
- package/dist/components/btns/MoveSectionBtns.d.ts.map +1 -0
- package/dist/components/btns/SolveQuizBtn.d.ts +2 -0
- package/dist/components/btns/SolveQuizBtn.d.ts.map +1 -0
- package/dist/components/dom.util.d.ts +40 -0
- package/dist/components/dom.util.d.ts.map +1 -0
- package/dist/components/quiz/QuizRenderer.d.ts +3 -0
- package/dist/components/quiz/QuizRenderer.d.ts.map +1 -0
- package/dist/components/scroll/CustomScroller.d.ts +4 -0
- package/dist/components/scroll/CustomScroller.d.ts.map +1 -0
- package/dist/components/spinner/SectionLoadingSpinner.d.ts +2 -0
- package/dist/components/spinner/SectionLoadingSpinner.d.ts.map +1 -0
- package/dist/components/spinner/Spinner.d.ts +10 -0
- package/dist/components/spinner/Spinner.d.ts.map +1 -0
- package/dist/hooks/useDebounce.d.ts +16 -0
- package/dist/hooks/useDebounce.d.ts.map +1 -0
- package/dist/hooks/useLongPressSpan.d.ts +10 -0
- package/dist/hooks/useLongPressSpan.d.ts.map +1 -0
- package/dist/hooks/useResizeObserver.d.ts +2 -0
- package/dist/hooks/useResizeObserver.d.ts.map +1 -0
- package/dist/hooks/useSingleDoubleClick.d.ts +16 -0
- package/dist/hooks/useSingleDoubleClick.d.ts.map +1 -0
- package/dist/hooks/useSwipePageClicks.d.ts +24 -0
- package/dist/hooks/useSwipePageClicks.d.ts.map +1 -0
- package/dist/index.cjs +33 -0
- package/dist/index.css +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8723 -0
- package/dist/overlay-bars/OverlayLayer.d.ts +3 -0
- package/dist/overlay-bars/OverlayLayer.d.ts.map +1 -0
- package/dist/overlay-bars/ViewerSettingsSheet.d.ts +6 -0
- package/dist/overlay-bars/ViewerSettingsSheet.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/AudioControlsMini.d.ts +2 -0
- package/dist/overlay-bars/bottomBar/AudioControlsMini.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/FakeAudioControlsMini.d.ts +3 -0
- package/dist/overlay-bars/bottomBar/FakeAudioControlsMini.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/OverlayBottomBar.d.ts +5 -0
- package/dist/overlay-bars/bottomBar/OverlayBottomBar.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/PlayButton.d.ts +13 -0
- package/dist/overlay-bars/bottomBar/PlayButton.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/ProgressScrubber.d.ts +5 -0
- package/dist/overlay-bars/bottomBar/ProgressScrubber.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/StepBtn.d.ts +6 -0
- package/dist/overlay-bars/bottomBar/StepBtn.d.ts.map +1 -0
- package/dist/overlay-bars/bottomBar/WPMSpeedButtons.d.ts +2 -0
- package/dist/overlay-bars/bottomBar/WPMSpeedButtons.d.ts.map +1 -0
- package/dist/overlay-bars/topBar/OverlayTopBar.d.ts +5 -0
- package/dist/overlay-bars/topBar/OverlayTopBar.d.ts.map +1 -0
- package/dist/playback/CR_ViewerPlayback.d.ts +27 -0
- package/dist/playback/CR_ViewerPlayback.d.ts.map +1 -0
- package/dist/playback/PlaybackBar.d.ts +28 -0
- package/dist/playback/PlaybackBar.d.ts.map +1 -0
- package/dist/playback/PlaybackToggleButton.d.ts +10 -0
- package/dist/playback/PlaybackToggleButton.d.ts.map +1 -0
- package/dist/playback/PlaybackViewport.d.ts +30 -0
- package/dist/playback/PlaybackViewport.d.ts.map +1 -0
- package/dist/playback/index.d.ts +5 -0
- package/dist/playback/index.d.ts.map +1 -0
- package/dist/playback/types.d.ts +20 -0
- package/dist/playback/types.d.ts.map +1 -0
- package/dist/recording/PlaybackHandler.d.ts +6 -0
- package/dist/recording/PlaybackHandler.d.ts.map +1 -0
- package/dist/recording/SettingsChangeEmitter.d.ts +3 -0
- package/dist/recording/SettingsChangeEmitter.d.ts.map +1 -0
- package/dist/recording/SnapshotRegistrar.d.ts +7 -0
- package/dist/recording/SnapshotRegistrar.d.ts.map +1 -0
- package/dist/recording/ViewportResizeEmitter.d.ts +7 -0
- package/dist/recording/ViewportResizeEmitter.d.ts.map +1 -0
- package/dist/stores/audio/crViewer_audio.context.d.ts +10 -0
- package/dist/stores/audio/crViewer_audio.context.d.ts.map +1 -0
- package/dist/stores/audio/crViewer_audio.hooks.d.ts +6 -0
- package/dist/stores/audio/crViewer_audio.hooks.d.ts.map +1 -0
- package/dist/stores/audio/crViewer_audio.provider.d.ts +14 -0
- package/dist/stores/audio/crViewer_audio.provider.d.ts.map +1 -0
- package/dist/stores/audio/crViewer_audio.store.d.ts +65 -0
- package/dist/stores/audio/crViewer_audio.store.d.ts.map +1 -0
- package/dist/stores/player/index.d.ts +5 -0
- package/dist/stores/player/index.d.ts.map +1 -0
- package/dist/stores/player/viewerPlayer.context.d.ts +7 -0
- package/dist/stores/player/viewerPlayer.context.d.ts.map +1 -0
- package/dist/stores/player/viewerPlayer.hooks.d.ts +13 -0
- package/dist/stores/player/viewerPlayer.hooks.d.ts.map +1 -0
- package/dist/stores/player/viewerPlayer.provider.d.ts +18 -0
- package/dist/stores/player/viewerPlayer.provider.d.ts.map +1 -0
- package/dist/stores/player/viewerPlayer.store.d.ts +52 -0
- package/dist/stores/player/viewerPlayer.store.d.ts.map +1 -0
- package/dist/stores/progress/crViewer_progress.context.d.ts +3 -0
- package/dist/stores/progress/crViewer_progress.context.d.ts.map +1 -0
- package/dist/stores/progress/crViewer_progress.hooks.d.ts +6 -0
- package/dist/stores/progress/crViewer_progress.hooks.d.ts.map +1 -0
- package/dist/stores/progress/crViewer_progress.provider.d.ts +15 -0
- package/dist/stores/progress/crViewer_progress.provider.d.ts.map +1 -0
- package/dist/stores/progress/crViewer_progress.store.d.ts +98 -0
- package/dist/stores/progress/crViewer_progress.store.d.ts.map +1 -0
- package/dist/stores/quizprogress/quiz_progress.context.d.ts +3 -0
- package/dist/stores/quizprogress/quiz_progress.context.d.ts.map +1 -0
- package/dist/stores/quizprogress/quiz_progress.hooks.d.ts +10 -0
- package/dist/stores/quizprogress/quiz_progress.hooks.d.ts.map +1 -0
- package/dist/stores/quizprogress/quiz_progress.provider.d.ts +17 -0
- package/dist/stores/quizprogress/quiz_progress.provider.d.ts.map +1 -0
- package/dist/stores/quizprogress/quiz_progress.store.d.ts +63 -0
- package/dist/stores/quizprogress/quiz_progress.store.d.ts.map +1 -0
- package/dist/stores/recorder/viewerRecorder.context.d.ts +7 -0
- package/dist/stores/recorder/viewerRecorder.context.d.ts.map +1 -0
- package/dist/stores/recorder/viewerRecorder.hooks.d.ts +13 -0
- package/dist/stores/recorder/viewerRecorder.hooks.d.ts.map +1 -0
- package/dist/stores/recorder/viewerRecorder.provider.d.ts +24 -0
- package/dist/stores/recorder/viewerRecorder.provider.d.ts.map +1 -0
- package/dist/stores/recorder/viewerRecorder.store.d.ts +50 -0
- package/dist/stores/recorder/viewerRecorder.store.d.ts.map +1 -0
- package/dist/stores/test/tempRecordingStore.d.ts +13 -0
- package/dist/stores/test/tempRecordingStore.d.ts.map +1 -0
- package/dist/stores/viewer/CRViewer.provider.d.ts +10 -0
- package/dist/stores/viewer/CRViewer.provider.d.ts.map +1 -0
- package/dist/stores/viewer/crViewer.context.d.ts +7 -0
- package/dist/stores/viewer/crViewer.context.d.ts.map +1 -0
- package/dist/stores/viewer/crViewer.hooks.d.ts +26 -0
- package/dist/stores/viewer/crViewer.hooks.d.ts.map +1 -0
- package/dist/stores/viewer/crViewer.store.d.ts +130 -0
- package/dist/stores/viewer/crViewer.store.d.ts.map +1 -0
- package/dist/types/viewerEvent.types.d.ts +149 -0
- package/dist/types/viewerEvent.types.d.ts.map +1 -0
- package/dist/utils/audioSrc.d.ts +4 -0
- package/dist/utils/audioSrc.d.ts.map +1 -0
- package/dist/utils/buildAudioTextMap.d.ts +15 -0
- package/dist/utils/buildAudioTextMap.d.ts.map +1 -0
- package/dist/utils/calcPage.util.d.ts +42 -0
- package/dist/utils/calcPage.util.d.ts.map +1 -0
- package/dist/utils/calcPage.util_BACKV3_2399_sf.d.ts +40 -0
- package/dist/utils/calcPage.util_BACKV3_2399_sf.d.ts.map +1 -0
- package/dist/utils/calcPage.util_BACKclaude.d.ts +40 -0
- package/dist/utils/calcPage.util_BACKclaude.d.ts.map +1 -0
- package/dist/utils/calcPage.util_BACKclaude_gptagain.d.ts +40 -0
- package/dist/utils/calcPage.util_BACKclaude_gptagain.d.ts.map +1 -0
- package/dist/utils/calcPage.util_BACKrecent.d.ts +40 -0
- package/dist/utils/calcPage.util_BACKrecent.d.ts.map +1 -0
- package/dist/utils/calcPage.util_BACKv6_fast_Sf.d.ts +40 -0
- package/dist/utils/calcPage.util_BACKv6_fast_Sf.d.ts.map +1 -0
- package/dist/utils/doubleRaf.d.ts +3 -0
- package/dist/utils/doubleRaf.d.ts.map +1 -0
- package/dist/utils/quizSrc.d.ts +3 -0
- package/dist/utils/quizSrc.d.ts.map +1 -0
- package/dist/utils/sectionRender.util.d.ts +21 -0
- package/dist/utils/sectionRender.util.d.ts.map +1 -0
- package/dist/utils/text.util.d.ts +3 -0
- package/dist/utils/text.util.d.ts.map +1 -0
- package/package.json +59 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";var zs=Object.defineProperty;var As=(e,t,n)=>t in e?zs(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var xr=(e,t,n)=>As(e,typeof t!="symbol"?t+"":t,n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("react/jsx-runtime"),u=require("react"),Ls=require("react-dom");function Gs(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 it=Gs(u),tr=u.createContext(void 0);var Ut=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Oo(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Kt={exports:{}},gn={},Yt={exports:{}},mn={};/**
|
|
2
|
+
* @license React
|
|
3
|
+
* use-sync-external-store-shim.production.js
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/var vr;function Hs(){if(vr)return mn;vr=1;var e=u;function t(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function a(m,p){var b=p(),S=r({inst:{value:b,getSnapshot:p}}),v=S[0].inst,g=S[1];return s(function(){v.value=b,v.getSnapshot=p,l(v)&&g({inst:v})},[m,b,p]),o(function(){return l(v)&&g({inst:v}),m(function(){l(v)&&g({inst:v})})},[m]),i(b),b}function l(m){var p=m.getSnapshot;m=m.value;try{var b=p();return!n(m,b)}catch{return!0}}function c(m,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return mn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,mn}var bn={};/**
|
|
10
|
+
* @license React
|
|
11
|
+
* use-sync-external-store-shim.development.js
|
|
12
|
+
*
|
|
13
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the MIT license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*/var Sr;function Ns(){return Sr||(Sr=1,process.env.NODE_ENV!=="production"&&(function(){function e(b,S){return b===S&&(b!==0||1/b===1/S)||b!==b&&S!==S}function t(b,S){d||o.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var v=S();if(!m){var g=S();s(v,g)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),m=!0)}g=i({inst:{value:v,getSnapshot:S}});var f=g[0].inst,y=g[1];return l(function(){f.value=v,f.getSnapshot=S,n(f)&&y({inst:f})},[b,v,S]),a(function(){return n(f)&&y({inst:f}),b(function(){n(f)&&y({inst:f})})},[b]),c(v),v}function n(b){var S=b.getSnapshot;b=b.value;try{var v=S();return!s(b,v)}catch{return!0}}function r(b,S){return S()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=u,s=typeof Object.is=="function"?Object.is:e,i=o.useState,a=o.useEffect,l=o.useLayoutEffect,c=o.useDebugValue,d=!1,m=!1,p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;bn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:p,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),bn}var yr;function Bo(){return yr||(yr=1,process.env.NODE_ENV==="production"?Yt.exports=Hs():Yt.exports=Ns()),Yt.exports}/**
|
|
18
|
+
* @license React
|
|
19
|
+
* use-sync-external-store-shim/with-selector.production.js
|
|
20
|
+
*
|
|
21
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
22
|
+
*
|
|
23
|
+
* This source code is licensed under the MIT license found in the
|
|
24
|
+
* LICENSE file in the root directory of this source tree.
|
|
25
|
+
*/var wr;function Fs(){if(wr)return gn;wr=1;var e=u,t=Bo();function n(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,a=e.useMemo,l=e.useDebugValue;return gn.useSyncExternalStoreWithSelector=function(c,d,m,p,b){var S=s(null);if(S.current===null){var v={hasValue:!1,value:null};S.current=v}else v=S.current;S=a(function(){function f(_){if(!y){if(y=!0,R=_,_=p(_),b!==void 0&&v.hasValue){var w=v.value;if(b(w,_))return k=w}return k=_}if(w=k,r(R,_))return w;var x=p(_);return b!==void 0&&b(w,x)?(R=_,w):(R=_,k=x)}var y=!1,R,k,T=m===void 0?null:m;return[function(){return f(d())},T===null?void 0:function(){return f(T())}]},[d,m,p,b]);var g=o(c,S[0],S[1]);return i(function(){v.hasValue=!0,v.value=g},[g]),l(g),g},gn}var xn={};/**
|
|
26
|
+
* @license React
|
|
27
|
+
* use-sync-external-store-shim/with-selector.development.js
|
|
28
|
+
*
|
|
29
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
|
+
*
|
|
31
|
+
* This source code is licensed under the MIT license found in the
|
|
32
|
+
* LICENSE file in the root directory of this source tree.
|
|
33
|
+
*/var Cr;function Ws(){return Cr||(Cr=1,process.env.NODE_ENV!=="production"&&(function(){function e(c,d){return c===d&&(c!==0||1/c===1/d)||c!==c&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=u,n=Bo(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,a=t.useMemo,l=t.useDebugValue;xn.useSyncExternalStoreWithSelector=function(c,d,m,p,b){var S=s(null);if(S.current===null){var v={hasValue:!1,value:null};S.current=v}else v=S.current;S=a(function(){function f(_){if(!y){if(y=!0,R=_,_=p(_),b!==void 0&&v.hasValue){var w=v.value;if(b(w,_))return k=w}return k=_}if(w=k,r(R,_))return w;var x=p(_);return b!==void 0&&b(w,x)?(R=_,w):(R=_,k=x)}var y=!1,R,k,T=m===void 0?null:m;return[function(){return f(d())},T===null?void 0:function(){return f(T())}]},[d,m,p,b]);var g=o(c,S[0],S[1]);return i(function(){v.hasValue=!0,v.value=g},[g]),l(g),g},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),xn}var Ir;function Vs(){return Ir||(Ir=1,process.env.NODE_ENV==="production"?Kt.exports=Fs():Kt.exports=Ws()),Kt.exports}var Ds=Vs();const $s=Oo(Ds),kr=e=>{let t;const n=new Set,r=(c,d)=>{const m=typeof c=="function"?c(t):c;if(!Object.is(m,t)){const p=t;t=d??(typeof m!="object"||m===null)?m:Object.assign({},t,m),n.forEach(b=>b(t,p))}},o=()=>t,a={setState:r,getState:o,getInitialState:()=>l,subscribe:c=>(n.add(c),()=>n.delete(c))},l=t=e(r,o,a);return a},bt=(e=>e?kr(e):kr),{useSyncExternalStoreWithSelector:qs}=$s,Us=e=>e;function Wt(e,t=Us,n){const r=qs(e.subscribe,e.getState,e.getInitialState,t,n);return u.useDebugValue(r),r}function Y(e,t){const n=u.useContext(tr);if(!n)throw new Error("useCRViewerScopedStore must be used inside <InternalCRViewerProvider>");return Wt(n,e,t)}function _t(){const e=u.useContext(tr);if(!e)throw new Error("useCRViewerStoreApi must be used inside <InternalCRViewerProvider>");return e}const xt=u.createContext(void 0);function Ks(){return bt((e,t)=>({emitCallback:null,isPlaybackMode:!1,playbackScale:1,dispatchHandler:null,applySnapshotHandler:null,setEmitCallback:n=>e({emitCallback:n}),emit:(n,r)=>{const{emitCallback:o,isPlaybackMode:s}=t();s||o&&o({...n,timestamp:r??Date.now()})},setPlaybackMode:n=>e({isPlaybackMode:n}),setPlaybackScale:n=>e({playbackScale:n}),setDispatchHandler:n=>e({dispatchHandler:n}),dispatch:n=>{const{dispatchHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerRecorder] dispatch called but not in playback mode");return}r?r(n):console.warn("[ViewerRecorder] dispatch called but no handler registered")},setApplySnapshotHandler:n=>e({applySnapshotHandler:n}),applySnapshot:n=>{const{applySnapshotHandler:r,isPlaybackMode:o}=t();if(!o){console.warn("[ViewerRecorder] applySnapshot called but not in playback mode");return}r?r(n):console.warn("[ViewerRecorder] applySnapshot called but no handler registered")}}))}function Ys({children:e,onViewerEvent:t,isPlaybackMode:n=!1,playbackScale:r=1,viewerRef:o}){const s=u.useMemo(()=>Ks(),[]);return u.useLayoutEffect(()=>(s.getState().setEmitCallback(t??null),()=>s.getState().setEmitCallback(null)),[t,s]),u.useLayoutEffect(()=>{s.getState().setPlaybackMode(n)},[n,s]),u.useLayoutEffect(()=>{s.getState().setPlaybackScale(r)},[r,s]),u.useLayoutEffect(()=>(o&&(o.current={dispatch:i=>{s.getState().dispatch(i)},applySnapshot:i=>{s.getState().applySnapshot(i)}}),()=>{o&&(o.current=null)}),[o,s]),h.jsx(xt.Provider,{value:s,children:e})}function Xs({onSingle:e,onDouble:t,delay:n=250,shouldIgnoreTarget:r}){const o=u.useRef(null);u.useEffect(()=>()=>{o.current!=null&&(clearTimeout(o.current),o.current=null)},[]);const s=u.useCallback(a=>{if(!(r!=null&&r(a.target))&&a.detail===1){if(o.current!=null)return;o.current=window.setTimeout(()=>{o.current=null,e==null||e(a)},n)}},[n,e,r]),i=u.useCallback(a=>{r!=null&&r(a.target)||o.current!=null&&(clearTimeout(o.current),o.current=null)},[t,r]);return{onClick:s,onDoubleClick:i}}const tn={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"}},vn=[8,16,24,40,64],Sn=[1.2,1.4,1.6,1.8,2,2.2,2.4],yn=[4,8,12,16,24],qn=e=>Math.round(12+(e-1)*(16/11)),Qs=e=>{let t=1,n=1/0;for(let r=1;r<=12;r++){const o=qn(r),s=Math.abs(o-e);s<n&&(t=r,n=s)}return t},wn=(e,t)=>{let n=0,r=1/0;return t.forEach((o,s)=>{const i=Math.abs(o-e);i<r&&(r=i,n=s)}),n+1},zo=[{label:"고딕체",value:"'Noto Sans KR', 'Apple SD Gothic Neo', 'Pretendard', Roboto, Segoe UI, Arial, sans-serif"},{label:"명조체",value:"'Nanum Myeongjo', 'Noto Serif KR', 'Batang', 'Times New Roman', serif"},{label:"바탕체",value:"'Batang', 'Nanum Myeongjo', 'Noto Serif KR', 'Times New Roman', serif"}],Oe={mode:"scroll",theme:"light",fontFamily:zo.find(e=>e.label==="명조체").value,fontSizePx:18,lineHeight:1.8,marginX:20,marginY:24,showOverlays:!0,isSettingsOpen:!1,pointerStyle:"highlight",pointerColor:"#fff59d",breakMarks:{slash:!0},breakGapPx:8,muteAudio:!1,audioSpeed:1,audioTargetWpm:200,showPointer:!0,showSplit:!0,viewportWidth:0,viewportHeight:0,playbackViewportWidth:0,playbackViewportHeight:0};function Zs(e){const{init:t,recorderStore:n}=e??{};return bt((r,o)=>({...Oe,...t,setMode:s=>r({mode:s}),setTheme:s=>r({theme:s}),setFontFamily:s=>r({fontFamily:s}),setFontSizePx:s=>r({fontSizePx:s}),setLineHeight:s=>r({lineHeight:s}),setMarginX:s=>r({marginX:s}),setMarginY:s=>r({marginY:s}),setShowOverlays:s=>r({showOverlays:s}),toggleOverlays:()=>r({showOverlays:!o().showOverlays}),setSettingsOpen:s=>r({isSettingsOpen:s}),resetToDefaults:()=>r(s=>({mode:Oe.mode,theme:Oe.theme,fontFamily:Oe.fontFamily,fontSizePx:Oe.fontSizePx,lineHeight:Oe.lineHeight,marginX:Oe.marginX,marginY:Oe.marginY,showOverlays:!1,isSettingsOpen:!0,pointerStyle:Oe.pointerStyle,pointerColor:Oe.pointerColor,breakMarks:Oe.breakMarks,breakGapPx:Oe.breakGapPx,muteAudio:Oe.muteAudio,audioSpeed:Oe.audioSpeed,showPointer:Oe.showPointer,showSplit:Oe.showSplit})),maps:{MARGIN_MAP:vn,LINEHEIGHT_MAP:Sn,BREAK_GAP_MAP:yn,fontSizeFromLevel:qn},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=yn[Math.max(1,Math.min(5,s))-1];r({breakGapPx:i})},getBreakGapLevel:()=>wn(o().breakGapPx,yn),getFontLevel:()=>Qs(o().fontSizePx),getLineLevel:()=>wn(o().lineHeight,Sn),getMarginLevel:()=>wn(o().marginX,vn),setFontLevel:s=>r({fontSizePx:qn(Math.max(1,Math.min(12,s)))}),setLineLevel:s=>r({lineHeight:Sn[Math.max(1,Math.min(7,s))-1]}),setMarginLevel:s=>{const i=vn[Math.max(1,Math.min(5,s))-1];r({marginX:i,marginY:i})},setMuteAudio:s=>{r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},toggleMuteAudio:()=>{const s=!o().muteAudio;r({muteAudio:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"muteAudio",value:s}})},setAudioSpeed:s=>{r({audioSpeed:s})},setAudioTargetWpm:s=>{r({audioTargetWpm:s}),n==null||n.getState().emit({type:"settings_change",payload:{key:"audioTargetWpm",value:s}})},setShowPointer:s=>r({showPointer:s}),toggleShowPointer:()=>r({showPointer:!o().showPointer}),setShowSplit:s=>r({showSplit:s}),toggleShowSplit:()=>r({showSplit:!o().showSplit}),setViewportSize:(s,i)=>r({viewportWidth:s,viewportHeight:i}),setPlaybackViewportSize:(s,i)=>r({playbackViewportWidth:s,playbackViewportHeight:i}),clearPlaybackViewport:()=>r({playbackViewportWidth:0,playbackViewportHeight:0})}))}const an=0,dt=1,Rt=2,Ao=4;function Tr(e){return()=>e}function Js(e){e()}function Lo(e,t){return n=>e(t(n))}function _r(e,t){return()=>e(t)}function ei(e,t){return n=>e(t,n)}function nr(e){return e!==void 0}function ti(...e){return()=>{e.map(Js)}}function Mt(){}function cn(e,t){return t(e),e}function ni(e,t){return t(e)}function we(...e){return e}function xe(e,t){return e(dt,t)}function ue(e,t){e(an,t)}function rr(e){e(Rt)}function Te(e){return e(Ao)}function J(e,t){return xe(e,ei(t,an))}function Ye(e,t){const n=e(dt,r=>{n(),t(r)});return n}function Rr(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Go(e,t){return e===t}function ye(e=Go){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function re(e){return t=>n=>{e(n)&&t(n)}}function K(e){return t=>Lo(t,e)}function Je(e){return t=>()=>{t(e)}}function H(e,...t){const n=ri(...t);return((r,o)=>{switch(r){case Rt:rr(e);return;case dt:return xe(e,n(o))}})}function et(e,t){return n=>r=>{n(t=e(t,r))}}function gt(e){return t=>n=>{e>0?e--:t(n)}}function st(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function fe(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);xe(s,l=>{const c=n;n=n|a,t[i]=l,c!==o&&n===o&&r&&(r(),r=null)})}),s=>i=>{const a=()=>{s([i].concat(t))};n===o?a():r=a}}function ri(...e){return t=>e.reduceRight(ni,t)}function oi(e){let t,n;const r=()=>t==null?void 0:t();return function(o,s){switch(o){case dt:return s?n===s?void 0:(r(),n=s,t=xe(e,s),t):(r(),Mt);case Rt:r(),n=null;return}}}function F(e){let t=e;const n=me();return((r,o)=>{switch(r){case an:t=o;break;case dt:{o(t);break}case Ao:return t}return n(r,o)})}function ze(e,t){return cn(F(t),n=>J(e,n))}function me(){const e=[];return((t,n)=>{switch(t){case an:e.slice().forEach(r=>{r(n)});return;case Rt:e.splice(0,e.length);return;case dt:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)}}})}function Ve(e){return cn(me(),t=>J(e,t))}function be(e,t=[],{singleton:n}={singleton:!0}){return{constructor:e,dependencies:t,id:si(),singleton:n}}const si=()=>Symbol();function ii(e){const t=new Map,n=({constructor:r,dependencies:o,id:s,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function Re(...e){const t=me(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,i)=>{const a=Math.pow(2,i);xe(s,l=>{n[i]=l,r=r|a,r===o&&ue(t,n)})}),function(s,i){switch(s){case Rt:{rr(t);return}case dt:return r===o&&i(n),xe(t,i)}}}function ne(e,t=Go){return H(e,ye(t))}function Un(...e){return function(t,n){switch(t){case Rt:return;case dt:return ti(...e.map(r=>xe(r,n)))}}}var Ne=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ne||{});const li={0:"debug",3:"error",1:"log",2:"warn"},ai=()=>typeof globalThis>"u"?window:globalThis,ft=be(()=>{const e=F(3);return{log:F((t,n,r=1)=>{var o;const s=(o=ai().VIRTUOSO_LOG_LEVEL)!=null?o:Te(e);r>=s&&console[li[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",t,n)}),logLevel:e}},[],{singleton:!0});function vt(e,t,n){return or(e,t,n).callbackRef}function or(e,t,n){const r=u.useRef(null);let o=i=>{};const s=u.useMemo(()=>typeof ResizeObserver<"u"?new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}):null,[e,n]);return o=i=>{i&&t?(s==null||s.observe(i),r.current=i):(r.current&&(s==null||s.unobserve(r.current)),r.current=null)},{callbackRef:o,ref:r}}function ci(e,t,n,r,o,s,i,a,l){const c=u.useCallback(d=>{const m=ui(d.children,t,a?"offsetWidth":"offsetHeight",o);let p=d.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const b=p.lastElementChild.dataset.viewportType==="window";let S;b&&(S=p.ownerDocument.defaultView);const v=i?a?i.scrollLeft:i.scrollTop:b?a?S.scrollX||S.document.documentElement.scrollLeft:S.scrollY||S.document.documentElement.scrollTop:a?p.scrollLeft:p.scrollTop,g=i?a?i.scrollWidth:i.scrollHeight:b?a?S.document.documentElement.scrollWidth:S.document.documentElement.scrollHeight:a?p.scrollWidth:p.scrollHeight,f=i?a?i.offsetWidth:i.offsetHeight:b?a?S.innerWidth:S.innerHeight:a?p.offsetWidth:p.offsetHeight;r({scrollHeight:g,scrollTop:Math.max(v,0),viewportHeight:f}),s==null||s(a?Mr("column-gap",getComputedStyle(d).columnGap,o):Mr("row-gap",getComputedStyle(d).rowGap,o)),m!==null&&e(m)},[e,t,o,s,i,r,a]);return or(c,n,l)}function ui(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let i=0;i<o;i++){const a=e.item(i);if(a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),c=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&r("Zero-sized element, this should not happen",{child:a},Ne.ERROR),d===c)continue;const m=s[s.length-1];s.length===0||m.size!==d||m.endIndex!==l-1?s.push({endIndex:l,size:d,startIndex:l}):s[s.length-1].endIndex++}return s}function Mr(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ne.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ho(e,t,n){const r=u.useRef(null),o=u.useCallback(l=>{if(!(l!=null&&l.offsetParent))return;const c=l.getBoundingClientRect(),d=c.width;let m,p;if(t){const b=t.getBoundingClientRect(),S=c.top-b.top;p=b.height-Math.max(0,S),m=S+t.scrollTop}else{const b=i.current.ownerDocument.defaultView;p=b.innerHeight-Math.max(0,c.top),m=c.top+b.scrollY}r.current={offsetTop:m,visibleHeight:p,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:i}=or(o,!0,n),a=u.useCallback(()=>{o(i.current)},[o,i]);return u.useEffect(()=>{var l;if(t){t.addEventListener("scroll",a);const c=new ResizeObserver(()=>{requestAnimationFrame(a)});return c.observe(t),()=>{t.removeEventListener("scroll",a),c.unobserve(t)}}else{const c=(l=i.current)==null?void 0:l.ownerDocument.defaultView;return c==null||c.addEventListener("scroll",a),c==null||c.addEventListener("resize",a),()=>{c==null||c.removeEventListener("scroll",a),c==null||c.removeEventListener("resize",a)}}},[a,t,i]),s}const Le=be(()=>{const e=me(),t=me(),n=F(0),r=me(),o=F(0),s=me(),i=me(),a=F(0),l=F(0),c=F(0),d=F(0),m=me(),p=me(),b=F(!1),S=F(!1),v=F(!1);return J(H(e,K(({scrollTop:g})=>g)),t),J(H(e,K(({scrollHeight:g})=>g)),i),J(t,o),{deviation:n,fixedFooterHeight:c,fixedHeaderHeight:l,footerHeight:d,headerHeight:a,horizontalDirection:S,scrollBy:p,scrollContainerState:e,scrollHeight:i,scrollingInProgress:b,scrollTo:m,scrollTop:t,skipAnimationFrameInResizeObserver:v,smoothScrollTargetReached:r,statefulScrollTop:o,viewportHeight:s}},[],{singleton:!0}),Bt={lvl:0};function No(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);s.push({end:a-1,start:r,value:o}),r=a,o=l}return s.push({end:1/0,start:r,value:o}),s}function ve(e){return e===Bt}function zt(e,t){if(!ve(e))return t===e.k?e.v:t<e.k?zt(e.l,t):zt(e.r,t)}function Xe(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=Xe(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Xe(e.l,t,n)}function We(e,t,n){return ve(e)?Vo(t,n,1):t===e.k?Ee(e,{k:t,v:n}):t<e.k?Er(Ee(e,{l:We(e.l,t,n)})):Er(Ee(e,{r:We(e.r,t,n)}))}function It(){return Bt}function kt(e,t,n){if(ve(e))return[];const r=Xe(e,t)[0];return di(Yn(e,r,n))}function Kn(e,t){if(ve(e))return Bt;const{k:n,l:r,r:o}=e;if(t===n){if(ve(r))return o;if(ve(o))return r;{const[s,i]=Wo(r);return Jt(Ee(e,{k:s,l:Fo(r),v:i}))}}else return t<n?Jt(Ee(e,{l:Kn(r,t)})):Jt(Ee(e,{r:Kn(o,t)}))}function ht(e){return ve(e)?[]:[...ht(e.l),{k:e.k,v:e.v},...ht(e.r)]}function Yn(e,t,n){if(ve(e))return[];const{k:r,l:o,r:s,v:i}=e;let a=[];return r>t&&(a=a.concat(Yn(o,t,n))),r>=t&&r<=n&&a.push({k:r,v:i}),r<=n&&(a=a.concat(Yn(s,t,n))),a}function Jt(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(Cn(t))return Do(Ee(e,{lvl:n-1}));if(!ve(t)&&!ve(t.r))return Ee(t.r,{l:Ee(t,{r:t.r.l}),lvl:n,r:Ee(e,{l:t.r.r,lvl:n-1})});throw new Error("Unexpected empty nodes")}else{if(Cn(e))return Xn(Ee(e,{lvl:n-1}));if(!ve(r)&&!ve(r.l)){const o=r.l,s=Cn(o)?r.lvl-1:r.lvl;return Ee(o,{l:Ee(e,{lvl:n-1,r:o.l}),lvl:o.lvl+1,r:Xn(Ee(r,{l:o.r,lvl:s}))})}else throw new Error("Unexpected empty nodes")}}function Ee(e,t){return Vo(t.k!==void 0?t.k:e.k,t.v!==void 0?t.v:e.v,t.lvl!==void 0?t.lvl:e.lvl,t.l!==void 0?t.l:e.l,t.r!==void 0?t.r:e.r)}function Fo(e){return ve(e.r)?e.l:Jt(Ee(e,{r:Fo(e.r)}))}function Cn(e){return ve(e)||e.lvl>e.r.lvl}function Wo(e){return ve(e.r)?[e.k,e.v]:Wo(e.r)}function Vo(e,t,n,r=Bt,o=Bt){return{k:e,l:r,lvl:n,r:o,v:t}}function Er(e){return Xn(Do(e))}function Do(e){const{l:t}=e;return!ve(t)&&t.lvl===e.lvl?Ee(t,{r:Ee(e,{l:t.r})}):e}function Xn(e){const{lvl:t,r:n}=e;return!ve(n)&&!ve(n.r)&&n.lvl===t&&n.r.lvl===t?Ee(n,{l:Ee(e,{r:n.l}),lvl:t+1}):e}function di(e){return No(e,({k:t,v:n})=>({index:t,value:n}))}function $o(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}function At(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}const sr=be(()=>({recalcInProgress:F(!1)}),[],{singleton:!0});function qo(e,t,n){return e[nn(e,t,n)]}function nn(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),i=e[s],a=n(i,t);if(a===0)return s;if(a===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function fi(e,t,n,r){const o=nn(e,t,r),s=nn(e,n,r,o);return e.slice(o,s+1)}function ut(e,t){return Math.round(e.getBoundingClientRect()[t])}function un(e){return!ve(e.groupOffsetTree)}function ir({index:e},t){return t===e?0:t<e?-1:1}function pi(){return{groupIndices:[],groupOffsetTree:It(),lastIndex:0,lastOffset:0,lastSize:0,offsetTree:[],sizeTree:It()}}function hi(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=We(e,0,s);continue}const a=kt(e,i-1,o+1);if(a.some(yi(r)))continue;let l=!1,c=!1;for(const{end:d,start:m,value:p}of a)l?(o>=m||s===p)&&(e=Kn(e,m)):(c=p!==s,l=!0),d>o&&o>=m&&p!==s&&(e=We(e,o+1,p));c&&(e=We(e,i,s))}return[e,n]}function gi(e){return typeof e.groupIndex<"u"}function mi({offset:e},t){return t===e?0:t<e?-1:1}function Lt(e,t,n){if(t.length===0)return 0;const{index:r,offset:o,size:s}=qo(t,e,ir),i=e-r,a=s*i+(i-1)*n+o;return a>0?a+n:a}function Uo(e,t){if(!un(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Ko(e,t,n){if(gi(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=Uo(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function bi(e,t,n,r=0){return r>0&&(t=Math.max(t,qo(e,r,ir).offset)),No(fi(e,t,n,mi),Si)}function xi(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,Ne.DEBUG);const s=e.sizeTree;let i=s,a=0;if(n.length>0&&ve(s)&&t.length===2){const p=t[0].size,b=t[1].size;i=n.reduce((S,v)=>We(We(S,v,p),v+1,b),i)}else[i,a]=hi(i,t);if(i===s)return e;const{lastIndex:l,lastOffset:c,lastSize:d,offsetTree:m}=Qn(e.offsetTree,a,i,o);return{groupIndices:n,groupOffsetTree:n.reduce((p,b)=>We(p,b,Lt(b,m,o)),It()),lastIndex:l,lastOffset:c,lastSize:d,offsetTree:m,sizeTree:i}}function vi(e){return ht(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 jr(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 Qn(e,t,n,r){let o=e,s=0,i=0,a=0,l=0;if(t!==0){l=nn(o,t-1,ir),a=o[l].offset;const c=Xe(n,t-1);s=c[0],i=c[1],o.length&&o[l].size===Xe(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:c,value:d}of kt(n,t,1/0)){const m=c-s,p=m*i+a+m*r;o.push({index:c,offset:p,size:d}),s=c,a=p,i=d}return{lastIndex:s,lastOffset:a,lastSize:i,offsetTree:o}}function Si(e){return{index:e.index,value:e}}function yi(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 wi={offsetHeight:"height",offsetWidth:"width"},tt=be(([{log:e},{recalcInProgress:t}])=>{const n=me(),r=me(),o=ze(r,0),s=me(),i=me(),a=F(0),l=F([]),c=F(void 0),d=F(void 0),m=F(void 0),p=F(void 0),b=F((w,x)=>ut(w,wi[x])),S=F(void 0),v=F(0),g=pi(),f=ze(H(n,fe(l,e,v),et(xi,g),ye()),g),y=ze(H(l,ye(),et((w,x)=>({current:x,prev:w.current}),{current:[],prev:[]}),K(({prev:w})=>w)),[]);J(H(l,re(w=>w.length>0),fe(f,v),K(([w,x,E])=>{const B=w.reduce((C,O,I)=>We(C,O,Lt(O,x.offsetTree,E)||I),It());return{...x,groupIndices:w,groupOffsetTree:B}})),f),J(H(r,fe(f),re(([w,{lastIndex:x}])=>w<x),K(([w,{lastIndex:x,lastSize:E}])=>[{endIndex:x,size:E,startIndex:w}])),n),J(c,d);const R=ze(H(c,K(w=>w===void 0)),!0);J(H(d,re(w=>w!==void 0&&ve(Te(f).sizeTree)),K(w=>{const x=Te(m),E=Te(l).length>0;return x?E?[{endIndex:0,size:x,startIndex:0},{endIndex:1,size:w,startIndex:1}]:[]:[{endIndex:0,size:w,startIndex:0}]})),n),J(H(p,re(w=>w!==void 0&&w.length>0&&ve(Te(f).sizeTree)),K(w=>{const x=[];let E=w[0],B=0;for(let C=1;C<w.length;C++){const O=w[C];O!==E&&(x.push({endIndex:C-1,size:E,startIndex:B}),E=O,B=C)}return x.push({endIndex:w.length-1,size:E,startIndex:B}),x})),n),J(H(l,fe(m,d),re(([,w,x])=>w!==void 0&&x!==void 0),K(([w,x,E])=>{const B=[];for(let C=0;C<w.length;C++){const O=w[C],I=w[C+1];B.push({startIndex:O,endIndex:O,size:x}),I!==void 0&&B.push({startIndex:O+1,endIndex:I-1,size:E})}return B})),n);const k=Ve(H(n,fe(f),et(({sizes:w},[x,E])=>({changed:E!==w,sizes:E}),{changed:!1,sizes:g}),K(w=>w.changed)));xe(H(a,et((w,x)=>({diff:w.prev-x,prev:x}),{diff:0,prev:0}),K(w=>w.diff)),w=>{const{groupIndices:x}=Te(f);if(w>0)ue(t,!0),ue(s,w+jr(w,x));else if(w<0){const E=Te(y);E.length>0&&(w-=jr(-w,E)),ue(i,w)}}),xe(H(a,fe(e)),([w,x])=>{w<0&&x("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},Ne.ERROR)});const T=Ve(s);J(H(s,fe(f),K(([w,x])=>{const E=x.groupIndices.length>0,B=[],C=x.lastSize;if(E){const O=zt(x.sizeTree,0);let I=0,P=0;for(;I<w;){const z=x.groupIndices[P],A=x.groupIndices.length===P+1?1/0:x.groupIndices[P+1]-z-1;B.push({endIndex:z,size:O,startIndex:z}),B.push({endIndex:z+1+A-1,size:C,startIndex:z+1}),P++,I+=A+1}const j=ht(x.sizeTree);return I!==w&&j.shift(),j.reduce((z,{k:A,v:D})=>{let Q=z.ranges;return z.prevSize!==0&&(Q=[...z.ranges,{endIndex:A+w-1,size:z.prevSize,startIndex:z.prevIndex}]),{prevIndex:A+w,prevSize:D,ranges:Q}},{prevIndex:w,prevSize:0,ranges:B}).ranges}return ht(x.sizeTree).reduce((O,{k:I,v:P})=>({prevIndex:I+w,prevSize:P,ranges:[...O.ranges,{endIndex:I+w-1,size:O.prevSize,startIndex:O.prevIndex}]}),{prevIndex:0,prevSize:C,ranges:[]}).ranges})),n);const _=Ve(H(i,fe(f,v),K(([w,{offsetTree:x},E])=>{const B=-w;return Lt(B,x,E)})));return J(H(i,fe(f,v),K(([w,x,E])=>{if(x.groupIndices.length>0){if(ve(x.sizeTree))return x;let B=It();const C=Te(y);let O=0,I=0,P=0;for(;O<-w;){P=C[I];const j=C[I+1]-P-1;I++,O+=j+1}if(B=ht(x.sizeTree).reduce((j,{k:z,v:A})=>We(j,Math.max(0,z+w),A),B),O!==-w){const j=zt(x.sizeTree,P);B=We(B,0,j);const z=Xe(x.sizeTree,-w+1)[1];B=We(B,1,z)}return{...x,sizeTree:B,...Qn(x.offsetTree,0,B,E)}}else{const B=ht(x.sizeTree).reduce((C,{k:O,v:I})=>We(C,Math.max(0,O+w),I),It());return{...x,sizeTree:B,...Qn(x.offsetTree,0,B,E)}}})),f),{beforeUnshiftWith:T,data:S,defaultItemSize:d,firstItemIndex:a,fixedItemSize:c,fixedGroupSize:m,gap:v,groupIndices:l,heightEstimates:p,itemSize:b,listRefresh:k,shiftWith:i,shiftWithOffset:_,sizeRanges:n,sizes:f,statefulTotalCount:o,totalCount:r,trackItemSizes:R,unshiftWith:s}},we(ft,sr),{singleton:!0});function Ci(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{groupIndices:[],totalCount:0})}const Yo=be(([{groupIndices:e,sizes:t,totalCount:n},{headerHeight:r,scrollTop:o}])=>{const s=me(),i=me(),a=Ve(H(s,K(Ci)));return J(H(a,K(l=>l.totalCount)),n),J(H(a,K(l=>l.groupIndices)),e),J(H(Re(o,t,r),re(([l,c])=>un(c)),K(([l,c,d])=>Xe(c.groupOffsetTree,Math.max(l-d,0),"v")[0]),ye(),K(l=>[l])),i),{groupCounts:s,topItemsIndexes:i}},we(tt,Le)),pt=be(([{log:e}])=>{const t=F(!1),n=Ve(H(t,re(r=>r),ye()));return xe(t,r=>{r&&Te(e)("props updated",{},Ne.DEBUG)}),{didMount:n,propsReady:t}},we(ft),{singleton:!0}),Ii=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||!Ii)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Vt=be(([{gap:e,listRefresh:t,sizes:n,totalCount:r},{fixedFooterHeight:o,fixedHeaderHeight:s,footerHeight:i,headerHeight:a,scrollingInProgress:l,scrollTo:c,smoothScrollTargetReached:d,viewportHeight:m},{log:p}])=>{const b=me(),S=me(),v=F(0);let g=null,f=null,y=null;function R(){g&&(g(),g=null),y&&(y(),y=null),f&&(clearTimeout(f),f=null),ue(l,!1)}return J(H(b,fe(n,m,r,v,a,i,p),fe(e,s,o),K(([[k,T,_,w,x,E,B,C],O,I,P])=>{const j=Xo(k),{align:z,behavior:A,offset:D}=j,Q=w-1,ae=Ko(j,T,Q);let de=Lt(ae,T.offsetTree,O)+E;z==="end"?(de+=I+Xe(T.sizeTree,ae)[1]-_+P,ae===Q&&(de+=B)):z==="center"?de+=(I+Xe(T.sizeTree,ae)[1]-_+P)/2:de-=x,D&&(de+=D);const $=pe=>{R(),pe?(C("retrying to scroll to",{location:k},Ne.DEBUG),ue(b,k)):(ue(S,!0),C("list did not change, scroll successful",{},Ne.DEBUG))};if(R(),A==="smooth"){let pe=!1;y=xe(t,ge=>{pe=pe||ge}),g=Ye(d,()=>{$(pe)})}else g=Ye(H(t,ki(150)),$);return f=setTimeout(()=>{R()},1200),ue(l,!0),C("scrolling from index to",{behavior:A,index:ae,top:de},Ne.DEBUG),{behavior:A,top:de}})),c),{scrollTargetReached:S,scrollToIndex:b,topListHeight:v}},we(tt,Le,ft),{singleton:!0});function ki(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}function lr(e,t){e==0?t():requestAnimationFrame(()=>{lr(e-1,t)})}function ar(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Dt=be(([{defaultItemSize:e,listRefresh:t,sizes:n},{scrollTop:r},{scrollTargetReached:o,scrollToIndex:s},{didMount:i}])=>{const a=F(!0),l=F(0),c=F(!0);return J(H(i,fe(l),re(([d,m])=>!!m),Je(!1)),a),J(H(i,fe(l),re(([d,m])=>!!m),Je(!1)),c),xe(H(Re(t,i),fe(a,n,e,c),re(([[,d],m,{sizeTree:p},b,S])=>d&&(!ve(p)||nr(b))&&!m&&!S),fe(l)),([,d])=>{Ye(o,()=>{ue(c,!0)}),lr(4,()=>{Ye(r,()=>{ue(a,!0)}),ue(s,d)})}),{initialItemFinalLocationReached:c,initialTopMostItemIndex:l,scrolledToInitialItem:a}},we(tt,Le,Vt,pt),{singleton:!0});function Qo(e,t){return Math.abs(e-t)<1.01}const Gt="up",Pt="down",Ti="none",_i={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollHeight:0,scrollTop:0,viewportHeight:0}},Ri=0,$t=be(([{footerHeight:e,headerHeight:t,scrollBy:n,scrollContainerState:r,scrollTop:o,viewportHeight:s}])=>{const i=F(!1),a=F(!0),l=me(),c=me(),d=F(4),m=F(Ri),p=ze(H(Un(H(ne(o),gt(1),Je(!0)),H(ne(o),gt(1),Je(!1),Rr(100))),ye()),!1),b=ze(H(Un(H(n,Je(!0)),H(n,Je(!1),Rr(200))),ye()),!1);J(H(Re(ne(o),ne(m)),K(([y,R])=>y<=R),ye()),a),J(H(a,st(50)),c);const S=Ve(H(Re(r,ne(s),ne(t),ne(e),ne(d)),et((y,[{scrollHeight:R,scrollTop:k},T,_,w,x])=>{const E=k+T-R>-x,B={scrollHeight:R,scrollTop:k,viewportHeight:T};if(E){let O,I;return k>y.state.scrollTop?(O="SCROLLED_DOWN",I=y.state.scrollTop-k):(O="SIZE_DECREASED",I=y.state.scrollTop-k||y.scrollTopDelta),{atBottom:!0,atBottomBecause:O,scrollTopDelta:I,state:B}}let C;return B.scrollHeight>y.state.scrollHeight?C="SIZE_INCREASED":T<y.state.viewportHeight?C="VIEWPORT_HEIGHT_DECREASING":k<y.state.scrollTop?C="SCROLLING_UPWARDS":C="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:C,state:B}},_i),ye((y,R)=>y&&y.atBottom===R.atBottom))),v=ze(H(r,et((y,{scrollHeight:R,scrollTop:k,viewportHeight:T})=>{if(Qo(y.scrollHeight,R))return{changed:!1,jump:0,scrollHeight:R,scrollTop:k};{const _=R-(k+T)<1;return y.scrollTop!==k&&_?{changed:!0,jump:y.scrollTop-k,scrollHeight:R,scrollTop:k}:{changed:!0,jump:0,scrollHeight:R,scrollTop:k}}},{changed:!1,jump:0,scrollHeight:0,scrollTop:0}),re(y=>y.changed),K(y=>y.jump)),0);J(H(S,K(y=>y.atBottom)),i),J(H(i,st(50)),l);const g=F(Pt);J(H(r,K(({scrollTop:y})=>y),ye(),et((y,R)=>Te(b)?{direction:y.direction,prevScrollTop:R}:{direction:R<y.prevScrollTop?Gt:Pt,prevScrollTop:R},{direction:Pt,prevScrollTop:0}),K(y=>y.direction)),g),J(H(r,st(50),Je(Ti)),g);const f=F(0);return J(H(p,re(y=>!y),Je(0)),f),J(H(o,st(100),fe(p),re(([y,R])=>R),et(([y,R],[k])=>[R,k],[0,0]),K(([y,R])=>R-y)),f),{atBottomState:S,atBottomStateChange:l,atBottomThreshold:d,atTopStateChange:c,atTopThreshold:m,isAtBottom:i,isAtTop:a,isScrolling:p,lastJumpDueToItemResize:v,scrollDirection:g,scrollVelocity:f}},we(Le)),Ht="top",Nt="bottom",Pr="none";function Or(e,t,n){return typeof e=="number"?n===Gt&&t===Ht||n===Pt&&t===Nt?e:0:n===Gt?t===Ht?e.main:e.reverse:t===Nt?e.main:e.reverse}function Br(e,t){var n;return typeof e=="number"?e:(n=e[t])!=null?n:0}const cr=be(([{deviation:e,fixedHeaderHeight:t,headerHeight:n,scrollTop:r,viewportHeight:o}])=>{const s=me(),i=F(0),a=F(0),l=F(0),c=ze(H(Re(ne(r),ne(o),ne(n),ne(s,At),ne(l),ne(i),ne(t),ne(e),ne(a)),K(([d,m,p,[b,S],v,g,f,y,R])=>{const k=d-y,T=g+f,_=Math.max(p-k,0);let w=Pr;const x=Br(R,Ht),E=Br(R,Nt);return b-=y,b+=p+f,S+=p+f,S-=y,b>d+T-x&&(w=Gt),S<d-_+m+E&&(w=Pt),w!==Pr?[Math.max(k-p-Or(v,Ht,w)-x,0),k-_-f+m+Or(v,Nt,w)+E]:null}),re(d=>d!=null),ye(At)),[0,0]);return{increaseViewportBy:a,listBoundary:s,overscan:l,topListHeight:i,visibleRange:c}},we(Le),{singleton:!0});function Mi(e,t,n){if(un(t)){const r=Uo(e,t);return[{index:Xe(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 In={bottom:0,firstItemIndex:0,items:[],offsetBottom:0,offsetTop:0,top:0,topItems:[],topListHeight:0,totalCount:0};function en(e,t,n,r,o,s){const{lastIndex:i,lastOffset:a,lastSize:l}=o;let c=0,d=0;if(e.length>0){c=e[0].offset;const v=e[e.length-1];d=v.offset+v.size}const m=n-i,p=a+m*l+(m-1)*r,b=c,S=p-d;return{bottom:d,firstItemIndex:s,items:zr(e,o,s),offsetBottom:S,offsetTop:c,top:b,topItems:zr(t,o,s),topListHeight:t.reduce((v,g)=>g.size+v,0),totalCount:n}}function Zo(e,t,n,r,o,s){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=ar(t,a),c=Array.from({length:a}).map((d,m)=>({data:s[m+l],index:m+l,offset:0,size:0}));return en(c,[],a,o,n,r)}function zr(e,t,n){if(e.length===0)return[];if(!un(t))return e.map(c=>({...c,index:c.index+n,originalIndex:c.index}));const r=e[0].index,o=e[e.length-1].index,s=[],i=kt(t.groupOffsetTree,r,o);let a,l=0;for(const c of e){(!a||a.end<c.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;c.index===a.start?d={index:l,type:"group"}:d={groupIndex:l,index:c.index-(l+1)+n},s.push({...d,data:c.data,offset:c.offset,originalIndex:c.index,size:c.size})}return s}function Ar(e,t){var n;return e===void 0?0:typeof e=="number"?e:(n=e[t])!=null?n:0}const St=be(([{data:e,firstItemIndex:t,gap:n,sizes:r,totalCount:o},s,{listBoundary:i,topListHeight:a,visibleRange:l},{initialTopMostItemIndex:c,scrolledToInitialItem:d},{topListHeight:m},p,{didMount:b},{recalcInProgress:S}])=>{const v=F([]),g=F(0),f=me(),y=F(0);J(s.topItemsIndexes,v);const R=ze(H(Re(b,S,ne(l,At),ne(o),ne(r),ne(c),d,ne(v),ne(t),ne(n),ne(y),e),re(([w,x,,E,,,,,,,,B])=>{const C=B&&B.length!==E;return w&&!x&&!C}),K(([,,[w,x],E,B,C,O,I,P,j,z,A])=>{var D,Q,ae,de;const $=B,{offsetTree:pe,sizeTree:ge}=$,Ce=Te(g);if(E===0)return{...In,totalCount:E};if(w===0&&x===0)return Ce===0?{...In,totalCount:E}:Zo(Ce,C,B,P,j,A||[]);if(ve(ge))return Ce>0?null:en(Mi(ar(C,E),$,A),[],E,j,$,P);const U=[];if(I.length>0){const V=I[0],q=I[I.length-1];let W=0;for(const le of kt(ge,V,q)){const X=le.value,ee=Math.max(le.start,V),oe=Math.min(le.end,q);for(let se=ee;se<=oe;se++)U.push({data:A==null?void 0:A[se],index:se,offset:W,size:X}),W+=X}}if(!O)return en([],U,E,j,$,P);const he=I.length>0?I[I.length-1]+1:0,G=bi(pe,w,x,he);if(G.length===0)return null;const Z=E-1,M=cn([],V=>{for(const q of G){const W=q.value;let le=W.offset,X=q.start;const ee=W.size;if(W.offset<w){X+=Math.floor((w-W.offset+j)/(ee+j));const se=X-q.start;le+=se*ee+se*j}X<he&&(le+=(he-X)*ee,X=he);const oe=Math.min(q.end,Z);for(let se=X;se<=oe&&!(le>=x);se++)V.push({data:A==null?void 0:A[se],index:se,offset:le,size:ee}),le+=ee+j}}),N=Ar(z,Ht),L=Ar(z,Nt);if(M.length>0&&(N>0||L>0)){const V=M[0],q=M[M.length-1];if(N>0&&V.index>he){const W=Math.min(N,V.index-he),le=[];let X=V.offset;for(let ee=V.index-1;ee>=V.index-W;ee--){const oe=(Q=(D=kt(ge,ee,ee)[0])==null?void 0:D.value)!=null?Q:V.size;X-=oe+j,le.unshift({data:A==null?void 0:A[ee],index:ee,offset:X,size:oe})}M.unshift(...le)}if(L>0&&q.index<Z){const W=Math.min(L,Z-q.index);let le=q.offset+q.size+j;for(let X=q.index+1;X<=q.index+W;X++){const ee=(de=(ae=kt(ge,X,X)[0])==null?void 0:ae.value)!=null?de:q.size;M.push({data:A==null?void 0:A[X],index:X,offset:le,size:ee}),le+=ee+j}}}return en(M,U,E,j,$,P)}),re(w=>w!==null),ye()),In);J(H(e,re(nr),K(w=>w==null?void 0:w.length)),o),J(H(R,K(w=>w.topListHeight)),m),J(m,a),J(H(R,K(w=>[w.top,w.bottom])),i),J(H(R,K(w=>w.items)),f);const k=Ve(H(R,re(({items:w})=>w.length>0),fe(o,e),re(([{items:w},x])=>w[w.length-1].originalIndex===x-1),K(([,w,x])=>[w-1,x]),ye(At),K(([w])=>w))),T=Ve(H(R,st(200),re(({items:w,topItems:x})=>w.length>0&&w[0].originalIndex===x.length),K(({items:w})=>w[0].index),ye())),_=Ve(H(R,re(({items:w})=>w.length>0),K(({items:w})=>{let x=0,E=w.length-1;for(;w[x].type==="group"&&x<E;)x++;for(;w[E].type==="group"&&E>x;)E--;return{endIndex:w[E].index,startIndex:w[x].index}}),ye($o)));return{endReached:k,initialItemCount:g,itemsRendered:f,listState:R,minOverscanItemCount:y,rangeChanged:_,startReached:T,topItemsIndexes:v,...p}},we(tt,Yo,cr,Dt,Vt,$t,pt,sr),{singleton:!0}),Jo=be(([{fixedFooterHeight:e,fixedHeaderHeight:t,footerHeight:n,headerHeight:r},{listState:o}])=>{const s=me(),i=ze(H(Re(n,e,r,t,o),K(([a,l,c,d,m])=>a+l+c+d+m.offsetBottom+m.bottom)),0);return J(ne(i),s),{totalListHeight:i,totalListHeightChanged:s}},we(Le,St),{singleton:!0}),Ei=be(([{viewportHeight:e},{totalListHeight:t}])=>{const n=F(!1),r=ze(H(Re(n,e,t),re(([o])=>o),K(([,o,s])=>Math.max(0,o-s)),st(0),ye()),0);return{alignToBottom:n,paddingTopAddition:r}},we(Le,Jo),{singleton:!0}),es=be(()=>({context:F(null)})),ji=({itemBottom:e,itemTop:t,locationParams:{align:n,behavior:r,...o},viewportBottom:s,viewportTop:i})=>t<i?{...o,align:n??"start",behavior:r}:e>s?{...o,align:n??"end",behavior:r}:null,ts=be(([{gap:e,sizes:t,totalCount:n},{fixedFooterHeight:r,fixedHeaderHeight:o,headerHeight:s,scrollingInProgress:i,scrollTop:a,viewportHeight:l},{scrollToIndex:c}])=>{const d=me();return J(H(d,fe(t,l,n,s,o,r,a),fe(e),K(([[m,p,b,S,v,g,f,y],R])=>{const{align:k,behavior:T,calculateViewLocation:_=ji,done:w,...x}=m,E=Ko(m,p,S-1),B=Lt(E,p.offsetTree,R)+v+g,C=B+Xe(p.sizeTree,E)[1],O=y+g,I=y+b-f,P=_({itemBottom:C,itemTop:B,locationParams:{align:k,behavior:T,...x},viewportBottom:I,viewportTop:O});return P?w&&Ye(H(i,re(j=>!j),gt(Te(i)?1:2)),w):w==null||w(),P}),re(m=>m!==null)),c),{scrollIntoView:d}},we(tt,Le,Vt,St,ft),{singleton:!0});function Lr(e){return e?e==="smooth"?"smooth":"auto":!1}const Pi=(e,t)=>typeof e=="function"?Lr(e(t)):t&&Lr(e),Oi=be(([{listRefresh:e,totalCount:t,fixedItemSize:n,data:r},{atBottomState:o,isAtBottom:s},{scrollToIndex:i},{scrolledToInitialItem:a},{didMount:l,propsReady:c},{log:d},{scrollingInProgress:m},{context:p},{scrollIntoView:b}])=>{const S=F(!1),v=me();let g=null;function f(T){ue(i,{align:"end",behavior:T,index:"LAST"})}xe(H(Re(H(ne(t),gt(1)),l),fe(ne(S),s,a,m),K(([[T,_],w,x,E,B])=>{let C=_&&E,O="auto";return C&&(O=Pi(w,x||B),C=C&&!!O),{followOutputBehavior:O,shouldFollow:C,totalCount:T}}),re(({shouldFollow:T})=>T)),({followOutputBehavior:T,totalCount:_})=>{g&&(g(),g=null),Te(n)?requestAnimationFrame(()=>{Te(d)("following output to ",{totalCount:_},Ne.DEBUG),f(T)}):g=Ye(e,()=>{Te(d)("following output to ",{totalCount:_},Ne.DEBUG),f(T),g=null})});function y(T){const _=Ye(o,w=>{T&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!g&&(Te(d)("scrolling to bottom due to increased size",{},Ne.DEBUG),f("auto"))});setTimeout(_,100)}xe(H(Re(ne(S),t,c),re(([T,,_])=>T&&_),et(({value:T},[,_])=>({refreshed:T===_,value:_}),{refreshed:!1,value:0}),re(({refreshed:T})=>T),fe(S,t)),([,T])=>{Te(a)&&y(T!==!1)}),xe(v,()=>{y(Te(S)!==!1)}),xe(Re(ne(S),o),([T,_])=>{T&&!_.atBottom&&_.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&f("auto")});const R=F(null),k=me();return J(Un(H(ne(r),K(T=>{var _;return(_=T==null?void 0:T.length)!=null?_:0})),H(ne(t))),k),xe(H(Re(H(k,gt(1)),l),fe(ne(R),a,m,p),K(([[T,_],w,x,E,B])=>_&&x&&(w==null?void 0:w({context:B,totalCount:T,scrollingInProgress:E}))),re(T=>!!T),st(0)),T=>{g&&(g(),g=null),Te(n)?requestAnimationFrame(()=>{Te(d)("scrolling into view",{}),ue(b,T)}):g=Ye(e,()=>{Te(d)("scrolling into view",{}),ue(b,T),g=null})}),{autoscrollToBottom:v,followOutput:S,scrollIntoViewOnChange:R}},we(tt,$t,Vt,Dt,pt,ft,Le,es,ts)),Bi=be(([{data:e,firstItemIndex:t,gap:n,sizes:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:i},{didMount:a}])=>(J(H(a,fe(s),re(([,l])=>l!==0),fe(o,r,t,n,e),K(([[,l],c,d,m,p,b=[]])=>Zo(l,c,d,m,p,b))),i),{}),we(tt,Dt,St,pt),{singleton:!0}),zi=be(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=F(0);return xe(H(e,fe(r),re(([,o])=>o!==0),K(([,o])=>({top:o}))),o=>{Ye(H(n,gt(1),re(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{ue(t,o)})})}),{initialScrollTop:r}},we(pt,Le,St),{singleton:!0}),ns=be(([{scrollVelocity:e}])=>{const t=F(!1),n=me(),r=F(!1);return J(H(e,fe(r,t,n),re(([o,s])=>!!s),K(([o,s,i,a])=>{const{enter:l,exit:c}=s;if(i){if(c(o,a))return!1}else if(l(o,a))return!0;return i}),ye()),t),xe(H(Re(t,e,n),fe(r)),([[o,s,i],a])=>{o&&a&&a.change&&a.change(s,i)}),{isSeeking:t,scrollSeekConfiguration:r,scrollSeekRangeChanged:n,scrollVelocity:e}},we($t),{singleton:!0}),ur=be(([{scrollContainerState:e,scrollTo:t}])=>{const n=me(),r=me(),o=me(),s=F(!1),i=F(void 0);return J(H(Re(n,r),K(([{scrollHeight:a,scrollTop:l,viewportHeight:c},{offsetTop:d}])=>({scrollHeight:a,scrollTop:Math.max(0,l-d),viewportHeight:c}))),e),J(H(t,fe(r),K(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),o),{customScrollParent:i,useWindowScroll:s,windowScrollContainerState:n,windowScrollTo:o,windowViewportRect:r}},we(Le)),Ai=be(([{sizeRanges:e,sizes:t},{headerHeight:n,scrollTop:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const c=me(),d=F(void 0),m=F(null),p=F(null);return J(a,m),J(l,p),xe(H(c,fe(t,r,i,m,p,n)),([b,S,v,g,f,y,R])=>{const k=vi(S.sizeTree);g&&f!==null&&y!==null&&(v=f.scrollTop-y.offsetTop),v-=R,b({ranges:k,scrollTop:v})}),J(H(d,re(nr),K(Li)),o),J(H(s,fe(d),re(([,b])=>b!==void 0),ye(),K(([,b])=>b.ranges)),e),{getState:c,restoreStateFrom:d}},we(tt,Le,Dt,pt,ur));function Li(e){return{align:"start",index:0,offset:e.scrollTop}}const Gi=be(([{topItemsIndexes:e}])=>{const t=F(0);return J(H(t,re(n=>n>=0),K(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},we(St));function rs(e){let t=!1,n;return(()=>(t||(t=!0,n=e()),n))}const Hi=rs(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Ni=be(([{deviation:e,scrollBy:t,scrollingInProgress:n,scrollTop:r},{isAtBottom:o,isScrolling:s,lastJumpDueToItemResize:i,scrollDirection:a},{listState:l},{beforeUnshiftWith:c,gap:d,shiftWithOffset:m,sizes:p},{log:b},{recalcInProgress:S}])=>{const v=Ve(H(l,fe(i),et(([,f,y,R],[{bottom:k,items:T,offsetBottom:_,totalCount:w},x])=>{const E=k+_;let B=0;return y===w&&f.length>0&&T.length>0&&(T[0].originalIndex===0&&f[0].originalIndex===0||(B=E-R,B!==0&&(B+=x))),[B,T,w,E]},[0,[],0,0]),re(([f])=>f!==0),fe(r,a,n,o,b,S),re(([,f,y,R,,,k])=>!k&&!R&&f!==0&&y===Gt),K(([[f],,,,,y])=>(y("Upward scrolling compensation",{amount:f},Ne.DEBUG),f))));function g(f){f>0?(ue(t,{behavior:"auto",top:-f}),ue(e,0)):(ue(e,0),ue(t,{behavior:"auto",top:-f}))}return xe(H(v,fe(e,s)),([f,y,R])=>{R&&Hi()?ue(e,y-f):g(-f)}),xe(H(Re(ze(s,!1),e,S),re(([f,y,R])=>!f&&!R&&y!==0),K(([f,y])=>y),st(1)),g),J(H(m,K(f=>({top:-f}))),t),xe(H(c,fe(p,d),K(([f,{groupIndices:y,lastSize:R,sizeTree:k},T])=>{function _(w){return w*(R+T)}if(y.length===0)return _(f);{let w=0;const x=zt(k,0);let E=0,B=0;for(;E<f;){E++,w+=x;let C=y.length===B+1?1/0:y[B+1]-y[B]-1;E+C>f&&(w-=x,C=f-E+1),E+=C,w+=_(C),B++}return w}})),f=>{ue(e,f),requestAnimationFrame(()=>{ue(t,{top:f}),requestAnimationFrame(()=>{ue(e,0),ue(S,!1)})})}),{deviation:e}},we(Le,$t,St,tt,ft,sr)),Fi=be(([e,t,n,r,o,s,i,a,l,c,d])=>({...e,...t,...n,...r,...o,...s,...i,...a,...l,...c,...d}),we(cr,Bi,pt,ns,Jo,zi,Ei,ur,ts,ft,es)),os=be(([{data:e,defaultItemSize:t,firstItemIndex:n,fixedItemSize:r,fixedGroupSize:o,gap:s,groupIndices:i,heightEstimates:a,itemSize:l,sizeRanges:c,sizes:d,statefulTotalCount:m,totalCount:p,trackItemSizes:b},{initialItemFinalLocationReached:S,initialTopMostItemIndex:v,scrolledToInitialItem:g},f,y,R,k,{scrollToIndex:T},_,{topItemCount:w},{groupCounts:x},E])=>{const{listState:B,minOverscanItemCount:C,topItemsIndexes:O,rangeChanged:I,...P}=k;return J(I,E.scrollSeekRangeChanged),J(H(E.windowViewportRect,K(j=>j.visibleHeight)),f.viewportHeight),{data:e,defaultItemHeight:t,firstItemIndex:n,fixedItemHeight:r,fixedGroupHeight:o,gap:s,groupCounts:x,heightEstimates:a,initialItemFinalLocationReached:S,initialTopMostItemIndex:v,scrolledToInitialItem:g,sizeRanges:c,topItemCount:w,topItemsIndexes:O,totalCount:p,...R,groupIndices:i,itemSize:l,listState:B,minOverscanItemCount:C,scrollToIndex:T,statefulTotalCount:m,trackItemSizes:b,rangeChanged:I,...P,...E,...f,sizes:d,...y}},we(tt,Dt,Le,Ai,Oi,St,Vt,Ni,Gi,Yo,Fi));function Wi(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 Xt=typeof document<"u"?u.useLayoutEffect:u.useEffect;function ss(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=u.createContext({});function l(g,f){g.propsReady&&ue(g.propsReady,!1);for(const y of r){const R=g[t.required[y]];ue(R,f[y])}for(const y of o)if(y in f){const R=g[t.optional[y]];ue(R,f[y])}g.propsReady&&ue(g.propsReady,!0)}function c(g){return s.reduce((f,y)=>(f[y]=R=>{const k=g[t.methods[y]];ue(k,R)},f),{})}function d(g){return i.reduce((f,y)=>(f[y]=oi(g[t.events[y]]),f),{})}const m=u.forwardRef((g,f)=>{const{children:y,...R}=g,[k]=u.useState(()=>cn(ii(e),w=>{l(w,R)})),[T]=u.useState(_r(d,k));Xt(()=>{for(const w of i)w in R&&xe(T[w],R[w]);return()=>{Object.values(T).map(rr)}},[R,T,k]),Xt(()=>{l(k,R)}),u.useImperativeHandle(f,Tr(c(k)));const _=n;return h.jsx(a.Provider,{value:k,children:n?h.jsx(_,{...Wi([...r,...o,...i],R),children:y}):y})}),p=g=>{const f=u.useContext(a);return u.useCallback(y=>{ue(f[g],y)},[f,g])},b=g=>{const f=u.useContext(a)[g],y=u.useCallback(R=>xe(f,R),[f]);return u.useSyncExternalStore(y,()=>Te(f),()=>Te(f))},S=g=>{const f=u.useContext(a)[g],[y,R]=u.useState(_r(Te,f));return Xt(()=>xe(f,k=>{k!==y&&R(Tr(k))}),[f,y]),y},v=u.version.startsWith("18")?b:S;return{Component:m,useEmitter:(g,f)=>{const y=u.useContext(a)[g];Xt(()=>xe(y,f),[f,y])},useEmitterValue:v,usePublisher:p}}const is=u.createContext(void 0),ls=u.createContext(void 0),as=typeof document<"u"?u.useLayoutEffect:u.useEffect;function kn(e){return"self"in e}function Vi(e){return"body"in e}function cs(e,t,n,r=Mt,o,s){const i=u.useRef(null),a=u.useRef(null),l=u.useRef(null),c=u.useCallback(p=>{let b,S,v;const g=p.target;if(Vi(g)||kn(g)){const y=kn(g)?g:g.defaultView;v=s?y.scrollX:y.scrollY,b=s?y.document.documentElement.scrollWidth:y.document.documentElement.scrollHeight,S=s?y.innerWidth:y.innerHeight}else v=s?g.scrollLeft:g.scrollTop,b=s?g.scrollWidth:g.scrollHeight,S=s?g.offsetWidth:g.offsetHeight;const f=()=>{e({scrollHeight:b,scrollTop:Math.max(v,0),viewportHeight:S})};p.suppressFlushSync?f():Ls.flushSync(f),a.current!==null&&(v===a.current||v<=0||v===b-S)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t,s]);u.useEffect(()=>{const p=o||i.current;return r(o||i.current),c({suppressFlushSync:!0,target:p}),p.addEventListener("scroll",c,{passive:!0}),()=>{r(null),p.removeEventListener("scroll",c)}},[i,c,n,r,o]);function d(p){const b=i.current;if(!b||(s?"offsetWidth"in b&&b.offsetWidth===0:"offsetHeight"in b&&b.offsetHeight===0))return;const S=p.behavior==="smooth";let v,g,f;kn(b)?(g=Math.max(ut(b.document.documentElement,s?"width":"height"),s?b.document.documentElement.scrollWidth:b.document.documentElement.scrollHeight),v=s?b.innerWidth:b.innerHeight,f=s?window.scrollX:window.scrollY):(g=b[s?"scrollWidth":"scrollHeight"],v=ut(b,s?"width":"height"),f=b[s?"scrollLeft":"scrollTop"]);const y=g-v;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),Qo(v,g)||p.top===f){e({scrollHeight:g,scrollTop:f,viewportHeight:v}),S&&t(!0);return}S?(a.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,s&&(p={behavior:p.behavior,left:p.top}),b.scrollTo(p)}function m(p){s&&(p={behavior:p.behavior,left:p.top}),i.current.scrollBy(p)}return{scrollByCallback:m,scrollerRef:i,scrollToCallback:d}}const Tn="-webkit-sticky",Gr="sticky",dr=rs(()=>{if(typeof document>"u")return Gr;const e=document.createElement("div");return e.style.position=Tn,e.style.position===Tn?Tn:Gr});function fr(e){return e}const Di=be(()=>{const e=F(a=>`Item ${a}`),t=F(a=>`Group ${a}`),n=F({}),r=F(fr),o=F("div"),s=F(Mt),i=(a,l=null)=>ze(H(n,K(c=>c[a]),ye()),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")}}),$i=be(([e,t])=>({...e,...t}),we(os,Di)),qi=({height:e})=>h.jsx("div",{style:{height:e}}),Ui={overflowAnchor:"none",position:dr(),zIndex:1},us={overflowAnchor:"none"},Ki={...us,display:"inline-block",height:"100%"},Hr=u.memo(function({showTopList:e=!1}){const t=ie("listState"),n=De("sizeRanges"),r=ie("useWindowScroll"),o=ie("customScrollParent"),s=De("windowScrollContainerState"),i=De("scrollContainerState"),a=o||r?s:i,l=ie("itemContent"),c=ie("context"),d=ie("groupContent"),m=ie("trackItemSizes"),p=ie("itemSize"),b=ie("log"),S=De("gap"),v=ie("horizontalDirection"),{callbackRef:g}=ci(n,p,m,e?Mt:a,b,S,o,v,ie("skipAnimationFrameInResizeObserver")),[f,y]=u.useState(0);pr("deviation",P=>{f!==P&&y(P)});const R=ie("EmptyPlaceholder"),k=ie("ScrollSeekPlaceholder")||qi,T=ie("ListComponent"),_=ie("ItemComponent"),w=ie("GroupComponent"),x=ie("computeItemKey"),E=ie("isSeeking"),B=ie("groupIndices").length>0,C=ie("alignToBottom"),O=ie("initialItemFinalLocationReached"),I=e?{}:{boxSizing:"border-box",...v?{display:"inline-block",height:"100%",marginLeft:f!==0?f:C?"auto":0,paddingLeft:t.offsetTop,paddingRight:t.offsetBottom,whiteSpace:"nowrap"}:{marginTop:f!==0?f:C?"auto":0,paddingBottom:t.offsetBottom,paddingTop:t.offsetTop},...O?{}:{visibility:"hidden"}};return!e&&t.totalCount===0&&R?h.jsx(R,{...Be(R,c)}):h.jsx(T,{...Be(T,c),"data-testid":e?"virtuoso-top-item-list":"virtuoso-item-list",ref:g,style:I,children:(e?t.topItems:t.items).map(P=>{const j=P.originalIndex,z=x(j+t.firstItemIndex,P.data,c);return E?u.createElement(k,{...Be(k,c),height:P.size,index:P.index,key:z,type:P.type||"item",...P.type==="group"?{}:{groupIndex:P.groupIndex}}):P.type==="group"?u.createElement(w,{...Be(w,c),"data-index":j,"data-item-index":P.index,"data-known-size":P.size,key:z,style:Ui},d(P.index,c)):u.createElement(_,{...Be(_,c),...Zi(_,P.data),"data-index":j,"data-item-group-index":P.groupIndex,"data-item-index":P.index,"data-known-size":P.size,key:z,style:v?Ki:us},B?l(P.index,P.groupIndex,P.data,c):l(P.index,P.data,c))})})}),Yi={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Xi={outline:"none",overflowX:"auto",position:"relative"},dn=e=>({height:"100%",position:"absolute",top:0,width:"100%",...e?{display:"flex",flexDirection:"column"}:{}}),Qi={position:dr(),top:0,width:"100%",zIndex:1};function Be(e,t){if(typeof e!="string")return{context:t}}function Zi(e,t){return{item:typeof e=="string"?void 0:t}}const Ji=u.memo(function(){const e=ie("HeaderComponent"),t=De("headerHeight"),n=ie("HeaderFooterTag"),r=vt(u.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ie("skipAnimationFrameInResizeObserver")),o=ie("context");return e?h.jsx(n,{ref:r,children:h.jsx(e,{...Be(e,o)})}):null}),el=u.memo(function(){const e=ie("FooterComponent"),t=De("footerHeight"),n=ie("HeaderFooterTag"),r=vt(u.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,ie("skipAnimationFrameInResizeObserver")),o=ie("context");return e?h.jsx(n,{ref:r,children:h.jsx(e,{...Be(e,o)})}):null});function ds({useEmitter:e,useEmitterValue:t,usePublisher:n}){return u.memo(function({children:r,style:o,context:s,...i}){const a=n("scrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=t("scrollerRef"),m=t("horizontalDirection")||!1,{scrollByCallback:p,scrollerRef:b,scrollToCallback:S}=cs(a,c,l,d,void 0,m);return e("scrollTo",S),e("scrollBy",p),h.jsx(l,{"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,ref:b,style:{...m?Xi:Yi,...o},tabIndex:0,...i,...Be(l,s),children:r})})}function fs({useEmitter:e,useEmitterValue:t,usePublisher:n}){return u.memo(function({children:r,style:o,context:s,...i}){const a=n("windowScrollContainerState"),l=t("ScrollerComponent"),c=n("smoothScrollTargetReached"),d=t("totalListHeight"),m=t("deviation"),p=t("customScrollParent"),b=u.useRef(null),S=t("scrollerRef"),{scrollByCallback:v,scrollerRef:g,scrollToCallback:f}=cs(a,c,l,S,p);return as(()=>{var y;return g.current=p||((y=b.current)==null?void 0:y.ownerDocument.defaultView),()=>{g.current=null}},[g,p]),e("windowScrollTo",f),e("scrollBy",v),h.jsx(l,{ref:b,"data-virtuoso-scroller":!0,style:{position:"relative",...o,...d!==0?{height:d+m}:{}},...i,...Be(l,s),children:r})})}const tl=({children:e})=>{const t=u.useContext(is),n=De("viewportHeight"),r=De("fixedItemHeight"),o=ie("alignToBottom"),s=ie("horizontalDirection"),i=u.useMemo(()=>Lo(n,l=>ut(l,s?"width":"height")),[n,s]),a=vt(i,!0,ie("skipAnimationFrameInResizeObserver"));return u.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),h.jsx("div",{"data-viewport-type":"element",ref:a,style:dn(o),children:e})},nl=({children:e})=>{const t=u.useContext(is),n=De("windowViewportRect"),r=De("fixedItemHeight"),o=ie("customScrollParent"),s=Ho(n,o,ie("skipAnimationFrameInResizeObserver")),i=ie("alignToBottom");return u.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),h.jsx("div",{"data-viewport-type":"window",ref:s,style:dn(i),children:e})},rl=({children:e})=>{const t=ie("TopItemListComponent")||"div",n=ie("headerHeight"),r={...Qi,marginTop:`${n}px`},o=ie("context");return h.jsx(t,{style:r,...Be(t,o),children:e})},ol=u.memo(function(e){const t=ie("useWindowScroll"),n=ie("topItemsIndexes").length>0,r=ie("customScrollParent"),o=ie("context");return h.jsxs(r||t?ll:il,{...e,context:o,children:[n&&h.jsx(rl,{children:h.jsx(Hr,{showTopList:!0})}),h.jsxs(r||t?nl:tl,{children:[h.jsx(Ji,{}),h.jsx(Hr,{}),h.jsx(el,{})]})]})}),{Component:sl,useEmitter:pr,useEmitterValue:ie,usePublisher:De}=ss($i,{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"}},ol),il=ds({useEmitter:pr,useEmitterValue:ie,usePublisher:De}),ll=fs({useEmitter:pr,useEmitterValue:ie,usePublisher:De}),al=sl,cl=be(()=>{const e=F(c=>h.jsxs("td",{children:["Item $",c]})),t=F(null),n=F(c=>h.jsxs("td",{colSpan:1e3,children:["Group ",c]})),r=F(null),o=F(null),s=F({}),i=F(fr),a=F(Mt),l=(c,d=null)=>ze(H(s,K(m=>m[c]),ye()),d);return{components:s,computeItemKey:i,context:t,EmptyPlaceholder:l("EmptyPlaceholder"),FillerRow:l("FillerRow"),fixedFooterContent:o,fixedHeaderContent:r,itemContent:e,groupContent:n,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder"),TableBodyComponent:l("TableBody","tbody"),TableComponent:l("Table","table"),TableFooterComponent:l("TableFoot","tfoot"),TableHeadComponent:l("TableHead","thead"),TableRowComponent:l("TableRow","tr"),GroupComponent:l("Group","tr")}});we(os,cl);dr();const Nr={bottom:0,itemHeight:0,items:[],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},ul={bottom:0,itemHeight:0,items:[{index:0}],itemWidth:0,offsetBottom:0,offsetTop:0,top:0},{ceil:Fr,floor:rn,max:Ot,min:_n,round:Wr}=Math;function Vr(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>({data:n===null?null:n[o+e],index:o+e}))}function dl(e){return{...ul,items:e}}function Qt(e,t){return e&&e.width===t.width&&e.height===t.height}function fl(e,t){return e&&e.column===t.column&&e.row===t.row}const pl=be(([{increaseViewportBy:e,listBoundary:t,overscan:n,visibleRange:r},{footerHeight:o,headerHeight:s,scrollBy:i,scrollContainerState:a,scrollTo:l,scrollTop:c,smoothScrollTargetReached:d,viewportHeight:m},p,b,{didMount:S,propsReady:v},{customScrollParent:g,useWindowScroll:f,windowScrollContainerState:y,windowScrollTo:R,windowViewportRect:k},T])=>{const _=F(0),w=F(0),x=F(Nr),E=F({height:0,width:0}),B=F({height:0,width:0}),C=me(),O=me(),I=F(0),P=F(null),j=F({column:0,row:0}),z=me(),A=me(),D=F(!1),Q=F(0),ae=F(!0),de=F(!1),$=F(!1);xe(H(S,fe(Q),re(([G,Z])=>!!Z)),()=>{ue(ae,!1)}),xe(H(Re(S,ae,B,E,Q,de),re(([G,Z,M,N,,L])=>G&&!Z&&M.height!==0&&N.height!==0&&!L)),([,,,,G])=>{ue(de,!0),lr(1,()=>{ue(C,G)}),Ye(H(c),()=>{ue(t,[0,0]),ue(ae,!0)})}),J(H(A,re(G=>G!=null&&G.scrollTop>0),Je(0)),w),xe(H(S,fe(A),re(([,G])=>G!=null)),([,G])=>{G&&(ue(E,G.viewport),ue(B,G.item),ue(j,G.gap),G.scrollTop>0&&(ue(D,!0),Ye(H(c,gt(1)),Z=>{ue(D,!1)}),ue(l,{top:G.scrollTop})))}),J(H(E,K(({height:G})=>G)),m),J(H(Re(ne(E,Qt),ne(B,Qt),ne(j,(G,Z)=>G&&G.column===Z.column&&G.row===Z.row),ne(c)),K(([G,Z,M,N])=>({gap:M,item:Z,scrollTop:N,viewport:G}))),z),J(H(Re(ne(_),r,ne(j,fl),ne(B,Qt),ne(E,Qt),ne(P),ne(w),ne(D),ne(ae),ne(Q)),re(([,,,,,,,G])=>!G),K(([G,[Z,M],N,L,V,q,W,,le,X])=>{const{column:ee,row:oe}=N,{height:se,width:_e}=L,{width:Ae}=V;if(W===0&&(G===0||Ae===0))return Nr;if(_e===0){const qt=ar(X,G),Bs=qt+Math.max(W-1,0);return dl(Vr(qt,Bs,q))}const Pe=ps(Ae,_e,ee);let Ge,Fe;le?Z===0&&M===0&&W>0?(Ge=0,Fe=W-1):(Ge=Pe*rn((Z+oe)/(se+oe)),Fe=Pe*Fr((M+oe)/(se+oe))-1,Fe=_n(G-1,Ot(Fe,Pe-1)),Ge=_n(Fe,Ot(0,Ge))):(Ge=0,Fe=-1);const qe=Vr(Ge,Fe,q),{bottom:je,top:rt}=Dr(V,N,L,qe),ot=Fr(G/Pe),hn=ot*se+(ot-1)*oe-je;return{bottom:je,itemHeight:se,items:qe,itemWidth:_e,offsetBottom:hn,offsetTop:rt,top:rt}})),x),J(H(P,re(G=>G!==null),K(G=>G.length)),_),J(H(Re(E,B,x,j),re(([G,Z,{items:M}])=>M.length>0&&Z.height!==0&&G.height!==0),K(([G,Z,{items:M},N])=>{const{bottom:L,top:V}=Dr(G,N,Z,M);return[V,L]}),ye(At)),t);const pe=F(!1);J(H(c,fe(pe),K(([G,Z])=>Z||G!==0)),pe);const ge=Ve(H(Re(x,_),re(([{items:G}])=>G.length>0),fe(pe),re(([[G,Z],M])=>{const N=G.items[G.items.length-1].index===Z-1;return(M||G.bottom>0&&G.itemHeight>0&&G.offsetBottom===0&&G.items.length===Z)&&N}),K(([[,G]])=>G-1),ye())),Ce=Ve(H(ne(x),re(({items:G})=>G.length>0&&G[0].index===0),Je(0),ye())),U=Ve(H(ne(x),fe(D),re(([{items:G},Z])=>G.length>0&&!Z),K(([{items:G}])=>({endIndex:G[G.length-1].index,startIndex:G[0].index})),ye($o),st(0)));J(U,b.scrollSeekRangeChanged),J(H(C,fe(E,B,_,j),K(([G,Z,M,N,L])=>{const V=Xo(G),{align:q,behavior:W,offset:le}=V;let X=V.index;X==="LAST"&&(X=N-1),X=Ot(0,X,_n(N-1,X));let ee=Zn(Z,L,M,X);return q==="end"?ee=Wr(ee-Z.height+M.height):q==="center"&&(ee=Wr(ee-Z.height/2+M.height/2)),le&&(ee+=le),{behavior:W,top:ee}})),l);const he=ze(H(x,K(G=>G.offsetBottom+G.bottom)),0);return J(H(k,K(G=>({height:G.visibleHeight,width:G.visibleWidth}))),E),{customScrollParent:g,data:P,deviation:I,footerHeight:o,gap:j,headerHeight:s,increaseViewportBy:e,initialItemCount:w,itemDimensions:B,overscan:n,restoreStateFrom:A,scrollBy:i,scrollContainerState:a,scrollHeight:O,scrollTo:l,scrollToIndex:C,scrollTop:c,smoothScrollTargetReached:d,totalCount:_,useWindowScroll:f,viewportDimensions:E,windowScrollContainerState:y,windowScrollTo:R,windowViewportRect:k,...b,gridState:x,horizontalDirection:$,initialTopMostItemIndex:Q,totalListHeight:he,...p,endReached:ge,propsReady:v,rangeChanged:U,startReached:Ce,stateChanged:z,stateRestoreInProgress:D,...T}},we(cr,Le,$t,ns,pt,ur,ft));function ps(e,t,n){return Ot(1,rn((e+n)/(rn(t)+n)))}function Dr(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{bottom:0,top:0};const s=Zn(e,t,n,r[0].index);return{bottom:Zn(e,t,n,r[r.length-1].index)+o,top:s}}function Zn(e,t,n,r){const o=ps(e.width,n.width,t.column),s=rn(r/o),i=s*n.height+Ot(0,s-1)*t.row;return i>0?i+t.row:i}const hl=be(()=>{const e=F(m=>`Item ${m}`),t=F({}),n=F(null),r=F("virtuoso-grid-item"),o=F("virtuoso-grid-list"),s=F(fr),i=F("div"),a=F(Mt),l=(m,p=null)=>ze(H(t,K(b=>b[m]),ye()),p),c=F(!1),d=F(!1);return J(ne(d),c),{components:t,computeItemKey:s,context:n,FooterComponent:l("Footer"),HeaderComponent:l("Header"),headerFooterTag:i,itemClassName:r,ItemComponent:l("Item","div"),itemContent:e,listClassName:o,ListComponent:l("List","div"),readyStateChanged:c,reportReadyState:d,ScrollerComponent:l("Scroller","div"),scrollerRef:a,ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),gl=be(([e,t])=>({...e,...t}),we(pl,hl)),ml=u.memo(function(){const e=ke("gridState"),t=ke("listClassName"),n=ke("itemClassName"),r=ke("itemContent"),o=ke("computeItemKey"),s=ke("isSeeking"),i=$e("scrollHeight"),a=ke("ItemComponent"),l=ke("ListComponent"),c=ke("ScrollSeekPlaceholder"),d=ke("context"),m=$e("itemDimensions"),p=$e("gap"),b=ke("log"),S=ke("stateRestoreInProgress"),v=$e("reportReadyState"),g=vt(u.useMemo(()=>f=>{const y=f.parentElement.parentElement.scrollHeight;i(y);const R=f.firstChild;if(R){const{height:k,width:T}=R.getBoundingClientRect();m({height:k,width:T})}p({column:$r("column-gap",getComputedStyle(f).columnGap,b),row:$r("row-gap",getComputedStyle(f).rowGap,b)})},[i,m,p,b]),!0,!1);return as(()=>{e.itemHeight>0&&e.itemWidth>0&&v(!0)},[e]),S?null:h.jsx(l,{className:t,ref:g,...Be(l,d),"data-testid":"virtuoso-item-list",style:{paddingBottom:e.offsetBottom,paddingTop:e.offsetTop},children:e.items.map(f=>{const y=o(f.index,f.data,d);return s?h.jsx(c,{...Be(c,d),height:e.itemHeight,index:f.index,width:e.itemWidth},y):u.createElement(a,{...Be(a,d),className:n,"data-index":f.index,key:y},r(f.index,f.data,d))})})}),bl=u.memo(function(){const e=ke("HeaderComponent"),t=$e("headerHeight"),n=ke("headerFooterTag"),r=vt(u.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=ke("context");return e?h.jsx(n,{ref:r,children:h.jsx(e,{...Be(e,o)})}):null}),xl=u.memo(function(){const e=ke("FooterComponent"),t=$e("footerHeight"),n=ke("headerFooterTag"),r=vt(u.useMemo(()=>s=>{t(ut(s,"height"))},[t]),!0,!1),o=ke("context");return e?h.jsx(n,{ref:r,children:h.jsx(e,{...Be(e,o)})}):null}),vl=({children:e})=>{const t=u.useContext(ls),n=$e("itemDimensions"),r=$e("viewportDimensions"),o=vt(u.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return u.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),h.jsx("div",{ref:o,style:dn(!1),children:e})},Sl=({children:e})=>{const t=u.useContext(ls),n=$e("windowViewportRect"),r=$e("itemDimensions"),o=ke("customScrollParent"),s=Ho(n,o,!1);return u.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),h.jsx("div",{ref:s,style:dn(!1),children:e})},yl=u.memo(function({...e}){const t=ke("useWindowScroll"),n=ke("customScrollParent"),r=n||t?Cl:wl,o=n||t?Sl:vl,s=ke("context");return h.jsx(r,{...e,...Be(r,s),children:h.jsxs(o,{children:[h.jsx(bl,{}),h.jsx(ml,{}),h.jsx(xl,{})]})})}),{useEmitter:hs,useEmitterValue:ke,usePublisher:$e}=ss(gl,{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"}},yl),wl=ds({useEmitter:hs,useEmitterValue:ke,usePublisher:$e}),Cl=fs({useEmitter:hs,useEmitterValue:ke,usePublisher:$e});function $r(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ne.WARN),t==="normal"?0:parseInt(t??"0",10)}const fn=u.createContext(void 0);function Se(e,t){const n=u.useContext(fn);if(!n)throw new Error("useAudioStore must be used within CRAudioProvider");return Wt(n,e,t)}function qr(){const e=u.useContext(fn);if(!e)throw new Error("useAudioStoreApi must be used within CRAudioProvider");return e}const hr=u.createContext(void 0);function mt(){const e=u.useContext(hr);if(!e)throw new Error("useProgressStoreApi must be used within InternalCRViewerProgressProvider");return e}function te(e,t){const n=u.useContext(hr);if(!n)throw new Error("useProgressStore must be used within InternalCRViewerProgressProvider");return Wt(n,o=>e(o.progress),t)}const Il="_run_zzb61_3",kl="_runWrap_zzb61_7",Tl="_highlight_zzb61_13",_l="_highlightleft_zzb61_14",Rl="_highlightright_zzb61_15",Ml="_highlightcenter_zzb61_16",El="_underline_zzb61_48",jl="_underlineleft_zzb61_49",Pl="_underlineright_zzb61_50",Ol="_underlinecenter_zzb61_51",Ze={run:Il,runWrap:kl,highlight:Tl,highlightleft:_l,highlightright:Rl,highlightcenter:Ml,underline:El,underlineleft:jl,underlineright:Pl,underlinecenter:Ol},Ur=e=>Symbol.iterator in e,Kr=e=>"entries"in e,Yr=(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},Bl=(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 zl(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:Ur(e)&&Ur(t)?Kr(e)&&Kr(t)?Yr(e,t):Bl(e,t):Yr({entries:()=>Object.entries(e)},{entries:()=>Object.entries(t)})}function Ft(e){const t=u.useRef(void 0);return n=>{const r=e(n);return zl(t.current,r)?t.current:t.current=r}}function Al(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 Ll(e){const t=e.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)/);return t?{r:+t[1],g:+t[2],b:+t[3]}:null}const Gl=Object.freeze({showPointer:void 0,pointerStyle:void 0,pointerColor:void 0}),gs=u.memo(function({runs:t,ns:n,baseIndex:r,preGroups:o}){const s=Se(f=>f.setClipIndex),i=Se(f=>f.seek),a=te(f=>f.setCurrentGlobalRunIndex),l=u.useCallback(f=>{var E;const y=(E=f.target)==null?void 0:E.closest("[data-g]");if(!y)return;const R=Number(y.dataset.g),k=R-r;if(k<0||k>=t.length)return;const T=t[k],_=T.text??"";if(!_.trim()||!/[가-힣a-zA-Z0-9]/.test(_))return;a(R,"program");const w=T.audioChunkIndex,x=T.audioTimeMs;w!=null&&x!=null&&(s(w),i(x))},[t,r,i,s,a]),c=u.useRef(null),d=u.useCallback(f=>{var _;const y=(_=f.target)==null?void 0:_.closest("[data-g]");if(!y)return;const k=Number(y.dataset.g)-r;if(k<0||k>=t.length)return;const T=(t[k].text??"").trim();c.current&&(window.clearTimeout(c.current),c.current=null),c.current=window.setTimeout(()=>{T&&alert(T),c.current=null},800)},[t,r]),m=u.useCallback(()=>{c.current&&(window.clearTimeout(c.current),c.current=null)},[]),p=m,b=m,S=m,v=o,g=r+t.length-1;return h.jsx("span",{onDoubleClick:l,onPointerDown:d,onPointerUp:p,onPointerCancel:b,onPointerLeave:S,children:v.map((f,y)=>h.jsx(Nl,{ns:n,group:f,runs:t,paraLastG:g},`${n}/grp:${y}-${f.startG}`))})},(e,t)=>e.ns===t.ns&&e.baseIndex===t.baseIndex&&e.runs===t.runs&&e.sectionId===t.sectionId),Hl=u.memo(function(){const t=u.useCallback(r=>({showSplit:r.showSplit,slash:r.breakMarks.slash,breakGapPx:r.breakGapPx}),[]),n=Y(Ft(t));return n.showSplit?h.jsxs(h.Fragment,{children:[h.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}}),n.slash&&h.jsx("span",{children:" / "}),h.jsx("span",{style:{display:"inline-block",width:n.breakGapPx/2}})]}):null}),Nl=u.memo(function({ns:t,group:n,runs:r,paraLastG:o}){const s=u.useCallback(S=>{const v=S.currentGlobalRunIndex;return v!=null&&v>=n.startG&&v<=n.endG},[n]),i=te(Ft(s)),a=u.useCallback(S=>i?{showPointer:S.showPointer,pointerStyle:S.pointerStyle,pointerColor:S.pointerColor}:Gl,[i]),l=Y(Ft(a)),c=n.r0??0,d=n.len??Math.max(0,n.endG-n.startG+1),m=i&&l.showPointer&&l.pointerStyle!=="underline",p=i&&l.showPointer&&l.pointerStyle==="underline",b=m||p?{"--hl-color":l.pointerColor,"--ul-color":l.pointerColor,"--ul-thickness":"0.3em","--ul-offset":"0.35em"}:void 0;return h.jsx(h.Fragment,{children:Array.from({length:d}).map((S,v)=>{const f=r[c+v],y=n.startG+v,R=`${t}/run:${y}`,k=!!f.split&&y!==o;let T=`${Ze.runWrap}`;return m&&(d===1?T+=` ${Ze.highlight}`:v===0?T+=` ${Ze.highlightleft}`:v+1===d?T+=` ${Ze.highlightright}`:T+=` ${Ze.highlightcenter}`),p&&(d===1?T+=` ${Ze.underline}`:v===0?T+=` ${Ze.underlineleft}`:v+1===d?T+=` ${Ze.underlineright}`:T+=` ${Ze.underlinecenter}`),h.jsxs(u.Fragment,{children:[h.jsx("span",{className:T,style:b,children:h.jsx(Fl,{gi:n.startG,g:y,run:f,active:i,pointerCfg:l})}),k&&h.jsx(Hl,{})]},R)})})},(e,t)=>e.group===t.group&&e.runs===t.runs&&e.ns===t.ns),Fl=u.memo(function({gi:t,g:n,run:r,active:o,pointerCfg:s}){const i=u.useMemo(()=>{const a={whiteSpace:"pre-wrap"};if(r.bold&&(a.fontWeight=700),r.italic&&(a.fontStyle="italic"),r.underline&&(a.textDecoration="underline"),o&&s.showPointer){const l=s.pointerColor;if(s.pointerStyle!=="underline"){a.backgroundColor=l;const c=l.startsWith("#")?Al(l):Ll(l);c&&(.299*c.r+.587*c.g+.114*c.b)/255<.6&&(a.color="#fff")}}return a},[r.bold,r.italic,r.underline,o,s]);return h.jsx("span",{className:Ze.run,style:i,"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);function Wl({block:e,computedMarker:t,ns:n,baseIndex:r,sectionId:o,preGroups:s}){var c;const i=e.list?e.list.level*24:0,a=((c=e.list)==null?void 0:c.kind)==="bullet"?e.list.glyph??"•":void 0,l=t??a;return h.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:i,textAlign:e.textAlign,boxSizing:"border-box"},children:[e.list?h.jsx("span",{style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:l||""}):null,h.jsx(gs,{preGroups:s,runs:e.runs,ns:n,baseIndex:r,sectionId:o})]})}const Vl=u.memo(Wl,(e,t)=>e.block===t.block&&e.computedMarker===t.computedMarker&&e.baseIndex===t.baseIndex&&e.ns===t.ns);function Dl(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 Qr(e,!1);case"upperalpha":case"upperlatin":return Qr(e,!0);case"lowerroman":return Xr(e,!1);case"upperroman":return Xr(e,!0);case"decimalenclosedcircle":return $l(e);default:return String(e)}}function $l(e){return e>=1&&e<=20?String.fromCharCode(9312+(e-1)):`(${e})`}function Xr(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 Qr(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 gr(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 mr(e,t){const n=e.list;if(!n||n.kind!=="ordered")return;const r=t.next(n.numId??0,n.level),o=Dl(r,n.format),s=(n.format||"").toLowerCase();return!/enclosed|paren/.test(s)&&s!=="decimalleadingzero"?`${o}.`:o}function ql(e){return e.map(t=>t.type==="image"?0:t.runs.length)}function Ul(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 Kl(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 Yl="_scroller_kqkmq_3",Xl={scroller:Yl},Ql=u.forwardRef(function({className:t,style:n,...r},o){return h.jsx("div",{ref:o,className:`${Xl.scroller}${t?" "+t:""}`,style:n,...r})});function Et(){const e=u.useContext(xt);if(!e)throw new Error("useViewerRecorderStoreApi must be used inside <ViewerRecorderProvider>");return e}const Jn=e=>/[가-힣a-zA-Z0-9]/.test(e),Zl=e=>((e==null?void 0:e.textContent)??"").trim(),on=(e,t)=>e.querySelector(`[data-g="${t}"]`);function Jl(e,t=12,n=1.5,r=.5){if(!e)return-1;const o=e.getBoundingClientRect(),s=o.top+t;let i=-1,a=1/0,l=1/0,c=-1,d=1/0,m=1/0;const p=e.querySelectorAll("[data-g]");for(let b=0;b<p.length;b++){const S=p[b];if(!S||!S.isConnected)continue;const v=Zl(S);if(!v||!Jn(v))continue;const g=S.getBoundingClientRect();if(g.height<=r||g.width<=r||g.bottom<=o.top||g.top>=o.bottom)continue;if(g.top<s){const R=Math.abs(g.top-s);(R<d||R===d&&(g.top<m||c!==-1&&Number(S.dataset.g)<c))&&(d=R,c=Number(S.dataset.g),m=g.top);continue}const f=Number(S.dataset.g);if(Number.isNaN(f))continue;g.top<l-n?(l=g.top,a=g.top,i=f):g.top<=l+n&&(g.top<a||g.top===a&&(i===-1||f<i))&&(a=g.top,i=f);const y=Math.abs(g.top-s);(y<d||y===d&&(g.top<m||c!==-1&&f<c))&&(d=y,c=f,m=g.top)}return i!==-1?i:c}const ms=async(e,t,{timeoutMs:n=1200,intervalMs:r=16}={})=>{const o=performance.now();let s=on(e,t);for(;!s;){if(performance.now()-o>n)return null;await new Promise(i=>setTimeout(i,r)),s=on(e,t)}return s},Zr=e=>{const t=e.getBoundingClientRect(),n=t.top+t.height*.15,r=t.top+t.height*.8,o=Array.from(e.querySelectorAll("[data-g]"));let s=Number.POSITIVE_INFINITY,i=Number.NEGATIVE_INFINITY;for(const a of o){const l=a.getBoundingClientRect();if(l.bottom<n||l.top>r||l.height<=0)continue;const c=Number(a.dataset.g);Number.isNaN(c)||(c<s&&(s=c),c>i&&(i=c))}return!Number.isFinite(s)||!Number.isFinite(i)?null:{first:s,last:i}},ea=(e,t,{topPaddingRatio:n=.15,behavior:r="auto"}={})=>{const o=on(e,t);if(!o)return!1;const s=e.getBoundingClientRect(),i=o.getBoundingClientRect(),a=s.height*n,l=i.top-(s.top+a);return e.scrollTo({top:e.scrollTop+l,behavior:r}),!0};function ta(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 Rn=async(e,t,{topPaddingRatio:n=.15,behavior:r="smooth",quietMs:o=120}={})=>{if(!ea(e,t,{topPaddingRatio:n,behavior:r}))return!1;await ta(e,o);const i=on(e,t);if(!i)return!1;const a=e.getBoundingClientRect(),l=i.getBoundingClientRect(),c=a.height*n,d=a.top+c,m=l.top-d;return Math.abs(m)<=1},ct=()=>new Promise(e=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>e())})}),br=u.createContext(null);function bs(){const e=u.useContext(br);if(!e)throw new Error("useQuizStoreApi must be used within QuizProgressProvider");return e}function Ue(e,t){const n=u.useContext(br);if(!n)throw new Error("useQuizStore must be used within QuizProgressProvider");return Wt(n,e,t)}const na=()=>{const e=te(n=>n.section),t=e.quiz;if(t&&t.length){const n=bs();return h.jsxs("button",{onClick:()=>{n.getState().openFromSection(e)},style:{width:300,background:"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:"pointer",boxShadow:"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease"},children:["퀴즈 풀기 (",t.length,")"]})}else return null},ra="_navBtn_rnisf_2",oa="_disabled_rnisf_25",sa="_label_rnisf_31",Tt={navBtn:ra,disabled:oa,label:sa};var xs={color:void 0,size:void 0,className:void 0,style:void 0,attr:void 0},Jr=u.createContext&&u.createContext(xs),ia=["attr","size","title"];function la(e,t){if(e==null)return{};var n=aa(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 aa(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 sn(){return sn=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},sn.apply(this,arguments)}function eo(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 ln(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?eo(Object(n),!0).forEach(function(r){ca(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):eo(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function ca(e,t,n){return t=ua(t),t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function ua(e){var t=da(e,"string");return typeof t=="symbol"?t:t+""}function da(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 vs(e){return e&&e.map((t,n)=>u.createElement(t.tag,ln({key:n},t.attr),vs(t.child)))}function nt(e){return t=>u.createElement(fa,sn({attr:ln({},e.attr)},t),vs(e.child))}function fa(e){var t=n=>{var{attr:r,size:o,title:s}=e,i=la(e,ia),a=o||n.size||"1em",l;return n.className&&(l=n.className),e.className&&(l=(l?l+" ":"")+e.className),u.createElement("svg",sn({stroke:"currentColor",fill:"currentColor",strokeWidth:"0"},n.attr,r,i,{className:l,style:ln(ln({color:e.color||n.color},n.style),e.style),height:a,width:a,xmlns:"http://www.w3.org/2000/svg"}),s&&u.createElement("title",null,s),e.children)};return Jr!==void 0?u.createElement(Jr.Consumer,null,n=>t(n)):t(xs)}function to(e){return nt({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 no(e){return nt({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)}function Ss(e,t){const n=u.useMemo(()=>!(e!=null&&e.length)||!t?-1:e.findIndex(s=>s.sectionId===t),[e,t]),r=u.useMemo(()=>!(e!=null&&e.length)||n<=0?null:e[n-1]??null,[e,n]),o=u.useMemo(()=>!(e!=null&&e.length)||n<0||n>=e.length-1?null:e[n+1]??null,[e,n]);return{index:n,prev:r,next:o}}const pa=({isIcon:e=!0})=>{const t=te(l=>l.sectionList),n=te(l=>l.section.section_id),r=te(l=>l.onSectionChange),{prev:o}=Ss(t,n),s=!o,i=u.useCallback(l=>{l.stopPropagation(),l.preventDefault(),o&&(r==null||r(o.sectionId))},[o,r]),a=o?`이전 섹션: ${o.title||"(제목 없음)"} • #${(o.order??0)+1}`:"이전 섹션 없음";return e?h.jsxs("button",{type:"button",className:`${Tt.navBtn} ${s?Tt.disabled:""}`,disabled:s,title:a,onMouseDown:i,onClick:l=>l.stopPropagation(),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&i(l)},children:[h.jsx(to,{size:18}),h.jsx("span",{className:Tt.label,children:"이전"})]}):h.jsx("button",{type:"button",disabled:s,title:a,onClick:i,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&i(l)},style:{width:300,background:s?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:s?"not-allowed":"pointer",boxShadow:s?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:s?.5:1},children:s?"첫섹션입니다":h.jsxs(h.Fragment,{children:[h.jsx(to,{size:18,style:{display:"inline",marginRight:"8px",verticalAlign:"middle"}}),"PrevSection"]})})},er=({isIcon:e=!0})=>{const t=te(l=>l.sectionList),n=te(l=>l.section.section_id),r=te(l=>l.onSectionChange),{next:o}=Ss(t,n),s=!o,i=u.useCallback(l=>{l.stopPropagation(),l.preventDefault(),o&&(r==null||r(o.sectionId))},[o,r]),a=o?`다음 섹션: ${o.title||"(제목 없음)"} • #${(o.order??0)+1}`:"다음 섹션 없음";return e?h.jsxs("button",{type:"button",className:`${Tt.navBtn} ${s?Tt.disabled:""}`,disabled:s,title:a,onMouseDown:i,onClick:l=>l.stopPropagation(),onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&i(l)},children:[h.jsx(no,{size:18}),h.jsx("span",{className:Tt.label,children:"다음"})]}):h.jsx("button",{type:"button",disabled:s,title:a,onClick:i,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&i(l)},style:{width:300,background:s?"#9ca3af":"#2563eb",color:"white",border:"none",borderRadius:"10px",padding:"14px 28px",fontSize:"16px",fontWeight:600,cursor:s?"not-allowed":"pointer",boxShadow:s?"none":"0 6px 16px rgba(37,99,235,0.3)",transition:"all 0.15s ease",opacity:s?.5:1},children:s?"마지막섹션입니다":h.jsxs(h.Fragment,{children:["NextSection",h.jsx(no,{size:18,style:{display:"inline",marginLeft:"8px",verticalAlign:"middle"}})]})})};function ys(e,t){let n=0,r=e.length-1;for(;n<r;){const o=Math.floor((n+r+1)/2);e[o]<=t?n=o:r=o-1}return n}function ha({section:e,blocks:t,nsPrefix:n}){const r=u.useMemo(()=>{const x=[],E=gr();return t.forEach((B,C)=>{B.type==="paragraph"&&(x[C]=mr(B,E))}),x},[t]),o=te(x=>{var E;return((E=x.layout)==null?void 0:E.prefix)??[]}),s=te(x=>{var E;return((E=x.derivedNav)==null?void 0:E.splitGroupsPerBlock)??[]}),i=Y(x=>x.marginX),a=Y(x=>x.viewportHeight),l=Y(x=>x.playbackViewportHeight),c=l>0?l:a,d=u.useRef({start:0,end:0}),m=u.useCallback(x=>{const E=t[x],B=`${n}blk-${E.id}`;if(E.type==="image"){const{src:I,alt:P,width:j,height:z}=E,A=j&&z?`${j} / ${z}`:"4 / 3",D=x>=d.current.start&&x<=d.current.end,Q=c>80?Math.floor((c-80)*.6):void 0;return h.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[h.jsx("div",{style:{position:"relative",width:"100%",maxHeight:Q,aspectRatio:A},children:h.jsx("img",{src:I,alt:P||"",loading:D?"eager":"lazy",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),P&&h.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:P})]})}const C=r[x]??void 0,O=s[x];return h.jsx("div",{style:{maxWidth:860,display:"flex"},children:h.jsx(Vl,{block:E,computedMarker:C,ns:B,baseIndex:o[x],sectionId:e.section_id,preGroups:O})})},[t,r,o,n,e,s,c]),p=u.useRef(null),b=u.useCallback(x=>{p.current=x},[]),S=u.useMemo(()=>u.memo(x=>{const{style:E,children:B,...C}=x;return h.jsx("div",{...C,style:E,children:h.jsx("div",{style:{boxSizing:"border-box",paddingRight:`${i}px`,paddingLeft:`${i}px`,maxWidth:860,margin:"0 auto",width:"100%",height:"100%"},children:B})})}),[i]),v=u.useRef(null),g=u.useMemo(()=>t.map(x=>x.id),[t]),f=u.useCallback(()=>{const x=e.quiz;return x&&x.length?h.jsxs("div",{style:{display:"block"},children:[h.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:h.jsx(na,{})}),h.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:h.jsx(er,{isIcon:!1})}),h.jsx("div",{style:{height:"80px",width:"100%"}})]}):h.jsxs("div",{children:[h.jsx("div",{style:{display:"flex",justifyContent:"center",marginTop:20},children:h.jsx(er,{isIcon:!1})}),h.jsx("div",{style:{height:40}})]})},[e]),y=u.useMemo(()=>({Item:S,Header:()=>h.jsx("div",{style:{height:40}}),Footer:f,Scroller:Ql}),[f,S]),R=u.useCallback(x=>g[x],[g]),k=mt(),[T]=u.useState(()=>k.getState().progress.currentGlobalRunIndex??0),_=u.useMemo(()=>{if(!o.length)return 0;const x=o[o.length-1],E=Math.max(0,Math.min(T,x));return ys(o,E)},[o,T]);console.log("SectionRenderVirtuoso확인");const w=mt();return u.useEffect(()=>{const x=p.current;x&&(console.log("@@@@@@@@@@@@@@@@"),(async()=>{const E=w.getState().progress.currentGlobalRunIndex,B=w.getState().progress.setSectionLoading;console.log("giFromStore",E);const C=E!=null&&E>=0?E:0;await ms(x,C),await ct(),await ct(),await ct(),await ct(),console.log("첫랜더끝"),B(!1)})())},[p,w]),h.jsxs(h.Fragment,{children:[h.jsx(al,{ref:v,style:{height:"100%",width:"100%",boxSizing:"border-box"},defaultItemHeight:99,computeItemKey:R,totalCount:t.length,itemContent:m,initialTopMostItemIndex:_,increaseViewportBy:{top:200,bottom:200},components:y,scrollerRef:b}),h.jsx(ga,{scrollContainerRef:p,virtRef:v,prefix:o})]})}const ga=({scrollContainerRef:e,virtRef:t,prefix:n})=>{const r=te(I=>I.setCurrentGlobalRunIndex),o=te(I=>I.registerSectionScrollApi),s=te(I=>I.currentGlobalRunIndex),i=Se(I=>I.scrollLock),a=Se(I=>I.syncToGI),l=Et(),c=u.useRef(!1),d=u.useRef(null),m=u.useRef(null),p=u.useRef(null),b=u.useRef(-1),S=u.useCallback(()=>{if(i)return;d.current=null;const I=m.current;if(!I)return;const P=Jl(I,5);P!==-1&&P!==b.current&&(b.current=P,a(P),r(P,"scroll"))},[i,a,r]),v=u.useCallback(I=>{m.current=I,d.current==null&&(d.current=requestAnimationFrame(S))},[S]),g=u.useCallback(I=>{m.current=I,p.current!=null&&(window.clearTimeout(p.current),p.current=null),p.current=window.setTimeout(()=>{p.current=null,S();const P=b.current;if(P===-1)return;const j=I.scrollTop,z=I.scrollHeight-I.clientHeight,A=z>0?j/z:0;let D=0;const Q=I.querySelector(`[data-g="${P}"]`);if(Q){const ae=I.getBoundingClientRect();D=(Q.getBoundingClientRect().top-ae.top)/ae.height}l.getState().emit({type:"scroll",payload:{scrollTop:j,scrollRatio:A,anchorGI:P,anchorOffsetRatio:D}})},100)},[S,l]),f=u.useRef(!1),y=u.useCallback(I=>{i||c.current&&(f.current||(v(I),g(I)))},[i,v,g]),R=u.useRef(void 0),k=u.useRef(void 0),T=u.useRef(void 0),_=u.useRef(void 0);u.useEffect(()=>{const I=e.current;if(I)return R.current=()=>{c.current=!0},k.current=()=>{c.current=!0},T.current=()=>{c.current=!0},_.current=()=>y(I),I.addEventListener("wheel",R.current,{passive:!0}),I.addEventListener("touchmove",k.current,{passive:!0}),window.addEventListener("keydown",T.current,{passive:!0}),I.addEventListener("scroll",_.current,{passive:!0}),()=>{I.removeEventListener("wheel",R.current),I.removeEventListener("touchmove",k.current),window.removeEventListener("keydown",T.current),I.removeEventListener("scroll",_.current),d.current!=null&&cancelAnimationFrame(d.current),p.current!=null&&(clearTimeout(p.current),p.current=null)}},[y,e]),u.useEffect(()=>{const I=e.current;if(!I||!i)return;const P=D=>{D.preventDefault(),D.stopPropagation(),c.current=!1},j=D=>{D.preventDefault(),D.stopPropagation(),c.current=!1},z=D=>{["ArrowUp","ArrowDown","PageUp","PageDown","Home","End"," "].includes(D.key)&&(D.preventDefault(),D.stopPropagation(),c.current=!1)},A={overscrollBehavior:I.style.overscrollBehavior,touchAction:I.style.touchAction};return I.style.overscrollBehavior="contain",I.style.touchAction="none",I.addEventListener("wheel",P,{passive:!1}),I.addEventListener("touchmove",j,{passive:!1}),window.addEventListener("keydown",z,{passive:!1}),()=>{I.removeEventListener("wheel",P),I.removeEventListener("touchmove",j),window.removeEventListener("keydown",z),I.style.overscrollBehavior=A.overscrollBehavior,I.style.touchAction=A.touchAction}},[i,e]);const w=u.useRef({first:-1,last:-1}),x=u.useRef(!1),E=u.useCallback(()=>{const I=e.current;if(!I)return;const P=Zr(I),j=(P==null?void 0:P.first)??-1,z=(P==null?void 0:P.last)??-1;w.current={first:j,last:z}},[e]),B=u.useRef(!1),C=u.useCallback(()=>{const I=e.current;if(!I||B.current)return;B.current=!0;const P=Math.min(I.scrollTop+Math.floor(I.clientHeight*.6),I.scrollHeight-I.clientHeight);requestAnimationFrame(()=>{I.scrollTo({top:P,behavior:"instant"})})},[e]);u.useEffect(()=>{!x.current&&i&&(B.current=!1,E()),x.current=i},[i,E]),u.useEffect(()=>{if(i!==!0)return;const I=e.current;if(!I)return;const{first:P,last:j}=w.current;if(P===-1||j===-1){C();return}if(I.scrollTop<=1){(async()=>{try{f.current=!0,await Rn(I,s,{behavior:"smooth",topPaddingRatio:.2})}finally{f.current=!1}E()})();return}if(s<P||s>j){async function A(){if(!I)return;const D=I.scrollTop<=1?0:.2;return await Rn(I,s,{behavior:"smooth",topPaddingRatio:D})}A().then(D=>{D?E():C()})}},[i,s,C,E,e]);const O=u.useCallback(()=>{const I=e.current;if(!I)return;function P(U,he,G=.2,Z=.8){const M=U.querySelector(`[data-g="${he}"]`);if(!M)return!1;const N=U.getBoundingClientRect(),L=M.getBoundingClientRect();if(L.height<=0||N.height<=0)return!1;const V=(L.top+L.height/2-N.top)/N.height;return V>=G&&V<=Z}const j=U=>U==="instant"?"auto":U,z=U=>{const he=I.scrollTop,G=I.scrollHeight-I.clientHeight,Z=G>0?he/G:0;let M=0;const N=I.querySelector(`[data-g="${U}"]`);if(N){const L=I.getBoundingClientRect();M=(N.getBoundingClientRect().top-L.top)/L.height}l.getState().emit({type:"scroll",payload:{scrollTop:he,scrollRatio:Z,anchorGI:U,anchorOffsetRatio:M}})},A=async(U,he="smooth")=>{var Z;const G=ys(n,U);(Z=t.current)==null||Z.scrollToIndex({index:G,align:"start",behavior:j(he)}),await ms(I,U)},D=()=>new Promise(U=>requestAnimationFrame(()=>U())),Q=async U=>{if(P(I,U,.1,.7))return z(U),!0;f.current=!0;const he=I.querySelector(`[data-g="${U}"]`),G=I.getBoundingClientRect();let Z=I.scrollTop<=1?0:.1;if(he){const N=he.getBoundingClientRect();Z=((N.top+N.height/2-G.top)/G.height>.5,.15)}const M=!!he;return M?(await Rn(I,U,{behavior:"smooth",topPaddingRatio:Z}),await D()):M||await A(U,"auto"),f.current=!1,z(U),P(I,U,.1,.7)},ae=async U=>Q(U);return{ensureVisibleGI:Q,scrollToGI:ae,getVisibleRange:()=>Zr(I),getScrollTop:()=>I.scrollTop,setScrollTop:U=>{I.scrollTop=U},getAnchorOffsetRatio:U=>{const he=I.querySelector(`[data-g="${U}"]`);if(!he)return 0;const G=he.getBoundingClientRect(),Z=I.getBoundingClientRect();return(G.top-Z.top)/Z.height},scrollToGIAtOffset:async(U,he)=>{await ae(U),await new Promise(q=>setTimeout(q,50));const G=I.querySelector(`[data-g="${U}"]`);if(!G)return;const Z=G.getBoundingClientRect(),M=I.getBoundingClientRect(),N=Z.top-M.top,L=he*M.height,V=N-L;I.scrollTop=I.scrollTop+V}}},[e,t,n,l]);return u.useEffect(()=>(console.log("@@@@@빌드스크롤api"),o(O()),()=>o(void 0)),[O,o]),null};function ma(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 ba(){const e=te(S=>S.section),t=Y(S=>S.theme),n=Y(S=>S.fontFamily),r=Y(S=>S.fontSizePx),o=Y(S=>S.lineHeight),s=tn[t],{blocks:i,nsPrefix:a}=u.useMemo(()=>({sectionId:e.section_id,blocks:e.ast.blocks,nsPrefix:`sec-${e.section_id??"0"}/`}),[e]),l=_t(),c=u.useCallback(()=>{const{isSettingsOpen:S,setSettingsOpen:v,toggleOverlays:g}=l.getState();S?v(!1):g()},[l]),{onClick:d,onDoubleClick:m}=Xs({onSingle:c,onDouble:()=>{},delay:250,shouldIgnoreTarget:ma}),p=u.useMemo(()=>({flex:1,fontFamily:n,background:s.bg,color:s.fg,fontSize:r,lineHeight:o,overflow:"hidden",WebkitOverflowScrolling:"touch"}),[n,s.bg,s.fg,r,o]),b=u.useMemo(()=>({margin:"0 auto",width:"100%",height:"100%"}),[]);return console.log("ScrollSectionWrap render"),h.jsx("div",{onClick:d,onDoubleClick:m,style:p,children:h.jsx("div",{style:b,children:h.jsx(ha,{section:e,blocks:i,nsPrefix:a})})})}function xa(e){return nt({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 va(e){return nt({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 ro(e){return nt({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 Sa(e){return nt({attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{fill:"none",d:"M0 0h24v24H0V0z"},child:[]},{tag:"path",attr:{d:"M9.64 7.64c.23-.5.36-1.05.36-1.64 0-2.21-1.79-4-4-4S2 3.79 2 6s1.79 4 4 4c.59 0 1.14-.13 1.64-.36L10 12l-2.36 2.36C7.14 14.13 6.59 14 6 14c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4c0-.59-.13-1.14-.36-1.64L12 14l7 7h3v-1L9.64 7.64zM6 8c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm0 12c-1.1 0-2-.89-2-2s.9-2 2-2 2 .89 2 2-.9 2-2 2zm6-7.5c-.28 0-.5-.22-.5-.5s.22-.5.5-.5.5.22.5.5-.22.5-.5.5zM19 3l-6 6 2 2 7-7V3h-3z"},child:[]}]})(e)}const ya="_wrap_1pn6r_2",wa="_visible_1pn6r_21",Ca="_container_1pn6r_27",Ia="_leftGroup_1pn6r_36",ka="_rightGroup_1pn6r_37",Ta="_leftleftGroup_1pn6r_51",_a="_leftrightGroup_1pn6r_52",Ra="_btn_1pn6r_78",Ma="_btnForbidden_1pn6r_100",Ea="_btnActive_1pn6r_107",ja="_label_1pn6r_112",Me={wrap:ya,visible:wa,container:Ca,leftGroup:Ia,rightGroup:ka,leftleftGroup:Ta,leftrightGroup:_a,btn:Ra,btnForbidden:Ma,btnActive:Ea,label:ja},Pa=u.memo(function(){const t=u.useRef(null),n=u.useContext(xt),r=(n==null?void 0:n.getState().isPlaybackMode)??!1,o=Se(C=>C.status),s=Se(C=>C.currentTimeMs),i=Se(C=>C.currentClip),a=Se(C=>C.clips),l=Se(C=>C.playbackKind),c=Y(C=>C.audioTargetWpm),d=Y(C=>C.setAudioSpeed),m=Y(C=>C.muteAudio),p=Y(C=>C.audioSpeed),b=Se(C=>C.getClipSrc),S=Se(C=>C._onTime),v=Se(C=>C._onEnded),g=Se(C=>C._onError),f=te(C=>C.setCurrentGlobalRunIndex),y=te(C=>C.getSectionScrollApi),R=te(C=>C.snapToReadable),k=te(C=>C.edgeReadable),T=u.useRef(null),_=u.useRef(null),w=u.useRef(!1),x=u.useRef(null);u.useEffect(()=>{var I,P;const C=((P=(I=a==null?void 0:a[i])==null?void 0:I.meta)==null?void 0:P.wpm)??200,O=(c||200)/C;d(O)},[a,i,c,d]),u.useEffect(()=>{l==="real"&&(w.current=!0)},[l]);const E=u.useMemo(()=>{const C=b(i);if(!C)return null;try{return new URL(C,window.location.href).href}catch{return C}},[i,b]);u.useEffect(()=>{w.current=!0},[E]),u.useEffect(()=>{const C=t.current;if(!C)return;const O=()=>{if(C.paused||C.ended)return;const j=C.currentTime*1e3;w.current&&j===0||(j>0&&(w.current=!1),S(j))},I=()=>{var z,A;v();const j=k(1);typeof j=="number"&&j>=0&&(f(j,"audio"),(A=(z=y())==null?void 0:z.ensureVisibleGI)==null||A.call(z,j))},P=j=>{const z=j.currentTarget;console.warn("Audio error",{networkState:z.networkState,readyState:z.readyState}),g()};return C.addEventListener("timeupdate",O),C.addEventListener("ended",I),C.addEventListener("error",P),()=>{C.removeEventListener("timeupdate",O),C.removeEventListener("ended",I),C.removeEventListener("error",P)}},[S,v,g,k,f,y]),u.useEffect(()=>{if(r)return;const C=t.current;if(!C)return;if(!E){try{C.pause()}catch(j){console.log("pause error",j)}_.current=null;return}const O=C.currentSrc||C.src||null,I=!O||O!==E;if(I){try{C.pause()}catch(j){console.log("pause error",j)}C.src=E;try{C.load()}catch(j){console.log("load error",j)}_.current=E}C.muted=!!m,C.volume=1,C.playbackRate=typeof p=="number"?p:1;const P=async()=>{I&&await new Promise(j=>{let z=!1;const A=()=>{z||(z=!0,C.removeEventListener("loadedmetadata",A),C.removeEventListener("canplay",A),j())};C.addEventListener("loadedmetadata",A),C.addEventListener("canplay",A),C.readyState>=1&&A()});try{await C.play()}catch(j){console.warn("el.play() failed",j)}};if(o==="loading"||o==="playing")P();else try{C.pause()}catch(j){console.log("pause error",j)}},[E,m,o,p,r]),u.useEffect(()=>{if(r)return;const C=t.current;if(!C||l!=="real")return;const O=s/1e3;if(Number.isFinite(O)){if(C.readyState<1){T.current=s;const I=()=>{if(T.current!=null){const P=T.current/1e3;try{C.currentTime=P}catch(j){console.log("currentTime보정 오류",j)}T.current=null}C.removeEventListener("loadedmetadata",I),C.removeEventListener("canplay",I)};C.addEventListener("loadedmetadata",I),C.addEventListener("canplay",I);return}if(Math.abs(C.currentTime-O)>.2)try{C.currentTime=O}catch(I){console.log("currentTime보정오류",I)}}},[s,l,r]);const B=Se(C=>C.getGIFromCT);return u.useEffect(()=>{var I,P;if(r||l!=="real"||o!=="playing"&&o!=="loading")return;const C=B(i,s);if(C<0)return;const O=R(C);O!==x.current&&(x.current=O,f(O,"audio"),O%5===0&&((P=(I=y())==null?void 0:I.ensureVisibleGI)==null||P.call(I,O)))},[o,i,s,l,B,R,f,y,r]),h.jsx("audio",{ref:t,preload:"auto",style:{display:"none"}})});function Oa(){return h.jsx(Pa,{})}const Ba="_scrubberWrap_jtztl_2",za="_labels_jtztl_8",Aa="_index_jtztl_14",La="_controls_jtztl_18",Ga="_percent_jtztl_24",Ha="_range_jtztl_45",yt={scrubberWrap:Ba,labels:za,index:Aa,controls:La,percent:Ga,range:Ha};function Na(){const e=te(k=>k.currentGlobalRunIndex),t=te(k=>k.totalRuns),n=te(k=>k.setCurrentGlobalRunIndex),r=te(k=>k.getSectionScrollApi),o=te(k=>k.giToPercentTotal),s=te(k=>k.percentToGITotal),i=te(k=>k.snapToReadable),a=Se(k=>k.scrollLock),l=Se(k=>k.pause),c=Se(k=>k.play),d=Se(k=>k.syncToGI),[m,p]=u.useState(()=>o(e||0));u.useEffect(()=>{p(o(e||0))},[e,o]);const b=u.useRef(!1),S=u.useMemo(()=>Math.max(0,Math.min(e??0,Math.max(0,(t??1)-1)))+1,[e,t]),v=u.useCallback(()=>{a&&(l(),b.current=!0)},[a,l]),g=u.useCallback(k=>{p(Number(k.currentTarget.value))},[]),f=u.useCallback(async()=>{const k=s(m),T=i(k);l(),n(T,"scrubber-commit"),d(T);const _=r();_!=null&&_.ensureVisibleGI&&await _.ensureVisibleGI(T),b.current&&(b.current=!1,c())},[m,s,i,l,n,d,r,c]),y=u.useMemo(()=>({"--pct":`${m}%`}),[m]),R=u.useMemo(()=>Math.round(m),[m]);return h.jsxs("div",{className:yt.scrubberWrap,children:[h.jsx("div",{className:yt.labels,children:h.jsxs("span",{className:yt.index,children:[S," / ",t||0]})}),h.jsxs("div",{className:yt.controls,children:[h.jsx("input",{type:"range",className:yt.range,min:0,max:100,step:.5,value:m,style:y,onMouseDown:v,onTouchStart:v,onChange:g,onMouseUp:()=>{f()},onTouchEnd:()=>{f()},onKeyUp:k=>k.key==="Enter"||k.key===" "?void f():void 0,"aria-label":"진행률"}),h.jsxs("span",{className:yt.percent,children:[R,"%"]})]})]})}const Fa=u.memo(Na),Wa=e=>Math.max(50,Math.min(500,e)),Va=u.memo(function(){const t=u.useContext(xt),n=(t==null?void 0:t.getState().isPlaybackMode)??!1,r=Se(x=>x.playbackKind),o=Se(x=>x.status),s=Se(x=>x.fake),i=Y(x=>x.audioTargetWpm),a=Se(x=>x.pause),l=te(x=>x.totalRuns),c=te(x=>x.currentGlobalRunIndex),d=te(x=>x.setCurrentGlobalRunIndex),m=te(x=>x.getSectionScrollApi),p=te(x=>x.nextReadableFrom),b=te(x=>x.edgeReadable),S=u.useRef(null),v=u.useRef(null),g=u.useRef(0),f=u.useRef(-1),y=!n&&r==="fake"&&o==="playing",R=Math.max(1,(s==null?void 0:s.totalWords)??1),k=u.useMemo(()=>{const x=Wa(i||200);return R/x*6e4},[R,i]),T=u.useMemo(()=>!l||l<=1||k<=0?0:(l-1)/k,[l,k]);u.useEffect(()=>{if(!y)return;const x=Math.max(0,Math.min(c??0,Math.max(0,(l??1)-1)));g.current=x,f.current=x,v.current=null},[y,c,l]);const _=u.useRef(-1);u.useEffect(()=>{if(!l){_.current=-1;return}const x=b(1);_.current=x??-1},[b,l]);const w=u.useCallback(x=>{(async()=>{var z,A;if(!y){S.current=null;return}if(!l||l<=1||T<=0){S.current=null;return}const E=v.current;v.current=x;const B=E==null?0:Math.max(0,x-E),C=l-1;g.current=Math.min(C,g.current+T*B);const O=Math.floor(g.current),I=m(),P=p(O,1);if(P==null){const D=_.current>=0?_.current:O;D!==f.current&&(f.current=D,d(D,"audio"),await((z=I==null?void 0:I.ensureVisibleGI)==null?void 0:z.call(I,D))),a(),S.current=null;return}const j=P;j!==f.current&&(f.current=j,d(j,"audio"),j%5===0&&await((A=I==null?void 0:I.ensureVisibleGI)==null?void 0:A.call(I,j))),S.current=requestAnimationFrame(w)})().catch(console.error)},[y,l,T,p,d,m,a]);return u.useEffect(()=>(y?S.current==null&&(S.current=requestAnimationFrame(w)):(S.current&&(cancelAnimationFrame(S.current),S.current=null),v.current=null),()=>{S.current&&(cancelAnimationFrame(S.current),S.current=null)}),[y,w]),null}),Da=u.memo(function(){return h.jsx(Va,{})}),$a="data:image/svg+xml,%3csvg%20width='111'%20height='111'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-435%2011)'%3e%3cpath%20d='M532.723%2046.8125C530.242%2046.8292%20527.8%2047.4292%20525.593%2048.5642%20523.298%2049.7713%20520.952%2050.8767%20518.608%2051.8815%20517.451%2031.9953%20500.391%2016.8128%20480.505%2017.9704%20462.359%2019.0268%20447.834%2033.4215%20446.615%2051.5578L438.476%2048.1353%20438.476%2049.9344C438.473%2054.7251%20441.432%2059.0185%20445.91%2060.721%20446.509%2060.9604%20447.138%2061.1708%20447.767%2061.3801%20448.053%2061.4761%20448.339%2061.5709%20448.622%2061.6692L447.745%2066.7254C447.463%2068.2415%20447.818%2069.8071%20448.728%2071.0521%20449.635%2072.2874%20450.984%2073.1242%20452.493%2073.3877L452.768%2073.4282C453.011%2073.488%20453.259%2073.5198%20453.509%2073.523%20456.31%2073.5182%20458.699%2071.4953%20459.166%2068.7338L459.781%2064.8673C468.886%2066.8727%20478.184%2067.875%20487.508%2067.8562%20493.267%2067.8674%20499.021%2067.5125%20504.736%2066.7937%20504.893%2066.7613%20505.041%2066.7405%20505.184%2066.7231L505.562%2068.8379C505.986%2071.6231%20508.396%2073.6706%20511.213%2073.6375%20511.583%2073.648%20511.953%2073.5977%20512.307%2073.4883%20515.422%2072.958%20517.518%2070.0024%20516.988%2066.8869%20516.984%2066.8688%20516.981%2066.8509%20516.978%2066.833L516.758%2065.6767C522.066%2065.3125%20527.42%2065.3125%20532.607%2065.3125L532.723%2065.3125C537.831%2065.6255%20542.226%2061.7378%20542.539%2056.6292%20542.852%2051.5205%20538.965%2047.1255%20533.856%2046.8125%20533.479%2046.7894%20533.1%2046.7894%20532.723%2046.8125ZM516.326%2052.7256C511.914%2054.5082%20507.352%2055.8913%20502.693%2056.858L492.697%2041.007%20501.916%2026.3469C510.579%2032.4029%20515.911%2042.1631%20516.326%2052.7256ZM500.254%2057.3217C497.133%2057.8531%20493.977%2058.1542%20490.811%2058.2224L487.449%2058.2224C480.061%2058.2766%20472.682%2057.6921%20465.394%2056.4753L474.504%2042.1644%20490.692%2042.1644ZM482.602%2020.2188C488.73%2020.2155%20494.742%2021.8953%20499.981%2025.075L490.693%2039.8507%20474.491%2039.8195%20465.194%2025.0415C470.449%2021.8782%20476.468%2020.2107%20482.602%2020.2188ZM463.254%2026.2995%20472.504%2041.0023%20462.938%2056.0267C458.169%2055.1133%20453.47%2053.8672%20448.875%2052.2977%20449.378%2041.8709%20454.689%2032.2672%20463.254%2026.2995ZM456.876%2068.3719C456.595%2070.0115%20455.173%2071.2097%20453.509%2071.2094%20453.431%2071.2042%20453.354%2071.191%20453.278%2071.1701%20453.133%2071.1343%20452.984%2071.1101%20452.835%2071.0972%20451.94%2070.9264%20451.142%2070.4243%20450.601%2069.6912%20450.063%2068.9533%20449.853%2068.0254%20450.023%2067.1278L450.844%2062.3872%20457.525%2064.2962ZM514.123%2069.8103C513.566%2070.5637%20512.74%2071.0728%20511.817%2071.2313L511.657%2071.2718C511.514%2071.32%20511.363%2071.3392%20511.213%2071.3285%20509.525%2071.3698%20508.075%2070.1378%20507.844%2068.4656L507.486%2066.4688%20514.501%2065.8548%20514.701%2067.2527C514.87%2068.1485%20514.661%2069.0742%20514.123%2069.8103ZM532.723%2063%20532.607%2063C526.955%2063%20521.113%2063%20515.284%2063.4625L515.276%2063.4625%20515.276%2063.4625%20505.9%2064.2904%20504.36%2064.5078C498.77%2065.2064%20493.141%2065.5509%20487.508%2065.5391%20477.952%2065.5601%20468.425%2064.4858%20459.114%2062.3375L450.263%2059.8168%20446.738%2058.5658C443.792%2057.4525%20441.62%2054.9086%20440.982%2051.8237%20454.33%2057.5309%20470.023%2060.5383%20486.577%2060.5383%20486.868%2060.5383%20487.161%2060.5383%20487.452%2060.5383L490.828%2060.5383C500.421%2060.2575%20509.874%2058.1665%20518.689%2054.3755L518.797%2054.3304C521.437%2053.2216%20524.086%2051.9728%20526.649%2050.6235%20528.526%2049.6491%20530.608%2049.1354%20532.723%2049.125%20536.554%2048.8199%20539.908%2051.6785%20540.213%2055.5099%20540.518%2059.3414%20537.659%2062.6949%20533.828%2063%20533.46%2063.0293%20533.091%2063.0293%20532.723%2063Z'/%3e%3cpath%20d='M534.442%2053.75C534.442%2055.0272%20533.407%2056.0625%20532.13%2056.0625%20530.852%2056.0625%20529.817%2055.0272%20529.817%2053.75%20529.817%2052.4728%20530.852%2051.4375%20532.13%2051.4375%20533.407%2051.4375%20534.442%2052.4728%20534.442%2053.75Z'/%3e%3c/g%3e%3c/svg%3e",qa="data:image/svg+xml,%3csvg%20width='159'%20height='159'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20overflow='hidden'%3e%3cg%20transform='translate(-392%20-84)'%3e%3cpath%20d='M496.776%20189.601C496.122%20189.934%20495.77%20190.663%20495.916%20191.383L499.911%20210.219C500.074%20210.985%20500.75%20211.532%20501.533%20211.531L501.929%20211.531C503.729%20211.515%20505.222%20212.919%20505.319%20214.716%20505.389%20216.544%20503.964%20218.083%20502.136%20218.154%20502.093%20218.155%20502.05%20218.156%20502.006%20218.156L497.503%20218.156C495.941%20218.15%20494.594%20217.058%20494.263%20215.531L490.363%20197.147C490.174%20196.252%20489.294%20195.68%20488.4%20195.87%20488.399%20195.87%20488.399%20195.87%20488.399%20195.87%20488.174%20195.918%20487.962%20196.014%20487.776%20196.15L481.184%20200.898C479.925%20201.758%20478.809%20202.45%20477.776%20203.015%20476.998%20203.429%20476.669%20204.372%20477.022%20205.18%20477.402%20206.011%20478.385%20206.378%20479.217%20205.998%20479.253%20205.981%20479.288%20205.964%20479.322%20205.945%20480.618%20205.229%20481.877%20204.447%20483.094%20203.604L487.657%20200.313%20491.031%20216.213C491.677%20219.273%20494.376%20221.464%20497.503%20221.469L501.882%20221.469C505.577%20221.473%20508.587%20218.502%20508.631%20214.807%20508.608%20211.503%20506.158%20208.719%20502.883%20208.277L499.416%20191.93C502.051%20190.581%20506.719%20188.344%20509.619%20188.344%20515.225%20188.346%20520.812%20187.662%20526.252%20186.307%20530.081%20185.36%20533.152%20182.51%20534.381%20178.762L534.535%20178.295C535.676%20175.09%20535.323%20171.542%20533.573%20168.624L525.126%20154.2C522.254%20149.369%20517.625%20145.835%20512.207%20144.337%20512.364%20138.624%20511.516%20132.927%20509.7%20127.508%20504.714%20113.244%20488.452%20105.977%20487.761%20105.669%20487.336%20105.48%20486.851%20105.48%20486.426%20105.669%20485.959%20105.876%20484.987%20106.308%20483.1%20111.962%20482.811%20112.832%20483.281%20113.77%20484.15%20114.059%20485.019%20114.348%20485.958%20113.878%20486.247%20113.009%20486.649%20111.744%20487.129%20110.505%20487.685%20109.299%20491.474%20111.245%20502.818%20117.831%20506.566%20128.543%20508.418%20133.972%20509.183%20139.713%20508.815%20145.437%20508.734%20146.277%20509.297%20147.043%20510.122%20147.217%20515.212%20148.269%20519.626%20151.41%20522.287%20155.875L530.744%20170.299C532.007%20172.379%20532.256%20174.921%20531.42%20177.207L531.254%20177.727C530.378%20180.388%20528.194%20182.41%20525.474%20183.079%20520.288%20184.375%20514.964%20185.031%20509.619%20185.031%20505.93%20185.031%20501.061%20187.35%20496.776%20189.601Z'/%3e%3cpath%20d='M422.439%20192.966C421.946%20190.791%20421.681%20188.571%20421.649%20186.341%20421.7%20185.427%20421.001%20184.643%20420.086%20184.592%20419.171%20184.54%20418.388%20185.239%20418.336%20186.154%20418.324%20187.879%20418.47%20189.602%20418.772%20191.3%20412.577%20189.633%20408.907%20183.26%20410.574%20177.065%20411.942%20171.981%20416.559%20168.453%20421.824%20168.469%20422.661%20168.473%20423.491%20168.611%20424.284%20168.88%20425.056%20169.133%20425.898%20168.787%20426.271%20168.065%20435.26%20150.783%20455.639%20142.806%20473.971%20149.392%20474.837%20150.636%20475.5%20151.557%20475.559%20151.638%20476.094%20152.38%20477.129%20152.549%20477.872%20152.014%20478.614%20151.479%20478.782%20150.444%20478.248%20149.702%20478.216%20149.657%20475.101%20145.338%20473.444%20142.62%20467.845%20132.798%20470.283%20120.115%20471.358%20115.817%20475.617%20117.014%20487.816%20121.194%20493.442%20131.039%20496.082%20135.531%20497.921%20140.449%20498.876%20145.571%20499.017%20146.361%20499.705%20146.936%20500.508%20146.936L503.929%20146.936C504.816%20146.948%20505.561%20146.274%20505.639%20145.391%20505.7%20144.478%20505.01%20143.688%20504.097%20143.627%20504.059%20143.624%20504.021%20143.623%20503.982%20143.623L501.871%20143.623C500.778%20138.613%20498.902%20133.806%20496.312%20129.38%20488.742%20116.13%20471.271%20112.337%20470.533%20112.183%20469.704%20112.01%20468.879%20112.489%20468.618%20113.294%20468.385%20114.011%20463.013%20131.036%20470.568%20144.256%20470.579%20144.276%20470.745%20144.576%20470.978%20144.973%20470.99%20144.991%20470.978%20145.003%20470.96%20144.998%20452.498%20140.481%20433.287%20148.811%20423.966%20165.375%20423.261%20165.231%20422.543%20165.158%20421.824%20165.156%20413.582%20165.183%20406.923%20171.886%20406.95%20180.128%20406.974%20187.414%20412.256%20193.618%20419.446%20194.803L419.446%20194.803C419.532%20195.194%20419.611%20195.585%20419.706%20195.972L419.8%20196.329C422.428%20206.56%20428.796%20215.436%20437.646%20221.204%20437.917%20221.379%20438.232%20221.473%20438.554%20221.474L473.068%20221.474C476.748%20221.495%20479.756%20218.542%20479.801%20214.862%20479.847%20211.242%20476.95%20208.27%20473.329%20208.224%20473.278%20208.223%20473.227%20208.223%20473.176%20208.224L465.158%20208.224C474.765%20201.216%20476.873%20187.747%20469.866%20178.14%20465.812%20172.583%20459.348%20169.297%20452.47%20169.297%20450.573%20169.261%20448.682%20169.507%20446.858%20170.029%20445.981%20170.293%20445.484%20171.219%20445.749%20172.096%20446.013%20172.973%20446.938%20173.47%20447.816%20173.206%20449.328%20172.775%20450.897%20172.574%20452.47%20172.609%20462.532%20172.632%20470.67%20180.807%20470.648%20190.869%20470.63%20198.914%20465.337%20205.995%20457.626%20208.29%20456.784%20208.543%20456.286%20209.408%20456.491%20210.263%20456.686%20211.016%20457.369%20211.54%20458.147%20211.533L473.107%20211.533C474.951%20211.521%20476.458%20213.001%20476.48%20214.845%20476.52%20216.635%20475.102%20218.118%20473.312%20218.158%20473.264%20218.159%20473.216%20218.159%20473.168%20218.158L439.054%20218.158C431.004%20212.776%20425.251%20204.584%20422.922%20195.184%20422.853%20194.889%20422.795%20194.619%20422.733%20194.339Z'/%3e%3cpath%20d='M519.521%20163.831C519.708%20162.011%20518.383%20160.385%20516.563%20160.199%20514.743%20160.012%20513.117%20161.337%20512.931%20163.157%20512.744%20164.977%20514.069%20166.603%20515.889%20166.789%20516.113%20166.812%20516.339%20166.812%20516.563%20166.789%20518.126%20166.629%20519.361%20165.394%20519.521%20163.831Z'/%3e%3c/g%3e%3c/svg%3e",Ua="_WPMSpeedButtonsWrap_pxoh4_1",Ka="_btnWrap_pxoh4_8",Ya="_label_pxoh4_14",Xa="_wpmString_pxoh4_21",Qa="_iconBtn_pxoh4_24",wt={WPMSpeedButtonsWrap:Ua,btnWrap:Ka,label:Ya,wpmString:Xa,iconBtn:Qa},oo=5,so=350,Za=40,Ja=.85,ec=e=>Math.max(50,Math.min(500,e)),tc=u.memo(function(){const t=Y(m=>m.audioTargetWpm);Y(m=>m.audioSpeed);const n=Y(m=>m.setAudioTargetWpm),r=u.useRef(t);u.useEffect(()=>{r.current=t},[t]);const o=u.useRef(null),s=u.useRef(so),i=u.useRef(null),a=u.useCallback(m=>{const p=r.current,b=m==="inc"?oo:-oo,S=ec(p+b);return S===p?!1:(n(S),r.current=S,!0)},[n]),l=u.useCallback(()=>{i.current=null,o.current&&(clearTimeout(o.current),o.current=null)},[]),c=u.useCallback(()=>{i.current&&(s.current=Math.max(Za,Math.floor(s.current*Ja)),o.current=window.setTimeout(()=>{a(i.current)?c():l()},s.current))},[a,l]),d=u.useCallback(m=>{if(i.current)return;i.current=m,s.current=so,a(m)&&c();const b=()=>l();window.addEventListener("mouseup",b,{once:!0}),window.addEventListener("touchend",b,{once:!0})},[c,a,l]);return u.useEffect(()=>l,[l]),h.jsx("div",{onMouseLeave:l,className:wt.WPMSpeedButtonsWrap,children:h.jsxs("div",{className:wt.btnWrap,children:[h.jsxs("button",{className:wt.iconBtn,type:"button",title:"WPM 느리게",onMouseDown:()=>d("dec"),onTouchStart:m=>{m.preventDefault(),d("dec")},onMouseUp:l,children:[h.jsx("img",{src:$a})," "]}),h.jsxs("div",{className:wt.label,children:[h.jsx("div",{children:t}),h.jsx("div",{className:wt.wpmString,children:"WPM"})]}),h.jsx("button",{className:wt.iconBtn,type:"button",title:"WPM 빠르게",onMouseDown:()=>d("inc"),onTouchStart:m=>{m.preventDefault(),d("inc")},onMouseUp:l,children:h.jsx("img",{src:qa})})]})})}),nc="_StepBtn_ua1nh_1",rc={StepBtn:nc};function oc(e){return nt({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 nt({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 io({direction:e}){const t=te(p=>p.currentGlobalRunIndex),n=te(p=>p.totalRuns),r=te(p=>p.hasReadableInDir),o=te(p=>p.computeStepTarget),s=te(p=>p.giToPercentTotal),i=te(p=>p.setCurrentGlobalRunIndex),a=Se(p=>p.syncToGI),l=te(p=>p.getSectionScrollApi),c=u.useCallback(async p=>{var v,g;const b=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),S=o(b,p);i(S,"scrubber-step"),a(S),await((g=(v=l())==null?void 0:v.ensureVisibleGI)==null?void 0:g.call(v,S))},[t,n,o,i,s,a,l]),d=u.useMemo(()=>{const p=Math.max(t,Math.min(0,Math.max(0,(n??1)-1))),b=!n||!r(p,1),S=!n||!r(p,-1);return e==="left"?S:b},[e,n,t]),m=u.useCallback(()=>{c(e==="left"?-1:1)},[e,c]);return h.jsx("button",{className:rc.StepBtn,type:"button",onClick:m,disabled:d,title:e==="left"?"이전":"다음",children:e==="left"?h.jsx(oc,{}):h.jsx(sc,{})})}const ic="_GCPlayBtn_1p162_1",lc="_playing_1p162_28",lo={GCPlayBtn:ic,playing:lc},ac=({size:e=60,color:t="#333",bgColor:n="#fff",isPlaying:r,onClick:o,tooltip:s="재생",title:i=""})=>h.jsx("button",{className:`${lo.GCPlayBtn} ${r?lo.playing:""}`,onClick:o,"data-tip":s,title:i,style:{"--btn-size":`${e}px`,"--icon-color":t,"--btn-bg":n}});function cc(){const e=Y(_=>_.showOverlays),t=te(_=>_.section),n=!!t.ast.isAddedSplit,r=!!t.ast.isAddedAudio,o=Y(_=>_.muteAudio),s=Y(_=>_.showPointer),i=Y(_=>_.showSplit),a=Y(_=>_.toggleMuteAudio),l=Y(_=>_.toggleShowPointer),c=Y(_=>_.toggleShowSplit),d=Y(_=>_.setSettingsOpen),m=Y(_=>_.setShowOverlays),p=()=>{d(!0),m(!1)},b=qr(),S=mt();u.useEffect(()=>{const _=b.getState(),{syncToGI:w,useFake:x,useReal:E}=_,B=_.playbackKind,C=S.getState().progress.currentGlobalRunIndex??0;if(!r){B!=="fake"&&x();return}o?B!=="fake"&&(console.log("이부분일까?"),x()):B!=="real"&&(w(C),E())},[r,o,S,b]);const v=Se(_=>_.play),g=Se(_=>_.pause),f=Se(_=>_.status),y=u.useCallback(_=>{_.stopPropagation(),f==="playing"||f==="loading"?g():v()},[f,v,g]),R=qr(),k=mt(),T=u.useCallback(async _=>{var Q,ae;if(_.stopPropagation(),f==="playing"||f==="loading"){g();return}const{progress:w}=k.getState(),{currentGlobalRunIndex:x,snapToReadable:E,edgeReadable:B,setCurrentGlobalRunIndex:C,getSectionScrollApi:O}=w,I=R.getState(),P=I.currentClip,j=O==null?void 0:O(),z=typeof x=="number"?x:0,A=typeof E=="function"?E(z):z,D=typeof B=="function"?B(1):null;if(D!=null&&A>=D){C==null||C(D,"audio"),await((Q=j==null?void 0:j.ensureVisibleGI)==null?void 0:Q.call(j,D)),I.syncToGI(D);return}C==null||C(A,"audio"),await((ae=j==null?void 0:j.ensureVisibleGI)==null?void 0:ae.call(j,A)),I.syncToGI(A),v(P)},[f,g,v,R,k]);return h.jsxs("div",{className:`${Me.wrap} ${e?Me.visible:""}`,onClick:_=>{_.stopPropagation()},onTouchStart:_=>{_.stopPropagation()},children:[h.jsx(Fa,{}),r&&!o?h.jsx(Oa,{}):h.jsx(Da,{}),h.jsxs("div",{className:Me.container,children:[h.jsxs("div",{className:Me.leftGroup,children:[h.jsxs("div",{className:Me.leftleftGroup,children:[h.jsx(io,{direction:"left"}),h.jsx(ac,{isPlaying:f==="playing",onClick:o?T:y,title:f==="playing"?"일시정지":"재생"}),h.jsx(io,{direction:"right"})]}),h.jsx("div",{className:Me.leftrightGroup,children:h.jsx(tc,{})})]}),h.jsxs("div",{className:Me.rightGroup,children:[h.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),p()},className:Me.btn,title:"뷰어 설정",children:[h.jsx(ro,{size:18}),h.jsx("span",{className:Me.label,children:"없앨예정"})]}),r&&h.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),a()},className:`${Me.btn} ${o?"":Me.btnActive}`,title:"오디오북 음소거 전환",children:[o?h.jsx(xa,{size:18}):h.jsx(va,{size:18}),h.jsx("span",{className:Me.label,children:"오디오북"})]}),h.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),l()},className:`${Me.btn} ${s?Me.btnActive:""}`,title:"포인터 표시",children:[h.jsx(ro,{size:18}),h.jsx("span",{className:Me.label,children:"포인터"})]}),n&&h.jsxs("button",{type:"button",onClick:_=>{_.stopPropagation(),n&&c()},disabled:!n,className:`${Me.btn} ${i?Me.btnActive:""} ${n?"":Me.btnForbidden}`,title:"끊어읽기 표시",children:[h.jsx(Sa,{size:18}),h.jsx("span",{className:Me.label,children:"끊어읽기"})]}),h.jsx(pa,{}),h.jsx(er,{})]})]})]})}const uc=u.memo(cc),dc="_topbar_143fz_2",fc="_visible_143fz_23",pc="_title_143fz_28",hc="_host_143fz_38",gc="_dropdownLayer_143fz_46",mc="_selectorWrap_143fz_56",bc="_selectorInner_143fz_78",xc="_selectorItem_143fz_84",vc="_active_143fz_100",Sc="_itemOrder_143fz_105",yc="_itemTitle_143fz_110",wc="_itemBadge_143fz_116",Cc="_selectorEmpty_143fz_121",Ic="_selectorFooter_143fz_127",He={topbar:dc,visible:fc,title:pc,host:hc,dropdownLayer:gc,selectorWrap:mc,selectorInner:bc,selectorItem:xc,active:vc,itemOrder:Sc,itemTitle:yc,itemBadge:wc,selectorEmpty:Cc,selectorFooter:Ic},kc=({sectionList:e,currentSectionId:t,onSectionChange:n,onRequestClose:r})=>{const o=u.useRef(null),s=u.useMemo(()=>(e==null?void 0:e.find(a=>a.sectionId===t))??null,[e,t]),i=u.useCallback(a=>{n==null||n(a),r==null||r()},[n,r]);return h.jsxs("div",{ref:o,className:He.selectorWrap,role:"listbox",tabIndex:-1,onMouseDown:a=>a.stopPropagation(),onClick:a=>a.stopPropagation(),children:[h.jsxs("div",{className:He.selectorInner,children:[(e??[]).map(a=>{const l=a.sectionId===t;return h.jsxs("button",{type:"button",role:"option","aria-selected":l,className:`${He.selectorItem} ${l?He.active:""}`,onClick:()=>i(a.sectionId),title:`${a.title||"(제목 없음)"} • #${a.order+1}`,children:[h.jsxs("span",{className:He.itemOrder,children:["#",a.order+1]}),h.jsx("span",{className:He.itemTitle,children:a.title||"(제목 없음)"}),l?h.jsx("span",{className:He.itemBadge,children:"현재"}):null]},a.sectionId)}),!(e!=null&&e.length)&&h.jsx("div",{className:He.selectorEmpty,children:"섹션이 없습니다"})]}),h.jsx("div",{className:He.selectorFooter,children:s?s.title:"섹션 선택"})]})};function Tc(){const e=Y(c=>c.showOverlays),t=te(c=>c.sectionList),n=te(c=>c.onSectionChange),r=te(c=>c.section),o=r.ast.title,[s,i]=u.useState(!1),a=u.useRef(null),l=u.useCallback(c=>{c.stopPropagation(),t!=null&&t.length&&i(d=>!d)},[t==null?void 0:t.length]);return u.useEffect(()=>{if(!s)return;const c=d=>{const m=d.target;a.current&&(a.current.contains(m)||i(!1))};return document.addEventListener("mousedown",c,!0),()=>document.removeEventListener("mousedown",c,!0)},[s]),u.useEffect(()=>{if(!s)return;const c=d=>{d.key==="Escape"&&i(!1)};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[s]),u.useEffect(()=>{e||i(!1)},[e]),h.jsxs("div",{ref:a,className:He.host,children:[h.jsx("div",{className:`${He.topbar} ${e?He.visible:""}`,title:o||"섹션 선택",onMouseDown:l,children:h.jsx("div",{className:He.title,children:h.jsx("span",{className:"truncate",children:o||"섹션 없음"})})}),s&&h.jsx("div",{className:He.dropdownLayer,onMouseDown:c=>c.stopPropagation(),onClick:c=>c.stopPropagation(),children:h.jsx(kc,{sectionList:t,currentSectionId:r.section_id,onSectionChange:n,onRequestClose:()=>i(!1)})})]})}const _c=u.memo(Tc),Rc="_wrap_rui1o_2",Mc="_wrapHidden_rui1o_24",Ec="_wrapVisible_rui1o_28",jc="_scrollArea_rui1o_32",Pc="_row_rui1o_45",Oc="_label_rui1o_52",Bc="_btn_rui1o_58",zc="_btnActive_rui1o_69",Ac="_btnSmall_rui1o_73",Lc="_pill_rui1o_85",Gc="_themeCircle_rui1o_96",Hc="_themeCircleActive_rui1o_109",Nc="_stepRow_rui1o_118",Fc="_stepLabel_rui1o_126",Wc="_stepValue_rui1o_131",Vc="_levelBox_rui1o_138",Dc="_inlineFlex_rui1o_143",Ie={wrap:Rc,wrapHidden:Mc,wrapVisible:Ec,scrollArea:jc,row:Pc,label:Oc,btn:Bc,btnActive:zc,btnSmall:Ac,pill:Lc,themeCircle:Gc,themeCircleActive:Hc,stepRow:Nc,stepLabel:Fc,stepValue:Wc,levelBox:Vc,inlineFlex:Dc};function $c({visible:e}){const t=Y(x=>x.mode),n=Y(x=>x.setMode),r=Y(x=>x.theme),o=Y(x=>x.setTheme),s=Y(x=>x.fontFamily),i=Y(x=>x.setFontFamily),a=Y(x=>x.resetToDefaults),l=Y(x=>x.getFontLevel()),c=Y(x=>x.getLineLevel()),d=Y(x=>x.getMarginLevel()),m=Y(x=>x.setFontLevel),p=Y(x=>x.setLineLevel),b=Y(x=>x.setMarginLevel),S=Y(x=>x.pointerStyle),v=Y(x=>x.setPointerStyle),g=Y(x=>x.pointerColor),f=Y(x=>x.setPointerColor),y=Y(x=>x.breakMarks),R=Y(x=>x.toggleBreakMark),k=Y(x=>x.getBreakGapLevel()),T=Y(x=>x.setBreakGapLevel),_=Y(x=>x.maps),w=`${Ie.wrap} ${e?Ie.wrapVisible:Ie.wrapHidden}`;return h.jsxs("div",{className:w,role:"dialog","aria-modal":"true","aria-label":"뷰어 설정",children:[h.jsxs("div",{className:Ie.scrollArea,children:[h.jsx(jt,{label:"열람방식",children:h.jsxs("div",{className:Ie.inlineFlex,children:[h.jsx(Ct,{active:t==="page",onClick:()=>n("page"),children:"페이지"}),h.jsx(Ct,{active:t==="scroll",onClick:()=>n("scroll"),children:"스크롤"})]})}),h.jsx(jt,{label:"테마",children:h.jsx("div",{className:Ie.inlineFlex,children:Object.keys(tn).map(x=>{const E=x,B=tn[E];return h.jsx("button",{type:"button",onClick:()=>o(E),className:`${Ie.themeCircle} ${r===x?Ie.themeCircleActive:""}`,style:{background:B.bg,color:B.fg,fontFamily:s},title:String(x),"aria-label":`테마: ${String(x)}`,children:"A"},`${x}_tc_button`)})})}),h.jsx(jt,{label:"글꼴",children:h.jsx("div",{className:Ie.inlineFlex,children:zo.map(x=>h.jsx(Ct,{active:s===x.value,onClick:()=>i(x.value),title:x.value,children:x.label},x.label))})}),h.jsx(Zt,{label:"글자 크기",level:l,min:1,max:12,onDec:()=>m(Math.max(1,l-1)),onInc:()=>m(Math.min(12,l+1)),valueText:`${_.fontSizeFromLevel(l)}px`}),h.jsx(Zt,{label:"줄 간격",level:c,min:1,max:7,onDec:()=>p(Math.max(1,c-1)),onInc:()=>p(Math.min(7,c+1)),valueText:`${_.LINEHEIGHT_MAP[c-1].toFixed(1)}`}),h.jsx(Zt,{label:"여백",level:d,min:1,max:5,onDec:()=>b(Math.max(1,d-1)),onInc:()=>b(Math.min(5,d+1)),valueText:`${_.MARGIN_MAP[d-1]}px`}),h.jsx(jt,{label:"포인터",children:h.jsxs("div",{className:Ie.inlineFlex,children:[h.jsx(Ct,{active:S==="highlight",onClick:()=>v("highlight"),children:"형광펜"}),h.jsx(Ct,{active:S==="underline",onClick:()=>v("underline"),children:"밑줄"}),h.jsx("input",{type:"color",value:g,onChange:x=>f(x.target.value),"aria-label":"포인터 색상",style:{width:36,height:28,padding:0,border:"none",background:"transparent"}})]})}),h.jsx(jt,{label:"끊기표시",children:h.jsx("div",{className:Ie.inlineFlex,children:h.jsx(Ct,{active:y.slash,onClick:()=>R("slash"),children:"슬래쉬"})})}),h.jsx(Zt,{label:"끊기간격",level:k,min:1,max:5,onDec:()=>T(Math.max(1,k-1)),onInc:()=>T(Math.min(5,k+1)),valueText:`${_.BREAK_GAP_MAP[k-1]}px`})]}),h.jsx("div",{className:Ie.inlineFlex,style:{justifyContent:"center"},children:h.jsx("button",{type:"button",onClick:a,className:Ie.pill,children:"보기 설정 초기화"})})]})}function jt({label:e,children:t}){return h.jsxs("div",{className:Ie.row,children:[h.jsx("label",{className:Ie.label,children:e}),t]})}function Ct({active:e,onClick:t,title:n,children:r}){return h.jsx("button",{type:"button",onClick:t,title:n,className:`${Ie.btn} ${e?Ie.btnActive:""}`,children:r})}function Zt({label:e,level:t,min:n,max:r,onDec:o,onInc:s,valueText:i}){const a=t<=n,l=t>=r;return h.jsxs("div",{className:Ie.stepRow,children:[h.jsx("label",{className:Ie.stepLabel,children:e}),h.jsxs("div",{className:Ie.inlineFlex,children:[h.jsx("button",{type:"button",onClick:o,disabled:a,className:Ie.btnSmall,"aria-label":"감소",children:"−"}),h.jsx("div",{className:Ie.levelBox,children:t}),h.jsx("button",{type:"button",onClick:s,disabled:l,className:Ie.btnSmall,"aria-label":"증가",children:"+"})]}),h.jsx("div",{className:Ie.stepValue,children:i})]})}const qc=u.memo(function(){const t=Y(r=>r.showOverlays),n=Y(r=>r.isSettingsOpen);return h.jsxs("div",{"aria-hidden":!0,style:{pointerEvents:"none",position:"absolute",inset:0},children:[h.jsx(_c,{}),h.jsx(uc,{}),h.jsx("div",{style:{pointerEvents:"auto"},children:h.jsx($c,{visible:!t&&n})})]})}),Uc=e=>(t,n,r)=>{const o=r.subscribe;return r.subscribe=((i,a,l)=>{let c=i;if(a){const d=(l==null?void 0:l.equalityFn)||Object.is;let m=i(r.getState());c=p=>{const b=i(p);if(!d(m,b)){const S=m;a(m=b,S)}},l!=null&&l.fireImmediately&&a(m,m)}return o(c)}),e(t,n,r)},Kc=Uc;function Yc(e){return e?e.kind==="saved"?e.cdnUrl:e.blobUrl:null}function Xc(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 Qc(e){let t=0;for(const n of e.ast.blocks??[])if(n.type==="paragraph")for(const r of n.runs??[])t+=Xc((r==null?void 0:r.text)??"");return t}function Zc(e){const t=e==null?void 0:e.recorderStore;let n=e==null?void 0:e.map,r=e==null?void 0:e.initialIndex;const o=b=>{if(!n)return null;const{g2ct:S}=n;if(!S)return null;const v=S[b];if(v)return{clip:v.clip,t:v.t};for(let g=1;g<=100&&b-g>=0;g++){const f=S[b-g];if(f)return{clip:f.clip,t:f.t}}for(let g=1;g<=100;g++){const f=S[b+g];if(f)return{clip:f.clip,t:f.t}}return null},s=(e==null?void 0:e.clips)??[];let i=0,a=0;const l=Math.max(1,Qc(e.section)||150);if(typeof(e==null?void 0:e.initialIndex)=="number"&&n){const b=o(e.initialIndex);b&&(i=b.clip,a=b.t,r=void 0)}const c=s.length>0,d=c?"paused":"idle",m=c?"real":"fake",p=c?null:{totalWords:l};return bt(Kc((b,S)=>({clips:s,currentClip:Math.max(0,Math.min(i,Math.max(0,s.length-1))),currentTimeMs:Math.max(0,a),status:d,scrollLock:!1,playbackKind:m,fake:p,useFake:()=>b(v=>({playbackKind:"fake",fake:{totalWords:l},scrollLock:v.status==="playing"})),useReal:()=>b(v=>({playbackKind:"real",fake:{totalWords:l},scrollLock:v.status==="playing"})),injectMap:v=>{if(n=v,typeof r=="number"){const g=o(r);g&&b(f=>({currentClip:Math.max(0,Math.min(g.clip,Math.max(0,f.clips.length-1))),currentTimeMs:Math.max(0,g.t)})),r=void 0}},setClipAndMs:(v,g)=>b(f=>{const y=Math.max(0,f.clips.length-1);return{currentClip:Math.max(0,Math.min(v,y)),currentTimeMs:Math.max(0,g),status:f.status,scrollLock:f.scrollLock}}),setClips:v=>b(g=>{const f=Array.isArray(v)?v:[],y=f.length>0;return{clips:f,currentClip:0,currentTimeMs:0,status:y?"paused":"idle",playbackKind:y?"real":"fake",fake:y?null:g.fake??{totalWords:l},scrollLock:!1}}),clear:()=>b(v=>({clips:[],currentClip:0,currentTimeMs:0,status:"idle",playbackKind:"fake",fake:v.fake??{totalWords:l},scrollLock:!1})),play:(v,g)=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"play"}}),b(f=>{if(f.playbackKind==="fake")return{status:"playing",scrollLock:!0};const y=typeof v=="number"?v:f.currentClip,R=typeof g=="number"?g:f.currentTimeMs;return{status:"loading",currentClip:Math.max(0,Math.min(y,Math.max(0,f.clips.length-1))),currentTimeMs:R,scrollLock:!0}})},pause:()=>{t==null||t.getState().emit({type:"audio_control",payload:{action:"pause"}}),b({status:"paused",scrollLock:!1})},seek:v=>b(g=>({currentTimeMs:Math.max(0,v),status:g.status})),stop:()=>b({status:"idle",currentTimeMs:0,scrollLock:!1}),nextClip:()=>b(v=>{if(v.playbackKind==="fake")return v;const g=Math.max(0,v.clips.length-1);return{currentClip:Math.min(v.currentClip+1,g),currentTimeMs:0,status:"loading",scrollLock:!0}}),prevClip:()=>b(v=>v.playbackKind==="fake"?v:{currentClip:Math.max(0,v.currentClip-1),currentTimeMs:0,status:"loading",scrollLock:!0}),setClipIndex:v=>b(g=>g.playbackKind==="fake"||v<0||v>=g.clips.length?g:{currentClip:v,currentTimeMs:0}),getClipSrc:v=>{const g=S();if(!g.clips.length)return null;const f=typeof v=="number"?v:g.currentClip;return Yc(g.clips[f])},getGIFromCT:(v,g)=>{if(!n)return-1;const f=n.byClip[v];if(!f||f.length===0)return-1;let y=0,R=f.length-1,k=0;for(;y<=R;){const T=y+R>>1;f[T].t<=g?(k=T,y=T+1):R=T-1}return f[Math.max(0,Math.min(k,f.length-1))].g},getCTFromGI:v=>{if(!n)return null;const{g2ct:g}=n;if(!g)return null;let f=g[v];if(!f){let y=v-1;const R=Math.max(0,v-100);for(;y>=R;){if(g[y]){f=g[y];break}y--}if(!f){let k=v+1;const T=v+100;for(;g[k]==null&&k<=T;)k++;g[k]&&(f=g[k])}}return f?{clip:f.clip,timeMs:f.t}:null},getMetaByGI:v=>{const g=S().getCTFromGI(v);return g?{clipIndex:g.clip,timeMs:g.timeMs}:null},syncToGI:v=>{const g=S().getMetaByGI(v);g&&S().setClipAndMs(g.clipIndex,g.timeMs)},_onTime:v=>b({currentTimeMs:v,status:"playing",scrollLock:!0}),_onEnded:()=>b(v=>{if(v.playbackKind==="fake")return{status:"ended",scrollLock:!1};const g=Math.max(0,v.clips.length-1);return v.currentClip>=g?{status:"ended",scrollLock:!1}:{currentClip:Math.min(v.currentClip+1,g),currentTimeMs:0,status:"loading",scrollLock:!0}}),_onError:()=>b({status:"error",scrollLock:!1}),_setStatusOnly:v=>b({status:v})})))}function Jc({children:e,initialState:t}){const n=u.useContext(xt)??void 0,r=u.useMemo(()=>Zc({...t,recorderStore:n}),[t,n]);return h.jsx(fn.Provider,{value:r,children:e})}function eu(e){var s,i;const t={},n=[],r=((s=e==null?void 0:e.ast)==null?void 0:s.blocks)??[];let o=0;for(const a of r){if((a==null?void 0:a.type)==="image")continue;const l=(a==null?void 0:a.runs)??[];for(let c=0;c<l.length;c++){const d=l[c],m=o+c;d.audioChunkIndex!=null&&d.audioTimeMs!=null&&((t[i=d.audioChunkIndex]||(t[i]=[])).push({t:d.audioTimeMs,g:m}),n[m]={clip:d.audioChunkIndex,t:d.audioTimeMs})}o+=l.length}return Object.values(t).forEach(a=>a.sort((l,c)=>l.t-c.t)),{byClip:t,g2ct:n}}function tu(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 nu(e){const t=ql(e),n=Ul(t),r=t.reduce((d,m)=>d+(m||0),0),o=new Int32Array(Math.max(1,r)).fill(-1),s=new Uint8Array(Math.max(1,r)).fill(0),i=[],a=[];return e.forEach((d,m)=>{var g;if(d.type!=="paragraph")return;const p=n[m]??0,b=d.runs??[];for(let f=0;f<b.length;f++){const y=((g=b[f])==null?void 0:g.text)||"";Jn(y)&&(s[p+f]=1)}const v=Kl(b,p).map(f=>{var T;const y=f.startG-p,R=f.endG-f.startG+1;let k=-1;for(let _=0;_<R;_++){const w=((T=b[y+_])==null?void 0:T.text)??"";if(Jn(w)){k=f.startG+_;break}}return{startG:f.startG,endG:f.endG,r0:y,len:R,firstReadableGI:k,splitIndex:f.splitIndex}});a[m]=v;for(const f of v){const y=i.length;for(let R=f.startG;R<=f.endG;R++)o[R]=y;i.push(f)}}),{nav:{groups:i,giToGroupIdx:o,readableGi:s,splitGroupsPerBlock:a},layout:{prefix:n,totalRuns:r}}}function ru(e){const{section:t,sectionList:n,onSectionChange:r,nav:o,layout:s,initialIndex:i,mountTime:a}=e,l=s.totalRuns??0,c=typeof i=="number"?i:l>0?0:-1,d=c>=0?tu(o.readableGi,c,l):-1;return{section:t,sectionId:t.section_id,sectionList:n,_onSectionChangeCallback:r,currentGlobalRunIndex:d,lastUpdateBy:"program",totalRuns:l,sectionLoading:!0,_loadingStartTime:a,_scrollApi:void 0,derivedNav:o,layout:s}}function ou(e){const{section:t,initialIndex:n,sectionList:r,onSectionChange:o,recorderStore:s}=e,i=t.ast.blocks,{nav:a,layout:l}=nu(i),c=Date.now(),d=ru({section:t,sectionList:r,onSectionChange:o,nav:a,layout:l,initialIndex:n,mountTime:c});return s&&(s.getState().emit({type:"render_start",payload:{sectionId:t.section_id}},c),s.getState().emit({type:"loading_start",payload:{}},c)),bt((m,p)=>{const b=C=>{m(O=>O.progress._scrollApi===C?O:{progress:{...O.progress,_scrollApi:C}})},S=()=>p().progress._scrollApi,v=C=>{m(O=>{const I=O.progress;if(I.totalRuns===C)return O;const P=I.currentGlobalRunIndex<0&&C>0;return{progress:{...I,totalRuns:C,currentGlobalRunIndex:P?0:I.currentGlobalRunIndex,lastUpdateBy:P?"program":I.lastUpdateBy}}})},g=(C,O="program")=>{const I=p().progress.currentGlobalRunIndex,P=p().progress,j=P.totalRuns>0?Math.max(-1,Math.min(C,P.totalRuns-1)):C;I===j&&P.lastUpdateBy===O||(m(z=>({progress:{...z.progress,currentGlobalRunIndex:j,lastUpdateBy:O}})),I!==j&&s&&s.getState().emit({type:"global_index_change",payload:{globalIndex:j}}))},f=C=>{const{sectionLoading:O,_loadingStartTime:I}=p().progress;if(O===C)return;const P=Date.now();if(C)m(j=>({progress:{...j.progress,sectionLoading:!0,_loadingStartTime:P}})),s&&s.getState().emit({type:"loading_start",payload:{}});else{const z=(I?P-I:0)/1e3;m(A=>({progress:{...A.progress,sectionLoading:!1,_loadingStartTime:null}})),s&&s.getState().emit({type:"loading_end",payload:{duration:z}})}},y=C=>{const{totalRuns:O,derivedNav:I}=p().progress,P=I==null?void 0:I.readableGi;if(!P||O<=0)return C;const j=O,z=Math.max(0,Math.min(C,j-1));if(P[z])return z;let A=z-1,D=z+1;for(;A>=0||D<j;){if(D<j&&P[D])return D;if(A>=0&&P[A])return A;D+=1,A-=1}return z},R=(C,O)=>{const{totalRuns:I,derivedNav:P}=p().progress,j=P==null?void 0:P.readableGi;if(!j||I<=0)return null;if(O>0){for(let z=Math.min(Math.max(C,0),I-1);z<I;z+=1)if(j[z])return z}else for(let z=Math.min(Math.max(C,0),I-1);z>=0;z-=1)if(j[z])return z;return null},k=C=>{const{totalRuns:O,derivedNav:I}=p().progress,P=I==null?void 0:I.readableGi;if(!P||O<=0)return null;if(C>0){for(let j=O-1;j>=0;j-=1)if(P[j])return j}else for(let j=0;j<O;j+=1)if(P[j])return j;return null};return{progress:{...d,onSectionChange:C=>{const{_onSectionChangeCallback:O}=p().progress;s&&s.getState().emit({type:"section_change",payload:{sectionId:C}}),O==null||O(C)},registerSectionScrollApi:b,getSectionScrollApi:S,setTotalRuns:v,setCurrentGlobalRunIndex:g,setSectionLoading:f,snapToReadable:y,nextReadableFrom:R,edgeReadable:k,hasReadableInDir:(C,O)=>R(C+(O>0?1:-1),O)!=null,computeStepTarget:(C,O)=>{const{totalRuns:I,derivedNav:P}=p().progress;if(!I||I<=0)return C;const j=(P==null?void 0:P.groups)??[],z=P==null?void 0:P.giToGroupIdx;if(!j.length||!z){const $=I-1;return y(Math.max(0,Math.min(C+O,$)))}let A=z[C]??-1;if(A<0||A>=j.length)for(let de=0;de<j.length;de+=1){const $=j[de];if(C>=$.startG&&C<=$.endG){A=de;break}}if(A<0||A>=j.length)return k(O)??y(C);const D=de=>de>=0&&de<j.length&&(j[de].firstReadableGI??-1)>=0;let Q=A+O;for(;Q>=0&&Q<j.length&&!D(Q);)Q+=O;if(Q<0||Q>=j.length)return k(O)??y(C+O);const ae=j[Q].firstReadableGI;return ae>=0?ae:y(C+O)},giToPercentTotal:C=>{const O=p().progress.totalRuns;return!O||O<=1?0:Math.max(0,Math.min(C,O-1))/(O-1)*100},percentToGITotal:C=>{const O=p().progress.totalRuns;if(!O||O<=1)return 0;const I=Math.max(0,Math.min(C,100)),P=Math.round(I/100*(O-1));return Math.max(0,Math.min(P,O-1))}}}})}function su({children:e,initialState:t}){const n=u.useContext(xt),r=u.useMemo(()=>ou({...t,recorderStore:n}),[t,n]);return h.jsx(hr.Provider,{value:r,children:e})}function iu({children:e,initialState:t}){const n=u.useContext(xt)??void 0,r=u.useMemo(()=>Zs({init:t,recorderStore:n}),[]);return h.jsx(tr.Provider,{value:r,children:e})}const lu=({pages:e,pageIndex:t,maxWidth:n})=>{const r=te(k=>k.section),o=u.useMemo(()=>{var k;return((k=r.ast)==null?void 0:k.blocks)??[]},[r]),s=Y(k=>k.marginX),i=Y(k=>k.lineHeight),a=Y(k=>k.fontSizePx),l=Y(k=>k.fontFamily),c=Y(k=>k.viewportHeight),d=Y(k=>k.playbackViewportHeight),m=d>0?d:c,p=te(k=>{var T;return((T=k.layout)==null?void 0:T.prefix)??[]}),b=te(k=>{var T;return((T=k.derivedNav)==null?void 0:T.splitGroupsPerBlock)??[]}),S=e[t],v=u.useMemo(()=>{const k=[];return o.forEach((T,_)=>{(T.type==="paragraph"||T.type==="image")&&k.push(_)}),k},[o]),g=u.useMemo(()=>{if(!S)return[];const k=[];for(let T=S.startBlock;T<=S.endBlock;T++){const _=v[T];_!=null&&k.push(_)}return k},[S,v]),f=u.useMemo(()=>{const k=[];for(const T of g){const _=o[T];(_==null?void 0:_.type)==="paragraph"&&k.push({b:_,originalBlockIndex:T})}return k},[g,o]),y=u.useMemo(()=>{const k=[],T=gr();return f.forEach((_,w)=>{k[w]=mr(_.b,T)}),k},[f]),R=(k,T,_)=>{if(!k||k.length===0)return[];const w=[];for(const x of k){const E=x.startG,B=x.endG;if(B<T||E>_)continue;const C=Math.max(E,T),O=Math.min(B,_),I=C-E|0,P=Math.max(0,O-C+1);if(P<=0)continue;const j=(x.r0??0)+I;w.push({...x,startG:C,endG:O,r0:j,len:P})}return w};return h.jsx("div",{style:{position:"relative",width:"100%",height:"100%",minHeight:0,display:"grid",placeItems:"center",fontFamily:l,fontSize:a,lineHeight:i},children:h.jsxs("div",{style:{width:"100%",maxWidth:n,height:"100%",boxSizing:"border-box",overflow:"hidden",display:"flex",flexDirection:"column",margin:"0 auto"},children:[h.jsx("div",{style:{height:40}}),h.jsx("div",{style:{flex:1,overflow:"hidden"},children:g.map((k,T)=>{var Z;const _=o[k],w=T===0,x=T===g.length-1,E={boxSizing:"border-box",paddingRight:`${s}px`,paddingLeft:`${s}px`,maxWidth:n,margin:"0 auto",display:"flex",width:"100%",height:"auto"},B=`sec-${r.section_id}/blk-${_.id??k}`;if(_.type==="image"){const{src:M,alt:N,width:L,height:V}=_,q=L&&V?`${L} / ${V}`:"4 / 3",W=m>80?Math.floor((m-80)*.6):void 0;return h.jsx("div",{style:E,children:h.jsxs("div",{style:{margin:"12px 0",textAlign:"center",width:"100%"},children:[h.jsx("div",{style:{position:"relative",width:"100%",maxHeight:W,aspectRatio:q},children:h.jsx("img",{src:M,alt:N||"",loading:"eager",style:{pointerEvents:"none",position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"contain",display:"block"}})}),N&&h.jsx("div",{style:{fontSize:12,color:"#6b7280",marginTop:4},children:N})]})},B)}const C=_,O=f.findIndex(M=>M.originalBlockIndex===k),I=O>=0?y[O]:void 0,P=C.runs??[],j=P.length;let z=0,A=Math.max(0,j-1);w&&S.startOffsetInBlock!=null&&(z=Math.min(Math.max(0,S.startOffsetInBlock),A)),x&&S.endOffsetInBlock!=null&&(A=Math.max(z,Math.min(S.endOffsetInBlock,A)));const D=z>0,Q=p[k]??0,ae=b[k]??[],de=Q+z,$=Q+A;let pe=R(ae,de,$);const ge=Q+z;pe=pe.map(M=>{const N=Math.max(0,(M.startG??de)-ge),L=M.len??Math.max(1,(M.endG??$)-(M.startG??de)+1);return{...M,r0:N,len:L}});const Ce=z<=A?P.slice(z,A+1):[],U=C.list?C.list.level*24:0,he=((Z=C.list)==null?void 0:Z.kind)==="bullet"?C.list.glyph??"•":void 0,G=D?void 0:I??he;return h.jsx("div",{style:E,children:h.jsxs("p",{style:{width:"100%",margin:"8px 0",paddingLeft:U,textAlign:C.textAlign,whiteSpace:"pre-wrap",boxSizing:"border-box"},children:[C.list&&G?h.jsx("span",{"aria-hidden":!0,style:{minWidth:16,display:"inline-block",whiteSpace:"nowrap",userSelect:"none"},children:G||""}):null,h.jsx(gs,{preGroups:pe,runs:Ce,ns:B,baseIndex:ge,sectionId:String(r.section_id)})]})},B)})})]})})},ao=.5;function au(e,t){const n=u.useRef(null),r=u.useRef(null),o=u.useRef(!1);u.useEffect(()=>{const s=()=>{n.current==null&&(n.current=requestAnimationFrame(()=>{n.current=null,t(),o.current=!0,requestAnimationFrame(()=>{o.current=!1})}))},i=new ResizeObserver(l=>{if(o.current)return;const c=l[0],{width:d,height:m}=c.contentRect,p=r.current;if(!p){r.current={w:d,h:m};return}Math.abs(p.w-d)<ao&&Math.abs(p.h-m)<ao||(r.current={w:d,h:m},s())});e.forEach(l=>{l.current&&i.observe(l.current)});const a=()=>s();return window.addEventListener("resize",a),()=>{window.removeEventListener("resize",a),i.disconnect(),n.current!=null&&cancelAnimationFrame(n.current),n.current=null}},[e,t])}function cu(e){const{onPrev:t,onNext:n,onSingle:r,onDouble:o,shouldIgnoreTarget:s,horizontalThreshold:i=120,verticalTolerance:a=40,velocityThreshold:l=.6,singleDelayMs:c=250,doubleClickWindowMs:d=300,suppressAfterSwipeMs:m=250}=e,p=it.useRef({pid:null,startX:0,startY:0,startT:0,swiping:!1,canceledClick:!1,lastUpT:0,lastSwipeAt:-1,capturedEl:null,prevUserSelect:null,singleTimer:null}),b=()=>{p.current.singleTimer!=null&&(window.clearTimeout(p.current.singleTimer),p.current.singleTimer=null)},S=()=>{var _;const T=((_=document==null?void 0:document.body)==null?void 0:_.style)??null;T&&p.current.prevUserSelect!=null&&(T.userSelect=p.current.prevUserSelect,p.current.prevUserSelect=null),p.current.capturedEl&&p.current.pid!=null&&typeof p.current.capturedEl.hasPointerCapture=="function"&&p.current.capturedEl.hasPointerCapture(p.current.pid)&&p.current.capturedEl.releasePointerCapture(p.current.pid),p.current.capturedEl=null},v=it.useCallback(T=>{s!=null&&s(T.target)||(p.current.pid=T.pointerId,p.current.startX=T.clientX,p.current.startY=T.clientY,p.current.startT=T.timeStamp,p.current.swiping=!1,p.current.canceledClick=!1)},[s]),g=it.useCallback(T=>{var x;if(p.current.pid==null||T.pointerId!==p.current.pid)return;const _=T.clientX-p.current.startX,w=T.clientY-p.current.startY;if(!p.current.swiping){const E=Math.abs(_),B=Math.abs(w);if(E>=i&&B<=a&&E>B){p.current.swiping=!0,p.current.canceledClick=!0;const C=T.currentTarget;typeof C.setPointerCapture=="function"&&(C.setPointerCapture(T.pointerId),p.current.capturedEl=C);const O=((x=document==null?void 0:document.body)==null?void 0:x.style)??null;O&&(p.current.prevUserSelect=O.userSelect??null,O.userSelect="none"),T.preventDefault()}return}T.preventDefault()},[i,a]),f=it.useCallback(T=>{if(p.current.pid==null||T.pointerId!==p.current.pid)return;const _=T.timeStamp-p.current.startT,w=T.clientX-p.current.startX;if(p.current.swiping){const x=Math.abs(w)/Math.max(1,_);(Math.abs(w)>=i||x>=l)&&(w<0?n():t()),S(),p.current.lastSwipeAt=T.timeStamp}else T.timeStamp-p.current.lastUpT;p.current.lastUpT=T.timeStamp,p.current.pid=null,p.current.swiping=!1},[i,l,n,t,d]),y=it.useCallback(()=>{S(),p.current.pid=null,p.current.swiping=!1,p.current.canceledClick=!1},[]),R=it.useCallback(T=>{if(!(s!=null&&s(T.target))&&!(T.timeStamp-p.current.lastSwipeAt<m)){if(p.current.canceledClick){p.current.canceledClick=!1;return}r&&p.current.singleTimer==null&&(p.current.singleTimer=window.setTimeout(()=>{p.current.singleTimer=null,r(T)},c))}},[r,s,c,m]),k=it.useCallback(T=>{if(!(s!=null&&s(T.target))&&!(T.timeStamp-p.current.lastSwipeAt<m)){if(p.current.canceledClick){p.current.canceledClick=!1;return}b(),o==null||o(T)}},[o,s,m]);return it.useEffect(()=>()=>{b(),S()},[]),{onPointerDown:v,onPointerMove:g,onPointerUp:f,onPointerCancel:y,onClick:R,onDoubleClick:k}}var Mn,co;function ws(){if(co)return Mn;co=1;function e(t){var n=typeof t;return t!=null&&(n=="object"||n=="function")}return Mn=e,Mn}var En,uo;function uu(){if(uo)return En;uo=1;var e=typeof Ut=="object"&&Ut&&Ut.Object===Object&&Ut;return En=e,En}var jn,fo;function Cs(){if(fo)return jn;fo=1;var e=uu(),t=typeof self=="object"&&self&&self.Object===Object&&self,n=e||t||Function("return this")();return jn=n,jn}var Pn,po;function du(){if(po)return Pn;po=1;var e=Cs(),t=function(){return e.Date.now()};return Pn=t,Pn}var On,ho;function fu(){if(ho)return On;ho=1;var e=/\s/;function t(n){for(var r=n.length;r--&&e.test(n.charAt(r)););return r}return On=t,On}var Bn,go;function pu(){if(go)return Bn;go=1;var e=fu(),t=/^\s+/;function n(r){return r&&r.slice(0,e(r)+1).replace(t,"")}return Bn=n,Bn}var zn,mo;function Is(){if(mo)return zn;mo=1;var e=Cs(),t=e.Symbol;return zn=t,zn}var An,bo;function hu(){if(bo)return An;bo=1;var e=Is(),t=Object.prototype,n=t.hasOwnProperty,r=t.toString,o=e?e.toStringTag:void 0;function s(i){var a=n.call(i,o),l=i[o];try{i[o]=void 0;var c=!0}catch{}var d=r.call(i);return c&&(a?i[o]=l:delete i[o]),d}return An=s,An}var Ln,xo;function gu(){if(xo)return Ln;xo=1;var e=Object.prototype,t=e.toString;function n(r){return t.call(r)}return Ln=n,Ln}var Gn,vo;function mu(){if(vo)return Gn;vo=1;var e=Is(),t=hu(),n=gu(),r="[object Null]",o="[object Undefined]",s=e?e.toStringTag:void 0;function i(a){return a==null?a===void 0?o:r:s&&s in Object(a)?t(a):n(a)}return Gn=i,Gn}var Hn,So;function bu(){if(So)return Hn;So=1;function e(t){return t!=null&&typeof t=="object"}return Hn=e,Hn}var Nn,yo;function xu(){if(yo)return Nn;yo=1;var e=mu(),t=bu(),n="[object Symbol]";function r(o){return typeof o=="symbol"||t(o)&&e(o)==n}return Nn=r,Nn}var Fn,wo;function vu(){if(wo)return Fn;wo=1;var e=pu(),t=ws(),n=xu(),r=NaN,o=/^[-+]0x[0-9a-f]+$/i,s=/^0b[01]+$/i,i=/^0o[0-7]+$/i,a=parseInt;function l(c){if(typeof c=="number")return c;if(n(c))return r;if(t(c)){var d=typeof c.valueOf=="function"?c.valueOf():c;c=t(d)?d+"":d}if(typeof c!="string")return c===0?c:+c;c=e(c);var m=s.test(c);return m||i.test(c)?a(c.slice(2),m?2:8):o.test(c)?r:+c}return Fn=l,Fn}var Wn,Co;function Su(){if(Co)return Wn;Co=1;var e=ws(),t=du(),n=vu(),r="Expected a function",o=Math.max,s=Math.min;function i(a,l,c){var d,m,p,b,S,v,g=0,f=!1,y=!1,R=!0;if(typeof a!="function")throw new TypeError(r);l=n(l)||0,e(c)&&(f=!!c.leading,y="maxWait"in c,p=y?o(n(c.maxWait)||0,l):p,R="trailing"in c?!!c.trailing:R);function k(I){var P=d,j=m;return d=m=void 0,g=I,b=a.apply(j,P),b}function T(I){return g=I,S=setTimeout(x,l),f?k(I):b}function _(I){var P=I-v,j=I-g,z=l-P;return y?s(z,p-j):z}function w(I){var P=I-v,j=I-g;return v===void 0||P>=l||P<0||y&&j>=p}function x(){var I=t();if(w(I))return E(I);S=setTimeout(x,_(I))}function E(I){return S=void 0,R&&d?k(I):(d=m=void 0,b)}function B(){S!==void 0&&clearTimeout(S),g=0,d=v=m=S=void 0}function C(){return S===void 0?b:E(t())}function O(){var I=t(),P=w(I);if(d=arguments,m=this,v=I,P){if(S===void 0)return T(v);if(y)return clearTimeout(S),S=setTimeout(x,l),k(v)}return S===void 0&&(S=setTimeout(x,l)),b}return O.cancel=B,O.flush=C,O}return Wn=i,Wn}var yu=Su();const wu=Oo(yu);function Cu(e,t=200,n,r){const o=u.useRef(e),s=u.useRef(n);u.useEffect(()=>{o.current=e},[e]),u.useEffect(()=>{s.current=n},[n]);const i=u.useMemo(()=>{const a=wu((...c)=>{o.current(...c)},t,r),l=((...c)=>{var d;(d=s.current)==null||d.call(s),a(...c)});return l.cancel=a.cancel.bind(a),l.flush=a.flush.bind(a),l},[t,r==null?void 0:r.leading,r==null?void 0:r.trailing,r==null?void 0:r.maxWait]);return u.useEffect(()=>()=>i.cancel(),[i]),i}let ks=0;class Ts extends Error{constructor(){super("calcPages canceled due to a newer invocation");xr(this,"code","CALC_PAGES_CANCELED");this.name="CalcPagesCanceled"}}const Ke=e=>{if(e!==ks)throw new Ts},Vn=e=>{const t=getComputedStyle(e),n=parseFloat(t.marginTop||"0")||0,r=parseFloat(t.marginBottom||"0")||0;return{mt:n,mb:r}},Io=e=>{const t=e.getClientRects(),n=t.length?t[0].top:e.getBoundingClientRect().top,r=e.querySelectorAll("[data-runbox]"),o=[];return r.forEach((s,i)=>{const a=s.getClientRects(),l=a.length?a[a.length-1].bottom:n;o[i]=Math.max(0,l-n)}),o},Iu=(e,t)=>{if(t<16)return async(r=24)=>{Ke(e)};let n=0;return async(r=24)=>{n++,n%r===0&&(Ke(e),await new Promise(o=>requestAnimationFrame(()=>o())),Ke(e))}};async function ku({viewHost:e,measureRoot:t,contentArea:n,items:r,cfgMaxWidth:o,marginX:s,fontFamily:i,fontSizePx:a,lineHeight:l,showSplit:c,breakGapPx:d=0,showSlash:m,paragraphMarkers:p,playbackScale:b=1,viewportHeight:S=0}){var g,f,y;const v=++ks;Ke(v);try{const R=Math.abs(b-1)>.001,k=1/b;R&&(t.style.transform=`scale(${k})`,t.style.transformOrigin="top left");const T=Math.max(0,e.offsetWidth||0),_=Math.max(0,Math.min(T,o));t.style.maxWidth=`${_}px`,Ke(v);let w=Math.round(n.offsetHeight||0);w||(w=Math.max(0,n.clientHeight|0)),console.log("[calcPages] playbackScale:",b.toFixed(4),R?"(scaled, applying inverse)":"(no scale)"),console.log("[calcPages] viewWidth:",T),console.log("[calcPages] pageBoxWidth:",_),console.log("[calcPages] maxPageHeight:",w),console.log("[calcPages] contentArea rect:",n.getBoundingClientRect()),console.log("[calcPages] measureRoot rect:",t.getBoundingClientRect());const x=1.5,E=(M,N)=>N+M<=w-x,B=getComputedStyle(e),C={letterSpacing:B.letterSpacing,wordSpacing:B.wordSpacing,fontKerning:B.fontKerning||"normal",fontVariantLigatures:B.fontVariantLigatures||"normal",textTransform:B.textTransform||"none",direction:B.direction||"ltr",wordBreak:B.wordBreak||"keep-all",overflowWrap:B.overflowWrap||B.wordWrap||"break-word",hyphens:B.hyphens||"manual"},O=M=>{M.style.letterSpacing=C.letterSpacing||"",M.style.wordSpacing=C.wordSpacing||"",M.style.fontKerning=C.fontKerning||"",M.style.fontVariantLigatures=C.fontVariantLigatures||"",M.style.textTransform=C.textTransform||"",M.style.direction=C.direction||"",M.style.wordBreak=C.wordBreak||"",M.style.wordWrap=C.overflowWrap||"",M.style.overflowWrap=C.overflowWrap||"",M.style.hyphens=C.hyphens||""},I=_,P=Math.max(0,I-2*(s||0));n.innerHTML="";const j=document.createElement("div");j.style.boxSizing="border-box",j.style.width=`${I}px`,j.style.maxWidth=`${I}px`,j.style.margin="0 auto",j.style.display="flex",n.appendChild(j);const z=document.createElement("div");z.style.boxSizing="border-box",z.style.paddingRight=`${s}px`,z.style.paddingLeft=`${s}px`,z.style.width=`${I}px`,z.style.maxWidth=`${I}px`,z.style.margin="0 auto",z.style.display="flex",z.style.justifyContent="center",z.style.height="auto",j.appendChild(z);const A=new Map,D={},Q=Iu(v,r.length),ae=(M,N)=>{const L=document.createElement("p");return L.style.margin="8px 0",L.style.paddingLeft=N?`${N}px`:"0",L.style.textAlign=M.textAlign??"start",L.style.whiteSpace="pre-wrap",L.style.lineHeight=String(l),L.style.fontSize=`${a}px`,L.style.boxSizing="border-box",L.style.fontFamily=i??"",L.style.width="100%",O(L),L},de=(M,N)=>{const L=N??[],V=document.createDocumentFragment();for(let q=0;q<L.length;q++){const W=L[q],le=document.createElement("span");le.dataset.runbox=String(q),le.style.whiteSpace="pre-wrap";const X=document.createElement("span");if(X.dataset.run=String(q),X.textContent=(W==null?void 0:W.text)??"",X.style.whiteSpace="pre-wrap",W!=null&&W.bold&&(X.style.fontWeight="700"),W!=null&&W.italic&&(X.style.fontStyle="italic"),W!=null&&W.underline&&(X.style.textDecoration="underline"),le.appendChild(X),c&&(W!=null&&W.split)&&q!==L.length-1){const ee=Math.max(0,(d??0)/2),oe=document.createElement("span");oe.style.display="inline-block",oe.style.width=`${ee}px`;const se=document.createElement("span");if(se.style.display="inline-block",se.style.width=`${ee}px`,le.appendChild(oe),m){const _e=document.createElement("span");_e.textContent=" / ",le.appendChild(_e)}le.appendChild(se)}V.appendChild(le)}M.appendChild(V)},$=S>80?Math.floor((S-80)*.6):void 0,pe=M=>{const N=M!=null&&M.width&&(M!=null&&M.height)?`${M.width} / ${M.height}`:"4 / 3",L=document.createElement("div");L.style.margin="12px 0",L.style.textAlign="center",L.style.width=`${P}px`;const V=document.createElement("div");V.style.position="relative",V.style.width="100%",$&&(V.style.maxHeight=`${$}px`),V.style.aspectRatio=N;const q=document.createElement("div");if(q.style.position="absolute",q.style.inset="0",q.style.width="100%",q.style.height="100%",V.appendChild(q),L.appendChild(V),M!=null&&M.alt){const W=document.createElement("div");W.style.fontSize="12px",W.style.color="#6B7280",W.style.marginTop="4px",W.textContent=String(M.alt),O(W),L.appendChild(W)}return L};for(let M=0;M<r.length;M++){Ke(v);const N=r[M];if(z.dataset.block=String(M),z.innerHTML="",N.kind==="image"){const se=N.block,_e=pe(se);z.appendChild(_e);const Ae=_e.getBoundingClientRect(),{mt:Pe,mb:Ge}=Vn(_e);D[M]={contentH:Math.ceil(Ae.height),mt:Pe,mb:Ge},await Q(24);continue}const L=N.block,V=L.list?(L.list.level??0)*24:0,q=N.paraIndex??0,W=p[q]??(((g=L.list)==null?void 0:g.kind)==="bullet"?((f=L.list)==null?void 0:f.glyph)??"•":void 0);if(!!(L.list&&W)){const se=ae(L,V);se.dataset.variant="with";const _e=ae(L,V);_e.dataset.variant="no";const Ae=document.createElement("span");Ae.textContent=`${W} `,Ae.style.minWidth="16px",Ae.style.display="inline-block",Ae.style.whiteSpace="nowrap",Ae.style.userSelect="none",se.appendChild(Ae),de(se,L.runs),de(_e,L.runs);const Pe=document.createDocumentFragment();Pe.appendChild(se),Pe.appendChild(_e),z.appendChild(Pe)}else{const se=ae(L,V);se.dataset.variant="with",de(se,L.runs),z.appendChild(se)}const X=z.querySelector('p[data-variant="with"]'),ee=z.querySelector('p[data-variant="no"]'),oe=ee??X;if(X&&oe){const se=Io(X),_e=Io(oe),{mt:Ae,mb:Pe}=Vn(X),{mt:Ge,mb:Fe}=Vn(oe),qe=((y=L.runs)==null?void 0:y.length)??0,je=ee?_e:se,rt=ee?Ge:Ae,ot=ee?Fe:Pe;if(M<3){const hn=X.getBoundingClientRect().height;console.log(`[calcPages] para ${M}: height=${hn.toFixed(2)}, lastBottom=[${se.slice(-3).map(qt=>qt.toFixed(1)).join(",")}], runs=${qe}`)}A.set(M,{runsLen:qe,lastBottomWith:se,lastBottomNo:je,mtWith:Ae,mbWith:Pe,mtNo:rt,mbNo:ot})}await Q(24)}Ke(v),z.innerHTML="";const ge=(M,N,L,V)=>{if(N>L)return{top:0,content:0,mb:0};const q=V?M.lastBottomNo:M.lastBottomWith,W=V?M.mtNo:M.mtWith,le=V?M.mbNo:M.mbWith,X=V?0:W,ee=N>0?q[N-1]??0:0,oe=Math.max(0,(q[L]??0)-ee);return{top:X,content:oe,mb:le}},Ce=[];let U=0,he,G=null,Z=null;for(;U<r.length;){Ke(v);const M=U;let N=0,L=0,V=he;V!=null&&G===U&&Z!=null&&(V=Math.max(V,Z+1));let q=-1,W;for(;U<r.length;){if(Ke(v),r[U].kind==="image"){const je=D[U]??{contentH:0,mt:0,mb:0},ot=(N===0?je.mt:L+je.mt)+je.contentH;if(E(ot,N)){N+=ot,q=U,W=void 0,L=je.mb,U+=1,he=void 0,G=null,Z=null;continue}if(N===0){Ce.push({startBlock:M,endBlock:U,...V!=null?{startOffsetInBlock:V}:{}}),U+=1,he=void 0,G=null,Z=null,L=0;break}break}const X=A.get(U),ee=X.runsLen,oe=U===M&&V!=null?V:0;if(oe>=ee){U+=1,he=void 0,G=null,Z=null;continue}const se=oe>0,_e=ge(X,oe,ee-1,se),Pe=(N===0?_e.top:L+_e.top)+_e.content;if(E(Pe,N)){N+=Pe,q=U,W=ee-1,L=_e.mb,U+=1,he=void 0,G=null,Z=null;continue}let Ge=oe,Fe=ee-1,qe=oe-1;for(;Ge<=Fe;){Ke(v);const je=Ge+Fe>>1,rt=ge(X,oe,je,se),ot=(N===0?rt.top:L+rt.top)+rt.content;E(ot,N)?(qe=je,Ge=je+1):Fe=je-1}if(qe>=oe){Ce.push({startBlock:M,endBlock:U,...V!=null?{startOffsetInBlock:V}:{},endOffsetInBlock:qe}),he=qe+1,G=U,Z=qe,L=0;break}if(N>0){Ce.push({startBlock:M,endBlock:q>=0?q:Math.min(U-1,r.length-1),...V!=null?{startOffsetInBlock:V}:{},...W!=null?{endOffsetInBlock:W}:{}}),L=0;break}else{const je=oe;Ce.push({startBlock:M,endBlock:U,...V!=null?{startOffsetInBlock:V}:{},endOffsetInBlock:je}),he=je+1,G=U,Z=je,L=0;break}}(Ce.length===0||Ce[Ce.length-1].startBlock!==M)&&Ce.push({startBlock:M,endBlock:q>=0?q:Math.min(U-1,r.length-1),...V!=null?{startOffsetInBlock:V}:{},...W!=null?{endOffsetInBlock:W}:{}})}return j.remove(),R&&(t.style.transform="",t.style.transformOrigin=""),Ke(v),{pages:Ce,pageByRunIndex:null}}catch(R){throw(R==null?void 0:R.name)==="CalcPagesCanceled",R}}function Tu(e,t,n){var r;if(!e)return null;for(let o=e.startBlock;o<=e.endBlock;o++){const s=t[o];if(!s||s.kind!=="paragraph")continue;const i=((r=s.block.runs)==null?void 0:r.length)??0;if(!i)continue;const a=o===e.startBlock&&e.startOffsetInBlock!=null?Math.min(Math.max(0,e.startOffsetInBlock),i-1):0;return(n[s.originalIndex]??0)+a}return null}function _u(e,t,n,r){var o;for(let s=0;s<t.length;s++){const i=t[s];for(let a=i.startBlock;a<=i.endBlock;a++){const l=n[a];if(!l||l.kind!=="paragraph")continue;const c=((o=l.block.runs)==null?void 0:o.length)??0;if(!c)continue;let d=0,m=c-1;a===i.startBlock&&i.startOffsetInBlock!=null&&(d=Math.max(0,Math.min(i.startOffsetInBlock,m))),a===i.endBlock&&i.endOffsetInBlock!=null&&(m=Math.max(d,Math.min(i.endOffsetInBlock,m)));const p=r[l.originalIndex]??0,b=p+d,S=p+m;if(e>=b&&e<=S)return s}}return-1}function Ru(e){var r,o;const t=e;if(!t)return!1;const n=((o=(r=t.tagName)==null?void 0:r.toLowerCase)==null?void 0:o.call(r))??"";return!!(["a","button","input","textarea","select","label"].includes(n)||t.isContentEditable)}function Mu(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 Eu(){const e=te($=>$.section),t=Et(),n=Y($=>$.theme),r=tn[n],o=Y($=>$.fontFamily),s=Y($=>$.fontSizePx),i=Y($=>$.lineHeight),a=Y($=>$.marginX),l=Y($=>$.viewportHeight),c=Y($=>$.playbackViewportHeight),d=c>0?c:l,m=860,p=u.useRef(null),{items:b}=u.useMemo(()=>{var $;return Mu((($=e==null?void 0:e.ast)==null?void 0:$.blocks)??[])},[e]),S=u.useMemo(()=>{const $=[],pe=gr();return b.forEach(ge=>{if(ge.kind==="paragraph"){const Ce=ge.paraIndex;$[Ce]=mr(ge.block,pe)}}),$},[b]),[v,g]=u.useState({pages:[],pageByRunIndex:null}),[f,y]=u.useState(0),R=u.useMemo(()=>({flex:1,fontFamily:o,background:r.bg,color:r.fg,fontSize:s,lineHeight:i,overflow:"hidden",WebkitOverflowScrolling:"touch",width:"100%",height:"100%",position:"relative",display:"grid",placeItems:"center"}),[o,r.bg,r.fg,s,i]),{showSplit:k,breakGapPx:T,slash:_}=Y(Ft($=>{var pe;return{showSplit:$.showSplit,breakGapPx:$.breakGapPx??0,slash:((pe=$.breakMarks)==null?void 0:pe.slash)??!1}})),w=mt();u.useEffect(()=>{v&&v.pages.length&&(console.log("그래서 총 페이지",v.pages.length),(async()=>{const $=w.getState().progress.setSectionLoading;await ct(),await ct(),await ct(),await ct(),console.log("recalc종료"),$(!1)})())},[v]);const x=u.useCallback(()=>{console.log("@@@@@@recalc호출");const $=p.current,pe=A.current,ge=D.current;if(console.log("showSplit",k),!$||!pe||!ge||b.length===0){g({pages:[],pageByRunIndex:null}),y(0);return}e.quiz,(async()=>{const Ce=performance.now();try{const U=t.getState().playbackScale,{pages:he,pageByRunIndex:G}=await ku({viewHost:$,measureRoot:pe,contentArea:ge,items:b,cfgMaxWidth:m,marginX:a,fontFamily:o,fontSizePx:s,lineHeight:i,showSplit:k,breakGapPx:T,showSlash:_,paragraphMarkers:S,playbackScale:U,viewportHeight:d}),Z=performance.now();console.log(`✅ calcPages 완료: ${(Z-Ce).toFixed(1)} ms (${he.length} pages)`),g({pages:he,pageByRunIndex:G}),y(0)}catch(U){if(U instanceof Ts){console.log("이젠실행 취소 들어옴!");return}console.log("에러발생",U)}})()},[e,b,m,a,o,s,i,k,T,_,S,t,d]);te($=>$.computeStepTarget);const E=te($=>$.setCurrentGlobalRunIndex);te($=>$.totalRuns);const B=te($=>{var pe;return((pe=$.layout)==null?void 0:pe.prefix)??[]}),C=u.useCallback($=>{const pe=f+$;if(pe<0||pe>=v.pages.length)return;const ge=Tu(v.pages[pe],b,B);ge!=null?E(ge,"scrubber-step"):y(pe)},[f,v.pages,b,B,E,y]),O=u.useCallback(()=>{C(-1)},[C]),I=u.useCallback(()=>{C(1)},[C]),P=_t(),j=u.useCallback(()=>{const{isSettingsOpen:$,setSettingsOpen:pe,toggleOverlays:ge}=P.getState();$?pe(!1):ge()},[P]),z=cu({onPrev:O,onNext:I,onSingle:j,onDouble:()=>{},shouldIgnoreTarget:Ru,horizontalThreshold:120,verticalTolerance:40,velocityThreshold:.6,singleDelayMs:250,doubleClickWindowMs:300,suppressAfterSwipeMs:250}),A=u.useRef(null),D=u.useRef(null),Q=u.useCallback(()=>{const $=w.getState().progress.setSectionLoading;$(!0)},[w]),ae=Cu(x,200,Q,{trailing:!0,leading:!1,maxWait:1e3});u.useEffect(()=>{ae.cancel(),Q(),x()},[ae,x,Q]),au([p],ae);const de=te($=>$.registerSectionScrollApi);return u.useEffect(()=>(de({ensureVisibleGI:async()=>!0,scrollToGI:async()=>!0,getVisibleRange:()=>null,getScrollTop:()=>0,setScrollTop:()=>{},getAnchorOffsetRatio:()=>0,scrollToGIAtOffset:async()=>{},stepPage:C}),()=>de(void 0)),[de,C]),h.jsxs("div",{ref:p,style:{...R,touchAction:"pan-y"},...z,children:[h.jsx(lu,{pages:v.pages,pageIndex:f,maxWidth:m}),h.jsx("div",{ref:A,"aria-hidden":!0,style:{position:"absolute",contain:"layout style paint",left:-999999,top:-999999,zIndex:-999999,opacity:0,width:"100%",maxWidth:m,height:"100%",minHeight:0,boxSizing:"border-box",overflow:"hidden",fontFamily:o,fontSize:s,lineHeight:i,pointerEvents:"none",background:"pink"},children:h.jsxs("div",{style:{width:"100%",maxWidth:m,height:"100%",boxSizing:"border-box",display:"flex",flexDirection:"column",margin:"0 auto",overflow:"hidden"},children:[h.jsx("div",{style:{height:40,background:"blue"}}),h.jsx("div",{ref:D,style:{height:"calc(100% - 110px)",overflow:"hidden",boxSizing:"border-box",width:"100%"}})]})}),h.jsx(ju,{pages:v.pages,items:b,onGotoPage:y})]})}const ju=({pages:e,items:t,onGotoPage:n})=>{const r=te(s=>s.currentGlobalRunIndex),o=te(s=>{var i;return((i=s.layout)==null?void 0:i.prefix)??[]});return u.useEffect(()=>{if(r==null||e.length===0)return;const s=_u(r,e,t,o);s>=0&&n(s)},[r,e,t,o,n]),h.jsx(h.Fragment,{})},Pu="_wrapper_excbn_1",Ou="_spinner_excbn_10",ko={wrapper:Pu,spinner:Ou};function Bu({size:e=28,speed:t=.8}){return h.jsx("div",{className:`${ko.wrapper}`,children:h.jsx("div",{className:ko.spinner,style:{width:e,height:e,borderWidth:3,animationDuration:`${t}s`}})})}function zu(){const e=te(Ft(t=>t.sectionLoading===!0));return h.jsx(h.Fragment,{children:e===!0&&h.jsx(Bu,{})})}const Au="_Overlay_ybic8_3",Lu="_Dialog_ybic8_15",Gu="_Body_ybic8_25",Hu="_Header_ybic8_32",Nu="_Paging_ybic8_39",Fu="_Remaining_ybic8_48",Wu="_RemainingDanger_ybic8_55",Vu="_NextBtn_ybic8_59",Du="_CloseBtn_ybic8_96",$u="_Question_ybic8_113",qu="_Score_ybic8_123",Uu="_Image_ybic8_130",Ku="_Options_ybic8_140",Yu="_OptionBtn_ybic8_145",Xu="_OptionBtnActive_ybic8_165",Qu="_Footer_ybic8_172",Zu="_OptionBtnCorrect_ybic8_195",Ju="_Judge_ybic8_201",ed="_Correct_ybic8_212",td="_Incorrect_ybic8_215",nd="_ResultHeader_ybic8_220",rd="_ResultActions_ybic8_233",od="_CloseBtnSoft_ybic8_239",sd="_SummaryGrid_ybic8_249",id="_StatCard_ybic8_257",ld="_StatLabel_ybic8_265",ad="_StatValue_ybic8_270",cd="_StatSub_ybic8_277",ce={Overlay:Au,Dialog:Lu,Body:Gu,Header:Hu,Paging:Nu,Remaining:Fu,RemainingDanger:Wu,NextBtn:Vu,CloseBtn:Du,Question:$u,Score:qu,Image:Uu,Options:Ku,OptionBtn:Yu,OptionBtnActive:Xu,Footer:Qu,OptionBtnCorrect:Zu,Judge:Ju,Correct:ed,Incorrect:td,ResultHeader:nd,ResultActions:rd,CloseBtnSoft:od,SummaryGrid:sd,StatCard:id,StatLabel:ld,StatValue:ad,StatSub:cd};function ud(e){return e?e.kind==="temp"?e.blobUrl:e.cdnUrl:null}function _s(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function dd(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 fd=u.memo(function(){const t=Ue(g=>g.phase),n=Ue(g=>g.quizzes),r=Ue(g=>g.order),o=Ue(g=>g.currentIndex),s=Ue(g=>g.answers),i=Ue(g=>g.correctCount),a=Ue(g=>g.remainingSec),l=Ue(g=>g.uiReveal),c=Ue(g=>g.startedAt),d=Ue(g=>g.finishedAt),m=Ue(g=>g.perQ),p=bs();u.useEffect(()=>{if(t==="idle"||t!=="doing"||a==null)return;const g=window.setInterval(()=>p.getState().tick(),1e3);return()=>window.clearInterval(g)},[t,a,p]);const b=t==="doing"?n[r[o]]:void 0,S=t==="doing"&&b?s[b.qid]??[]:[],v=u.useMemo(()=>{if(t==="idle"||t!=="finished")return;const g=r.map(A=>n[A]),f=g.length,y=g.reduce((A,D)=>A+(D.score??0),0),R=g.reduce((A,D)=>{const Q=m[D.qid];return A+(Q!=null&&Q.isCorrect?D.score??0:0)},0),k=g.map(A=>m[A.qid]).filter(A=>!!A),T=typeof c=="number"&&typeof d=="number"?Math.max(0,d-c):k.reduce((A,D)=>A+(D.ms??0),0),_=f>0?Math.round(T/f):0,w=[...k].sort((A,D)=>A.ms-D.ms),x=w[0],E=w[w.length-1],B=k.filter(A=>!A.multi),C=k.filter(A=>A.multi),O=B.filter(A=>A.isCorrect).length,I=C.filter(A=>A.isCorrect).length,P=k.filter(A=>A.timedOut).length,j=k.filter(A=>A.revealed).length,z=k.filter(A=>!A.isCorrect).sort((A,D)=>D.ms-A.ms).slice(0,3);return{total:f,correct:i,rate:f?Math.round(i/f*100):0,timeMsTotal:T,avgMs:_,totalScore:y,gainedScore:R,fastest:x,slowest:E,singles:{total:B.length,correct:O},multis:{total:C.length,correct:I},timedOut:P,revealed:j,wrongTop3:z}},[t,r,n,m,c,d,i]);return t==="idle"?null:h.jsx("div",{className:ce.Overlay,role:"dialog","aria-modal":"true",children:h.jsx("div",{className:ce.Dialog,children:t==="doing"&&b?h.jsx(pd,{q:b,index:o,total:r.length,selected:S,uiReveal:l,onSelect:g=>{if(l)return;const f=p.getState();_s(b)?f.selectToggle(g):f.selectSingle(g)},onBeforeNext:()=>p.getState().setReveal(!0),onNext:()=>p.getState().afterRevealNext(),remainingSec:a,onClose:()=>p.getState().close()}):h.jsx(hd,{total:r.length,correct:i,summary:v,onClose:()=>p.getState().close()})})})});function pd(e){const{q:t,index:n,total:r,selected:o,uiReveal:s,onSelect:i,onBeforeNext:a,onNext:l,remainingSec:c,onClose:d}=e,m=_s(t),p=u.useMemo(()=>{const g=t.options.map((f,y)=>({opt:f,i:y}));for(let f=g.length-1;f>0;f--){const y=Math.floor(Math.random()*(f+1));[g[f],g[y]]=[g[y],g[f]]}return g},[t.qid]),b=u.useMemo(()=>ud(t),[t]),S=u.useMemo(()=>dd(t),[t]),v=u.useMemo(()=>{const g=[...o].sort((f,y)=>f-y);if(g.length!==S.length)return!1;for(let f=0;f<g.length;f++)if(g[f]!==S[f])return!1;return!0},[o,S]);return h.jsxs("div",{className:ce.Body,children:[h.jsxs("div",{className:ce.Header,children:[h.jsx("div",{className:ce.Paging,children:`Quiz (${n+1}/${r})`}),h.jsx("button",{type:"button",onClick:d,className:ce.CloseBtn,children:"X"})]}),h.jsx("div",{className:ce.Question,children:t.question}),h.jsx("div",{className:ce.Score,children:` (${t.score}점${m?" ,모두선택":""})`}),h.jsx("div",{className:`${ce.Judge}${s?v?` ${ce.Correct}`:` ${ce.Incorrect}`:""}`,"aria-live":"polite",children:s?v?`Correct : +${t.score} point`:"Incorrect : 0 point":"a"}),h.jsx("div",{className:ce.Image,children:b&&h.jsx("img",{src:b,alt:""})}),h.jsx("div",{className:ce.Options,children:p.map(({opt:g,i:f})=>{const y=o.includes(f),R=S.includes(f),k=[ce.OptionBtn,y?ce.OptionBtnActive:"",s&&R?ce.OptionBtnCorrect:""].filter(Boolean).join(" ");return h.jsx("button",{type:"button",onClick:()=>i(f),className:k,disabled:s,children:g},f)})}),h.jsx("div",{className:ce.Footer,children:s?h.jsx("button",{type:"button",onClick:l,className:ce.NextBtn,children:n+1>=r?"Complete":"Next Quiz"}):h.jsxs("button",{type:"button",onClick:a,className:`${ce.NextBtn}`,children:["Submit",typeof c=="number"&&h.jsx("span",{className:`${ce.Remaining} ${c<=5?ce.RemainingDanger:""}`,children:` (${c} s )`})]})})]})}function To(e){return e==null?"-":`${Math.round(e/1e3)}s`}function hd(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 h.jsxs("div",{className:ce.Body,children:[h.jsx("div",{className:ce.ResultHeader,children:"결과 요약"}),h.jsxs("div",{className:ce.SummaryGrid,role:"list",children:[h.jsxs("div",{className:ce.StatCard,role:"listitem",children:[h.jsx("div",{className:ce.StatLabel,children:"정답률"}),h.jsxs("div",{className:ce.StatValue,children:[s,"%"]}),h.jsx("div",{className:ce.StatSub,children:`정답수 ${n}/문제수${t}`})]}),h.jsxs("div",{className:ce.StatCard,role:"listitem",children:[h.jsx("div",{className:ce.StatLabel,children:"총 점수"}),h.jsx("div",{className:ce.StatValue,children:r?`${r.gainedScore}/${r.totalScore}`:"-"}),h.jsx("div",{className:ce.StatSub,children:"획득점수/최대점수"})]}),h.jsxs("div",{className:ce.StatCard,role:"listitem",children:[h.jsx("div",{className:ce.StatLabel,children:"총 소요 시간"}),h.jsx("div",{className:ce.StatValue,children:To(r==null?void 0:r.timeMsTotal)}),h.jsx("div",{className:ce.StatSub,children:`평균 ${To(r==null?void 0:r.avgMs)}`})]}),h.jsxs("div",{className:ce.StatCard,role:"listitem",children:[h.jsx("div",{className:ce.StatLabel,children:"타입오버 퀴즈수"}),h.jsx("div",{className:ce.StatValue,children:r?`${r.timedOut}`:"-"}),h.jsx("div",{className:ce.StatSub,children:"timeout"})]})]}),h.jsx("div",{className:ce.ResultActions,children:h.jsx("button",{type:"button",onClick:o,className:ce.CloseBtnSoft,children:"닫기"})})]})}function gd(e){return e.map((t,n)=>n)}function md(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 Dn(e){var t;return(((t=e.answers)==null?void 0:t.length)??0)>1}function $n(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 _o(e){if(!e)return{};const t=(e.quiz??[]).slice().sort((n,r)=>n.index-r.index);return{sectionId:e.section_id,quizzes:t,order:gd(t),currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}}}function bd(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=_o(e);return bt()((o,s)=>({...t,...n,hydrateFromSection:i=>{if(!i)return;const a=_o(i);o(a)},openFromSection:i=>{i&&s().hydrateFromSection(i);const a=s();if(!a.quizzes.length)return;const l=a.quizzes[0];o({phase:"doing",startedAt:Date.now(),finishedAt:void 0,questionStartedAt:Date.now(),remainingSec:l.limit_sec||void 0,currentIndex:0,uiReveal:!1})},close:()=>{o({phase:"idle",sectionId:void 0,quizzes:[],order:[],currentIndex:0,answers:{},correctCount:0,startedAt:void 0,finishedAt:void 0,questionStartedAt:void 0,remainingSec:void 0,uiReveal:!1,perQ:{}})},selectToggle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid,d=a.answers[c]??[],m=d.includes(i)?d.filter(p=>p!==i):[...d,i].sort((p,b)=>p-b);o({answers:{...a.answers,[c]:m}})},selectSingle:i=>{const a=s();if(a.phase!=="doing"||a.uiReveal)return;const c=a.quizzes[a.order[a.currentIndex]].qid;o({answers:{...a.answers,[c]:[i]}})},submitCurrent:()=>{const i=s();if(i.phase!=="doing")return;const a=i.order[i.currentIndex],l=i.quizzes[a],c=l.qid,d=(i.answers[c]??[]).slice().sort((g,f)=>g-f),m=$n(l),p=md(d,m),b=i.questionStartedAt?Date.now()-i.questionStartedAt:0,S=i.perQ[c],v={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Dn(l),selected:d,correctIdxes:m,isCorrect:p,ms:b,revealed:(S==null?void 0:S.revealed)??!1,timedOut:(S==null?void 0:S.timedOut)??!1};if(o({correctCount:i.correctCount+(p?1:0),perQ:{...i.perQ,[c]:v}}),i.currentIndex+1>=i.order.length)o({uiReveal:!1,remainingSec:void 0}),s().finish();else{const g=i.currentIndex+1;o({currentIndex:g,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[g]].limit_sec||void 0,uiReveal:!1})}},setReveal:i=>{const a=s();if(a.phase==="doing"){if(i){const l=a.quizzes[a.order[a.currentIndex]],c=l.qid,d=a.perQ[c],m={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Dn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??$n(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:(d==null?void 0:d.timedOut)??!1};o({perQ:{...a.perQ,[c]:m}})}o({uiReveal:i})}},afterRevealNext:()=>{s().phase==="doing"&&s().submitCurrent()},next:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex+1>=i.order.length)return;const a=i.currentIndex+1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},prev:()=>{const i=s();if(i.phase!=="doing"||i.currentIndex<=0)return;const a=i.currentIndex-1;o({currentIndex:a,questionStartedAt:Date.now(),remainingSec:i.quizzes[i.order[a]].limit_sec||void 0,uiReveal:!1})},finish:()=>{o({phase:"finished",remainingSec:void 0,uiReveal:!1,finishedAt:Date.now()})},tick:()=>{const i=s();if(i.phase!=="doing"||i.remainingSec==null)return;const a=i.remainingSec-1;if(a<=0){const l=i.quizzes[i.order[i.currentIndex]],c=l.qid,d=i.perQ[c],m={qid:c,index:l.index,question:l.question,score:l.score??0,multi:Dn(l),selected:(d==null?void 0:d.selected)??[],correctIdxes:(d==null?void 0:d.correctIdxes)??$n(l),isCorrect:(d==null?void 0:d.isCorrect)??!1,ms:(d==null?void 0:d.ms)??0,revealed:!0,timedOut:!0};o({remainingSec:0,uiReveal:!0,perQ:{...i.perQ,[c]:m}})}else o({remainingSec:a})}}))}function xd({children:e,initialState:t}){const n=u.useMemo(()=>bd(t.section),[t]);return h.jsx(br.Provider,{value:n,children:e})}function vd({containerRef:e}){const t=Et(),n=_t();return u.useEffect(()=>{const r=e.current;if(!r)return;let o=r.clientWidth,s=r.clientHeight;n.getState().setViewportSize(o,s);const i=new ResizeObserver(()=>{const a=r.clientWidth,l=r.clientHeight;(a!==o||l!==s)&&(o=a,s=l,n.getState().setViewportSize(a,l),t.getState().emit({type:"viewport_resize",payload:{width:a,height:l}}))});return i.observe(r),()=>{i.disconnect()}},[t,n,e]),null}const Sd=e=>e;function yd(e,t=Sd){const n=u.useSyncExternalStore(e.subscribe,u.useCallback(()=>t(e.getState()),[e,t]),u.useCallback(()=>t(e.getInitialState()),[e,t]));return u.useDebugValue(n),n}const Ro=e=>{const t=bt(e),n=r=>yd(t,r);return Object.assign(n,t),n},wd=(e=>e?Ro(e):Ro),Mo=wd(e=>({_snapshotGetter:null,registerSnapshotGetter:t=>{e({_snapshotGetter:t})},unregisterSnapshotGetter:()=>{e({_snapshotGetter:null})}}));function Cd({containerRef:e}){const t=_t(),n=mt(),r=Et();return u.useEffect(()=>{if(!!!r.getState().emitCallback)return;const s=()=>{var g,f,y,R,k;const i=t.getState(),{progress:a}=n.getState(),l=(g=e.current)==null?void 0:g.getBoundingClientRect(),c=(l==null?void 0:l.width)??0,d=(l==null?void 0:l.height)??0,m=(f=a.getSectionScrollApi)==null?void 0:f.call(a),p=((y=m==null?void 0:m.getScrollTop)==null?void 0:y.call(m))??0,b=(R=m==null?void 0:m.getVisibleRange)==null?void 0:R.call(m),S=(b==null?void 0:b.first)??a.currentGlobalRunIndex,v=((k=m==null?void 0:m.getAnchorOffsetRatio)==null?void 0:k.call(m,S))??0;return{viewerState:{mode:i.mode,theme:i.theme,fontFamily:i.fontFamily,fontSizePx:i.fontSizePx,lineHeight:i.lineHeight,marginX:i.marginX,marginY:i.marginY,pointerStyle:i.pointerStyle,pointerColor:i.pointerColor,breakMarks:i.breakMarks,breakGapPx:i.breakGapPx,muteAudio:i.muteAudio,audioSpeed:i.audioSpeed,audioTargetWpm:i.audioTargetWpm,showPointer:i.showPointer,showSplit:i.showSplit,showOverlays:i.showOverlays,isSettingsOpen:i.isSettingsOpen,viewportWidth:i.viewportWidth,viewportHeight:i.viewportHeight,playbackViewportWidth:i.playbackViewportWidth,playbackViewportHeight:i.playbackViewportHeight},globalIndex:a.currentGlobalRunIndex,scrollY:p,anchorGI:S,anchorOffsetRatio:v,sectionId:a.sectionId,viewportWidth:c,viewportHeight:d}};return Mo.getState().registerSnapshotGetter(s),()=>{Mo.getState().unregisterSnapshotGetter()}},[r,t,n,e]),null}function Id(){const e=Et(),t=_t(),n=mt(),r=u.useContext(fn),o=u.useCallback(l=>{const{viewerState:c}=l;if(c){c.mode&&t.getState().setMode(c.mode);const{mode:m,...p}=c;t.setState(p)}if(typeof l.globalIndex=="number"&&n.getState().progress.setCurrentGlobalRunIndex(l.globalIndex,"playback"),(c==null?void 0:c.mode)==="scroll"||!(c!=null&&c.mode)){const m=n.getState().progress.getSectionScrollApi();if(m){if(l.scrollY===0)m.setScrollTop(0);else if(m.scrollToGIAtOffset){const p=l.anchorGI??l.globalIndex;if(typeof p=="number"){const b=l.anchorOffsetRatio??0;m.scrollToGIAtOffset(p,b)}}}}},[t,n]),s=u.useCallback(l=>{switch(l.type){case"global_index_change":{const{globalIndex:c}=l.payload;n.getState().progress.setCurrentGlobalRunIndex(c,"playback");break}case"scroll":{if(t.getState().mode==="page")break;const{scrollTop:d,anchorGI:m,anchorOffsetRatio:p}=l.payload,b=n.getState().progress.getSectionScrollApi();b&&(d===0?b.setScrollTop(0):b.scrollToGIAtOffset&&typeof m=="number"&&b.scrollToGIAtOffset(m,p));break}case"settings_change":{const{key:c,value:d}=l.payload,m=t.getState();c in m&&typeof m[c]!="function"&&t.setState({[c]:d});break}case"mode_change":{const{mode:c}=l.payload;t.getState().setMode(c);break}case"audio_control":{if(!r)break;const{action:c}=l.payload;switch(c){case"play":r.getState()._setStatusOnly("playing");break;case"pause":r.getState()._setStatusOnly("paused");break;case"stop":r.getState()._setStatusOnly("idle");break}break}case"render_start":case"loading_start":case"loading_end":case"viewport_resize":break;default:console.log("[PlaybackHandler] 미처리 이벤트:",l.type)}},[n,t,r]),i=u.useCallback(()=>{e.getState().setDispatchHandler(s),e.getState().setApplySnapshotHandler(o)},[e,s,o]),a=u.useCallback(()=>{e.getState().setDispatchHandler(null),e.getState().setApplySnapshotHandler(null)},[e]);return u.useEffect(()=>{if(e.getState().isPlaybackMode)return i(),()=>a()},[e,i,a]),u.useEffect(()=>e.subscribe((c,d)=>{c.isPlaybackMode&&!d.isPlaybackMode?i():!c.isPlaybackMode&&d.isPlaybackMode&&a()}),[e,i,a]),null}const Eo=["mode","theme","fontFamily","fontSizePx","lineHeight","marginX","marginY","pointerStyle","pointerColor","breakMarks","breakGapPx","muteAudio","audioSpeed","audioTargetWpm","showPointer","showSplit","showOverlays","isSettingsOpen"];function kd(){const e=Et(),t=_t(),n=u.useRef(null);return u.useEffect(()=>{const r=t.getState();n.current={};for(const s of Eo)n.current[s]=r[s];const o=t.subscribe(s=>{const i=n.current;if(i)for(const a of Eo){const l=i[a],c=s[a];l!==c&&(a==="mode"?e.getState().emit({type:"mode_change",payload:{mode:c}}):e.getState().emit({type:"settings_change",payload:{key:a,value:c}}),i[a]=c)}});return()=>{o(),n.current=null}},[e,t]),null}const Td=(e,t,n)=>Math.min(n,Math.max(t,e));function Rs({section:e,initialViewerState:t,initialProgressRunIndex:n,sectionList:r=[],onSectionChange:o,onViewerEvent:s,isPlaybackMode:i=!1,playbackScale:a,viewerRef:l}){const c=String((e==null?void 0:e.section_id)??"0"),d=u.useMemo(()=>{var g,f;const S=((g=e==null?void 0:e.ast)==null?void 0:g.blocks)??[];let v=0;for(const y of S)(y==null?void 0:y.type)!=="image"&&(v+=((f=y==null?void 0:y.runs)==null?void 0:f.length)??0);return v},[e]),m=u.useMemo(()=>typeof n=="number"?Td(n,d>0?0:-1,Math.max(d-1,-1)):(d>0,0),[n,d]),p=u.useMemo(()=>({section:e,initialIndex:m,sectionList:r,onSectionChange:o}),[e,m]),b=u.useMemo(()=>{const S=(e==null?void 0:e.audios)??[],v=S.length>0?eu(e):void 0;return{clips:S,map:v,initialIndex:m,section:e}},[e,m]);return h.jsx(Ys,{onViewerEvent:s,isPlaybackMode:i,playbackScale:a,viewerRef:l,children:h.jsx(iu,{initialState:t,children:h.jsx(su,{initialState:p,children:h.jsx(Jc,{initialState:b,children:h.jsx(xd,{initialState:{section:e},children:h.jsx(_d,{})},c)},c)},c)})})}function _d(){const e=Y(n=>n.mode),t=u.useRef(null);return h.jsxs("div",{ref:t,style:{position:"relative",display:"flex",flexDirection:"column",height:"100%",width:"100%"},children:[e==="scroll"?h.jsx(ba,{}):h.jsx(Eu,{}),h.jsx(qc,{}),h.jsx(fd,{}),h.jsx(zu,{}),h.jsx(Cd,{containerRef:t}),h.jsx(vd,{containerRef:t}),h.jsx(kd,{}),h.jsx(Id,{})]})}function Rd(e){return nt({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M5.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75A.75.75 0 0 0 7.25 3h-1.5ZM12.75 3a.75.75 0 0 0-.75.75v12.5c0 .414.336.75.75.75h1.5a.75.75 0 0 0 .75-.75V3.75a.75.75 0 0 0-.75-.75h-1.5Z"},child:[]}]})(e)}function Md(e){return nt({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{d:"M6.3 2.84A1.5 1.5 0 0 0 4 4.11v11.78a1.5 1.5 0 0 0 2.3 1.27l9.344-5.891a1.5 1.5 0 0 0 0-2.538L6.3 2.841Z"},child:[]}]})(e)}const Ed="_button_onals_1",jd={button:Ed};function Pd({playbackState:e,disabled:t,onClick:n}){return h.jsx("button",{onClick:n,disabled:t,className:jd.button,title:e==="playing"?"일시정지":e==="paused"?"재개":"재생",children:e==="playing"?h.jsx(Rd,{}):h.jsx(Md,{})})}const Od=u.memo(Pd),Bd="_container_18q02_1",zd="_topRow_18q02_11",Ad="_timeDisplay_18q02_17",Ld="_bottomRow_18q02_23",Gd="_sliderContainer_18q02_29",Hd="_trackBackground_18q02_35",Nd="_trackFill_18q02_47",Fd="_rangeInput_18q02_54",Wd="_viewportInfo_18q02_89",Qe={container:Bd,topRow:zd,timeDisplay:Ad,bottomRow:Ld,sliderContainer:Gd,trackBackground:Hd,trackFill:Nd,rangeInput:Fd,"rangeInput--disabled":"_rangeInput--disabled_18q02_66",viewportInfo:Wd};function Vd({playbackState:e,disabled:t,elapsedTime:n,totalDuration:r,viewport:o,onTogglePlay:s,onSeekStart:i,onSeekChange:a,onSeekEnd:l}){const c=m=>{a(parseFloat(m.target.value))},d=[Qe.rangeInput,t&&Qe["rangeInput--disabled"]].filter(Boolean).join(" ");return h.jsxs("div",{className:Qe.container,children:[h.jsxs("div",{className:Qe.topRow,children:[h.jsx(Od,{playbackState:e,disabled:t,onClick:s}),h.jsxs("span",{className:Qe.viewportInfo,children:["해상도: ",o.width.toFixed(0)," × ",o.height.toFixed(0)]}),h.jsxs("span",{className:Qe.timeDisplay,children:[n.toFixed(1),"s / ",r.toFixed(1),"s"]})]}),h.jsx("div",{className:Qe.bottomRow,children:h.jsxs("div",{className:Qe.sliderContainer,children:[h.jsx("div",{className:Qe.trackBackground,children:h.jsx("div",{className:Qe.trackFill,style:{width:`${n/r*100}%`}})}),h.jsx("input",{type:"range",min:0,max:r,step:.01,value:n,onMouseDown:i,onTouchStart:i,onChange:c,onMouseUp:l,onTouchEnd:l,disabled:t,className:d})]})})]})}const Ms=u.memo(Vd),Dd="_outerContainer_77t1u_1",$d="_scaleWrapper_77t1u_11",qd="_viewerContainer_77t1u_15",Ud="_eventBlocker_77t1u_22",Kd="_emptyMessage_77t1u_29",Yd="_bufferingOverlay_77t1u_34",Xd="_spinner_77t1u_44",lt={outerContainer:Dd,scaleWrapper:$d,viewerContainer:qd,eventBlocker:Ud,emptyMessage:Kd,bufferingOverlay:Yd,spinner:Xd},Qd=u.memo(Rs),jo=24;function Zd({isBuffering:e,isEmpty:t,currentViewport:n,initialSnapshot:r,section:o,sectionSummaries:s,onSectionChange:i,viewerRef:a,onContainerResize:l,onScaleChange:c}){const d=u.useRef(null),[m,p]=u.useState({width:0,height:0});u.useEffect(()=>{const g=d.current;if(!g)return;const f=()=>{const R={width:g.clientWidth,height:g.clientHeight};p(R),l==null||l(R)};f();const y=new ResizeObserver(f);return y.observe(g),()=>y.disconnect()},[l]);const b=u.useMemo(()=>n.width>0&&n.height>0?n:{width:r.viewportWidth||400,height:r.viewportHeight||600},[n,r]),S=u.useMemo(()=>{if(m.width===0||m.height===0)return 1;const g=(m.width-jo*2)/b.width,f=(m.height-jo*2)/b.height;return Math.min(g,f,1)},[m,b]);u.useEffect(()=>{c==null||c(S)},[S,c]);const v=m.width>0&&m.height>0;return h.jsxs("div",{ref:d,className:lt.outerContainer,children:[!t&&v?h.jsx("div",{className:lt.scaleWrapper,style:{transform:`scale(${S})`},children:h.jsxs("div",{className:lt.viewerContainer,style:{width:b.width,height:b.height},children:[h.jsx(Qd,{section:o,initialProgressRunIndex:r.globalIndex,initialViewerState:{...r.viewerState,playbackViewportWidth:b.width,playbackViewportHeight:b.height},sectionList:s,onSectionChange:i,isPlaybackMode:!0,playbackScale:S,viewerRef:a}),h.jsx("canvas",{className:lt.eventBlocker,style:{width:b.width,height:b.height}})]})}):t?h.jsx("div",{className:lt.emptyMessage,children:"녹화된 데이터가 없습니다."}):h.jsx("div",{className:lt.emptyMessage,children:"로딩 중..."}),e&&h.jsx("div",{className:lt.bufferingOverlay,children:h.jsx("div",{className:lt.spinner})})]})}const Es=u.memo(Zd),pn=u.createContext(void 0);function at(e,t){const n=u.useContext(pn);if(!n)throw new Error("useViewerPlayerStore must be used inside <ViewerPlayerProvider>");return Wt(n,e,t)}function js(){const e=u.useContext(pn);if(!e)throw new Error("useViewerPlayerStoreApi must be used inside <ViewerPlayerProvider>");return e}const Po={width:0,height:0};function Ps(){return bt((e,t)=>({meta:null,playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:Po,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0,setMeta:n=>e({meta:n}),setPlaybackState:n=>e({playbackState:n}),setIsBuffering:n=>e({isBuffering:n}),setElapsedTime:n=>e({elapsedTime:n}),setCurrentViewport:n=>e({currentViewport:n}),setViewportScale:n=>e({viewportScale:n}),setCurrentSection:n=>e({currentSection:n}),addLoadedChunk:n=>{const{loadedChunks:r}=t(),o=new Set(r);o.add(n),e({loadedChunks:o})},removeLoadedChunks:n=>{const{loadedChunks:r}=t(),o=new Set(r);for(const s of n)o.delete(s);e({loadedChunks:o})},setLoadedChunks:n=>e({loadedChunks:n}),setCurrentChunkIndex:n=>e({currentChunkIndex:n}),reset:n=>{e({playbackState:"idle",isBuffering:!1,elapsedTime:0,currentViewport:n??Po,viewportScale:1,currentSection:null,loadedChunks:new Set,currentChunkIndex:0})}}))}function Os({children:e,meta:t,initialSection:n,initialViewport:r}){const o=u.useMemo(()=>Ps(),[]);return u.useLayoutEffect(()=>{o.getState().setMeta(t??null)},[t,o]),u.useLayoutEffect(()=>{n&&o.getState().setCurrentSection(n)},[n,o]),u.useLayoutEffect(()=>{r&&o.getState().setCurrentViewport(r)},[r,o]),h.jsx(pn.Provider,{value:o,children:e})}const Jd="_container_1dh6p_1",e0={container:Jd},t0=100;function n0(e){const{meta:t,initialSection:n}=e,r={width:t.initialSnapshot.viewportWidth,height:t.initialSnapshot.viewportHeight};return h.jsx(Os,{meta:t,initialSection:n,initialViewport:r,children:h.jsx(r0,{...e})})}function r0({meta:e,getChunk:t,availableChunks:n,initialStartTime:r=0,initialSection:o,sectionsMap:s,sectionSummaries:i=[],onSectionChange:a,onChunksEvicted:l}){const{totalDuration:c,chunkCount:d,chunkDuration:m,initialSnapshot:p}=e,b=js(),S=at(M=>M.playbackState),v=at(M=>M.isBuffering),g=at(M=>M.elapsedTime),f=at(M=>M.currentViewport);at(M=>M.viewportScale);const y=at(M=>M.currentSection);at(M=>M.loadedChunks);const R=u.useMemo(()=>d===0?0:Math.min(Math.floor(r/m),d-1),[r,m,d]),k=u.useRef(0),T=u.useRef(0),_=u.useRef(0),w=u.useRef(null),x=u.useRef(0),E=u.useRef(0),B=u.useRef(0),C=u.useRef(!1),O=u.useRef(null),I=u.useRef(new Map),P=u.useRef(new Set),j=u.useRef(null);u.useMemo(()=>{if(d===0)return 0;const M=Math.floor(g/m);return Math.min(M,d-1)},[g,m,d]);const z=`${c}-${d}-${p.globalIndex}`,A=u.useRef(z);u.useEffect(()=>{z!==A.current&&(A.current=z,w.current&&(cancelAnimationFrame(w.current),w.current=null),b.getState().reset({width:p.viewportWidth,height:p.viewportHeight}),b.getState().setCurrentSection(o),k.current=0,T.current=0,O.current=null,I.current.clear(),P.current.clear(),_.current=0,x.current=0,E.current=0,B.current=0,C.current=!1)},[z,p,o,b]);const D=u.useCallback(M=>{var V;const N=b.getState(),L=N.currentSection;if(M.type==="viewport_resize"){const{width:q,height:W}=M.payload;N.setCurrentViewport({width:q,height:W})}else if(M.type==="section_change"||M.type==="render_start"){const{sectionId:q}=M.payload,W=s.get(q);W&&L&&W.section_id!==L.section_id&&(console.log(`[CR_ViewerPlayback] 섹션 변경 (${M.type}): ${q}`),N.setCurrentSection(W),a==null||a(q))}(V=j.current)==null||V.dispatch(M)},[s,a,b]),Q=u.useCallback(async M=>{if(M<0||M>=d)return null;const N=I.current.get(M);if(N)return N;if(P.current.has(M)){for(;P.current.has(M);)await new Promise(L=>setTimeout(L,10));return I.current.get(M)??null}P.current.add(M);try{const L=await t(M);I.current.set(M,L);const V=[];for(const W of I.current.keys())(W<M-1||W>M+2)&&(I.current.delete(W),V.push(W));const q=b.getState();return q.addLoadedChunk(M),V.length>0&&(q.removeLoadedChunks(V),l==null||l(V)),L}catch(L){return console.error(`[PlaybackContainer] 청크 ${M} 로드 실패:`,L),null}finally{P.current.delete(M)}},[d,t,l,b]),ae=u.useCallback(M=>{const N=M+1;N<d&&!I.current.has(N)&&Q(N)},[d,Q]),de=u.useRef(!0);u.useEffect(()=>{if(!de.current||d===0)return;de.current=!1;const M=b.getState();k.current=r,x.current=r,E.current=R,M.setElapsedTime(r);let N=!1;return(async()=>{const V=R+1,q=[Q(R)];V<d&&q.push(Q(V));const[W]=await Promise.all(q);N||!W||(O.current=W,M.setCurrentViewport({width:W.snapshot.viewportWidth,height:W.snapshot.viewportHeight}),setTimeout(()=>{var ee;if(N)return;const le=s.get(W.snapshot.sectionId);le&&M.setCurrentSection(le),(ee=j.current)==null||ee.applySnapshot(W.snapshot);let X=0;for(let oe=0;oe<W.events.length;oe++){const se=W.events[oe];if(se.relTime<=r)D(se),X=oe+1;else break}B.current=X},50))})(),()=>{N=!0}},[d,Q,R,r,s,D,b]);const $=u.useCallback(async M=>{const N=b.getState(),L=Math.min(Math.floor(M/m),d-1),V=L+1,q=[Q(L)];V<d&&q.push(Q(V));const[W]=await Promise.all(q);W&&(O.current=W,N.setCurrentViewport({width:W.snapshot.viewportWidth,height:W.snapshot.viewportHeight}),setTimeout(()=>{var ee;const le=s.get(W.snapshot.sectionId);le&&N.setCurrentSection(le),(ee=j.current)==null||ee.applySnapshot(W.snapshot);let X=0;for(let oe=0;oe<W.events.length;oe++){const se=W.events[oe];if(se.relTime<=M)D(se),X=oe+1;else break}E.current=L,B.current=X},0))},[m,d,Q,s,D,b]),pe=u.useCallback(async M=>{const N=b.getState(),L=Math.max(0,Math.min(M,c));N.setIsBuffering(!0),w.current&&(cancelAnimationFrame(w.current),w.current=null),k.current=L,N.setElapsedTime(L),x.current=L,await $(L),N.setIsBuffering(!1)},[c,$,b]),ge=u.useCallback(()=>{const M=b.getState(),N=performance.now(),L=(N-_.current)/1e3;k.current=L,N-T.current>=t0&&(T.current=N,M.setElapsedTime(L));const V=O.current;if(!V){M.setIsBuffering(!0);const X=E.current;Q(X).then(ee=>{ee?(O.current=ee,b.getState().setIsBuffering(!1),w.current=requestAnimationFrame(ge)):(b.getState().setIsBuffering(!1),b.getState().setPlaybackState("paused"))});return}const q=E.current,W=V.events;let le=B.current;for(;le<W.length;){const X=W[le];if(X.relTime<=L)D(X),le++;else break}if(B.current=le,L>=V.endTime)if(q<d-1){const X=q+1;E.current=X,B.current=0;const ee=I.current.get(X);ee?(O.current=ee,M.setCurrentViewport({width:ee.snapshot.viewportWidth,height:ee.snapshot.viewportHeight}),ae(X),w.current=requestAnimationFrame(ge)):(M.setIsBuffering(!0),Q(X).then(oe=>{oe?(O.current=oe,b.getState().setCurrentViewport({width:oe.snapshot.viewportWidth,height:oe.snapshot.viewportHeight}),b.getState().setIsBuffering(!1),ae(X),w.current=requestAnimationFrame(ge)):(b.getState().setIsBuffering(!1),b.getState().setPlaybackState("paused"))}));return}else{M.setPlaybackState("paused"),M.setElapsedTime(c),x.current=c;return}w.current=requestAnimationFrame(ge)},[d,c,Q,ae,D,b]),Ce=u.useCallback(async()=>{var L;if(d===0)return;const M=b.getState(),N=M.playbackState;if(N==="playing")w.current&&(cancelAnimationFrame(w.current),w.current=null),x.current=k.current,M.setElapsedTime(k.current),M.setPlaybackState("paused");else{const V=()=>{b.getState().setPlaybackState("playing"),w.current=requestAnimationFrame(ge)};if(N==="paused")if(k.current>=c-.01){_.current=performance.now(),E.current=0,B.current=0,k.current=0,M.setElapsedTime(0),x.current=0,M.setCurrentViewport({width:p.viewportWidth,height:p.viewportHeight}),M.setIsBuffering(!0);const q=await Q(0);b.getState().setIsBuffering(!1),q&&(O.current=q,(L=j.current)==null||L.applySnapshot(q.snapshot),ae(0),setTimeout(V,100))}else _.current=performance.now()-x.current*1e3,V();else _.current=performance.now()-k.current*1e3,ae(E.current),V()}},[d,c,p,ge,Q,ae,b]),U=u.useRef(null),he=u.useCallback(()=>{C.current=b.getState().playbackState==="playing",w.current&&(cancelAnimationFrame(w.current),w.current=null)},[b]),G=u.useCallback(M=>{const N=Math.max(0,Math.min(M,c));U.current=N,k.current=N,b.getState().setElapsedTime(N),x.current=N},[c,b]),Z=u.useCallback(async()=>{const M=U.current;U.current=null,M!==null&&await pe(M),C.current?setTimeout(()=>{_.current=performance.now()-x.current*1e3,w.current=requestAnimationFrame(ge)},100):b.getState().playbackState==="idle"&&b.getState().setPlaybackState("paused"),C.current=!1},[pe,ge,b]);return u.useEffect(()=>()=>{w.current&&cancelAnimationFrame(w.current)},[]),y?h.jsxs("div",{className:e0.container,children:[h.jsx(Ms,{playbackState:S,disabled:d===0,elapsedTime:g,totalDuration:c,viewport:{width:f.width,height:f.height},onTogglePlay:Ce,onSeekStart:he,onSeekChange:G,onSeekEnd:Z}),h.jsx(Es,{isBuffering:v,isEmpty:d===0,currentViewport:f,initialSnapshot:p,section:y,sectionSummaries:i,onSectionChange:a,viewerRef:j,onScaleChange:b.getState().setViewportScale})]}):null}exports.CRViewer=Rs;exports.CR_ViewerPlayback=n0;exports.PlaybackBar=Ms;exports.PlaybackViewport=Es;exports.ViewerPlayerContext=pn;exports.ViewerPlayerProvider=Os;exports.createViewerPlayerStore=Ps;exports.useViewerPlayerStore=at;exports.useViewerPlayerStoreApi=js;
|
package/dist/index.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@charset "UTF-8";._run_zzb61_3{cursor:pointer}._runWrap_zzb61_7{position:relative;isolation:isolate;z-index:0}._highlight_zzb61_13:before,._highlightleft_zzb61_14:before,._highlightright_zzb61_15:before,._highlightcenter_zzb61_16:before{content:"";position:absolute;z-index:-1;top:-4px;bottom:-4px;background:var(--hl-color, pink);pointer-events:none}._highlight_zzb61_13:before{left:-4px;right:-4px}._highlightleft_zzb61_14:before{left:-4px;right:0}._highlightright_zzb61_15:before{left:0;right:-4px}._highlightcenter_zzb61_16:before{left:0;right:0}._underline_zzb61_48:after,._underlineleft_zzb61_49:after,._underlineright_zzb61_50:after,._underlinecenter_zzb61_51:after{content:"";position:absolute;left:0;right:0;height:var(--ul-thickness, .2em);bottom:calc(-1 * var(--ul-offset, .35em));background:var(--ul-color, red);pointer-events:none}._underline_zzb61_48:after{left:-4px;right:-4px}._underlineleft_zzb61_49:after{left:-4px;right:0}._underlineright_zzb61_50:after{left:0;right:0}._underlinecenter_zzb61_51:after{left:0;right:0}._scroller_kqkmq_3{height:100%;overflow-y:auto;overflow-x:hidden;outline:none;scrollbar-width:none;-ms-overflow-style:none}._scroller_kqkmq_3::-webkit-scrollbar{width:0;height:0;background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-track{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-thumb{background:transparent;pointer-events:none}._scroller_kqkmq_3::-webkit-scrollbar-button,._scroller_kqkmq_3::-webkit-scrollbar-corner{display:none;pointer-events:none}@media(forced-colors:active){._scroller_kqkmq_3{scrollbar-width:auto}}._navBtn_rnisf_2{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:52px;height:52px;border:none;border-radius:12px;background:none;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._navBtn_rnisf_2:hover:not(:disabled){background:#0000000f}._navBtn_rnisf_2:active:not(:disabled){background:#0000001a}._navBtn_rnisf_2:disabled,._navBtn_rnisf_2._disabled_rnisf_25{opacity:.4;cursor:not-allowed;transform:none}._label_rnisf_31{margin-top:4px;font-size:.6rem;font-weight:500;width:52px}._navGroup_rnisf_39{display:flex;gap:8px}._wrap_1pn6r_2{position:absolute;left:0;right:0;bottom:0;height:auto;display:flex;flex-direction:column;justify-content:space-between;padding:12px 16px 20px;box-sizing:border-box;background:#fff;color:#333;transition:opacity .15s ease;opacity:0;pointer-events:none;border-top:1px solid #ddd}._visible_1pn6r_21{opacity:1;pointer-events:auto}._container_1pn6r_27{display:flex;align-items:center;gap:12px;flex-wrap:wrap;width:100%}._leftGroup_1pn6r_36,._rightGroup_1pn6r_37{display:flex;align-items:center;gap:5px}._leftGroup_1pn6r_36{flex:1 1 520px;min-width:200px;justify-content:flex-start}._leftGroup_1pn6r_36 ._leftleftGroup_1pn6r_51,._leftGroup_1pn6r_36 ._leftrightGroup_1pn6r_52{flex:1 1 0;display:flex;justify-content:center;min-width:160px}._rightGroup_1pn6r_37{flex:1 1 420px;min-width:220px;margin-left:auto;justify-content:center;align-items:center}._wrap_1pn6r_2>div:last-child{display:flex;align-items:center;justify-content:space-between;margin-top:8px}._btn_1pn6r_78{-webkit-appearance:none;-moz-appearance:none;appearance:none;display:flex;flex-direction:column;align-items:center;justify-content:center;width:52px;height:52px;border:none;border-radius:12px;background:#fff;color:#222;font-size:12px;font-weight:600;cursor:pointer;transition:all .15s ease}._btn_1pn6r_78:hover{opacity:.7}._btnForbidden_1pn6r_100{opacity:.4;cursor:not-allowed;background:#f2f2f2!important;border-color:#aaa}._btnActive_1pn6r_107{background:#333;color:#fff}._label_1pn6r_112{margin-top:4px;font-size:.6rem;font-weight:500;width:52px}._group_1pn6r_119{display:inline-flex;align-items:center;gap:6px;background:#ffffff0f;border-radius:6px;padding:4px 8px}._label_1pn6r_112{min-width:50px;text-align:center;font-variant-numeric:tabular-nums}._scrubberWrap_jtztl_2{display:grid;gap:8px;-webkit-user-select:none;user-select:none}._labels_jtztl_8{display:flex;justify-content:space-between;font-size:12px;color:var(--text-subtle, #666)}._labels_jtztl_8 ._index_jtztl_14{font-variant-numeric:tabular-nums}._controls_jtztl_18{display:grid;grid-template-columns:1fr 40px;align-items:center;gap:8px}._controls_jtztl_18 ._percent_jtztl_24{display:flex;justify-content:flex-end;font-size:.8rem;font-variant-numeric:tabular-nums}._stepBtn_jtztl_31{height:28px;border:1px solid var(--line, #ddd);background:var(--bg, #fff);border-radius:8px;font-size:16px;line-height:1;cursor:pointer}._stepBtn_jtztl_31:disabled{opacity:.5;cursor:not-allowed}._range_jtztl_45{width:100%;-webkit-appearance:none;-moz-appearance:none;appearance:none;height:6px;border-radius:999px;background:linear-gradient(to right,currentColor var(--pct, 50%),#e5e7eb 0);outline:none}._range_jtztl_45::-webkit-slider-thumb{-webkit-appearance:none;width:16px;height:16px;border-radius:999px;background:currentColor;cursor:pointer}._range_jtztl_45::-moz-range-thumb{width:16px;height:16px;border-radius:999px;background:currentColor;border:none;cursor:pointer}._WPMSpeedButtonsWrap_pxoh4_1{float:right;display:flex;flex-direction:column;box-sizing:border-box}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8{box-sizing:border-box;padding:10px;display:flex;gap:7px}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._label_pxoh4_14{font-size:.8rem;display:flex;flex-direction:column;justify-content:center;align-items:center}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._label_pxoh4_14 ._wpmString_pxoh4_21{font-size:.7rem}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24:hover{background:#eee}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24{padding:3px;border-radius:5px;border:1px solid #888;background:none;width:50px;height:50px}._WPMSpeedButtonsWrap_pxoh4_1 ._btnWrap_pxoh4_8 ._iconBtn_pxoh4_24 img{width:100%}._StepBtn_ua1nh_1{background:none;border:none;font-size:2rem;display:flex;justify-content:center;align-items:center;color:#000}._StepBtn_ua1nh_1:hover{color:#666;filter:brightness(.9);cursor:pointer}._GCPlayBtn_1p162_1{width:var(--btn-size);height:var(--btn-size);border:none;outline:none;position:relative;background-color:var(--btn-bg);transition:background-color .25s ease,transform .1s ease,filter .1s}._GCPlayBtn_1p162_1:hover{opacity:.7;cursor:pointer}._GCPlayBtn_1p162_1:focus{outline:none}._GCPlayBtn_1p162_1:before{content:"";position:absolute;top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .34);height:0;border-style:solid;border-width:calc(var(--btn-size) * .2) 0 calc(var(--btn-size) * .2) calc(var(--btn-size) * .4);border-color:transparent transparent transparent var(--icon-color);transition:.2s ease}._GCPlayBtn_1p162_1._playing_1p162_28:before{top:calc(var(--btn-size) * .3);left:calc(var(--btn-size) * .32);width:calc(var(--btn-size) * .12);height:calc(var(--btn-size) * .4);border:none;background-color:var(--icon-color);box-shadow:calc(var(--btn-size) * .18) 0 0 0 var(--icon-color)}._topbar_143fz_2{position:absolute;left:0;right:0;top:0;height:48px;display:flex;align-items:center;gap:8px;padding:0 12px;background:#fff;color:#333;-webkit-backdrop-filter:saturate(120%) blur(6px);backdrop-filter:saturate(120%) blur(6px);transition:opacity .15s ease;opacity:0;pointer-events:none;border-bottom:1px solid #333;box-sizing:border-box}._visible_143fz_23{opacity:1;pointer-events:auto}._title_143fz_28{font-size:14px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1}._host_143fz_38{position:absolute;left:0;right:0;top:0;z-index:30}._dropdownLayer_143fz_46{position:absolute;left:0;right:0;top:48px;z-index:40;pointer-events:auto}._selectorWrap_143fz_56{margin:0 auto;width:100%;max-height:min(50vh,420px);overflow:hidden;background:#fff;border:1px solid #e6e6e6;border-radius:0 0 12px 12px;box-shadow:0 8px 24px #00000014;animation:_dropdown-enter_143fz_1 .12s ease}@keyframes _dropdown-enter_143fz_1{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}._selectorInner_143fz_78{max-height:min(50vh,380px);overflow:auto;padding:6px}._selectorItem_143fz_84{width:100%;text-align:left;display:grid;grid-template-columns:56px 1fr auto;gap:8px;padding:10px 12px;border-radius:8px;border:1px solid transparent;background:transparent;cursor:pointer}._selectorItem_143fz_84:hover{background:#f7f7f9}._active_143fz_100{background:#eef3ff;border-color:#d7e3ff}._itemOrder_143fz_105{font-weight:600;color:#666}._itemTitle_143fz_110{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}._itemBadge_143fz_116{font-size:12px;color:#3b82f6}._selectorEmpty_143fz_121{padding:12px;color:#777;text-align:center}._selectorFooter_143fz_127{padding:8px 12px;border-top:1px solid #f0f0f0;font-size:12px;color:#666}._wrap_rui1o_2{position:absolute;left:0;right:0;bottom:0;max-height:60%;pointer-events:auto;transition:transform .22s ease;background:#fff;color:#111;border-top:1px solid rgba(0,0,0,.08);box-shadow:0 -6px 24px #0000001f;padding:40px 0;box-sizing:border-box;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:10px;overflow:hidden}._wrapHidden_rui1o_24{transform:translateY(100%)}._wrapVisible_rui1o_28{transform:translateY(0)}._scrollArea_rui1o_32{flex:1;overflow:auto;display:flex;flex-direction:column;max-width:600px;min-width:260px;padding-left:20px;padding-right:20px;gap:10px;box-sizing:border-box}._row_rui1o_45{display:flex;align-items:center;gap:20px;min-height:45px}._label_rui1o_52{width:78px;flex:0 0 78px;font-weight:700}._btn_rui1o_58{-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_rui1o_69{background:#00000014}._btnSmall_rui1o_73{-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_rui1o_85{-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_rui1o_96{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_rui1o_109{border:2px solid #007aff;box-shadow:0 0 0 2px #007aff40}._row_rui1o_45{flex-wrap:wrap}._stepRow_rui1o_118{display:flex;align-items:center;gap:8px;min-height:40px;flex-wrap:wrap}._stepLabel_rui1o_126{width:78px;flex:0 0 78px}._stepValue_rui1o_131{margin-left:auto;width:72px;text-align:right;font-variant-numeric:tabular-nums}._levelBox_rui1o_138{width:28px;text-align:center}._inlineFlex_rui1o_143{display:flex;align-items:center;gap:6px;flex-wrap:wrap}._wrapper_excbn_1{display:grid;place-items:center;position:absolute;top:0;right:0;bottom:0;left:0;z-index:10000;background:#fff}._spinner_excbn_10{border-radius:50%;border:3px solid #e5e7eb;border-top-color:#3b82f6;animation:_spin_excbn_10 linear infinite}@keyframes _spin_excbn_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}._button_onals_1{display:flex;align-items:center;justify-content:center;width:32px;height:32px;border-radius:50%;border:1px solid #d1d5db;background:#fff;color:#000;cursor:pointer;transition:background .15s ease}._button_onals_1:hover:not(:disabled){background:#f3f4f6}._button_onals_1:disabled{opacity:.5;cursor:not-allowed}._button_onals_1 svg{width:16px;height:16px}._container_18q02_1{padding:8px 12px;border-bottom:1px solid #e5e7eb;display:flex;flex-direction:column;gap:8px;background:#f9fafb;flex-shrink:0}._topRow_18q02_11{display:flex;align-items:center;gap:8px}._timeDisplay_18q02_17{margin-left:auto;font-size:12px;color:#6b7280}._bottomRow_18q02_23{display:flex;align-items:center;gap:8px}._sliderContainer_18q02_29{flex:1;position:relative;height:20px}._trackBackground_18q02_35{position:absolute;top:50%;left:0;right:0;height:4px;transform:translateY(-50%);background:#d1d5db;border-radius:2px;overflow:hidden}._trackFill_18q02_47{position:absolute;left:0;height:100%;background:#ef4444}._rangeInput_18q02_54{position:absolute;top:0;left:0;width:100%;height:100%;margin:0;cursor:pointer;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}._rangeInput--disabled_18q02_66{cursor:not-allowed}._rangeInput_18q02_54::-webkit-slider-thumb{-webkit-appearance:none;width:14px;height:14px;background:#ef4444;border-radius:50%;cursor:pointer;border:2px solid #fff;box-shadow:0 1px 3px #0000004d}._rangeInput_18q02_54::-moz-range-thumb{width:14px;height:14px;background:#ef4444;border-radius:50%;cursor:pointer;border:2px solid #fff;box-shadow:0 1px 3px #0000004d}._viewportInfo_18q02_89{font-size:11px;color:#9ca3af}._outerContainer_77t1u_1{flex:1;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#1f2937;position:relative}._scaleWrapper_77t1u_11{transform-origin:center center}._viewerContainer_77t1u_15{box-shadow:0 4px 24px #0000004d;border-radius:4px;overflow:hidden;position:relative}._eventBlocker_77t1u_22{position:absolute;top:0;left:0;background:transparent}._emptyMessage_77t1u_29{padding:20px;color:#9ca3af}._bufferingOverlay_77t1u_34{position:absolute;top:0;right:0;bottom:0;left:0;display:flex;align-items:center;justify-content:center;background:#00000080;z-index:10}._spinner_77t1u_44{width:48px;height:48px;border:4px solid rgba(255,255,255,.3);border-top-color:#fff;border-radius:50%;animation:_spin_77t1u_44 1s linear infinite}@keyframes _spin_77t1u_44{to{transform:rotate(360deg)}}._container_1dh6p_1{width:100%;height:100%;position:relative;display:flex;flex-direction:column}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as CRViewer } from './CR_Viewer';
|
|
2
|
+
export { default as CR_ViewerPlayback } from './playback/CR_ViewerPlayback';
|
|
3
|
+
export { default as PlaybackBar } from './playback/PlaybackBar';
|
|
4
|
+
export { default as PlaybackViewport } from './playback/PlaybackViewport';
|
|
5
|
+
export type { PlaybackMeta, PlaybackState, ViewportSize } from './playback/types';
|
|
6
|
+
export { ViewerPlayerContext, useViewerPlayerStore, useViewerPlayerStoreApi, ViewerPlayerProvider, createViewerPlayerStore, } from './stores/player';
|
|
7
|
+
export type { ViewerPlayerState, ViewerPlayerActions, ViewerPlayerStore, } from './stores/player/viewerPlayer.store';
|
|
8
|
+
export * from './types/viewerEvent.types';
|
|
9
|
+
export type { SectionData, SectionId, Block, ParagraphBlock, ImageBlock, InlineRun, SectionAudio, SectionImage, SectionQuiz, SectionAST, SectionSummary, } from '@readerseye2/cr_type';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|