@jimka/typescript-ui 0.4.1 → 0.5.0
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/lib/{AbstractBooleanInput-DE5NNJT0.js → AbstractBooleanInput-CbW7ZrDT.js} +2 -2
- package/dist/lib/{AbstractBooleanInput-DE5NNJT0.js.map → AbstractBooleanInput-CbW7ZrDT.js.map} +1 -1
- package/dist/lib/{AbstractInput-BxfrmD2W.js → AbstractInput-B10DfLOf.js} +2 -2
- package/dist/lib/{AbstractInput-BxfrmD2W.js.map → AbstractInput-B10DfLOf.js.map} +1 -1
- package/dist/lib/Anchor-BsblS5it.js +2 -0
- package/dist/lib/Anchor-BsblS5it.js.map +1 -0
- package/dist/lib/AnchorConstraints-Bfkt8019.js +2 -0
- package/dist/lib/AnchorConstraints-Bfkt8019.js.map +1 -0
- package/dist/lib/{AnimatedDropdown-QLNasu_Y.js → AnimatedDropdown-kL47HPGP.js} +2 -2
- package/dist/lib/{AnimatedDropdown-QLNasu_Y.js.map → AnimatedDropdown-kL47HPGP.js.map} +1 -1
- package/dist/lib/Border-CNS6aEXB.js +2 -0
- package/dist/lib/{Border-CKKUk5G9.js.map → Border-CNS6aEXB.js.map} +1 -1
- package/dist/lib/Button-T16zSZip.js +2 -0
- package/dist/lib/Button-T16zSZip.js.map +1 -0
- package/dist/lib/{Card-a4dzYrbX.js → Card-CD3jxshU.js} +2 -2
- package/dist/lib/{Card-a4dzYrbX.js.map → Card-CD3jxshU.js.map} +1 -1
- package/dist/lib/CodeEditor-BGlB232h.js +2 -0
- package/dist/lib/CodeEditor-BGlB232h.js.map +1 -0
- package/dist/lib/ComboBox-C9FYMuLv.js +2 -0
- package/dist/lib/ComboBox-C9FYMuLv.js.map +1 -0
- package/dist/lib/Component-w65rPK75.js +2 -0
- package/dist/lib/Component-w65rPK75.js.map +1 -0
- package/dist/lib/Container-C7RPLQEc.js +2 -0
- package/dist/lib/{Container-0bsG2Q8Z.js.map → Container-C7RPLQEc.js.map} +1 -1
- package/dist/lib/DOM-Ba8YRVel.js +2 -0
- package/dist/lib/{DOM-67StIm5G.js.map → DOM-Ba8YRVel.js.map} +1 -1
- package/dist/lib/DragManager-UvPHSoRm.js +2 -0
- package/dist/lib/{DragManager-DRor_-1x.js.map → DragManager-UvPHSoRm.js.map} +1 -1
- package/dist/lib/{FieldDecorator-Bpx8J8n9.js → FieldDecorator-HG65hEtk.js} +2 -2
- package/dist/lib/{FieldDecorator-Bpx8J8n9.js.map → FieldDecorator-HG65hEtk.js.map} +1 -1
- package/dist/lib/{Fit-CL1m1nIZ.js → Fit-Cg3dPyZg.js} +2 -2
- package/dist/lib/{Fit-CL1m1nIZ.js.map → Fit-Cg3dPyZg.js.map} +1 -1
- package/dist/lib/FloatingPanel-D5buuVrQ.js +2 -0
- package/dist/lib/FloatingPanel-D5buuVrQ.js.map +1 -0
- package/dist/lib/{Glyph-wN7bk7mg.js → Glyph-DeJF_zsR.js} +2 -2
- package/dist/lib/{Glyph-wN7bk7mg.js.map → Glyph-DeJF_zsR.js.map} +1 -1
- package/dist/lib/{Grid-DHHmaB-Y.js → Grid-BYBohJIA.js} +2 -2
- package/dist/lib/{Grid-DHHmaB-Y.js.map → Grid-BYBohJIA.js.map} +1 -1
- package/dist/lib/{GridConstraints-DVc1BmlP.js → GridConstraints-Bts284FI.js} +2 -2
- package/dist/lib/{GridConstraints-DVc1BmlP.js.map → GridConstraints-Bts284FI.js.map} +1 -1
- package/dist/lib/{Header-2hKwQo_u.js → Header-BIFJK9nR.js} +2 -2
- package/dist/lib/{Header-2hKwQo_u.js.map → Header-BIFJK9nR.js.map} +1 -1
- package/dist/lib/{IconText-DC7Xe34b.js → IconText-Dsb1xS-E.js} +2 -2
- package/dist/lib/{IconText-DC7Xe34b.js.map → IconText-Dsb1xS-E.js.map} +1 -1
- package/dist/lib/LanguageRegistry-CcVnbKuh.js +2 -0
- package/dist/lib/LanguageRegistry-CcVnbKuh.js.map +1 -0
- package/dist/lib/LayoutSerialization-ySzY1h2l.js +2 -0
- package/dist/lib/{LayoutSerialization-D5bBas4W.js.map → LayoutSerialization-ySzY1h2l.js.map} +1 -1
- package/dist/lib/LayoutSizes-DKDK1Cle.js +2 -0
- package/dist/lib/LayoutSizes-DKDK1Cle.js.map +1 -0
- package/dist/lib/List-BPd-IXZR.js +2 -0
- package/dist/lib/{List-CG4NvwuV.js.map → List-BPd-IXZR.js.map} +1 -1
- package/dist/lib/MemoryStore-BgP7-Uzn.js +2 -0
- package/dist/lib/{MemoryStore-DT6iWWco.js.map → MemoryStore-BgP7-Uzn.js.map} +1 -1
- package/dist/lib/Menu-C0roOCY7.js +2 -0
- package/dist/lib/Menu-C0roOCY7.js.map +1 -0
- package/dist/lib/{MenuButton-wy_0RskC.js → MenuButton-BR4KOFld.js} +2 -2
- package/dist/lib/{MenuButton-wy_0RskC.js.map → MenuButton-BR4KOFld.js.map} +1 -1
- package/dist/lib/Panel-CpNQTLNF.js +2 -0
- package/dist/lib/{Panel-Rd9zkNXx.js.map → Panel-CpNQTLNF.js.map} +1 -1
- package/dist/lib/{Position-Ck_KD4cR.js → Position-PBVBW1JS.js} +2 -2
- package/dist/lib/{Position-Ck_KD4cR.js.map → Position-PBVBW1JS.js.map} +1 -1
- package/dist/lib/{ProgressSpinner-yt-VXyCb.js → ProgressSpinner-lAsK26C-.js} +2 -2
- package/dist/lib/{ProgressSpinner-yt-VXyCb.js.map → ProgressSpinner-lAsK26C-.js.map} +1 -1
- package/dist/lib/RadioButton-CCcIaL54.js +2 -0
- package/dist/lib/RadioButton-CCcIaL54.js.map +1 -0
- package/dist/lib/{RovingTabIndex-DFJyoveq.js → RovingTabIndex-C2Vzq0IX.js} +2 -2
- package/dist/lib/{RovingTabIndex-DFJyoveq.js.map → RovingTabIndex-C2Vzq0IX.js.map} +1 -1
- package/dist/lib/Scrollbar-C3ZZyZ1e.js +2 -0
- package/dist/lib/Scrollbar-C3ZZyZ1e.js.map +1 -0
- package/dist/lib/Slider-DZ9drUxn.js +2 -0
- package/dist/lib/Slider-DZ9drUxn.js.map +1 -0
- package/dist/lib/{Spacer-qalSEJ5i.js → Spacer-SDhOMp2g.js} +2 -2
- package/dist/lib/{Spacer-qalSEJ5i.js.map → Spacer-SDhOMp2g.js.map} +1 -1
- package/dist/lib/TabButton-DNo4ZgV8.js +2 -0
- package/dist/lib/TabButton-DNo4ZgV8.js.map +1 -0
- package/dist/lib/Text-CdHf3B-1.js +2 -0
- package/dist/lib/Text-CdHf3B-1.js.map +1 -0
- package/dist/lib/{Tooltip-Dro4DOZs.js → Tooltip-B_UF5bXD.js} +2 -2
- package/dist/lib/{Tooltip-Dro4DOZs.js.map → Tooltip-B_UF5bXD.js.map} +1 -1
- package/dist/lib/Tree-C7qLbIYH.js +2 -0
- package/dist/lib/Tree-C7qLbIYH.js.map +1 -0
- package/dist/lib/VBox-32fxpkDl.js +2 -0
- package/dist/lib/VBox-32fxpkDl.js.map +1 -0
- package/dist/lib/{Validator-Du8PqS5i.js → Validator-Cjs1EU5Q.js} +2 -2
- package/dist/lib/{Validator-Du8PqS5i.js.map → Validator-Cjs1EU5Q.js.map} +1 -1
- package/dist/lib/{VirtualScroller-Bv4KXGKW.js → VirtualScroller-cvFNMS7U.js} +2 -2
- package/dist/lib/{VirtualScroller-Bv4KXGKW.js.map → VirtualScroller-cvFNMS7U.js.map} +1 -1
- package/dist/lib/component/button.es.js +1 -1
- package/dist/lib/component/chart.es.js +1 -1
- package/dist/lib/component/chart.es.js.map +1 -1
- package/dist/lib/component/container.es.js +1 -1
- package/dist/lib/component/container.es.js.map +1 -1
- package/dist/lib/component/diagram.es.js +1 -1
- package/dist/lib/component/diagram.es.js.map +1 -1
- package/dist/lib/component/display.es.js +1 -1
- package/dist/lib/component/display.es.js.map +1 -1
- package/dist/lib/component/editor.es.js +3 -3
- package/dist/lib/component/editor.es.js.map +1 -1
- package/dist/lib/component/input.es.js +1 -1
- package/dist/lib/component/input.es.js.map +1 -1
- package/dist/lib/component/list.es.js +1 -1
- package/dist/lib/component/list.es.js.map +1 -1
- package/dist/lib/component/menubar.es.js +1 -1
- package/dist/lib/component/menubar.es.js.map +1 -1
- package/dist/lib/component/table.es.js +2 -2
- package/dist/lib/component/table.es.js.map +1 -1
- package/dist/lib/component/tree.es.js +1 -1
- package/dist/lib/component/tree.es.js.map +1 -1
- package/dist/lib/core.es.js +1 -1
- package/dist/lib/core.es.js.map +1 -1
- package/dist/lib/data.es.js +1 -1
- package/dist/lib/glyphs/solid/index.es.js +1 -1
- package/dist/lib/languages-Dl8qdL8a.js +2 -0
- package/dist/lib/languages-Dl8qdL8a.js.map +1 -0
- package/dist/lib/layout.es.js +1 -1
- package/dist/lib/layout.es.js.map +1 -1
- package/dist/lib/overlay.es.js +1 -1
- package/dist/lib/overlay.es.js.map +1 -1
- package/dist/lib/primitive.es.js +1 -1
- package/dist/lib/router.es.js +1 -1
- package/dist/lib/router.es.js.map +1 -1
- package/dist/lib/selectionsEqual-BrTxPMmK.js +2 -0
- package/dist/lib/{selectionsEqual-Ci3_uflt.js.map → selectionsEqual-BrTxPMmK.js.map} +1 -1
- package/dist/lib/types/component/button/TabButton.d.ts +1 -1
- package/dist/lib/types/component/button/ToggleButton.d.ts +1 -1
- package/dist/lib/types/component/chart/ChartLegend.d.ts +1 -1
- package/dist/lib/types/component/container/FloatingPanel.d.ts +23 -0
- package/dist/lib/types/component/container/ScrollStrip.d.ts +1 -1
- package/dist/lib/types/component/container/Scrollbar.d.ts +1 -3
- package/dist/lib/types/component/container/TabBar.d.ts +1 -1
- package/dist/lib/types/component/container/index.d.ts +2 -0
- package/dist/lib/types/component/diagram/DiagramGroupNode.d.ts +1 -1
- package/dist/lib/types/component/display/Markdown.d.ts +42 -1
- package/dist/lib/types/component/display/MarkdownMinimap.d.ts +38 -0
- package/dist/lib/types/component/display/MarkdownViewer.d.ts +60 -0
- package/dist/lib/types/component/display/index.d.ts +6 -0
- package/dist/lib/types/component/editor/CodeEditor.d.ts +13 -0
- package/dist/lib/types/component/editor/index.d.ts +1 -1
- package/dist/lib/types/component/input/Checkbox.d.ts +1 -1
- package/dist/lib/types/component/input/RadioButton.d.ts +1 -1
- package/dist/lib/types/component/input/Slider.d.ts +1 -1
- package/dist/lib/types/component/input/Text.d.ts +0 -2
- package/dist/lib/types/component/input/Toggle.d.ts +1 -1
- package/dist/lib/types/component/menubar/MenuBar.d.ts +1 -1
- package/dist/lib/types/component/menubar/ToolBar.d.ts +1 -0
- package/dist/lib/types/component/table/Body.d.ts +1 -0
- package/dist/lib/types/component/table/cell/SortPriorityBadge.d.ts +1 -1
- package/dist/lib/types/component/table/cell/editor/CellEditorPool.d.ts +1 -0
- package/dist/lib/types/component/table/cell/editor/Date.d.ts +1 -0
- package/dist/lib/types/component/table/cell/editor/DateTime.d.ts +1 -0
- package/dist/lib/types/component/table/cell/editor/Time.d.ts +1 -0
- package/dist/lib/types/component/tree/Tree.d.ts +9 -1
- package/dist/lib/types/component/tree/index.d.ts +1 -1
- package/dist/lib/types/component/tree/renderer/Label.d.ts +1 -1
- package/dist/lib/types/core/Component.d.ts +5 -0
- package/dist/lib/types/core/Theme.d.ts +4 -2
- package/dist/lib/types/layout/LayoutManager.d.ts +8 -0
- package/dist/lib/validation.es.js +1 -1
- package/llms.txt +3 -0
- package/package.json +15 -15
- package/dist/lib/AnchorConstraints-DdDYSDkf.js +0 -2
- package/dist/lib/AnchorConstraints-DdDYSDkf.js.map +0 -1
- package/dist/lib/Border-CKKUk5G9.js +0 -2
- package/dist/lib/Button-MZDYJOMC.js +0 -2
- package/dist/lib/Button-MZDYJOMC.js.map +0 -1
- package/dist/lib/ComboBox-C04SfXAR.js +0 -2
- package/dist/lib/ComboBox-C04SfXAR.js.map +0 -1
- package/dist/lib/Component-fRQvgaEY.js +0 -2
- package/dist/lib/Component-fRQvgaEY.js.map +0 -1
- package/dist/lib/Container-0bsG2Q8Z.js +0 -2
- package/dist/lib/DOM-67StIm5G.js +0 -2
- package/dist/lib/DragManager-DRor_-1x.js +0 -2
- package/dist/lib/LayoutSerialization-D5bBas4W.js +0 -2
- package/dist/lib/LayoutSizes-qNaURyiw.js +0 -2
- package/dist/lib/LayoutSizes-qNaURyiw.js.map +0 -1
- package/dist/lib/List-CG4NvwuV.js +0 -2
- package/dist/lib/MemoryStore-DT6iWWco.js +0 -2
- package/dist/lib/Menu-CrZy2u0g.js +0 -2
- package/dist/lib/Menu-CrZy2u0g.js.map +0 -1
- package/dist/lib/Panel-Rd9zkNXx.js +0 -2
- package/dist/lib/RadioButton-D23rId-V.js +0 -2
- package/dist/lib/RadioButton-D23rId-V.js.map +0 -1
- package/dist/lib/Scrollbar-SOj9psiP.js +0 -2
- package/dist/lib/Scrollbar-SOj9psiP.js.map +0 -1
- package/dist/lib/Slider-DBnAZ-F7.js +0 -2
- package/dist/lib/Slider-DBnAZ-F7.js.map +0 -1
- package/dist/lib/TabButton-DKECTTk1.js +0 -2
- package/dist/lib/TabButton-DKECTTk1.js.map +0 -1
- package/dist/lib/Text-KB5LksJl.js +0 -2
- package/dist/lib/Text-KB5LksJl.js.map +0 -1
- package/dist/lib/VBox-P3WFGkPc.js +0 -2
- package/dist/lib/VBox-P3WFGkPc.js.map +0 -1
- package/dist/lib/selectionsEqual-Ci3_uflt.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"../DOM-67StIm5G.js";import{l as t,n}from"../Position-Ck_KD4cR.js";import{S as r,b as i,h as a,r as o,t as s}from"../Component-fRQvgaEY.js";import{t as c}from"../ListenerBag-WPdKuuds.js";import{t as l}from"../Glyph-wN7bk7mg.js";import{t as u}from"../Text-KB5LksJl.js";import{r as d}from"../VBox-P3WFGkPc.js";import{t as f}from"../Border-CKKUk5G9.js";import{t as ee}from"../ProgressSpinner-yt-VXyCb.js";import{t as p}from"../Placement-7kqdaK4Z.js";import{t as te}from"../Header-2hKwQo_u.js";import{t as m}from"../Button-MZDYJOMC.js";import{angle_left as h}from"../glyphs/solid/angle_left.es.js";import{angle_right as g}from"../glyphs/solid/angle_right.es.js";import{n as _,t as v}from"../Slider-DBnAZ-F7.js";import{t as y}from"../IconText-DC7Xe34b.js";import{angles_left as b}from"../glyphs/solid/angles_left.es.js";import{angles_right as x}from"../glyphs/solid/angles_right.es.js";import{play as S}from"../glyphs/solid/play.es.js";import{pause as C}from"../glyphs/solid/pause.es.js";import{volume_high as w}from"../glyphs/solid/volume_high.es.js";import{volume_mute as T}from"../glyphs/solid/volume_mute.es.js";import{expand as E}from"../glyphs/solid/expand.es.js";import{compress as D}from"../glyphs/solid/compress.es.js";import{lexer as O}from"marked";var k={tag:`canvas`,maxFps:30},A=-1,Canvas=class extends s{_ctx=null;_rafId=null;_animationStartMs=null;_lastDrawMs=null;_elapsedMs=0;_animationRequested=!1;_syncedWidth=A;_syncedHeight=A;_syncedDpr=A;_dprToken=0;constructor(e,t){super(e,{...k,...t??{}}),this.clearInsets()}applyOptions(e){return super.applyOptions(e),e.onDraw!==void 0&&this.setOnDraw(e.onDraw),e.animateWhenHidden!==void 0&&this.setAnimateWhenHidden(e.animateWhenHidden),e.maxFps!==void 0&&this.setMaxFps(e.maxFps),this}getContext(){if(this._ctx)return this._ctx;let t=this.getElement();return t?(this._ctx=e.sink.getContext(t,`2d`),this._ctx):null}setOnDraw(e){return this._options.onDraw=e??void 0,this.redraw(),this}getOnDraw(){return this._options.onDraw??this._defaultOptions.onDraw??null}redraw(){let e=this.getContext();if(!e)return this;let t=this.getWidth(),n=this.getHeight();return e.clearRect(0,0,t,n),this.getOnDraw()?.(e,t,n,this._elapsedMs),this}startAnimation(){return this._animationRequested=!0,this._animationStartMs=null,this._lastDrawMs=null,this._elapsedMs=0,this.reconcileAnimation(),this}stopAnimation(){return this._animationRequested=!1,this.reconcileAnimation(),this}isAnimating(){return this._rafId!==null}setAnimateWhenHidden(e){return this._options.animateWhenHidden=e,this.reconcileAnimation(),this}setMaxFps(e){return this._options.maxFps=Math.max(0,e),this}getMaxFps(){return this._options.maxFps??this._defaultOptions.maxFps??0}getAnimateWhenHidden(){return this._options.animateWhenHidden??this._defaultOptions.animateWhenHidden??!1}syncBackingStore(){let t=this.getContext();if(!t)return;let n=this.getWidth(),r=this.getHeight(),i=e.source.getDevicePixelRatio();if(n===this._syncedWidth&&r===this._syncedHeight&&i===this._syncedDpr)return;let a=this.getElement();e.sink.apply(a,{setAttr:{width:String(Math.round(n*i)),height:String(Math.round(r*i))}}),t.setTransform(i,0,0,i,0,0),this._syncedWidth=n,this._syncedHeight=r,this._syncedDpr=i,this.redraw()}doLayout(){return super.doLayout(),this.syncBackingStore(),this}render(){let e=super.render();return this.watchDevicePixelRatio(),e}destructor(){this.stopAnimation(),super.destructor()}shouldAnimate(){return this._animationRequested&&(this.getAnimateWhenHidden()||this.isEffectivelyVisible())}reconcileAnimation(){this.shouldAnimate()?this._rafId===null&&(this._rafId=e.sink.requestAnimationFrame(this.animationStep)):this._rafId!=null&&(e.sink.cancelAnimationFrame(this._rafId),this._rafId=null)}animationStep=t=>{if(!this._animationRequested){this._rafId=null;return}this._animationStartMs===null&&(this._animationStartMs=t);let n=this.getMaxFps(),r=n>0?1e3/n:0;(this._lastDrawMs===null||t-this._lastDrawMs>=r)&&(this._lastDrawMs=t,this._elapsedMs=t-this._animationStartMs,this.redraw()),this._rafId=e.sink.requestAnimationFrame(this.animationStep)};onEffectiveVisibilityChange(e){super.onEffectiveVisibilityChange(e),this.reconcileAnimation()}watchDevicePixelRatio(){let t=++this._dprToken,n=e.source.getDevicePixelRatio();e.source.matchMedia(`(resolution: ${n}dppx)`).addChangeListener(()=>this.onDevicePixelRatioChange(t))}onDevicePixelRatioChange(e){e===this._dprToken&&this.getElement()&&(this.syncBackingStore(),this.watchDevicePixelRatio())}},ne=a(Canvas),re={tag:`canvas`,maxFps:30},j=-1,WebGLCanvas=class extends s{_gl=null;_rafId=null;_animationStartMs=null;_lastDrawMs=null;_elapsedMs=0;_animationRequested=!1;_contextLost=!1;_syncedWidth=j;_syncedHeight=j;_syncedDpr=j;_dprToken=0;constructor(e,t){super(e,{...re,...t??{}}),this._contextInitialised=!1,this.clearInsets()}applyOptions(e){return super.applyOptions(e),e.onContextInit!==void 0&&this.setOnContextInit(e.onContextInit),e.onFrame!==void 0&&this.setOnFrame(e.onFrame),e.animateWhenHidden!==void 0&&this.setAnimateWhenHidden(e.animateWhenHidden),e.maxFps!==void 0&&this.setMaxFps(e.maxFps),this}getContext(){if(this._gl)return this._gl;let t=this.getElement();return t?(this._gl=e.sink.getContext(t,`webgl2`),this._gl):null}setOnContextInit(e){return this._options.onContextInit=e??void 0,this._contextInitialised=!1,this}getOnContextInit(){return this._options.onContextInit??this._defaultOptions.onContextInit??null}setOnFrame(e){return this._options.onFrame=e??void 0,this}getOnFrame(){return this._options.onFrame??this._defaultOptions.onFrame??null}startAnimation(){return this._animationRequested=!0,this._animationStartMs=null,this._lastDrawMs=null,this._elapsedMs=0,this.reconcileAnimation(),this}stopAnimation(){return this._animationRequested=!1,this.reconcileAnimation(),this}isAnimating(){return this._rafId!==null}setAnimateWhenHidden(e){return this._options.animateWhenHidden=e,this.reconcileAnimation(),this}getAnimateWhenHidden(){return this._options.animateWhenHidden??this._defaultOptions.animateWhenHidden??!1}setMaxFps(e){return this._options.maxFps=Math.max(0,e),this}getMaxFps(){return this._options.maxFps??this._defaultOptions.maxFps??0}syncBackingStore(){let t=this.getContext();if(!t)return;let n=this.getWidth(),r=this.getHeight(),i=e.source.getDevicePixelRatio();if(n===this._syncedWidth&&r===this._syncedHeight&&i===this._syncedDpr)return;let a=Math.round(n*i),o=Math.round(r*i);e.sink.apply(this.getElement(),{setAttr:{width:String(a),height:String(o)}}),t.viewport(0,0,a,o),this._syncedWidth=n,this._syncedHeight=r,this._syncedDpr=i,this.renderFrame()}doLayout(){return super.doLayout(),this.syncBackingStore(),this}render(){let e=super.render();return r.addListener(this,`webglcontextlost`,e=>{e.preventDefault(),this._contextLost=!0}),r.addListener(this,`webglcontextrestored`,()=>{this._contextLost=!1,this._contextInitialised=!1,this.syncBackingStore()}),this.watchDevicePixelRatio(),this.onFirstLayout(()=>this.startAnimation()),e}destructor(){this.stopAnimation(),super.destructor()}shouldAnimate(){return this._animationRequested&&(this.getAnimateWhenHidden()||this.isEffectivelyVisible())}reconcileAnimation(){this.shouldAnimate()?this._rafId===null&&(this._rafId=e.sink.requestAnimationFrame(this.animationStep)):this._rafId!=null&&(e.sink.cancelAnimationFrame(this._rafId),this._rafId=null)}animationStep=t=>{if(!this._animationRequested){this._rafId=null;return}this._animationStartMs===null&&(this._animationStartMs=t);let n=this.getMaxFps(),r=n>0?1e3/n:0;(this._lastDrawMs===null||t-this._lastDrawMs>=r)&&(this._lastDrawMs=t,this._elapsedMs=t-this._animationStartMs,this.renderFrame()),this._rafId=e.sink.requestAnimationFrame(this.animationStep)};onEffectiveVisibilityChange(e){super.onEffectiveVisibilityChange(e),this.reconcileAnimation()}renderFrame(){let e=this.getContext();!e||this._contextLost||(this._contextInitialised||=(this.getOnContextInit()?.(e),!0),this.getOnFrame()?.(e,this.getWidth(),this.getHeight(),this._elapsedMs))}watchDevicePixelRatio(){let t=++this._dprToken,n=e.source.getDevicePixelRatio();e.source.matchMedia(`(resolution: ${n}dppx)`).addChangeListener(()=>this.onDevicePixelRatioChange(t))}onDevicePixelRatioChange(e){e===this._dprToken&&this.getElement()&&(this.syncBackingStore(),this.watchDevicePixelRatio())}},ie=a(WebGLCanvas),M=100,N={tag:`img`},Image=class extends s{_src;constructor(e,t,n){super(t,{...N,...n??{}}),this._src=e,this.clearInsets()}getElement(e=!1){return super.getElement(e)}getPreferredSize(){let t=this.getElement(),n=e.source.getNaturalSize(t);return{width:n.width,height:n.height}}getMinSize(){let t=super.getMinSize();if(this._options.minSize)return t;let n=this.getElement();if(!n||!e.source.getNaturalSize(n).width)return{width:20,height:20};let r=e.source.getNaturalSize(n);return{width:Math.min(r.width,M),height:Math.min(r.height,M)}}render(){let t=super.render();return e.sink.apply(t,{setAttr:{src:this._src.valueOf()}}),t}},P=a(Image),F=`ts-ui-md-code`,I=`ts-ui-md-pre`,L=`ts-ui-md-quote`,R=`ts-ui-md-list`,z=`ts-ui-md-link`,B=`ts-ui-md-heading`,V=`ts-ui-md-table-wrap`,H=`ts-ui-md-table`,U=`ts-ui-md-th`,W=`ts-ui-md-td`,G=`ts-ui-md-align-left`,K=`ts-ui-md-align-center`,q=`ts-ui-md-align-right`,ae=1,J=6,Y=!1;function ensureMarkdownClassRules(){Y||(Y=!0,new i({scope:`class`,name:F,styles:{fontFamily:`var(--ts-ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)`,background:`rgba(127, 127, 127, 0.16)`,borderRadius:`var(--ts-ui-border-radius, 3px)`,padding:`0.1em 0.3em`}}),new i({scope:`class`,name:I,styles:{fontFamily:`var(--ts-ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)`,background:`rgba(127, 127, 127, 0.16)`,borderRadius:`var(--ts-ui-border-radius, 3px)`,padding:`0.6em 0.8em`,whiteSpace:`pre`,overflow:`auto`}}),new i({scope:`class`,name:L,styles:{borderLeft:`3px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,paddingLeft:`1em`,marginLeft:`0`}}),new i({scope:`class`,name:R,styles:{paddingLeft:`1.5em`}}),new i({scope:`class`,name:z,styles:{color:`var(--ts-ui-indicator-focus, #2563eb)`}}),new i({scope:`class`,name:B,styles:{fontWeight:`600`}}),new i({scope:`class`,name:V,styles:{maxWidth:`100%`,overflowX:`auto`}}),new i({scope:`class`,name:H,styles:{borderCollapse:`collapse`}}),new i({scope:`class`,name:U,styles:{border:`1px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,padding:`0.3em 0.6em`,fontWeight:`600`,textAlign:`left`}}),new i({scope:`class`,name:W,styles:{border:`1px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,padding:`0.3em 0.6em`}}),new i({scope:`class`,name:G,styles:{textAlign:`left`}}),new i({scope:`class`,name:K,styles:{textAlign:`center`}}),new i({scope:`class`,name:q,styles:{textAlign:`right`}}))}function alignmentClass(e){switch(e){case`left`:return G;case`center`:return K;case`right`:return q;default:return null}}function slugify(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function defaultLinkResolver(e){return{href:e,external:!0}}var Markdown=class extends s{_contentHandles=[];_measuredHeight=null;_unsubscribeTheme;constructor(e,t){super(t),e!==void 0&&this._options.markdown===void 0&&(this._options.markdown=e),this.setWhiteSpace(`normal`),this.setElementCSSRule(`overflowWrap`,`break-word`),this._unsubscribeTheme=o.onThemeChange(()=>this.measureContentHeight()),this.onFirstLayout(()=>this.measureContentHeight())}applyOptions(e){return super.applyOptions(e),e.markdown!==void 0&&(this._options.markdown=e.markdown),e.linkResolver!==void 0&&(this._options.linkResolver=e.linkResolver),this}getMarkdown(){return this._options.markdown??``}setLinkResolver(e){return this._options.linkResolver=e,this}getLinkResolver(){return this._options.linkResolver??defaultLinkResolver}setMarkdown(e){this._options.markdown=e;let t=this.getElement();return t?(this.clearContent(),ensureMarkdownClassRules(),this.appendBlockTokens(t,O(e),new Map),this.measureContentHeight(),this):this}getMinSize(){let e=super.getMinSize();return this._measuredHeight===null?e:e?{width:e.width,height:Math.max(e.height,this._measuredHeight)}:{width:0,height:this._measuredHeight}}getPreferredSize(){let e=super.getPreferredSize();return this._measuredHeight===null||this.getPreferredSizeConstraint()!==null?e:e?{width:e.width,height:this._measuredHeight}:{width:0,height:this._measuredHeight}}setWidth(e){let t=e!==this.getWidth();return super.setWidth(e),t&&this.measureContentHeight(),this}destructor(){this._unsubscribeTheme(),super.destructor()}measureContentHeight(){let t=this.getElement();if(!t)return;let n=this.getHeight();this.setElementStyle(`height`,`auto`),this.commitElementStyle();let r=this.getBorderSize(),i=e.source.getScrollMetrics(t).scrollHeight+r.top+r.bottom;this.setElementStyle(`height`,n+`px`),this.commitElementStyle(),i!==this._measuredHeight&&(this._measuredHeight=i,(this.getParentComponent()??this).scheduleLayout())}render(){let e=super.render();return ensureMarkdownClassRules(),this.appendBlockTokens(e,O(this.getMarkdown()),new Map),e}create(t){let n=e.sink.createElement(t);return this.trackHandle(n),this._contentHandles.push(n),n}clearContent(){for(let t of this._contentHandles)e.sink.removeElement(t),this.untrackHandle(t),e.sink.release(t);this._contentHandles.length=0}appendBlockTokens(e,t,n){for(let r of t)this.appendBlockToken(e,r,n)}appendBlockToken(e,t,n){switch(t.type){case`heading`:this.appendHeading(e,t,n);break;case`paragraph`:this.appendParagraph(e,t);break;case`list`:this.appendList(e,t,n);break;case`blockquote`:this.appendBlockquote(e,t,n);break;case`code`:this.appendCode(e,t);break;case`table`:this.appendTable(e,t);break;case`space`:break;default:this.appendTextNode(e,t.raw??``);break}}appendHeading(t,n,r){let i=Math.min(Math.max(n.depth,ae),J),a=this.create(`h`+i),o=slugify(n.text),s=r.get(o)??0;r.set(o,s+1);let c=s===0?o:`${o}-${s}`;e.sink.apply(a,{addClass:[B],setAttr:{id:c}}),this.appendInlineTokens(a,n.tokens),e.sink.appendChild(t,a)}appendParagraph(t,n){let r=this.create(`p`);this.appendInlineTokens(r,n.tokens),e.sink.appendChild(t,r)}appendList(t,n,r){let i=this.create(n.ordered?`ol`:`ul`);e.sink.apply(i,{addClass:[R]});for(let e of n.items)this.appendListItem(i,e,r);e.sink.appendChild(t,i)}appendListItem(t,n,r){let i=this.create(`li`);for(let e of n.tokens)if(e.type===`text`){let t=e;t.tokens&&t.tokens.length>0?this.appendInlineTokens(i,t.tokens):this.appendInlineToken(i,t,n.tokens.length===1)}else this.appendBlockToken(i,e,r);e.sink.appendChild(t,i)}appendTable(t,n){let r=this.create(`div`);e.sink.apply(r,{addClass:[V]});let i=this.create(`table`);e.sink.apply(i,{addClass:[H]});let a=this.create(`thead`);this.appendTableRow(a,n.header,!0),e.sink.appendChild(i,a);let o=this.create(`tbody`);for(let e of n.rows)this.appendTableRow(o,e,!1);e.sink.appendChild(i,o),e.sink.appendChild(r,i),e.sink.appendChild(t,r)}appendTableRow(t,n,r){let i=this.create(`tr`);for(let t of n){let n=this.create(r?`th`:`td`),a=[r?U:W],o=alignmentClass(t.align);o&&a.push(o),e.sink.apply(n,{addClass:a}),this.appendInlineTokens(n,t.tokens),e.sink.appendChild(i,n)}e.sink.appendChild(t,i)}appendBlockquote(t,n,r){let i=this.create(`blockquote`);e.sink.apply(i,{addClass:[L]}),this.appendBlockTokens(i,n.tokens,r),e.sink.appendChild(t,i)}appendCode(t,n){let r=this.create(`pre`);e.sink.apply(r,{addClass:[I]});let i=this.create(`code`);e.sink.apply(i,{text:n.text}),e.sink.appendChild(r,i),e.sink.appendChild(t,r)}appendInlineTokens(e,t){let n=t.length===1;for(let r of t)this.appendInlineToken(e,r,n)}appendInlineToken(t,n,r){switch(n.type){case`text`:{let i=n;i.tokens&&i.tokens.length>0?this.appendInlineTokens(t,i.tokens):r?e.sink.apply(t,{text:i.text}):this.appendTextNode(t,i.text);break}case`strong`:this.appendInlineWrapper(t,`strong`,n.tokens);break;case`em`:this.appendInlineWrapper(t,`em`,n.tokens);break;case`codespan`:{let r=this.create(`code`);e.sink.apply(r,{addClass:[F],text:n.text}),e.sink.appendChild(t,r);break}case`link`:this.appendLink(t,n);break;default:this.appendTextNode(t,n.text??n.raw??``);break}}appendInlineWrapper(t,n,r){let i=this.create(n);this.appendInlineTokens(i,r),e.sink.appendChild(t,i)}appendLink(t,n){let r=this.create(`a`),i=this.getLinkResolver()(n.href),a={href:i.href};i.external&&(a.target=`_blank`,a.rel=`noopener noreferrer`),e.sink.apply(r,{addClass:[z],setAttr:a}),this.appendInlineTokens(r,n.tokens),e.sink.appendChild(t,r)}appendTextNode(t,n){let r=this.create(`span`);e.sink.apply(r,{text:n}),e.sink.appendChild(t,r)}},oe=a(Markdown),se={gap:2,insets:new n(0,0,0,0)},IconLabel=class extends s{_glyph;_label;constructor(e,t,n,r,i){super(r,{...se,...i??{}}),this.setLayoutManager(new d({spacing:this.getGap()}));let a=this._options.glyph??e,o=this._options.text??t,s=this._options.forId??n;this._glyph=new l(a),this._label=new _(o,s),this.addComponent(this._glyph),this.addComponent(this._label),this._options.gap!==void 0&&this.getLayoutManager().setComponentSpacing(this._options.gap)}applyOptions(e){return super.applyOptions(e),e.gap!==void 0&&(this._options.gap=e.gap),e.glyph!==void 0&&(this._options.glyph=e.glyph),e.text!==void 0&&(this._options.text=e.text),e.forId!==void 0&&(this._options.forId=e.forId),this}setGlyph(e){return this.removeComponent(this._glyph),this._glyph=new l(e),this.insertComponent(this._glyph,0),this}setText(e){return this._label.setText(e),this}setForId(e){return this._label.setForId(e),this}setGap(e){return this._options.gap=e,this.getLayoutManager().setComponentSpacing(e),this}getGap(){return this._options.gap??this._defaultOptions.gap}getGlyphComponent(){return this._glyph}getLabelComponent(){return this._label}},ce=a(IconLabel);i.ensureKeyframes(`ts-ui-progress-indeterminate`,`0% { transform: translateX(-100%); } 100% { transform: translateX(400%); }`);var ProgressBar=class extends s{_track;_fill;_value;_indeterminate;constructor(e=0,n=!1,r){super(),this._value=t.clamp(e,0,100),this._indeterminate=n,this.setBackgroundColor(`var(--ts-ui-progress-track-bg, rgb(220, 220, 220))`),this.setBorderRadius(`var(--ts-ui-progress-track-radius, 4px)`),this._track=new s,this._track.setOverflow(`hidden`),this._track.setBorderRadius(`var(--ts-ui-progress-track-radius, 4px)`),this._fill=new s,this._fill.setBackgroundColor(`var(--ts-ui-progress-fill-bg, rgb(30, 100, 200))`),this._track.addComponent(this._fill),super.addComponent(this._track),this.getAria().setRole(`progressbar`),this.getAria().setValueMin(0),this.getAria().setValueMax(100),this.getAria().setValueNow(this._value),this._indeterminate&&this.applyIndeterminate(!0),r&&this.applyOptions(r)}applyOptions(e){return super.applyOptions(e),e.indeterminate!==void 0&&this.setIndeterminate(e.indeterminate),e.value!==void 0&&this.setValue(e.value),this}getBaseline(){let e=this.getPreferredSize();return e?e.height-2:null}getValue(){return this._indeterminate?0:this._value}setValue(e){let n=t.clamp(e,0,100);return n===this._value?this:(this._value=n,this.getAria().setValueNow(n),this._indeterminate||this.scheduleLayout(),this)}isIndeterminate(){return this._indeterminate}setIndeterminate(e){return this._indeterminate===e?this:(this._indeterminate=e,this.applyIndeterminate(e),this.flushLayout(),this)}doLayout(){let e=this.getContentBounds();if(!e)return super.doLayout(),this;if(this._track.setX(e.x),this._track.setY(e.y),this._track.setSize({width:e.width,height:e.height}),this._indeterminate){let t=Math.max(20,Math.round(e.width*.25));this._fill.setX(0),this._fill.setY(0),this._fill.setSize({width:t,height:e.height})}else{let t=Math.round(e.width*this._value/100);this._fill.setX(0),this._fill.setY(0),this._fill.setSize({width:t,height:e.height})}return super.doLayout(),this}applyIndeterminate(e){e?(this._fill.setBackgroundColor(`var(--ts-ui-progress-indeterminate-bg, rgb(30, 100, 200))`),this._fill.setAnimation(`ts-ui-progress-indeterminate 1.4s ease-in-out infinite`)):(this._fill.setBackgroundColor(`var(--ts-ui-progress-fill-bg, rgb(30, 100, 200))`),this._fill.clearAnimation())}},le=a(ProgressBar);l.register(b,h,g,x);var PaginationBar=class extends s{_store;_firstBtn;_prevBtn;_nextBtn;_lastBtn;_pageText;_onStoreUpdate=()=>this.refresh();constructor(e,t){super(),this._store=e;let n=new d;n.setComponentSpacing(4),this.setLayoutManager(n),this._firstBtn=new m({glyph:`angles-left`}),this._prevBtn=new m({glyph:`angle-left`}),this._pageText=new u(`Page x of y`),this._nextBtn=new m({glyph:`angle-right`}),this._lastBtn=new m({glyph:`angles-right`}),this._firstBtn.setPreferredSize({width:28,height:28}),this._prevBtn.setPreferredSize({width:28,height:28}),this._nextBtn.setPreferredSize({width:28,height:28}),this._lastBtn.setPreferredSize({width:28,height:28}),this._pageText.centerInHeight(28),this._firstBtn.on(`action`,()=>{this._store.goToPage(1)}),this._prevBtn.on(`action`,()=>this._store.prevPage()),this._nextBtn.on(`action`,()=>this._store.nextPage()),this._lastBtn.on(`action`,()=>{let e=this._store.getTotalPages();this._store.goToPage(e??this._store.getPage())}),this.addComponent(this._firstBtn),this.addComponent(this._prevBtn),this.addComponent(this._pageText),this.addComponent(this._nextBtn),this.addComponent(this._lastBtn),this._store.on(`pagechange`,this._onStoreUpdate),this._store.on(`load`,this._onStoreUpdate),this._store.on(`datachange`,this._onStoreUpdate),this._store.on(`add`,this._onStoreUpdate),this._store.on(`remove`,this._onStoreUpdate),this._store.on(`sync`,this._onStoreUpdate),this.refresh(),t&&this.applyOptions(t)}applyOptions(e){return super.applyOptions(e),e.pageSize!==void 0&&this._store.setPageSize(e.pageSize),e.pageIndex!==void 0&&this._store.goToPage(e.pageIndex),this}destructor(){this._store.off(`pagechange`,this._onStoreUpdate),this._store.off(`load`,this._onStoreUpdate),this._store.off(`datachange`,this._onStoreUpdate),this._store.off(`add`,this._onStoreUpdate),this._store.off(`remove`,this._onStoreUpdate),this._store.off(`sync`,this._onStoreUpdate),super.destructor()}refresh(){let e=this._store.getPage(),t=this._store.getTotalPages(),n=this._store.hasPendingChanges(),r=t==null?`Page ${e}`:`Page ${e} of ${t}`;this._pageText.setText(r),this._firstBtn.setEnabled(!n&&e>1),this._prevBtn.setEnabled(!n&&e>1),this._nextBtn.setEnabled(!n&&(t==null||e<t)),this._lastBtn.setEnabled(!n&&t!=null&&e<t)}},ue=a(PaginationBar),de=[`timeupdate`,`play`,`pause`,`ended`,`loadedmetadata`,`durationchange`,`volumechange`,`ratechange`],fe=1,pe=1,X={tag:`video`},Video=class extends s{_listeners=new c;_mediaHandlers=new Map;constructor(e,t){super(e,{...X,...t??{}}),this.clearInsets(),this.getAria().setLabel(`Video`),this.buildMediaHandlers(),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.src!==void 0&&this.setSrc(e.src),e.poster!==void 0&&this.setPoster(e.poster),e.autoplay!==void 0&&this.setAutoplay(e.autoplay),e.loop!==void 0&&this.setLoop(e.loop),e.preload!==void 0&&this.setPreload(e.preload),e.muted!==void 0&&this.setMuted(e.muted),e.volume!==void 0&&this.setVolume(e.volume),e.playbackRate!==void 0&&this.setPlaybackRate(e.playbackRate),this}getSrc(){return this._options.src??null}setSrc(e){return this._options.src=e,this.setElementAttribute(`src`,e),this}getPoster(){return this._options.poster??null}setPoster(e){return this._options.poster=e,this.setElementAttribute(`poster`,e),this}isAutoplay(){return this._options.autoplay??!1}setAutoplay(e){return this._options.autoplay=e,this.setElementAttribute(`autoplay`,e?``:null),this}isLoop(){return this._options.loop??!1}setLoop(e){return this._options.loop=e,this.setElementAttribute(`loop`,e?``:null),this}isMuted(){return this._options.muted??!1}setMuted(t){this._options.muted=t,this.setElementAttribute(`muted`,t?``:null);let n=this.getElement();return n&&e.sink.setMuted(n,t),this}getPreload(){return this._options.preload??null}setPreload(e){return this._options.preload=e,this.setElementAttribute(`preload`,e),this}getVolume(){return this._options.volume??fe}setVolume(t){let n=Math.max(0,Math.min(1,t));this._options.volume=n;let r=this.getElement();return r&&e.sink.setVolume(r,n),this}getPlaybackRate(){return this._options.playbackRate??pe}setPlaybackRate(t){this._options.playbackRate=t;let n=this.getElement();return n&&e.sink.setPlaybackRate(n,t),this}setCurrentTime(t){let n=this.getElement();return n&&e.sink.setCurrentTime(n,t),this}play(){let t=this.getElement();return t&&e.sink.mediaPlay(t),this}pause(){let t=this.getElement();return t&&e.sink.mediaPause(t),this}getMediaState(){let t=this.getElement();return t?e.source.getMediaState(t):{currentTime:0,duration:0,paused:!0,ended:!1,volume:this.getVolume(),muted:this.isMuted(),playbackRate:this.getPlaybackRate()}}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e){this._listeners.fire(e)}init(e){super.init(e);let t=e??this.getElement();return t?(this.replayMediaOptions(t),this.attachMediaListeners(t),this):this}destructor(){let t=this.getElement();if(t)for(let[n,r]of this._mediaHandlers)e.sink.removeListener(t,n,r);super.destructor()}buildMediaHandlers(){for(let e of de)this._mediaHandlers.set(e,()=>this.emit(e))}replayMediaOptions(t){let n=this._options,r={};n.src!==void 0&&(r.src=n.src),n.poster!==void 0&&(r.poster=n.poster),n.preload!==void 0&&(r.preload=n.preload),n.autoplay&&(r.autoplay=``),n.loop&&(r.loop=``),n.muted&&(r.muted=``),Object.keys(r).length>0&&e.sink.apply(t,{setAttr:r}),n.muted!==void 0&&e.sink.setMuted(t,n.muted),n.volume!==void 0&&e.sink.setVolume(t,n.volume),n.playbackRate!==void 0&&e.sink.setPlaybackRate(t,n.playbackRate)}attachMediaListeners(t){for(let[n,r]of this._mediaHandlers)e.sink.addListener(t,n,r)}},Z=a(Video),ProgressiveEngine=class{load(e,t){e.setSrc(t)}destroy(){}};l.register(S,C,w,T,E,D);var Q=28,$=80,me=28,he=.05,ge=6;function formatMediaTime(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(n).padStart(2,`0`);return i>=1?`${i}:${String(r).padStart(2,`0`)}:${a}`:`${r}:${a}`}var VideoPlayer=class extends s{_video;_controls;_playBtn;_scrubber;_timeText;_muteBtn;_volume;_fullscreenBtn;_engine=new ProgressiveEngine;_playing=!1;_fullscreen=!1;_scrubbing=!1;_syncing=!1;_listeners=new c;_onPlayButton=()=>this.togglePlay();_onMuteButton=()=>this.setMuted(!this.isMuted());_onFullscreenButton=()=>this.toggleFullscreen();_onScrub=()=>this.beginScrub();_onVolumeChange=e=>this.onVolumeSlider(e);_onVideoPlay=()=>this.onVideoPlay();_onVideoPause=()=>this.onVideoPause();_onVideoEnded=()=>this.onVideoEnded();_onVideoTimeUpdate=()=>this.onVideoTimeUpdate();_onVideoSync=()=>this.syncFromVideo();_onFullscreenChange=()=>this.syncFullscreen();constructor(e){super(),this.setLayoutManager(new f),this.getAria().setRole(`region`),this.getAria().setLabel(`Video player`),this._video=new Z,this.buildControlBar(),this.wireControlListeners(),this.wireVideoListeners(),this.addComponent(this._video,{placement:p.CENTER}),this.addComponent(this._controls,{placement:p.SOUTH}),this.syncFromState(this._video.getMediaState()),e&&this.applyOptions(e),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.engine!==void 0&&(this._engine=e.engine),e.src!==void 0&&this.setSrc(e.src),e.poster!==void 0&&this._video.setPoster(e.poster),e.autoplay!==void 0&&this._video.setAutoplay(e.autoplay),e.loop!==void 0&&this._video.setLoop(e.loop),e.muted!==void 0&&this._video.setMuted(e.muted),e.volume!==void 0&&this._video.setVolume(e.volume),e.playbackRate!==void 0&&this._video.setPlaybackRate(e.playbackRate),e.controls!==void 0&&this.setControlsVisible(e.controls),this}getSrc(){return this._video.getSrc()}setSrc(e){return this._engine.destroy(),this._engine.load(this._video,e),this}getVolume(){return this._video.getVolume()}setVolume(e){return this._video.setVolume(e),this.syncFromVideo(),this}isMuted(){return this._video.isMuted()}setMuted(e){return this._video.setMuted(e),this.syncFromVideo(),this}getPlaybackRate(){return this._video.getPlaybackRate()}setPlaybackRate(e){return this._video.setPlaybackRate(e),this}setCurrentTime(e){return this._video.setCurrentTime(e),this}getCurrentTime(){return this._video.getMediaState().currentTime}getDuration(){return this._video.getMediaState().duration}isPlaying(){return this._playing}play(){return this._video.play(),this}pause(){return this._video.pause(),this}togglePlay(){return this._playing?this.pause():this.play()}isControlsVisible(){return this._options.controls??!0}setControlsVisible(e){return this._options.controls=e,this._controls.setVisible(e),this}isFullscreen(){return this._fullscreen}enterFullscreen(){let t=this.getElement();return t&&e.sink.requestFullscreen(t),this}exitFullscreen(){return e.sink.exitFullscreen(),this}toggleFullscreen(){return this._fullscreen?this.exitFullscreen():this.enterFullscreen()}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e){this._listeners.fire(e)}init(t){super.init(t);let n=t??this.getElement();return n?(e.sink.addListener(n,`fullscreenchange`,this._onFullscreenChange),this.syncFromVideo(),this):this}destructor(){let t=this.getElement();t&&e.sink.removeListener(t,`fullscreenchange`,this._onFullscreenChange),super.destructor()}syncFromState(e){this._syncing=!0;try{this._scrubbing||(this._scrubber.setMax(e.duration||0),this._scrubber.setValue(e.currentTime)),this._timeText.setText(`${formatMediaTime(e.currentTime)} / ${formatMediaTime(e.duration)}`),this._playBtn.setGlyph(e.paused?`play`:`pause`),this._muteBtn.setGlyph(e.muted||e.volume===0?`volume-mute`:`volume-high`),this._volume.setValue(e.muted?0:e.volume)}finally{this._syncing=!1}}syncFromVideo(){this.syncFromState(this._video.getMediaState())}buildControlBar(){this._playBtn=this.makeControlButton(`play`,`Play`),this._muteBtn=this.makeControlButton(`volume-high`,`Mute`),this._fullscreenBtn=this.makeControlButton(`expand`,`Fullscreen`),this._scrubber=new v({min:0,max:0,value:0}),this._scrubber.getAria().setLabel(`Seek`),this._volume=new v({min:0,max:1,step:he,value:1}),this._volume.getAria().setLabel(`Volume`),this._volume.setPreferredSize({width:$,height:this._volume.getPreferredSize().height}),this._volume.setMaxSize({width:$,height:this._volume.getPreferredSize().height}),this._timeText=new u(`0:00 / 0:00`),this._timeText.centerInHeight(me);let e=new d;e.setComponentSpacing(ge),this._controls=new s,this._controls.setLayoutManager(e),this._controls.setBackgroundColor(`var(--ts-ui-body-bg, rgb(255, 255, 255))`),this._controls.addComponent(this._playBtn),this._controls.addComponent(this._scrubber,{weight:1}),this._controls.addComponent(this._timeText),this._controls.addComponent(this._muteBtn),this._controls.addComponent(this._volume),this._controls.addComponent(this._fullscreenBtn)}makeControlButton(e,t){let n=new m({glyph:e,text:t,showText:!1});return n.setPreferredSize({width:Q,height:Q}),n}wireControlListeners(){this._playBtn.on(`action`,this._onPlayButton),this._muteBtn.on(`action`,this._onMuteButton),this._fullscreenBtn.on(`action`,this._onFullscreenButton),this._scrubber.on(`action`,this._onScrub),this._volume.on(`change`,this._onVolumeChange)}wireVideoListeners(){this._video.on(`play`,this._onVideoPlay),this._video.on(`pause`,this._onVideoPause),this._video.on(`ended`,this._onVideoEnded),this._video.on(`timeupdate`,this._onVideoTimeUpdate),this._video.on(`durationchange`,this._onVideoSync),this._video.on(`loadedmetadata`,this._onVideoSync),this._video.on(`volumechange`,this._onVideoSync),this._video.on(`ratechange`,this._onVideoSync)}beginScrub(){this._syncing||(this._scrubbing=!0,this._video.setCurrentTime(this._scrubber.getValue()))}onVolumeSlider(e){this._syncing||(this._video.setVolume(e),this.syncFromVideo())}onVideoPlay(){this._playing=!0,this.syncFromVideo(),this.emit(`play`)}onVideoPause(){this._playing=!1,this.syncFromVideo(),this.emit(`pause`)}onVideoEnded(){this._playing=!1,this.syncFromVideo(),this.emit(`ended`)}onVideoTimeUpdate(){this.syncFromVideo(),this._scrubbing=!1}syncFullscreen(){let t=e.source.getFullscreenElement(),n=this.getElement();this._fullscreen=n!=null&&t===n,this._fullscreenBtn.setGlyph(this._fullscreen?`compress`:`expand`),this.doLayout()}getInnerSize(){if(this._fullscreen&&this.getElement()){let t=e.source.getViewportSize(),n=this.getPerimeterSize();return{width:t.width-n.left-n.right,height:t.height-n.top-n.bottom}}return super.getInnerSize()}},_e=a(VideoPlayer);export{ne as Canvas,l as Glyph,te as Header,ce as IconLabel,y as IconText,P as Image,oe as Markdown,ue as PaginationBar,le as ProgressBar,ee as ProgressSpinner,ProgressiveEngine,Z as Video,_e as VideoPlayer,ie as WebGLCanvas};
|
|
1
|
+
import{t as e}from"../DOM-Ba8YRVel.js";import{a as t,l as n,n as r}from"../Position-PBVBW1JS.js";import{S as i,b as a,h as o,r as s,t as c}from"../Component-w65rPK75.js";import{t as l}from"../ListenerBag-WPdKuuds.js";import{t as u}from"../Glyph-DeJF_zsR.js";import{t as d}from"../Panel-CpNQTLNF.js";import{t as ee}from"../Fit-Cg3dPyZg.js";import{t as f}from"../Text-CdHf3B-1.js";import{n as p,r as m}from"../VBox-32fxpkDl.js";import{t as te}from"../Border-CNS6aEXB.js";import{t as ne}from"../ProgressSpinner-lAsK26C-.js";import{t as h}from"../Placement-7kqdaK4Z.js";import{t as re}from"../Header-BIFJK9nR.js";import{t as g}from"../Button-T16zSZip.js";import{angle_left as ie}from"../glyphs/solid/angle_left.es.js";import{angle_right as ae}from"../glyphs/solid/angle_right.es.js";import{t as oe}from"../Anchor-BsblS5it.js";import{t as se}from"../AnchorConstraints-Bfkt8019.js";import{n as ce,t as _}from"../Slider-DZ9drUxn.js";import{t as le}from"../IconText-Dsb1xS-E.js";import{t as v}from"../FloatingPanel-D5buuVrQ.js";import{n as ue,t as de}from"../Tree-C7qLbIYH.js";import{compress as y}from"../glyphs/solid/compress.es.js";import{expand as b}from"../glyphs/solid/expand.es.js";import{magnifying_glass_plus as fe}from"../glyphs/solid/magnifying_glass_plus.es.js";import{magnifying_glass_minus as pe}from"../glyphs/solid/magnifying_glass_minus.es.js";import{arrows_rotate as me}from"../glyphs/solid/arrows_rotate.es.js";import{angles_left as he}from"../glyphs/solid/angles_left.es.js";import{angles_right as ge}from"../glyphs/solid/angles_right.es.js";import{play as _e}from"../glyphs/solid/play.es.js";import{pause as ve}from"../glyphs/solid/pause.es.js";import{volume_high as ye}from"../glyphs/solid/volume_high.es.js";import{volume_mute as be}from"../glyphs/solid/volume_mute.es.js";import{lexer as x}from"marked";var xe={tag:`canvas`,maxFps:30},S=-1,Canvas=class extends c{_ctx=null;_rafId=null;_animationStartMs=null;_lastDrawMs=null;_elapsedMs=0;_animationRequested=!1;_syncedWidth=S;_syncedHeight=S;_syncedDpr=S;_dprToken=0;constructor(e,t){super(e,{...xe,...t??{}}),this.clearInsets()}applyOptions(e){return super.applyOptions(e),e.onDraw!==void 0&&this.setOnDraw(e.onDraw),e.animateWhenHidden!==void 0&&this.setAnimateWhenHidden(e.animateWhenHidden),e.maxFps!==void 0&&this.setMaxFps(e.maxFps),this}getContext(){if(this._ctx)return this._ctx;let t=this.getElement();return t?(this._ctx=e.sink.getContext(t,`2d`),this._ctx):null}setOnDraw(e){return this._options.onDraw=e??void 0,this.redraw(),this}getOnDraw(){return this._options.onDraw??this._defaultOptions.onDraw??null}redraw(){let e=this.getContext();if(!e)return this;let t=this.getWidth(),n=this.getHeight();return e.clearRect(0,0,t,n),this.getOnDraw()?.(e,t,n,this._elapsedMs),this}startAnimation(){return this._animationRequested=!0,this._animationStartMs=null,this._lastDrawMs=null,this._elapsedMs=0,this.reconcileAnimation(),this}stopAnimation(){return this._animationRequested=!1,this.reconcileAnimation(),this}isAnimating(){return this._rafId!==null}setAnimateWhenHidden(e){return this._options.animateWhenHidden=e,this.reconcileAnimation(),this}setMaxFps(e){return this._options.maxFps=Math.max(0,e),this}getMaxFps(){return this._options.maxFps??this._defaultOptions.maxFps??0}getAnimateWhenHidden(){return this._options.animateWhenHidden??this._defaultOptions.animateWhenHidden??!1}syncBackingStore(){let t=this.getContext();if(!t)return;let n=this.getWidth(),r=this.getHeight(),i=e.source.getDevicePixelRatio();if(n===this._syncedWidth&&r===this._syncedHeight&&i===this._syncedDpr)return;let a=this.getElement();e.sink.apply(a,{setAttr:{width:String(Math.round(n*i)),height:String(Math.round(r*i))}}),t.setTransform(i,0,0,i,0,0),this._syncedWidth=n,this._syncedHeight=r,this._syncedDpr=i,this.redraw()}doLayout(){return super.doLayout(),this.syncBackingStore(),this}render(){let e=super.render();return this.watchDevicePixelRatio(),e}destructor(){this.stopAnimation(),super.destructor()}shouldAnimate(){return this._animationRequested&&(this.getAnimateWhenHidden()||this.isEffectivelyVisible())}reconcileAnimation(){this.shouldAnimate()?this._rafId===null&&(this._rafId=e.sink.requestAnimationFrame(this.animationStep)):this._rafId!=null&&(e.sink.cancelAnimationFrame(this._rafId),this._rafId=null)}animationStep=t=>{if(!this._animationRequested){this._rafId=null;return}this._animationStartMs===null&&(this._animationStartMs=t);let n=this.getMaxFps(),r=n>0?1e3/n:0;(this._lastDrawMs===null||t-this._lastDrawMs>=r)&&(this._lastDrawMs=t,this._elapsedMs=t-this._animationStartMs,this.redraw()),this._rafId=e.sink.requestAnimationFrame(this.animationStep)};onEffectiveVisibilityChange(e){super.onEffectiveVisibilityChange(e),this.reconcileAnimation()}watchDevicePixelRatio(){let t=++this._dprToken,n=e.source.getDevicePixelRatio();e.source.matchMedia(`(resolution: ${n}dppx)`).addChangeListener(()=>this.onDevicePixelRatioChange(t))}onDevicePixelRatioChange(e){e===this._dprToken&&this.getElement()&&(this.syncBackingStore(),this.watchDevicePixelRatio())}},Se=o(Canvas),Ce={tag:`canvas`,maxFps:30},C=-1,WebGLCanvas=class extends c{_gl=null;_rafId=null;_animationStartMs=null;_lastDrawMs=null;_elapsedMs=0;_animationRequested=!1;_contextLost=!1;_syncedWidth=C;_syncedHeight=C;_syncedDpr=C;_dprToken=0;constructor(e,t){super(e,{...Ce,...t??{}}),this._contextInitialised=!1,this.clearInsets()}applyOptions(e){return super.applyOptions(e),e.onContextInit!==void 0&&this.setOnContextInit(e.onContextInit),e.onFrame!==void 0&&this.setOnFrame(e.onFrame),e.animateWhenHidden!==void 0&&this.setAnimateWhenHidden(e.animateWhenHidden),e.maxFps!==void 0&&this.setMaxFps(e.maxFps),this}getContext(){if(this._gl)return this._gl;let t=this.getElement();return t?(this._gl=e.sink.getContext(t,`webgl2`),this._gl):null}setOnContextInit(e){return this._options.onContextInit=e??void 0,this._contextInitialised=!1,this}getOnContextInit(){return this._options.onContextInit??this._defaultOptions.onContextInit??null}setOnFrame(e){return this._options.onFrame=e??void 0,this}getOnFrame(){return this._options.onFrame??this._defaultOptions.onFrame??null}startAnimation(){return this._animationRequested=!0,this._animationStartMs=null,this._lastDrawMs=null,this._elapsedMs=0,this.reconcileAnimation(),this}stopAnimation(){return this._animationRequested=!1,this.reconcileAnimation(),this}isAnimating(){return this._rafId!==null}setAnimateWhenHidden(e){return this._options.animateWhenHidden=e,this.reconcileAnimation(),this}getAnimateWhenHidden(){return this._options.animateWhenHidden??this._defaultOptions.animateWhenHidden??!1}setMaxFps(e){return this._options.maxFps=Math.max(0,e),this}getMaxFps(){return this._options.maxFps??this._defaultOptions.maxFps??0}syncBackingStore(){let t=this.getContext();if(!t)return;let n=this.getWidth(),r=this.getHeight(),i=e.source.getDevicePixelRatio();if(n===this._syncedWidth&&r===this._syncedHeight&&i===this._syncedDpr)return;let a=Math.round(n*i),o=Math.round(r*i);e.sink.apply(this.getElement(),{setAttr:{width:String(a),height:String(o)}}),t.viewport(0,0,a,o),this._syncedWidth=n,this._syncedHeight=r,this._syncedDpr=i,this.renderFrame()}doLayout(){return super.doLayout(),this.syncBackingStore(),this}render(){let e=super.render();return i.addListener(this,`webglcontextlost`,e=>{e.preventDefault(),this._contextLost=!0}),i.addListener(this,`webglcontextrestored`,()=>{this._contextLost=!1,this._contextInitialised=!1,this.syncBackingStore()}),this.watchDevicePixelRatio(),this.onFirstLayout(()=>this.startAnimation()),e}destructor(){this.stopAnimation(),super.destructor()}shouldAnimate(){return this._animationRequested&&(this.getAnimateWhenHidden()||this.isEffectivelyVisible())}reconcileAnimation(){this.shouldAnimate()?this._rafId===null&&(this._rafId=e.sink.requestAnimationFrame(this.animationStep)):this._rafId!=null&&(e.sink.cancelAnimationFrame(this._rafId),this._rafId=null)}animationStep=t=>{if(!this._animationRequested){this._rafId=null;return}this._animationStartMs===null&&(this._animationStartMs=t);let n=this.getMaxFps(),r=n>0?1e3/n:0;(this._lastDrawMs===null||t-this._lastDrawMs>=r)&&(this._lastDrawMs=t,this._elapsedMs=t-this._animationStartMs,this.renderFrame()),this._rafId=e.sink.requestAnimationFrame(this.animationStep)};onEffectiveVisibilityChange(e){super.onEffectiveVisibilityChange(e),this.reconcileAnimation()}renderFrame(){let e=this.getContext();!e||this._contextLost||(this._contextInitialised||=(this.getOnContextInit()?.(e),!0),this.getOnFrame()?.(e,this.getWidth(),this.getHeight(),this._elapsedMs))}watchDevicePixelRatio(){let t=++this._dprToken,n=e.source.getDevicePixelRatio();e.source.matchMedia(`(resolution: ${n}dppx)`).addChangeListener(()=>this.onDevicePixelRatioChange(t))}onDevicePixelRatioChange(e){e===this._dprToken&&this.getElement()&&(this.syncBackingStore(),this.watchDevicePixelRatio())}},we=o(WebGLCanvas),w=100,Te={tag:`img`},Image=class extends c{_src;constructor(e,t,n){super(t,{...Te,...n??{}}),this._src=e,this.clearInsets()}getElement(e=!1){return super.getElement(e)}getPreferredSize(){let t=this.getElement(),n=e.source.getNaturalSize(t);return{width:n.width,height:n.height}}getMinSize(){let t=super.getMinSize();if(this._options.minSize)return t;let n=this.getElement();if(!n||!e.source.getNaturalSize(n).width)return{width:20,height:20};let r=e.source.getNaturalSize(n);return{width:Math.min(r.width,w),height:Math.min(r.height,w)}}render(){let t=super.render();return e.sink.apply(t,{setAttr:{src:this._src.valueOf()}}),t}},Ee=o(Image),T=`ts-ui-md-code`,E=`ts-ui-md-pre`,D=`ts-ui-md-quote`,O=`ts-ui-md-list`,k=`ts-ui-md-link`,A=`ts-ui-md-heading`,j=`ts-ui-md-table-wrap`,M=`ts-ui-md-table`,N=`ts-ui-md-th`,P=`ts-ui-md-td`,F=`ts-ui-md-align-left`,I=`ts-ui-md-align-center`,L=`ts-ui-md-align-right`,R=`ts-ui-md-code-host`,z=1,B=6,De={js:`javascript`,javascript:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,ts:`javascript`,typescript:`javascript`,tsx:`javascript`,json:`json`,html:`html`,htm:`html`,sql:`sql`,md:`markdown`,markdown:`markdown`},Oe=20,ke=8;function mapFenceLangToEditorId(e){if(!e)return null;let t=e.trim().split(/\s+/,1)[0]?.toLowerCase();return t?De[t]??null:null}var V=!1;function ensureMarkdownClassRules(){V||(V=!0,new a({scope:`class`,name:T,styles:{fontFamily:`var(--ts-ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)`,background:`rgba(127, 127, 127, 0.16)`,borderRadius:`var(--ts-ui-border-radius, 3px)`,padding:`0.1em 0.3em`,lineHeight:`normal`}}),new a({scope:`class`,name:E,styles:{fontFamily:`var(--ts-ui-font-mono, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace)`,background:`rgba(127, 127, 127, 0.16)`,borderRadius:`var(--ts-ui-border-radius, 3px)`,padding:`0.6em 0.8em`,whiteSpace:`pre`,overflow:`auto`,lineHeight:`normal`}}),new a({scope:`class`,name:D,styles:{borderLeft:`3px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,paddingLeft:`1em`,marginLeft:`0`}}),new a({scope:`class`,name:O,styles:{paddingLeft:`1.5em`}}),new a({scope:`class`,name:k,styles:{color:`var(--ts-ui-indicator-focus, #2563eb)`}}),new a({scope:`class`,name:A,styles:{fontWeight:`600`}}),new a({scope:`class`,name:j,styles:{maxWidth:`100%`,overflowX:`auto`}}),new a({scope:`class`,name:M,styles:{borderCollapse:`collapse`}}),new a({scope:`class`,name:N,styles:{border:`1px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,padding:`0.3em 0.6em`,fontWeight:`600`,textAlign:`left`}}),new a({scope:`class`,name:P,styles:{border:`1px solid var(--ts-ui-border-color, rgba(127, 127, 127, 0.4))`,padding:`0.3em 0.6em`}}),new a({scope:`class`,name:F,styles:{textAlign:`left`}}),new a({scope:`class`,name:I,styles:{textAlign:`center`}}),new a({scope:`class`,name:L,styles:{textAlign:`right`}}),new a({scope:`class`,name:R,styles:{position:`relative`}}))}function alignmentClass(e){switch(e){case`left`:return F;case`center`:return I;case`right`:return L;default:return null}}function slugify(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function nextHeadingId(e,t){let n=slugify(e),r=t.get(n)??0;return t.set(n,r+1),r===0?n:`${n}-${r}`}function defaultLinkResolver(e){return{href:e,external:!0}}var Markdown=class extends c{_contentHandles=[];_measuredHeight=null;_unsubscribeTheme;_codeEditors=[];_pendingCodeUpgrades=[];_awaitingVisibilityKickoffs=[];_awaitingViewportKickoffs=[];_viewportWatchArmed=!1;_viewportPassScheduled=!1;_measureScheduled=!1;handleViewportPass=()=>this.onViewportPass();handleScheduledMeasure=()=>this.onScheduledMeasure();_renderGeneration=0;_maxMeasure=null;constructor(e,t){super(t),e!==void 0&&this._options.markdown===void 0&&(this._options.markdown=e),this.setWhiteSpace(`normal`),this.setElementCSSRule(`overflowWrap`,`break-word`),this.setElementCSSRule(`lineHeight`,`var(--ts-ui-md-line-height, 1.6)`),this.setMaxMeasure(this._options.maxMeasure??null),this.setFontScale(this._options.fontScale??1),this._unsubscribeTheme=s.onThemeChange(()=>this.onThemeChanged()),this.onFirstLayout(()=>this.measureContentHeight())}applyOptions(e){return super.applyOptions(e),e.markdown!==void 0&&(this._options.markdown=e.markdown),e.linkResolver!==void 0&&(this._options.linkResolver=e.linkResolver),e.maxMeasure!==void 0&&(this._options.maxMeasure=e.maxMeasure),e.fontScale!==void 0&&(this._options.fontScale=e.fontScale),this}getMarkdown(){return this._options.markdown??``}setLinkResolver(e){return this._options.linkResolver=e,this}getLinkResolver(){return this._options.linkResolver??defaultLinkResolver}setMaxMeasure(e){return this._options.maxMeasure=e,this._maxMeasure=typeof e==`number`?`${e}ch`:e,this.setElementCSSRule(`maxWidth`,this._maxMeasure??`var(--ts-ui-md-max-measure, 70ch)`),this}getMaxMeasure(){return this._options.maxMeasure??null}setFontScale(e){return this._options.fontScale=e,this.setElementCSSRule(`fontSize`,e===1?null:e*100+`%`),this}getFontScale(){return this._options.fontScale??1}setMarkdown(e){this._options.markdown=e;let t=this.getElement();return t?(this.clearContent(),ensureMarkdownClassRules(),this.appendBlockTokens(t,x(e),new Map),this.measureContentHeight(),this):this}getMinSize(){let e=super.getMinSize();return this._measuredHeight===null?e:e?{width:e.width,height:Math.max(e.height,this._measuredHeight)}:{width:0,height:this._measuredHeight}}getPreferredSize(){let e=super.getPreferredSize();return this._measuredHeight===null||this.getPreferredSizeConstraint()!==null?e:e?{width:e.width,height:this._measuredHeight}:{width:0,height:this._measuredHeight}}setWidth(e){let t=e!==this.getWidth();return super.setWidth(e),t&&(this.resyncCodeEditorWidths(),this.measureContentHeight()),this}onThemeChanged(){this.resyncCodeEditorWidths(),this.measureContentHeight()}destructor(){this.clearContent(),this._unsubscribeTheme(),super.destructor()}measureContentHeight(){let t=this.getElement();if(!t)return;this.commitElementStyle(),this.flushPendingCodeUpgrades();let n=this.getHeight();this.setElementStyle(`height`,`auto`),this.commitElementStyle();let r=this.getBorderSize(),i=e.source.getScrollMetrics(t).scrollHeight+r.top+r.bottom;this.setElementStyle(`height`,n+`px`),this.commitElementStyle(),i!==this._measuredHeight&&(this._measuredHeight=i,(this.getParentComponent()??this).scheduleLayout())}render(){let e=super.render();return ensureMarkdownClassRules(),this.appendBlockTokens(e,x(this.getMarkdown()),new Map),e}create(t){let n=e.sink.createElement(t);return this.trackHandle(n),this._contentHandles.push(n),n}clearContent(){for(let t of this._contentHandles)e.sink.removeElement(t),this.untrackHandle(t),e.sink.release(t);this._contentHandles.length=0,this._renderGeneration+=1;for(let{editor:e}of this._codeEditors)e.dispose();this._codeEditors.length=0,this._pendingCodeUpgrades.length=0,this._awaitingVisibilityKickoffs.length=0,this._awaitingViewportKickoffs.length=0,this.disarmViewportWatch()}applyCodeEditorUpgrade(t,n,r,i,a,o){let s=e.source.getScrollMetrics(r),c=s.clientWidth,l=s.scrollHeight;for(let t of[r,i]){e.sink.removeElement(t),this.untrackHandle(t),e.sink.release(t);let n=this._contentHandles.indexOf(t);n!==-1&&this._contentHandles.splice(n,1)}let u=new t(a,{readOnly:!0,language:o,autoHeightMaxRows:Oe});u.setX(0).setY(0).setWidth(c).setHeight(l);let d=!1;u.on(`heightchange`,e=>{if(!d){d=!0;let t=Math.abs(e.height-l);t>ke&&console.warn(`Markdown: fenced "${o}" code block's CodeEditor corrected its guessed height by ${Math.round(t)}px (${l}px → ${e.height}px) on mount.`)}this.handleCodeEditorHeightChange(n,e.height)}),e.sink.appendChild(n,u.getElement(!0)),e.sink.apply(n,{style:{height:l+`px`}}),this._codeEditors.push({editor:u,wrapper:n})}handleCodeEditorHeightChange(t,n){e.sink.apply(t,{style:{height:n+`px`}}),this.scheduleContentMeasure()}flushPendingCodeUpgrades(){this._pendingCodeUpgrades=this._pendingCodeUpgrades.filter(e=>!this.isEffectivelyVisible()||(this.applyCodeEditorUpgrade(e.CodeEditorClass,e.wrapper,e.pre,e.code,e.text,e.languageId),!1))}resyncCodeEditorWidths(){if(this.commitElementStyle(),this.isEffectivelyVisible())for(let{editor:t,wrapper:n}of this._codeEditors)t.setWidth(e.source.getScrollMetrics(n).clientWidth)}startCodeEditorImport(e){if(!this.isEffectivelyVisible()){this._awaitingVisibilityKickoffs.push(e);return}if(!this.isBlockNearViewport(e.wrapper)){this._awaitingViewportKickoffs.push(e),this.armViewportWatch();return}this.loadCodeEditorUpgrade(e.wrapper,e.pre,e.code,e.text,e.languageId,e.generation)}isBlockNearViewport(t){let n=e.source.getElementRect(t),r=e.source.getViewportSize().height*2;return n.bottom>=0&&n.top<=r}armViewportWatch(){this._viewportWatchArmed||(this._viewportWatchArmed=!0,i.addViewportListener(this,`scroll`,this.handleViewportChange),i.addViewportListener(this,`resize`,this.handleViewportChange))}disarmViewportWatch(){this._viewportWatchArmed&&(this._viewportWatchArmed=!1,i.removeViewportListener(this,`scroll`,this.handleViewportChange),i.removeViewportListener(this,`resize`,this.handleViewportChange))}handleViewportChange(){this.scheduleViewportPass()}scheduleViewportPass(){this._viewportPassScheduled||this._awaitingViewportKickoffs.length===0||(this._viewportPassScheduled=!0,c.afterNextLayout(this.handleViewportPass))}onViewportPass(){if(this._viewportPassScheduled=!1,this._awaitingViewportKickoffs.length===0){this.disarmViewportWatch();return}if(!this.isEffectivelyVisible())return;this.commitElementStyle();let t=e.source.getViewportSize().height*2,n=this._awaitingViewportKickoffs,r=[],i=[];for(let a=0;a<n.length;a++){let o=n[a],s=e.source.getElementRect(o.wrapper);if(s.top>t){i.push(...n.slice(a));break}(s.bottom>=0?r:i).push(o)}this._awaitingViewportKickoffs=i,i.length===0&&this.disarmViewportWatch();for(let e of r)this.loadCodeEditorUpgrade(e.wrapper,e.pre,e.code,e.text,e.languageId,e.generation)}onEffectiveVisibilityChange(e){if(super.onEffectiveVisibilityChange(e),!e||this._awaitingVisibilityKickoffs.length===0)return;let t=this._awaitingVisibilityKickoffs;this._awaitingVisibilityKickoffs=[];for(let e of t)this.startCodeEditorImport(e)}async loadCodeEditorUpgrade(e,t,n,r,i,a){let[{CodeEditor:o}]=await Promise.all([import(`../CodeEditor-BGlB232h.js`).then(e=>e.n),import(`../languages-Dl8qdL8a.js`).then(e=>e.t)]);a===this._renderGeneration&&(this.isEffectivelyVisible()?(this.applyCodeEditorUpgrade(o,e,t,n,r,i),this.scheduleContentMeasure()):this._pendingCodeUpgrades.push({CodeEditorClass:o,wrapper:e,pre:t,code:n,text:r,languageId:i,generation:a}))}scheduleContentMeasure(){this._measureScheduled||(this._measureScheduled=!0,c.afterNextLayout(this.handleScheduledMeasure))}onScheduledMeasure(){this._measureScheduled=!1,this.measureContentHeight(),this.scheduleViewportPass()}appendBlockTokens(e,t,n){for(let r of t)this.appendBlockToken(e,r,n)}appendBlockToken(e,t,n){switch(t.type){case`heading`:this.appendHeading(e,t,n);break;case`paragraph`:this.appendParagraph(e,t);break;case`list`:this.appendList(e,t,n);break;case`blockquote`:this.appendBlockquote(e,t,n);break;case`code`:this.appendCode(e,t);break;case`table`:this.appendTable(e,t);break;case`space`:break;default:this.appendTextNode(e,t.raw??``)}}appendHeading(t,n,r){let i=Math.min(Math.max(n.depth,z),B),a=this.create(`h`+i),o=nextHeadingId(n.text,r);e.sink.apply(a,{addClass:[A],setAttr:{id:o}}),this.appendInlineTokens(a,n.tokens),e.sink.appendChild(t,a)}appendParagraph(t,n){let r=this.create(`p`);this.appendInlineTokens(r,n.tokens),e.sink.appendChild(t,r)}appendList(t,n,r){let i=this.create(n.ordered?`ol`:`ul`);e.sink.apply(i,{addClass:[O]});for(let e of n.items)this.appendListItem(i,e,r);e.sink.appendChild(t,i)}appendListItem(t,n,r){let i=this.create(`li`);for(let e of n.tokens)if(e.type===`text`){let t=e;t.tokens&&t.tokens.length>0?this.appendInlineTokens(i,t.tokens):this.appendInlineToken(i,t,n.tokens.length===1)}else this.appendBlockToken(i,e,r);e.sink.appendChild(t,i)}appendTable(t,n){let r=this.create(`div`);e.sink.apply(r,{addClass:[j]});let i=this.create(`table`);e.sink.apply(i,{addClass:[M]});let a=this.create(`thead`);this.appendTableRow(a,n.header,!0),e.sink.appendChild(i,a);let o=this.create(`tbody`);for(let e of n.rows)this.appendTableRow(o,e,!1);e.sink.appendChild(i,o),e.sink.appendChild(r,i),e.sink.appendChild(t,r)}appendTableRow(t,n,r){let i=this.create(`tr`);for(let t of n){let n=this.create(r?`th`:`td`),a=[r?N:P],o=alignmentClass(t.align);o&&a.push(o),e.sink.apply(n,{addClass:a}),this.appendInlineTokens(n,t.tokens),e.sink.appendChild(i,n)}e.sink.appendChild(t,i)}appendBlockquote(t,n,r){let i=this.create(`blockquote`);e.sink.apply(i,{addClass:[D]}),this.appendBlockTokens(i,n.tokens,r),e.sink.appendChild(t,i)}appendCode(t,n){let r=this.create(`pre`);e.sink.apply(r,{addClass:[E]});let i=this.create(`code`);e.sink.apply(i,{text:n.text}),e.sink.appendChild(r,i);let a=mapFenceLangToEditorId(n.lang);if(a===null){e.sink.appendChild(t,r);return}let o=this.create(`div`);e.sink.apply(o,{addClass:[R]}),e.sink.appendChild(o,r),e.sink.appendChild(t,o);let s={wrapper:o,pre:r,code:i,text:n.text,languageId:a,generation:this._renderGeneration};this.onFirstLayout(()=>this.startCodeEditorImport(s))}appendInlineTokens(e,t){let n=t.length===1;for(let r of t)this.appendInlineToken(e,r,n)}appendInlineToken(t,n,r){switch(n.type){case`text`:{let i=n;i.tokens&&i.tokens.length>0?this.appendInlineTokens(t,i.tokens):r?e.sink.apply(t,{text:i.text}):this.appendTextNode(t,i.text);break}case`strong`:this.appendInlineWrapper(t,`strong`,n.tokens);break;case`em`:this.appendInlineWrapper(t,`em`,n.tokens);break;case`codespan`:{let r=this.create(`code`);e.sink.apply(r,{addClass:[T],text:n.text}),e.sink.appendChild(t,r);break}case`link`:this.appendLink(t,n);break;default:this.appendTextNode(t,n.text??n.raw??``)}}appendInlineWrapper(t,n,r){let i=this.create(n);this.appendInlineTokens(i,r),e.sink.appendChild(t,i)}appendLink(t,n){let r=this.create(`a`),i=this.getLinkResolver()(n.href),a={href:i.href};i.external&&(a.target=`_blank`,a.rel=`noopener noreferrer`),e.sink.apply(r,{addClass:[k],setAttr:a}),this.appendInlineTokens(r,n.tokens),e.sink.appendChild(t,r)}appendTextNode(t,n){let r=this.create(`span`);e.sink.apply(r,{text:n}),e.sink.appendChild(t,r)}};function inlineText(e){return e.map(e=>{switch(e.type){case`text`:return e.tokens?inlineText(e.tokens):e.text;case`strong`:return inlineText(e.tokens);case`em`:return inlineText(e.tokens);case`codespan`:return e.text;case`link`:return inlineText(e.tokens);default:return e.text??e.raw??``}}).join(``)}function collectHeadings(e,t,n){for(let r of e)if(r.type===`heading`){let e=r,i=Math.min(Math.max(e.depth,z),B);n.push({id:nextHeadingId(e.text,t),text:inlineText(e.tokens),depth:i})}else if(r.type===`blockquote`)collectHeadings(r.tokens,t,n);else if(r.type===`list`)for(let e of r.items)collectHeadings(e.tokens,t,n)}function extractMarkdownHeadings(e){let t=[];return collectHeadings(x(e),new Map,t),t}var H=1;function findActiveHeading(t,n){let r=e.source.getElementRect(t).top,i=e.source.getScrollMetrics(t),a=i.scrollHeight>i.clientHeight&&i.scrollTop>=i.scrollHeight-i.clientHeight-H,o=null;for(let i of n){let n=e.source.getElementById(i.id);if(!(!n||!e.source.contains(t,n))){if(e.source.getElementRect(n).top<=r+H)o=i.id;else{a&&(o=i.id);break}}}return o}var U=o(Markdown),W=3,Ae=`On this page`,je=500,Me=160,Ne=240,Pe=12,Fe=new r(8,12,4,12),Ie={maxHeadingDepth:W,maxSize:{width:t,height:je},minSize:{width:Me,height:0}},MarkdownMinimap=class extends v{_tree;_listeners=new l;_scrollSource;_nodesById=new Map;_nearestShown=new Map;handleSelection=e=>this.onTreeSelection(e);handleActiveHeadingChange=e=>this.applyActiveHeading(e);constructor(e,t){super(e,{...Ie,...t??{}}),this.setBackgroundColor(`var(--ts-ui-input-bg, rgb(255, 255, 255))`),this.setShadow(`var(--ts-ui-popover-shadow, 2px 4px 12px rgba(0, 0, 0, 0.18))`),this.setBorderRadius(`var(--ts-ui-border-radius, 4px)`),this.setLayoutManager(new p({spacing:4,stretching:!0}));let n=new f(Ae);n.setFontSize(12),n.setFontWeight(`700`),n.setOpacity(.6);let r=new c({layoutManager:new ee,padding:Fe});r.addComponent(n),this.addComponent(r),this._tree=new de({backgroundColor:`transparent`,rowOverflow:`clip`}),this._tree.setRendererFactory(()=>{let e=new ue;return e.getLabel().setFontSize(Pe),e}),this._tree.on(`selection`,this.handleSelection),this.addComponent(this._tree),this._scrollSource=e?.scrollSource??null,this._scrollSource?.on(`activeheadingchange`,this.handleActiveHeadingChange),this.applyListeners(e?.listeners)}getPreferredSize(){if(this.getPreferredSizeConstraint()!==null)return super.getPreferredSize();let e=super.getPreferredSize();return e&&{width:Math.max(e.width,Ne),height:e.height}}applyOptions(e){return super.applyOptions(e),e.maxHeadingDepth!==void 0&&(this._options.maxHeadingDepth=e.maxHeadingDepth),this}getMaxHeadingDepth(){return this._options.maxHeadingDepth??this._defaultOptions.maxHeadingDepth??W}setHeadings(e){let t=this.getMaxHeadingDepth(),n=[],r=[],i=new Map,a=new Map;for(let o of e){for(;r.length>0&&r[r.length-1].depth>=o.depth;)r.pop();let e=r.length>0?r[r.length-1].node:null;if(o.depth<=t){let t={label:o.text,data:o.id,children:[]};e?e.children.push(t):n.push(t),i.set(o.id,t),a.set(o.id,o.id),r.push({depth:o.depth,node:t})}else a.set(o.id,e?a.get(e.data)??null:null)}return this._nodesById=i,this._nearestShown=a,this._tree.setNodes(n),this._tree.expandAll(),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}onTreeSelection(e){let t=e[0];!t||t.data===void 0||this.emit(`select`,t.data)}applyActiveHeading(e){if(e===null)return;let t=this._nearestShown.get(e)??null;if(t===null)return;let n=this._nodesById.get(t);n&&this._tree.selectNode(n)}destructor(){this._scrollSource?.off(`activeheadingchange`,this.handleActiveHeadingChange),super.destructor()}},G=o(MarkdownMinimap);u.register(y,b,fe,pe,me);var K=[60,70,90],q=[.85,1,1.15,1.3],J=1,Y=1,Le=32,Re={showMinimap:!0,showControls:!0},MarkdownViewer=class extends d{_markdown;_minimap;_controls;_narrowerBtn;_widerBtn;_zoomOutBtn;_zoomInBtn;_resetBtn;_headings;_widthIndex=J;_zoomIndex=Y;_lastActiveHeadingId=null;_pendingClickScrollTop=null;_listeners=new l;handleNativeScroll=()=>this.onNativeScroll();handleMinimapSelect=e=>this.scrollToHeading(e);_onNarrower=()=>this.stepWidth(-1);_onWider=()=>this.stepWidth(1);_onZoomOut=()=>this.stepZoom(-1);_onZoomIn=()=>this.stepZoom(1);_onReset=()=>this.resetViewerProperties();constructor(e,t){super(e,{...Re,...t??{},layoutManager:new oe,autoScroll:`y`}),this._markdown=new U(e?.markdown,{linkResolver:e?.linkResolver,padding:new r(0,0,0,Le)});let n=new se;n.left=0,n.right=0,this.addComponent(this._markdown,n),this._headings=extractMarkdownHeadings(e?.markdown??``),this._minimap=new G({scrollSource:this,maxHeadingDepth:e?.maxHeadingDepth,corner:`top-right`}),this._minimap.setHeadings(this._headings),this._minimap.on(`select`,this.handleMinimapSelect),this.addComponent(this._minimap,this._minimap.getAnchorConstraints()),this.buildControls(),this.wireControlListeners(),this.addComponent(this._controls,this._controls.getAnchorConstraints()),i.addSubtreeListener(this,`scroll`,this.handleNativeScroll),this.setMinimapVisible(this._options.showMinimap??this._defaultOptions.showMinimap??!0),this.setControlsVisible(this._options.showControls??this._defaultOptions.showControls??!0),this.applyListeners(e?.listeners)}doLayout(){return super.doLayout(),this._minimap?.placeNextTo(this._markdown??null),this}applyOptions(e){return super.applyOptions(e),e.showMinimap!==void 0&&(this._options.showMinimap=e.showMinimap),e.showControls!==void 0&&(this._options.showControls=e.showControls),this}getMarkdown(){return this._markdown}setMarkdown(e){return this._markdown.setMarkdown(e),this._headings=extractMarkdownHeadings(e),this._minimap.setHeadings(this._headings),this}isMinimapVisible(){return this._options.showMinimap??this._defaultOptions.showMinimap??!0}setMinimapVisible(e){return this._options.showMinimap=e,this._minimap.setVisible(e),this}isControlsVisible(){return this._options.showControls??this._defaultOptions.showControls??!0}setControlsVisible(e){return this._options.showControls=e,this._controls.setVisible(e),this}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e,t){this._listeners.fire(e,t)}buildControls(){this._narrowerBtn=this.makeControlButton(`compress`,`Narrower`),this._widerBtn=this.makeControlButton(`expand`,`Wider`),this._zoomOutBtn=this.makeControlButton(`magnifying-glass-minus`,`Zoom out`),this._zoomInBtn=this.makeControlButton(`magnifying-glass-plus`,`Zoom in`),this._resetBtn=this.makeControlButton(`arrows-rotate`,`Reset`),this._controls=new v({corner:`bottom-right`,layoutManager:new p({spacing:4})}),this._controls.addComponent(this._narrowerBtn),this._controls.addComponent(this._widerBtn),this._controls.addComponent(this._zoomOutBtn),this._controls.addComponent(this._zoomInBtn),this._controls.addComponent(this._resetBtn)}makeControlButton(e,t){return new g({glyph:e,text:t,showText:!1})}wireControlListeners(){this._narrowerBtn.on(`action`,this._onNarrower),this._widerBtn.on(`action`,this._onWider),this._zoomOutBtn.on(`action`,this._onZoomOut),this._zoomInBtn.on(`action`,this._onZoomIn),this._resetBtn.on(`action`,this._onReset)}stepWidth(e){this._widthIndex=n.clamp(this._widthIndex+e,0,K.length-1),this._markdown.setMaxMeasure(K[this._widthIndex]+`ch`),this._minimap.placeNextTo(this._markdown)}stepZoom(e){this._zoomIndex=n.clamp(this._zoomIndex+e,0,q.length-1),this._markdown.setFontScale(q[this._zoomIndex]),this._minimap.placeNextTo(this._markdown)}resetViewerProperties(){this._widthIndex=J,this._zoomIndex=Y,this._markdown.setMaxMeasure(null),this._markdown.setFontScale(1),this._minimap.placeNextTo(this._markdown)}onNativeScroll(){let t=this.getScrollElement();if(!t)return;if(this._pendingClickScrollTop!==null){if(e.source.getScrollTop(t)===this._pendingClickScrollTop)return;this._pendingClickScrollTop=null}let n=findActiveHeading(t,this._headings);n!==this._lastActiveHeadingId&&(this._lastActiveHeadingId=n,this.emit(`activeheadingchange`,n))}scrollToHeading(t){let n=this.getScrollElement();if(!n)return;let r=e.source.getElementById(t);if(!r||!e.source.contains(n,r))return;let i=e.source.getElementRect(r).top,a=e.source.getElementRect(n).top;this.setScrollTop(this.getScrollTop()+(i-a)),this._pendingClickScrollTop=this.getScrollTop(),t!==this._lastActiveHeadingId&&(this._lastActiveHeadingId=t,this.emit(`activeheadingchange`,t))}},ze=o(MarkdownViewer),Be={gap:2,insets:new r(0,0,0,0)},IconLabel=class extends c{_glyph;_label;constructor(e,t,n,r,i){super(r,{...Be,...i??{}}),this.setLayoutManager(new m({spacing:this.getGap()}));let a=this._options.glyph??e,o=this._options.text??t,s=this._options.forId??n;this._glyph=new u(a),this._label=new ce(o,s),this.addComponent(this._glyph),this.addComponent(this._label),this._options.gap!==void 0&&this.getLayoutManager().setComponentSpacing(this._options.gap)}applyOptions(e){return super.applyOptions(e),e.gap!==void 0&&(this._options.gap=e.gap),e.glyph!==void 0&&(this._options.glyph=e.glyph),e.text!==void 0&&(this._options.text=e.text),e.forId!==void 0&&(this._options.forId=e.forId),this}setGlyph(e){return this.removeComponent(this._glyph),this._glyph=new u(e),this.insertComponent(this._glyph,0),this}setText(e){return this._label.setText(e),this}setForId(e){return this._label.setForId(e),this}setGap(e){return this._options.gap=e,this.getLayoutManager().setComponentSpacing(e),this}getGap(){return this._options.gap??this._defaultOptions.gap}getGlyphComponent(){return this._glyph}getLabelComponent(){return this._label}},Ve=o(IconLabel);a.ensureKeyframes(`ts-ui-progress-indeterminate`,`0% { transform: translateX(-100%); } 100% { transform: translateX(400%); }`);var ProgressBar=class extends c{_track;_fill;_value;_indeterminate;constructor(e=0,t=!1,r){super(),this._value=n.clamp(e,0,100),this._indeterminate=t,this.setBackgroundColor(`var(--ts-ui-progress-track-bg, rgb(220, 220, 220))`),this.setBorderRadius(`var(--ts-ui-progress-track-radius, 4px)`),this._track=new c,this._track.setOverflow(`hidden`),this._track.setBorderRadius(`var(--ts-ui-progress-track-radius, 4px)`),this._fill=new c,this._fill.setBackgroundColor(`var(--ts-ui-progress-fill-bg, rgb(30, 100, 200))`),this._track.addComponent(this._fill),super.addComponent(this._track),this.getAria().setRole(`progressbar`),this.getAria().setValueMin(0),this.getAria().setValueMax(100),this.getAria().setValueNow(this._value),this._indeterminate&&this.applyIndeterminate(!0),r&&this.applyOptions(r)}applyOptions(e){return super.applyOptions(e),e.indeterminate!==void 0&&this.setIndeterminate(e.indeterminate),e.value!==void 0&&this.setValue(e.value),this}getBaseline(){let e=this.getPreferredSize();return e?e.height-2:null}getValue(){return this._indeterminate?0:this._value}setValue(e){let t=n.clamp(e,0,100);return t===this._value?this:(this._value=t,this.getAria().setValueNow(t),this._indeterminate||this.scheduleLayout(),this)}isIndeterminate(){return this._indeterminate}setIndeterminate(e){return this._indeterminate===e?this:(this._indeterminate=e,this.applyIndeterminate(e),this.flushLayout(),this)}doLayout(){let e=this.getContentBounds();if(!e)return super.doLayout(),this;if(this._track.setX(e.x),this._track.setY(e.y),this._track.setSize({width:e.width,height:e.height}),this._indeterminate){let t=Math.max(20,Math.round(e.width*.25));this._fill.setX(0),this._fill.setY(0),this._fill.setSize({width:t,height:e.height})}else{let t=Math.round(e.width*this._value/100);this._fill.setX(0),this._fill.setY(0),this._fill.setSize({width:t,height:e.height})}return super.doLayout(),this}applyIndeterminate(e){e?(this._fill.setBackgroundColor(`var(--ts-ui-progress-indeterminate-bg, rgb(30, 100, 200))`),this._fill.setAnimation(`ts-ui-progress-indeterminate 1.4s ease-in-out infinite`)):(this._fill.setBackgroundColor(`var(--ts-ui-progress-fill-bg, rgb(30, 100, 200))`),this._fill.clearAnimation())}},He=o(ProgressBar);u.register(he,ie,ae,ge);var PaginationBar=class extends c{_store;_firstBtn;_prevBtn;_nextBtn;_lastBtn;_pageText;_onStoreUpdate=()=>this.refresh();constructor(e,t){super(),this._store=e;let n=new m;n.setComponentSpacing(4),this.setLayoutManager(n),this._firstBtn=new g({glyph:`angles-left`}),this._prevBtn=new g({glyph:`angle-left`}),this._pageText=new f(`Page x of y`),this._nextBtn=new g({glyph:`angle-right`}),this._lastBtn=new g({glyph:`angles-right`}),this._firstBtn.setPreferredSize({width:28,height:28}),this._prevBtn.setPreferredSize({width:28,height:28}),this._nextBtn.setPreferredSize({width:28,height:28}),this._lastBtn.setPreferredSize({width:28,height:28}),this._pageText.centerInHeight(28),this._firstBtn.on(`action`,()=>{this._store.goToPage(1)}),this._prevBtn.on(`action`,()=>this._store.prevPage()),this._nextBtn.on(`action`,()=>this._store.nextPage()),this._lastBtn.on(`action`,()=>{let e=this._store.getTotalPages();this._store.goToPage(e??this._store.getPage())}),this.addComponent(this._firstBtn),this.addComponent(this._prevBtn),this.addComponent(this._pageText),this.addComponent(this._nextBtn),this.addComponent(this._lastBtn),this._store.on(`pagechange`,this._onStoreUpdate),this._store.on(`load`,this._onStoreUpdate),this._store.on(`datachange`,this._onStoreUpdate),this._store.on(`add`,this._onStoreUpdate),this._store.on(`remove`,this._onStoreUpdate),this._store.on(`sync`,this._onStoreUpdate),this.refresh(),t&&this.applyOptions(t)}applyOptions(e){return super.applyOptions(e),e.pageSize!==void 0&&this._store.setPageSize(e.pageSize),e.pageIndex!==void 0&&this._store.goToPage(e.pageIndex),this}destructor(){this._store.off(`pagechange`,this._onStoreUpdate),this._store.off(`load`,this._onStoreUpdate),this._store.off(`datachange`,this._onStoreUpdate),this._store.off(`add`,this._onStoreUpdate),this._store.off(`remove`,this._onStoreUpdate),this._store.off(`sync`,this._onStoreUpdate),super.destructor()}refresh(){let e=this._store.getPage(),t=this._store.getTotalPages(),n=this._store.hasPendingChanges(),r=t==null?`Page ${e}`:`Page ${e} of ${t}`;this._pageText.setText(r),this._firstBtn.setEnabled(!n&&e>1),this._prevBtn.setEnabled(!n&&e>1),this._nextBtn.setEnabled(!n&&(t==null||e<t)),this._lastBtn.setEnabled(!n&&t!=null&&e<t)}},X=o(PaginationBar),Ue=[`timeupdate`,`play`,`pause`,`ended`,`loadedmetadata`,`durationchange`,`volumechange`,`ratechange`],We=1,Ge=1,Ke={tag:`video`},Video=class extends c{_listeners=new l;_mediaHandlers=new Map;constructor(e,t){super(e,{...Ke,...t??{}}),this.clearInsets(),this.getAria().setLabel(`Video`),this.buildMediaHandlers(),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.src!==void 0&&this.setSrc(e.src),e.poster!==void 0&&this.setPoster(e.poster),e.autoplay!==void 0&&this.setAutoplay(e.autoplay),e.loop!==void 0&&this.setLoop(e.loop),e.preload!==void 0&&this.setPreload(e.preload),e.muted!==void 0&&this.setMuted(e.muted),e.volume!==void 0&&this.setVolume(e.volume),e.playbackRate!==void 0&&this.setPlaybackRate(e.playbackRate),this}getSrc(){return this._options.src??null}setSrc(e){return this._options.src=e,this.setElementAttribute(`src`,e),this}getPoster(){return this._options.poster??null}setPoster(e){return this._options.poster=e,this.setElementAttribute(`poster`,e),this}isAutoplay(){return this._options.autoplay??!1}setAutoplay(e){return this._options.autoplay=e,this.setElementAttribute(`autoplay`,e?``:null),this}isLoop(){return this._options.loop??!1}setLoop(e){return this._options.loop=e,this.setElementAttribute(`loop`,e?``:null),this}isMuted(){return this._options.muted??!1}setMuted(t){this._options.muted=t,this.setElementAttribute(`muted`,t?``:null);let n=this.getElement();return n&&e.sink.setMuted(n,t),this}getPreload(){return this._options.preload??null}setPreload(e){return this._options.preload=e,this.setElementAttribute(`preload`,e),this}getVolume(){return this._options.volume??We}setVolume(t){let n=Math.max(0,Math.min(1,t));this._options.volume=n;let r=this.getElement();return r&&e.sink.setVolume(r,n),this}getPlaybackRate(){return this._options.playbackRate??Ge}setPlaybackRate(t){this._options.playbackRate=t;let n=this.getElement();return n&&e.sink.setPlaybackRate(n,t),this}setCurrentTime(t){let n=this.getElement();return n&&e.sink.setCurrentTime(n,t),this}play(){let t=this.getElement();return t&&e.sink.mediaPlay(t),this}pause(){let t=this.getElement();return t&&e.sink.mediaPause(t),this}getMediaState(){let t=this.getElement();return t?e.source.getMediaState(t):{currentTime:0,duration:0,paused:!0,ended:!1,volume:this.getVolume(),muted:this.isMuted(),playbackRate:this.getPlaybackRate()}}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e){this._listeners.fire(e)}init(e){super.init(e);let t=e??this.getElement();return t?(this.replayMediaOptions(t),this.attachMediaListeners(t),this):this}destructor(){let t=this.getElement();if(t)for(let[n,r]of this._mediaHandlers)e.sink.removeListener(t,n,r);super.destructor()}buildMediaHandlers(){for(let e of Ue)this._mediaHandlers.set(e,()=>this.emit(e))}replayMediaOptions(t){let n=this._options,r={};n.src!==void 0&&(r.src=n.src),n.poster!==void 0&&(r.poster=n.poster),n.preload!==void 0&&(r.preload=n.preload),n.autoplay&&(r.autoplay=``),n.loop&&(r.loop=``),n.muted&&(r.muted=``),Object.keys(r).length>0&&e.sink.apply(t,{setAttr:r}),n.muted!==void 0&&e.sink.setMuted(t,n.muted),n.volume!==void 0&&e.sink.setVolume(t,n.volume),n.playbackRate!==void 0&&e.sink.setPlaybackRate(t,n.playbackRate)}attachMediaListeners(t){for(let[n,r]of this._mediaHandlers)e.sink.addListener(t,n,r)}},Z=o(Video),ProgressiveEngine=class{load(e,t){e.setSrc(t)}destroy(){}};u.register(_e,ve,ye,be,b,y);var Q=28,$=80,qe=28,Je=.05,Ye=6;function formatMediaTime(e){if(!Number.isFinite(e)||e<0)return`0:00`;let t=Math.floor(e),n=t%60,r=Math.floor(t/60)%60,i=Math.floor(t/3600),a=String(n).padStart(2,`0`);return i>=1?`${i}:${String(r).padStart(2,`0`)}:${a}`:`${r}:${a}`}var VideoPlayer=class extends c{_video;_controls;_playBtn;_scrubber;_timeText;_muteBtn;_volume;_fullscreenBtn;_engine=new ProgressiveEngine;_playing=!1;_fullscreen=!1;_scrubbing=!1;_syncing=!1;_listeners=new l;_onPlayButton=()=>this.togglePlay();_onMuteButton=()=>this.setMuted(!this.isMuted());_onFullscreenButton=()=>this.toggleFullscreen();_onScrub=()=>this.beginScrub();_onVolumeChange=e=>this.onVolumeSlider(e);_onVideoPlay=()=>this.onVideoPlay();_onVideoPause=()=>this.onVideoPause();_onVideoEnded=()=>this.onVideoEnded();_onVideoTimeUpdate=()=>this.onVideoTimeUpdate();_onVideoSync=()=>this.syncFromVideo();_onFullscreenChange=()=>this.syncFullscreen();constructor(e){super(),this.setLayoutManager(new te),this.getAria().setRole(`region`),this.getAria().setLabel(`Video player`),this._video=new Z,this.buildControlBar(),this.wireControlListeners(),this.wireVideoListeners(),this.addComponent(this._video,{placement:h.CENTER}),this.addComponent(this._controls,{placement:h.SOUTH}),this.syncFromState(this._video.getMediaState()),e&&this.applyOptions(e),this.applyListeners(e?.listeners)}applyOptions(e){return super.applyOptions(e),e.engine!==void 0&&(this._engine=e.engine),e.src!==void 0&&this.setSrc(e.src),e.poster!==void 0&&this._video.setPoster(e.poster),e.autoplay!==void 0&&this._video.setAutoplay(e.autoplay),e.loop!==void 0&&this._video.setLoop(e.loop),e.muted!==void 0&&this._video.setMuted(e.muted),e.volume!==void 0&&this._video.setVolume(e.volume),e.playbackRate!==void 0&&this._video.setPlaybackRate(e.playbackRate),e.controls!==void 0&&this.setControlsVisible(e.controls),this}getSrc(){return this._video.getSrc()}setSrc(e){return this._engine.destroy(),this._engine.load(this._video,e),this}getVolume(){return this._video.getVolume()}setVolume(e){return this._video.setVolume(e),this.syncFromVideo(),this}isMuted(){return this._video.isMuted()}setMuted(e){return this._video.setMuted(e),this.syncFromVideo(),this}getPlaybackRate(){return this._video.getPlaybackRate()}setPlaybackRate(e){return this._video.setPlaybackRate(e),this}setCurrentTime(e){return this._video.setCurrentTime(e),this}getCurrentTime(){return this._video.getMediaState().currentTime}getDuration(){return this._video.getMediaState().duration}isPlaying(){return this._playing}play(){return this._video.play(),this}pause(){return this._video.pause(),this}togglePlay(){return this._playing?this.pause():this.play()}isControlsVisible(){return this._options.controls??!0}setControlsVisible(e){return this._options.controls=e,this._controls.setVisible(e),this}isFullscreen(){return this._fullscreen}enterFullscreen(){let t=this.getElement();return t&&e.sink.requestFullscreen(t),this}exitFullscreen(){return e.sink.exitFullscreen(),this}toggleFullscreen(){return this._fullscreen?this.exitFullscreen():this.enterFullscreen()}on(e,t){return this._listeners.add(e,t),this}off(e,t){return this._listeners.remove(e,t),this}emit(e){this._listeners.fire(e)}init(t){super.init(t);let n=t??this.getElement();return n?(e.sink.addListener(n,`fullscreenchange`,this._onFullscreenChange),this.syncFromVideo(),this):this}destructor(){let t=this.getElement();t&&e.sink.removeListener(t,`fullscreenchange`,this._onFullscreenChange),super.destructor()}syncFromState(e){this._syncing=!0;try{this._scrubbing||(this._scrubber.setMax(e.duration||0),this._scrubber.setValue(e.currentTime)),this._timeText.setText(`${formatMediaTime(e.currentTime)} / ${formatMediaTime(e.duration)}`),this._playBtn.setGlyph(e.paused?`play`:`pause`),this._muteBtn.setGlyph(e.muted||e.volume===0?`volume-mute`:`volume-high`),this._volume.setValue(e.muted?0:e.volume)}finally{this._syncing=!1}}syncFromVideo(){this.syncFromState(this._video.getMediaState())}buildControlBar(){this._playBtn=this.makeControlButton(`play`,`Play`),this._muteBtn=this.makeControlButton(`volume-high`,`Mute`),this._fullscreenBtn=this.makeControlButton(`expand`,`Fullscreen`),this._scrubber=new _({min:0,max:0,value:0}),this._scrubber.getAria().setLabel(`Seek`),this._volume=new _({min:0,max:1,step:Je,value:1}),this._volume.getAria().setLabel(`Volume`),this._volume.setPreferredSize({width:$,height:this._volume.getPreferredSize().height}),this._volume.setMaxSize({width:$,height:this._volume.getPreferredSize().height}),this._timeText=new f(`0:00 / 0:00`),this._timeText.centerInHeight(qe);let e=new m;e.setComponentSpacing(Ye),this._controls=new c,this._controls.setLayoutManager(e),this._controls.setBackgroundColor(`var(--ts-ui-body-bg, rgb(255, 255, 255))`),this._controls.addComponent(this._playBtn),this._controls.addComponent(this._scrubber,{weight:1}),this._controls.addComponent(this._timeText),this._controls.addComponent(this._muteBtn),this._controls.addComponent(this._volume),this._controls.addComponent(this._fullscreenBtn)}makeControlButton(e,t){let n=new g({glyph:e,text:t,showText:!1});return n.setPreferredSize({width:Q,height:Q}),n}wireControlListeners(){this._playBtn.on(`action`,this._onPlayButton),this._muteBtn.on(`action`,this._onMuteButton),this._fullscreenBtn.on(`action`,this._onFullscreenButton),this._scrubber.on(`action`,this._onScrub),this._volume.on(`change`,this._onVolumeChange)}wireVideoListeners(){this._video.on(`play`,this._onVideoPlay),this._video.on(`pause`,this._onVideoPause),this._video.on(`ended`,this._onVideoEnded),this._video.on(`timeupdate`,this._onVideoTimeUpdate),this._video.on(`durationchange`,this._onVideoSync),this._video.on(`loadedmetadata`,this._onVideoSync),this._video.on(`volumechange`,this._onVideoSync),this._video.on(`ratechange`,this._onVideoSync)}beginScrub(){this._syncing||(this._scrubbing=!0,this._video.setCurrentTime(this._scrubber.getValue()))}onVolumeSlider(e){this._syncing||(this._video.setVolume(e),this.syncFromVideo())}onVideoPlay(){this._playing=!0,this.syncFromVideo(),this.emit(`play`)}onVideoPause(){this._playing=!1,this.syncFromVideo(),this.emit(`pause`)}onVideoEnded(){this._playing=!1,this.syncFromVideo(),this.emit(`ended`)}onVideoTimeUpdate(){this.syncFromVideo(),this._scrubbing=!1}syncFullscreen(){let t=e.source.getFullscreenElement(),n=this.getElement();this._fullscreen=n!=null&&t===n,this._fullscreenBtn.setGlyph(this._fullscreen?`compress`:`expand`),this.doLayout()}getInnerSize(){if(this._fullscreen&&this.getElement()){let t=e.source.getViewportSize(),n=this.getPerimeterSize();return{width:t.width-n.left-n.right,height:t.height-n.top-n.bottom}}return super.getInnerSize()}},Xe=o(VideoPlayer);export{Se as Canvas,u as Glyph,re as Header,Ve as IconLabel,le as IconText,Ee as Image,U as Markdown,G as MarkdownMinimap,ze as MarkdownViewer,X as PaginationBar,He as ProgressBar,ne as ProgressSpinner,ProgressiveEngine,Z as Video,Xe as VideoPlayer,we as WebGLCanvas,extractMarkdownHeadings,findActiveHeading};
|
|
2
2
|
//# sourceMappingURL=display.es.js.map
|