<commit_before>"use strict";

class gsuiBlocksManager {
	constructor( root ) {
		this.rootElement = root;
		this.__offset = 0;
		this.__fontSize = 16;
		this.__pxPerBeat = 64;
		this.__blcs = new Map();
		this.__blcsEditing = new Map();
		this.__blcsSelected = new Map();
		this.__uiPanels = new gsuiPanels( root );
		this.__uiTimeline = new gsuiTimeline();
		this.__elPanGridWidth = 0;
		this.__elLoopA = root.querySelector( ".gsuiBlocksManager-loopA" );
		this.__elLoopB = root.querySelector( ".gsuiBlocksManager-loopB" );
		this.__selection = root.querySelector( ".gsuiBlocksManager-selection" );
		this.__elPanGrid = root.querySelector( ".gsuiBlocksManager-gridPanel" );
		this.__sideContent = root.querySelector( ".gsuiBlocksManager-sidePanelContent" );
		this.__elCurrentTime = root.querySelector( ".gsuiBlocksManager-currentTime" );
		this.__rowsContainer = root.querySelector( ".gsuiBlocksManager-rows" );
		this.__rowsWrapinContainer = root.querySelector( ".gsuiBlocksManager-rowsWrapin" );
		this.__uiBeatlines = new gsuiBeatlines( this.__rowsContainer );
		this.__rows = this.__rowsContainer.getElementsByClassName( "gsui-row" );

		this.onaddBlock =
		this.oneditBlock =
		this.onremoveBlock =
		this.onchange =
		this.onchangeLoop =
		this.onchangeCurrentTime = () => {};
		this.__elPanGrid.onresizing = this.__gridPanelResizing.bind( this );
		this.__uiTimeline.oninputLoop = this.__loop.bind( this );
		this.__uiTimeline.onchangeLoop = ( isLoop, a, b ) => this.onchangeLoop( isLoop, a, b );
		this.__uiTimeline.onchangeCurrentTime = t => {
			this.__currentTime( t );
			this.onchangeCurrentTime( t );
		};
		root.querySelector( ".gsuiBlocksManager-timelineWrap" ).append( this.__uiTimeline.rootElement );

		this.__rowsContainer.oncontextmenu =
		root.ondragstart = () => false;
		root.onkeydown = this._onkeydown.bind( this );
		this.__rowsScrollTop = -1;
		this.__rowsScrollLeft = -1;
		this.__sideContent.onwheel = this.__onwheelPanelContent.bind( this );
		this.__sideContent.onscroll = this.__onscrollPanelContent.bind( this );
		this.__rowsContainer.onwheel = this.__onwheelRows.bind( this );
		this.__rowsContainer.onscroll = this.__onscrollRows.bind( this );
		root.onwheel = e => { e.ctrlKey && e.preventDefault(); };

		this.uiBlc = {
			when( el, v ) { el.style.left = v + "em"; },
			duration( el, v ) { el.style.width = v + "em"; },
			selected( el, v ) { el.classList.toggle( "gsuiBlocksManager-block-selected", !!v ); },
			deleted( el, v ) { el.classList.toggle( "gsuiBlocksManager-block-hidden", !!v ); },
		};
		this.__eventReset();
	}

	// Public methods
	// ............................................................................................
	timeSignature( a, b ) {
		this.__uiTimeline.timeSignature( a, b );
		this.__uiBeatlines.timeSignature( a, b );<commit_msg>gsuiBlocksManager: constructor, init timeSignature/pxPerBeat<commit_after>"use strict";

class gsuiBlocksManager {
	constructor( root ) {
		this.rootElement = root;
		this.__offset = 0;
		this.__fontSize = 16;
		this.__blcs = new Map();
		this.__blcsEditing = new Map();
		this.__blcsSelected = new Map();
		this.__uiPanels = new gsuiPanels( root );
		this.__uiTimeline = new gsuiTimeline();
		this.__elPanGridWidth = 0;
		this.__elLoopA = root.querySelector( ".gsuiBlocksManager-loopA" );
		this.__elLoopB = root.querySelector( ".gsuiBlocksManager-loopB" );
		this.__selection = root.querySelector( ".gsuiBlocksManager-selection" );
		this.__elPanGrid = root.querySelector( ".gsuiBlocksManager-gridPanel" );
		this.__sideContent = root.querySelector( ".gsuiBlocksManager-sidePanelContent" );
		this.__elCurrentTime = root.querySelector( ".gsuiBlocksManager-currentTime" );
		this.__rowsContainer = root.querySelector( ".gsuiBlocksManager-rows" );
		this.__rowsWrapinContainer = root.querySelector( ".gsuiBlocksManager-rowsWrapin" );
		this.__uiBeatlines = new gsuiBeatlines( this.__rowsContainer );
		this.__rows = this.__rowsContainer.getElementsByClassName( "gsui-row" );

		this.onaddBlock =
		this.oneditBlock =
		this.onremoveBlock =
		this.onchange =
		this.onchangeLoop =
		this.onchangeCurrentTime = () => {};
		this.__elPanGrid.onresizing = this.__gridPanelResizing.bind( this );
		this.__uiTimeline.oninputLoop = this.__loop.bind( this );
		this.__uiTimeline.onchangeLoop = ( isLoop, a, b ) => this.onchangeLoop( isLoop, a, b );
		this.__uiTimeline.onchangeCurrentTime = t => {
			this.__currentTime( t );
			this.onchangeCurrentTime( t );
		};
		root.querySelector( ".gsuiBlocksManager-timelineWrap" ).append( this.__uiTimeline.rootElement );

		this.__rowsContainer.oncontextmenu =
		root.ondragstart = () => false;
		root.onkeydown = this._onkeydown.bind( this );
		this.__rowsScrollTop = -1;
		this.__rowsScrollLeft = -1;
		this.__sideContent.onwheel = this.__onwheelPanelContent.bind( this );
		this.__sideContent.onscroll = this.__onscrollPanelContent.bind( this );
		this.__rowsContainer.onwheel = this.__onwheelRows.bind( this );
		this.__rowsContainer.onscroll = this.__onscrollRows.bind( this );
		root.onwheel = e => { e.ctrlKey && e.preventDefault(); };

		this.uiBlc = {
			when( el, v ) { el.style.left = v + "em"; },
			duration( el, v ) { el.style.width = v + "em"; },
			selected( el, v ) { el.classList.toggle( "gsuiBlocksManager-block-selected", !!v ); },
			deleted( el, v ) { el.classList.toggle( "gsuiBlocksManager-block-hidden", !!v ); },
		};
		this.__eventReset();
		this.setPxPerBeat( 64 );
		this.timeSignature( 4, 4 );
	}

	// Public methods
	// ............................................................................................
	timeSignature( a, b ) {
		this.__uiTimeline.timeSignature( a, b );
		this.__uiBeatlines.timeSignature( a, b );
{'fraction_non_alphanumeric': 0.17002982979470083, 'fraction_numerical': 0.0031584488506755572, 'mean_word_length': 3.6721311475409837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1544239', 'n_tokens_mistral': 1949, 'n_tokens_neox': 1857, 'n_words': 318}