:: introCharacterSelectWidgets[widget]
	<<widget 'characterSelect'>>
		/*
			Args
				0: starting category
				1: Passage to direct to after selection
			Contents
				What to display on the front page
		 */
		<<set _finalPassage = _args[1]>>
		<<set _categories = setup.getStartingCharactersByFilter({parent: _args[0]})>>
		<<set _returnPassage = _args[2]>>
		<<for _categoryKey, _categoryData range _categories>>
			<<set _hidden = _categoryData.hidden>>
			<<set _label = _categoryData.label>>
			<<if $DEBUGGING && _hidden>>
				<<set _hidden = false>>
				<<set _label = 'DEBUG: '+_label>>
			<</if>>

			<<if !_categoryData.disabled && !_hidden>>
				<<act _label undefined `{capture:['_categoryKey','_finalPassage']}`>><<gt 'introCharacterSelectFromCategory' _categoryKey _returnPassage _finalPassage>><</act>>
			<</if>>
		<</for>>
	<</widget>>

:: introCharacterSelectFromCategory[quest]
	<<set _categoryKey =  $location_var[$here][0]>>
	<<set _returnPassage =  $location_var[$here][1]>>
	<<set _finalPassage =  $location_var[$here][2]>>
	
	<<act 'Back to overview'>><<gt _returnPassage>><</act>>

	
	<<set _categoryData = setup.getStartingCharacter(_categoryKey)>>
	<h2>_categoryData.label</h2>
	<<image _categoryData.image>>
	<p>_categoryData.desc</p>

	<<set _options = setup.getStartingCharactersByFilter({parent: _categoryKey})>>

	<<for _optionKey, _optionData range _options>>
		<<if !_optionData.disabled>>
			<<act _optionData.label undefined `{capture:['_optionKey']}`>><<gt 'introCharacterSelectDetails' _optionKey _returnPassage _finalPassage>><</act>>
		<</if>>
	<</for>>


:: introCharacterSelectDetails[quest]
	<<set _optionKey =  $location_var[$here][0]>>
	<<set _returnPassage =  $location_var[$here][1]>>
	<<set _finalPassage =  $location_var[$here][2]>>

	<<set _optionData = setup.getStartingCharacter(_optionKey)>>

	<<debug>>
		<pre>
		<<=JSON.stringify(_optionData,null,'\t') >>
		</pre>
	<</debug>>

	<h2>_optionData.label</h2>
	<<image _optionData.image>>
	<p>_optionData.desc</p>

	<<act 'Back to overview'>><<gt _returnPassage>><</act>>
	<<act 'Confirm this option'>>
		<<gs 'introCharacterSelectApply' _optionKey>>
		<<gt _finalPassage>>
	<</act>>
	<<act 'Customize this option'>>
		<<gs 'introCharacterSelectApply' _optionKey>>
		<<gt 'introCustomize' _finalPassage>>
	<</act>>

:: introCharacterSelectApply[include]
	<<set _optionKey =  $location_var[$here][0]>>
	<<set _optionData = setup.getStartingCharacter(_optionKey)>>

	<<run setup.startingCharacterApply(_optionKey)>>

	<!-- Start Passage -->
	<<set _finalPassage ??= _optionData.passage ?? ''>>

	

