
<narabi_yoso>
    <style scoped>
    </style>

    <div class="BetRaceHead_Wrap {vote_mode == 'TIPSTAR' ? 'tipstar' : ''}">
        <div class="BetRaceHead_WrapInner">
            <span class="BetRaceHead_Txt01" if={ Object.keys(cur_race).length >= 1 }>{ cur_race.jyo } {day_count} { edit_race_num(race_id) }</span>
            <span class="BetRaceHead_Txt02"><span>{ cur_race.race_name }</span><span class="BetRaceHead_Txt03" if={ cur_race.close }>締切 { cur_race.close }</span></span>


            <div class="voteSelectWrap">
                <button id="voteMenuButton" class="voteButton jsVoteBtn">{vote_mode} 投票</button>
                <ul id="voteTypeMenu" class="voteTypeMenu jsMenuType">
                    <li data-value="netkeirin" onclick="{changeBetMode.bind(this, 'netkeirin')}" class="{vote_mode == 'netkeirin' ? 'isActive' : ''}"><span class="check"></span>netkeirin</li>
                    <li data-value="tipstar" onclick="{changeBetMode.bind(this, 'TIPSTAR')}" class="{vote_mode == 'TIPSTAR' ? 'isActive' : ''}"><span class="check"></span>TIPSTAR</li>
                </ul>
            </div>

            <!-- <select name="vote_type">
                <option value="netkeirin">netkeirin</option>
                <option value="tipstar">TIPSTAR</option>
            </select> -->
            <!--<ul if={ race_id } class="BetRaceHead_Link">
                <li>
                    <a href="{ args.keirin_url }{kaisai_mode}/entry/?race_id={ race_id }">出走表</a>
                </li>
                <li>
                    <a href="javascript:void(0);" id="RaceChoiceBtn" onClick={ act_race_choice.bind(this) }>レース選択</a>
                </li>
            </ul>-->
        </div>
    </div><!-- /.BetRaceHead_Wrap -->

	<!--section if={ line.length > 0 } class="DeployYoso" style="display: none"-->
	<section if={ is_narabi_show } class="DeployYoso">
		<div class="DeployYosoWrap">

			<div each={ syaban_list, key in line } class="DeployBox Grid3">
				<div class="DeployInBox"><svg if={ key == line.length - 1 } width="18" height="16" viewBox="0 0 64 64"><title>左矢印</title><path fill-rule="evenodd" d="M64 20 L28 20 L28 8 L0 32 L28 56 L28 44 L64 44 Z" fill="#ffba00"></path></svg></div>
					<div each={ syaban, idx in syaban_list } class="DeployInBox">
						<div class="Shaban_InBox">
							<span class="{edit_class(syaban)}">{syaban}</span>
						</div><!-- /.Shaban_InBox -->
					</div><!-- /.DeployInBox -->
			</div><!-- /.DeployBox -->

		</div><!-- /.DeployYosoWrap -->
	</section>


<virtual if={ is_show }>
    <div class="HalfModal RaceChoiceArea">
        <div class="RaceChoiceWrap">
            <ul class="RaceChoiceSelect">
                <li class="RaceChoice_tab { tab_flag['vote'] ? 'active' : '' }" onclick="{changeTab.bind(this, 'vote')}"><a href="javascript:void(0);">発売中</a></li>
                <li class="RaceChoice_tab { tab_flag['jyo'] ? 'active' : '' }" onclick="{changeTab.bind(this, 'jyo')}"><a href="javascript:void(0);">場別一覧</a></li>
            </ul>
            <div class="RaceChoice_list sale_list { tab_flag['vote'] ? 'active' : '' }">
                <ul>
                    <li each={ race, idx in vote_list } if="{ race }">
                        <div class="RaceList_Item01">
                            <div class="Race_Num">
                                <span if="{ race['jyo_cd'] <= '90' }">{ jyo_list[race['jyo_cd']] }</span>
                                <span if="{ race['jyo_cd'] > '90' }" class="Pist6_Icon">
                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.736 12.824">
                                        <path d="M21.506,2.908a2.69,2.69,0,0,0-2.118-.851H15.916l-1.535,8.7h1.767l.577-3.2H18.45A3.307,3.307,0,0,0,21.937,4.78a2.222,2.222,0,0,0-.431-1.873m-4.079.67h1.725a1.035,1.035,0,0,1,.825.317,1.093,1.093,0,0,1,.176.915,1.551,1.551,0,0,1-1.469,1.239H16.991Z"></path>
                                        <path d="M21.774,10.76h1.779l1.535-8.7H23.309Z"></path>
                                        <path d="M29.767,1.826c-1.934,0-3.525,1.061-3.783,2.522-.248,1.4.393,2.267,1.959,2.636l1.609.389c.467.125,1,.4.9.991a1.847,1.847,0,0,1-2.059,1.107A1.706,1.706,0,0,1,27.132,8.9a1.229,1.229,0,0,1-.23-.961l.019-.107H25.154l-.013.075a2.522,2.522,0,0,0,.514,2.043,3.149,3.149,0,0,0,2.5,1.046h.1c1.736,0,3.665-.955,3.954-2.6C32.455,7,31.74,6.04,30.14,5.621l-1.61-.389c-.6-.152-.859-.445-.784-.87.1-.562.9-1.02,1.783-1.02a1.6,1.6,0,0,1,1.255.474A.971.971,0,0,1,31,4.623l-.019.107h1.779l.013-.075a2.258,2.258,0,0,0-.447-1.881,3.214,3.214,0,0,0-2.558-.952"></path>
                                        <path d="M40.857,2.057h-7.1l-.281,1.594h2.666l-1.253,7.108h1.767l1.253-7.108h2.666Z"></path>
                                        <path d="M46.049,2.736a2.217,2.217,0,0,0-1.833-.679C42.38,2.194,41,3.77,40.321,6.5a4.346,4.346,0,0,0,.371,3.672,2.3,2.3,0,0,0,1.914.823,3.673,3.673,0,0,0,3.452-3.13,2.391,2.391,0,0,0-.422-1.984,2.314,2.314,0,0,0-1.848-.74,2.958,2.958,0,0,0-1.48.477c.358-1.34,1.109-2,1.687-2.048a.672.672,0,0,1,.535.146.883.883,0,0,1,.2.686v.094h1.752l.013-.075a1.946,1.946,0,0,0-.446-1.68m-1.771,5.2a1.654,1.654,0,0,1-1.545,1.531.851.851,0,0,1-.673-.308,1.412,1.412,0,0,1-.241-1.143,1.6,1.6,0,0,1,1.5-1.361.952.952,0,0,1,.759.314,1.168,1.168,0,0,1,.2.967"></path>
                                        <path d="M46.287,9.5h1v.141h-.424v1.094h-.154V9.644h-.424Zm2.449,0v1.236h-.154V9.691L48.2,10.739H48.04l-.378-1.048v1.048h-.154V9.5h.246l.368,1.033L48.49,9.5Z"></path>
                                        <path d="M6.412,0a6.412,6.412,0,1,0,6.412,6.412h0A6.412,6.412,0,0,0,6.412,0Zm.331,9.837a3.19,3.19,0,0,1-1.651-.458l-.079.448H2.875l1.206-6.84H6.218l-.087.5A3.206,3.206,0,1,1,6.742,9.84Z"></path>
                                    </svg>
                                </span>
                                <span>{ race['race_id'].substr(10, 2).replace(/^0/, '') }R</span>
                            </div>
                            <img if="{ campaign_badge_race_id_list.includes(race['race_id']) }" src="{ args.cdn_keirin_url }/common/img/race/campaignBadge.png" class="commonCampaignBadge" alt="最大5%">
                        </div>
                        <div class="RaceList_Item02">
                            <div class="Race_TitleBox">
                                <div class="Race_Rank">{race['race_name']}</div>
                                <div class="Race_Group Content_Icon_Text">
                                <span class="Race_Day">{edit_make_day_count(race)}</span>
                                <span if="{ race['kaisai']['grade_icon'] }" class="Icon_RaceMark Icon_Grade Icon_GradeType{ race['kaisai']['grade_icon'] }">{ race['kaisai']['grade_name'] }</span>
                                <span if="{ race['kaisai']['is_girls'] == '1' }" class="Icon_RaceMark Girls" aria-label="ガールズ"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2106 -2355)"><rect width="18" height="14" transform="translate(-2106 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2103.3 2356.4)"><path d="M1541.137,669.152a3.51,3.51,0,0,0-2.6-1.117,3.29,3.29,0,0,0-2.039.7.825.825,0,1,1-1.649,0,3.289,3.289,0,0,0-2.039-.7,3.51,3.51,0,0,0-2.6,1.117,3.982,3.982,0,0,0-1.03,2.738,4.743,4.743,0,0,0,1.287,3.125A27.291,27.291,0,0,0,1533.7,678c.446.376.953.8,1.478,1.256a.769.769,0,0,0,1,0c.526-.454,1.032-.881,1.479-1.257a27.273,27.273,0,0,0,3.222-2.988,4.74,4.74,0,0,0,1.287-3.125,3.982,3.982,0,0,0-1.03-2.738Zm0,0" transform="translate(-1529.188 -668.035)" fill="#fff"/></g></g></svg></span>
                                <span if="{ race['kaisai']['is_night'] == '1' }" class="Icon_RaceMark Nighter" aria-label="ナイター"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2079 -2355)"><rect width="18" height="14" transform="translate(-2079 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2075.174 2356.2)"><path d="M29.221,8.52A5.566,5.566,0,1,1,23.819,0a.067.067,0,0,1,.062.107,5.258,5.258,0,0,0,5.27,8.311A.067.067,0,0,1,29.221,8.52Z" transform="translate(-18.968 0)" fill="#efda45"/></g></g></svg></span>
                                <span if="{ race['kaisai']['is_midnight'] == '1' }" class="Icon_RaceMark MidNight" aria-label="ミッドナイト"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2052 -2355)"><rect width="18" height="14" transform="translate(-2052 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2050 2355.833)"><path d="M427.453,205.549l-.108-.029h0l-.079-.021a.216.216,0,0,1-.16-.2l-.01-.195a.216.216,0,0,0-.4-.105l-.106.163a.216.216,0,0,1-.238.091l-.188-.05a.216.216,0,0,0-.224.346l.122.152a.215.215,0,0,1,.037.2h0a.215.215,0,0,1-.022.052l-.106.163a.216.216,0,0,0,.26.32l.181-.07a.216.216,0,0,1,.246.065l.122.152a.216.216,0,0,0,.384-.147l-.01-.195a.216.216,0,0,1,.138-.213l.181-.07a.216.216,0,0,0-.023-.41Z" transform="translate(-416.347 -204.686)" fill="#ffd839"/><g transform="translate(0.303)"><path d="M128.727,224.337a.216.216,0,0,0-.224-.346l-.925.249a.209.209,0,0,1-.086,0l-1.233,2.308-.012.227a.216.216,0,0,0,.384.148l.6-.744a.216.216,0,0,1,.246-.065l.894.343a.216.216,0,0,0,.26-.32l-.523-.8a.217.217,0,0,1,.013-.254Z" transform="translate(-125.126 -223.249)" fill="#ffaf46"/><path d="M87.1,197.79l-.521-.8a.216.216,0,0,0-.4.106l-.051.956a.216.216,0,0,1-.16.2l-.925.247a.216.216,0,0,0-.022.411l.894.343a.216.216,0,0,1,.139.213l-.038.73,1.232-2.308A.215.215,0,0,1,87.1,197.79Z" transform="translate(-84.887 -196.89)" fill="#ffaf46"/></g><path d="M155.23,273.186a.433.433,0,0,0-.448-.69l-2.833.759a.445.445,0,0,1-.475-.182l-1.6-2.459a.433.433,0,0,0-.8.213l-.153,2.928a.433.433,0,0,1-.32.4l-2.832.759a.433.433,0,0,0-.043.822l2.738,1.051a.433.433,0,0,1,.277.427l-.137,2.607-.017.321a.433.433,0,0,0,.769.3l1.845-2.279a.433.433,0,0,1,.491-.132l2.738,1.051a.433.433,0,0,0,.519-.639l-1.6-2.459a.433.433,0,0,1,.027-.508Z" transform="translate(-143.51 -268.423)" fill="#ffcd00"/><rect width="12" height="12" transform="translate(0 0.167)" fill="none"/></g></g></svg></span>
                                <span if="{ race['kaisai']['is_morning'] == '1' }" class="Icon_RaceMark Morning" aria-label="モーニング"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2025 -2355)"><rect width="18" height="14" transform="translate(-2025 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2022 2355.833)"><path d="M13.663,7.167l-1.3-1.148,1.255-1.2a.177.177,0,0,0-.074-.3L11.872,4.04l.618-1.617a.177.177,0,0,0-.029-.176.18.18,0,0,0-.167-.063l-1.718.277L10.437.737a.178.178,0,0,0-.1-.146A.18.18,0,0,0,10.157.6l-1.432.982-.87-1.5a.179.179,0,0,0-.31,0l-1,1.72-1.727-1a.18.18,0,0,0-.179,0,.178.178,0,0,0-.09.154l0,1.73L2.812,2.552a.179.179,0,0,0-.162.076.177.177,0,0,0-.015.177L3.378,4.37,1.75,4.98a.177.177,0,0,0-.05.3l1.346,1.1L1.837,7.626a.177.177,0,0,0,.086.3l1.689.417-.554,1.64a.177.177,0,0,0,.035.174.18.18,0,0,0,.17.057l1.705-.343.207,1.718a.179.179,0,0,0,.285.121l1.392-1.037.928,1.416a.179.179,0,0,0,.151.083h.007a.179.179,0,0,0,.151-.095L8.9,10.589l1.47.926a.18.18,0,0,0,.179.007.178.178,0,0,0,.1-.15l.072-1.728,1.727.21a.18.18,0,0,0,.165-.07.177.177,0,0,0,.022-.177L11.95,8.016,13.6,7.469a.177.177,0,0,0,.062-.3Z" transform="translate(-1.634)" fill="#ffa600"/><ellipse cx="3.685" cy="3.682" rx="3.685" ry="3.682" transform="translate(2.32 2.37)" fill="#ffdb2d"/></g></g></svg></span>
                                </div>
                                <div class="Race_Data">
                                    <span if={race['kaisai']['is_kaisai_end'] == '1'}>発走 { race['start'] }</span>
                                    <span if={race['kaisai']['is_kaisai_end'] == '0'}>終了</span>
                                    <span if={race['kaisai']['is_kaisai_end'] == '1'} class="Deadline_Txt01">{ race['close_text'] }</span>
                                </div>
                            </div>
                        </div>
                        <div class="RaceList_Item03" if={race['kaisai']['is_kaisai_end'] == '1'}>
                            <!--<a href="{ args.keirin_url }{ race['jyo_cd'] < '90' ? 'race' : 'pist6' }/entry/?race_id={ race['race_id'] }&rf=bet_btn" class="entry_link">出走表</a>-->
                            <a href="javascript:void(0);" onclick={ act_chenge_race.bind(this, race['race_id']) } class="vote_link">投票</a>
                        </div>
                        <div class="RaceList_Item03" if={race['kaisai']['is_kaisai_end'] == '0'}>
                            <a href="{ args.keirin_url }{ race['jyo_cd'] < '90' ? 'race' : 'pist6' }/result/?race_id={ race['race_id'] }&rf=bet_btn" class="result_link">結果</a>
                        </div>
                    </li>
                </ul>
            </div>
            <div class="RaceChoice_list place_list { tab_flag['jyo'] ? 'active' : '' }">
                <div class="Title">投票するレースを選んでください</div>
                <!--p class="Txt01">選択後、マークシートが開きます。</p-->
                <!--div class="Check" if={ is_select_race_chack }>
                    <input type="checkbox" id="check_submit" name="check_submit" value="1" onclick={ act_check_btn.bind(this) } checked="{ check_btn ? 'checked' : ''}">
                    <label for="check_submit">次回から直近のレースを表示する</label>
                </div--><!-- /.Check -->

                <div class="Btn_Group nar_top">
                    <ul class="jyo_tab">
                        <li each={ val, jyo_cd in kaisai_list } id="btn_jyoname_{val['jyo_cd']}" class="{ val['is_kaisai_end'] == '0' ? 'Race_Fixed' : '' } { select_jyo == val['jyo_cd'] ? 'Active' : '' }">
                            <a href="javascript:void(0);" onclick={ act_select_jyo.bind(this, val['jyo_cd']) }>{ val['jyo_cd'] == '91' ? '' : jyo_list[val['jyo_cd']] }
                                <p if="{ val['jyo_cd'] < '90' }" class="Content_Icon_Text">
                                <span if="{ val['grade_icon'] }" class="Icon_RaceMark Icon_Grade Icon_GradeType{ val['grade_icon'] }">{ val['grade_name'] }</span>
                                <span if="{ val['is_girls'] == '1' }" class="Icon_RaceMark Girls" aria-label="ガールズ"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2106 -2355)"><rect width="18" height="14" transform="translate(-2106 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2103.3 2356.4)"><path d="M1541.137,669.152a3.51,3.51,0,0,0-2.6-1.117,3.29,3.29,0,0,0-2.039.7.825.825,0,1,1-1.649,0,3.289,3.289,0,0,0-2.039-.7,3.51,3.51,0,0,0-2.6,1.117,3.982,3.982,0,0,0-1.03,2.738,4.743,4.743,0,0,0,1.287,3.125A27.291,27.291,0,0,0,1533.7,678c.446.376.953.8,1.478,1.256a.769.769,0,0,0,1,0c.526-.454,1.032-.881,1.479-1.257a27.273,27.273,0,0,0,3.222-2.988,4.74,4.74,0,0,0,1.287-3.125,3.982,3.982,0,0,0-1.03-2.738Zm0,0" transform="translate(-1529.188 -668.035)" fill="#fff"/></g></g></svg></span>
                                <span if="{ val['is_night'] == '1' }" class="Icon_RaceMark Nighter" aria-label="ナイター"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2079 -2355)"><rect width="18" height="14" transform="translate(-2079 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2075.174 2356.2)"><path d="M29.221,8.52A5.566,5.566,0,1,1,23.819,0a.067.067,0,0,1,.062.107,5.258,5.258,0,0,0,5.27,8.311A.067.067,0,0,1,29.221,8.52Z" transform="translate(-18.968 0)" fill="#efda45"/></g></g></svg></span>
                                <span if="{ val['is_midnight'] == '1' }" class="Icon_RaceMark MidNight" aria-label="ミッドナイト"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2052 -2355)"><rect width="18" height="14" transform="translate(-2052 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2050 2355.833)"><path d="M427.453,205.549l-.108-.029h0l-.079-.021a.216.216,0,0,1-.16-.2l-.01-.195a.216.216,0,0,0-.4-.105l-.106.163a.216.216,0,0,1-.238.091l-.188-.05a.216.216,0,0,0-.224.346l.122.152a.215.215,0,0,1,.037.2h0a.215.215,0,0,1-.022.052l-.106.163a.216.216,0,0,0,.26.32l.181-.07a.216.216,0,0,1,.246.065l.122.152a.216.216,0,0,0,.384-.147l-.01-.195a.216.216,0,0,1,.138-.213l.181-.07a.216.216,0,0,0-.023-.41Z" transform="translate(-416.347 -204.686)" fill="#ffd839"/><g transform="translate(0.303)"><path d="M128.727,224.337a.216.216,0,0,0-.224-.346l-.925.249a.209.209,0,0,1-.086,0l-1.233,2.308-.012.227a.216.216,0,0,0,.384.148l.6-.744a.216.216,0,0,1,.246-.065l.894.343a.216.216,0,0,0,.26-.32l-.523-.8a.217.217,0,0,1,.013-.254Z" transform="translate(-125.126 -223.249)" fill="#ffaf46"/><path d="M87.1,197.79l-.521-.8a.216.216,0,0,0-.4.106l-.051.956a.216.216,0,0,1-.16.2l-.925.247a.216.216,0,0,0-.022.411l.894.343a.216.216,0,0,1,.139.213l-.038.73,1.232-2.308A.215.215,0,0,1,87.1,197.79Z" transform="translate(-84.887 -196.89)" fill="#ffaf46"/></g><path d="M155.23,273.186a.433.433,0,0,0-.448-.69l-2.833.759a.445.445,0,0,1-.475-.182l-1.6-2.459a.433.433,0,0,0-.8.213l-.153,2.928a.433.433,0,0,1-.32.4l-2.832.759a.433.433,0,0,0-.043.822l2.738,1.051a.433.433,0,0,1,.277.427l-.137,2.607-.017.321a.433.433,0,0,0,.769.3l1.845-2.279a.433.433,0,0,1,.491-.132l2.738,1.051a.433.433,0,0,0,.519-.639l-1.6-2.459a.433.433,0,0,1,.027-.508Z" transform="translate(-143.51 -268.423)" fill="#ffcd00"/><rect width="12" height="12" transform="translate(0 0.167)" fill="none"/></g></g></svg></span>
                                <span if="{ val['is_morning'] == '1' }" class="Icon_RaceMark Morning" aria-label="モーニング"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2025 -2355)"><rect width="18" height="14" transform="translate(-2025 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2022 2355.833)"><path d="M13.663,7.167l-1.3-1.148,1.255-1.2a.177.177,0,0,0-.074-.3L11.872,4.04l.618-1.617a.177.177,0,0,0-.029-.176.18.18,0,0,0-.167-.063l-1.718.277L10.437.737a.178.178,0,0,0-.1-.146A.18.18,0,0,0,10.157.6l-1.432.982-.87-1.5a.179.179,0,0,0-.31,0l-1,1.72-1.727-1a.18.18,0,0,0-.179,0,.178.178,0,0,0-.09.154l0,1.73L2.812,2.552a.179.179,0,0,0-.162.076.177.177,0,0,0-.015.177L3.378,4.37,1.75,4.98a.177.177,0,0,0-.05.3l1.346,1.1L1.837,7.626a.177.177,0,0,0,.086.3l1.689.417-.554,1.64a.177.177,0,0,0,.035.174.18.18,0,0,0,.17.057l1.705-.343.207,1.718a.179.179,0,0,0,.285.121l1.392-1.037.928,1.416a.179.179,0,0,0,.151.083h.007a.179.179,0,0,0,.151-.095L8.9,10.589l1.47.926a.18.18,0,0,0,.179.007.178.178,0,0,0,.1-.15l.072-1.728,1.727.21a.18.18,0,0,0,.165-.07.177.177,0,0,0,.022-.177L11.95,8.016,13.6,7.469a.177.177,0,0,0,.062-.3Z" transform="translate(-1.634)" fill="#ffa600"/><ellipse cx="3.685" cy="3.682" rx="3.685" ry="3.682" transform="translate(2.32 2.37)" fill="#ffdb2d"/></g></g></svg></span>
                                </p>
                                <span if="{ val['jyo_cd'] >= '90' }" class="Pist6_Icon">
                                    <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.736 12.824">
                                        <path d="M21.506,2.908a2.69,2.69,0,0,0-2.118-.851H15.916l-1.535,8.7h1.767l.577-3.2H18.45A3.307,3.307,0,0,0,21.937,4.78a2.222,2.222,0,0,0-.431-1.873m-4.079.67h1.725a1.035,1.035,0,0,1,.825.317,1.093,1.093,0,0,1,.176.915,1.551,1.551,0,0,1-1.469,1.239H16.991Z"></path>
                                        <path d="M21.774,10.76h1.779l1.535-8.7H23.309Z"></path>
                                        <path d="M29.767,1.826c-1.934,0-3.525,1.061-3.783,2.522-.248,1.4.393,2.267,1.959,2.636l1.609.389c.467.125,1,.4.9.991a1.847,1.847,0,0,1-2.059,1.107A1.706,1.706,0,0,1,27.132,8.9a1.229,1.229,0,0,1-.23-.961l.019-.107H25.154l-.013.075a2.522,2.522,0,0,0,.514,2.043,3.149,3.149,0,0,0,2.5,1.046h.1c1.736,0,3.665-.955,3.954-2.6C32.455,7,31.74,6.04,30.14,5.621l-1.61-.389c-.6-.152-.859-.445-.784-.87.1-.562.9-1.02,1.783-1.02a1.6,1.6,0,0,1,1.255.474A.971.971,0,0,1,31,4.623l-.019.107h1.779l.013-.075a2.258,2.258,0,0,0-.447-1.881,3.214,3.214,0,0,0-2.558-.952"></path>
                                        <path d="M40.857,2.057h-7.1l-.281,1.594h2.666l-1.253,7.108h1.767l1.253-7.108h2.666Z"></path>
                                        <path d="M46.049,2.736a2.217,2.217,0,0,0-1.833-.679C42.38,2.194,41,3.77,40.321,6.5a4.346,4.346,0,0,0,.371,3.672,2.3,2.3,0,0,0,1.914.823,3.673,3.673,0,0,0,3.452-3.13,2.391,2.391,0,0,0-.422-1.984,2.314,2.314,0,0,0-1.848-.74,2.958,2.958,0,0,0-1.48.477c.358-1.34,1.109-2,1.687-2.048a.672.672,0,0,1,.535.146.883.883,0,0,1,.2.686v.094h1.752l.013-.075a1.946,1.946,0,0,0-.446-1.68m-1.771,5.2a1.654,1.654,0,0,1-1.545,1.531.851.851,0,0,1-.673-.308,1.412,1.412,0,0,1-.241-1.143,1.6,1.6,0,0,1,1.5-1.361.952.952,0,0,1,.759.314,1.168,1.168,0,0,1,.2.967"></path>
                                        <path d="M46.287,9.5h1v.141h-.424v1.094h-.154V9.644h-.424Zm2.449,0v1.236h-.154V9.691L48.2,10.739H48.04l-.378-1.048v1.048h-.154V9.5h.246l.368,1.033L48.49,9.5Z"></path>
                                        <path d="M6.412,0a6.412,6.412,0,1,0,6.412,6.412h0A6.412,6.412,0,0,0,6.412,0Zm.331,9.837a3.19,3.19,0,0,1-1.651-.458l-.079.448H2.875l1.206-6.84H6.218l-.087.5A3.206,3.206,0,1,1,6.742,9.84Z"></path>
                                    </svg>
                                </span>
                                <img if="{ campaign_badge_jyo_cd_list.includes(val['jyo_cd']) }" src="{ args.cdn_keirin_url }/common/img/race/campaignBadge.png" class="commonCampaignBadge" alt="最大5%">
                            </a>
                        </li>
                    </ul>
                </div><!-- /.Btn_Group -->
                <div class="RaceInformation_Wrap">
                    <div if={ cur_kaisai && Object.keys(cur_kaisai).length >= 1 } class="RaceInformation">
                        <ul class="RaceInformation_Item fc">
                            <li class="Item01" if={ select_jyo <= 90 }>{cur_kaisai['hi']}日目</li>
                            <li class="Item03">
                                <span class="Icon_GradeType Icon_GradeType{cur_kaisai['grade_icon']}">{cur_kaisai['grade_name']}</span>
                                <span if={ cur_kaisai['is_girls'] == '1' } class="Icon_RaceMark Girls" aria-label="ガールズ"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2106 -2355)"><rect width="18" height="14" transform="translate(-2106 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2103.3 2356.4)"><path d="M1541.137,669.152a3.51,3.51,0,0,0-2.6-1.117,3.29,3.29,0,0,0-2.039.7.825.825,0,1,1-1.649,0,3.289,3.289,0,0,0-2.039-.7,3.51,3.51,0,0,0-2.6,1.117,3.982,3.982,0,0,0-1.03,2.738,4.743,4.743,0,0,0,1.287,3.125A27.291,27.291,0,0,0,1533.7,678c.446.376.953.8,1.478,1.256a.769.769,0,0,0,1,0c.526-.454,1.032-.881,1.479-1.257a27.273,27.273,0,0,0,3.222-2.988,4.74,4.74,0,0,0,1.287-3.125,3.982,3.982,0,0,0-1.03-2.738Zm0,0" transform="translate(-1529.188 -668.035)" fill="#fff"/></g></g></svg></span>
                                <span if={ cur_kaisai['is_night'] == '1' } class="Icon_RaceMark Nighter" aria-label="ナイター"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2079 -2355)"><rect width="18" height="14" transform="translate(-2079 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2075.174 2356.2)"><path d="M29.221,8.52A5.566,5.566,0,1,1,23.819,0a.067.067,0,0,1,.062.107,5.258,5.258,0,0,0,5.27,8.311A.067.067,0,0,1,29.221,8.52Z" transform="translate(-18.968 0)" fill="#efda45"/></g></g></svg></span>
                                <span if={ cur_kaisai['is_midnight'] == '1' } class="Icon_RaceMark MidNight" aria-label="ミッドナイト"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2052 -2355)"><rect width="18" height="14" transform="translate(-2052 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2050 2355.833)"><path d="M427.453,205.549l-.108-.029h0l-.079-.021a.216.216,0,0,1-.16-.2l-.01-.195a.216.216,0,0,0-.4-.105l-.106.163a.216.216,0,0,1-.238.091l-.188-.05a.216.216,0,0,0-.224.346l.122.152a.215.215,0,0,1,.037.2h0a.215.215,0,0,1-.022.052l-.106.163a.216.216,0,0,0,.26.32l.181-.07a.216.216,0,0,1,.246.065l.122.152a.216.216,0,0,0,.384-.147l-.01-.195a.216.216,0,0,1,.138-.213l.181-.07a.216.216,0,0,0-.023-.41Z" transform="translate(-416.347 -204.686)" fill="#ffd839"/><g transform="translate(0.303)"><path d="M128.727,224.337a.216.216,0,0,0-.224-.346l-.925.249a.209.209,0,0,1-.086,0l-1.233,2.308-.012.227a.216.216,0,0,0,.384.148l.6-.744a.216.216,0,0,1,.246-.065l.894.343a.216.216,0,0,0,.26-.32l-.523-.8a.217.217,0,0,1,.013-.254Z" transform="translate(-125.126 -223.249)" fill="#ffaf46"/><path d="M87.1,197.79l-.521-.8a.216.216,0,0,0-.4.106l-.051.956a.216.216,0,0,1-.16.2l-.925.247a.216.216,0,0,0-.022.411l.894.343a.216.216,0,0,1,.139.213l-.038.73,1.232-2.308A.215.215,0,0,1,87.1,197.79Z" transform="translate(-84.887 -196.89)" fill="#ffaf46"/></g><path d="M155.23,273.186a.433.433,0,0,0-.448-.69l-2.833.759a.445.445,0,0,1-.475-.182l-1.6-2.459a.433.433,0,0,0-.8.213l-.153,2.928a.433.433,0,0,1-.32.4l-2.832.759a.433.433,0,0,0-.043.822l2.738,1.051a.433.433,0,0,1,.277.427l-.137,2.607-.017.321a.433.433,0,0,0,.769.3l1.845-2.279a.433.433,0,0,1,.491-.132l2.738,1.051a.433.433,0,0,0,.519-.639l-1.6-2.459a.433.433,0,0,1,.027-.508Z" transform="translate(-143.51 -268.423)" fill="#ffcd00"/><rect width="12" height="12" transform="translate(0 0.167)" fill="none"/></g></g></svg></span>
                                <span if={ cur_kaisai['is_morning'] == '1' } class="Icon_RaceMark Morning" aria-label="モーニング"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="14" viewBox="0 0 18 14"><g transform="translate(2025 -2355)"><rect width="18" height="14" transform="translate(-2025 2355)" fill="#ff9292" opacity="0"/><g transform="translate(-2022 2355.833)"><path d="M13.663,7.167l-1.3-1.148,1.255-1.2a.177.177,0,0,0-.074-.3L11.872,4.04l.618-1.617a.177.177,0,0,0-.029-.176.18.18,0,0,0-.167-.063l-1.718.277L10.437.737a.178.178,0,0,0-.1-.146A.18.18,0,0,0,10.157.6l-1.432.982-.87-1.5a.179.179,0,0,0-.31,0l-1,1.72-1.727-1a.18.18,0,0,0-.179,0,.178.178,0,0,0-.09.154l0,1.73L2.812,2.552a.179.179,0,0,0-.162.076.177.177,0,0,0-.015.177L3.378,4.37,1.75,4.98a.177.177,0,0,0-.05.3l1.346,1.1L1.837,7.626a.177.177,0,0,0,.086.3l1.689.417-.554,1.64a.177.177,0,0,0,.035.174.18.18,0,0,0,.17.057l1.705-.343.207,1.718a.179.179,0,0,0,.285.121l1.392-1.037.928,1.416a.179.179,0,0,0,.151.083h.007a.179.179,0,0,0,.151-.095L8.9,10.589l1.47.926a.18.18,0,0,0,.179.007.178.178,0,0,0,.1-.15l.072-1.728,1.727.21a.18.18,0,0,0,.165-.07.177.177,0,0,0,.022-.177L11.95,8.016,13.6,7.469a.177.177,0,0,0,.062-.3Z" transform="translate(-1.634)" fill="#ffa600"/><ellipse cx="3.685" cy="3.682" rx="3.685" ry="3.682" transform="translate(2.32 2.37)" fill="#ffdb2d"/></g></g></svg></span>
                                <span class="RaceName">{cur_kaisai['sp_race_name']}</span>
                            </li>
                        </ul>
                    </div><!-- /.RaceInformation -->
                </div>

                <div class="RaceSelectArea">
                    <ul>
                        <li each={ race , key in race_list[select_jyo] }>
                            <virtual if={ !check_vote_race(race['race_id'], race['sale_status'], race['close'], false) }>
                                <a href="javascript:void(0);" onclick={ act_chenge_race.bind(this, race['race_id']) } class="RaceLink {race['sale_status'] > 0 ? 'Race_Fixed' : ''}">
                                <span>
                                    <span class="RaceNum">{ race.race_id.substr(10, 2).replace(/^0/, '') }R</span>
                                    <span class="RaceName" if={ race['sale_status'] <= 0 && race.race_id.substr(8, 2) >= '90' }>発売前</span>
                                    <span class="RaceName" if={ race['sale_status'] > 0 } >締切</span>
                                </span>
                                </a>
                            </virtual>
                            <virtual if={ check_vote_race(race['race_id'], race['sale_status'], race['close'], false) }>
                                <a href="javascript:void(0);" onclick={ act_chenge_race.bind(this, race['race_id']) } class="RaceLink">
                                    <span class="RaceNum">{ race.race_id.substr(10, 2).replace(/^0/, '') }R</span>
                                    <span class="RaceName">発売中</span>
                                </a>
                            </virtual>
                            <img if="{ campaign_badge_race_id_list.includes(race['race_id']) }" src="{ args.cdn_keirin_url }/common/img/race/campaignBadge.png" class="commonCampaignBadge" alt="最大5%">
                        </li>
                    </ul>
                </div><!-- /.RaceSelectArea -->
            </div>
        </div><!-- /.RaceChoiceWrap -->
        <div class="HalfModal_CloseBtn"><span>閉じる</span></div>
    </div><!-- /.HalfModal .RaceChoiceArea -->
    <div if={ Object.keys(cur_race).length <= 0 } class="RaceNotBet">
        <div class="RaceNotBetTxt">
            <p>レース発売時間外です。</p>
            <p>発売開始までしばらくお待ち下さい。</p>
        </div><!-- /.RaceNotBetTxt -->
        <div class="LinkBtn_03 mt20">
            <a href="{ args.keirin_url }/race/race_list/">
                <span class="Icon_More01">レース一覧へ<svg xmlns="http://www.w3.org/2000/svg" class="Icon_Arrow" width="9" height="7" viewBox="0 0 9 7"><path d="M5.6.105a.38.38,0,0,0-.525,0,.344.344,0,0,0,0,.5L7.735,3.146H.368A.359.359,0,0,0,0,3.5a.363.363,0,0,0,.368.357H7.735L5.074,6.393a.349.349,0,0,0,0,.5.38.38,0,0,0,.525,0L8.89,3.749a.334.334,0,0,0,0-.5Zm0,0" transform="translate(0)" fill="#707070"></path></svg></span>
            </a>
        </div><!-- /.LinkBtn_03 -->
    </div><!-- /.RaceNotBet -->
</virtual>

    <script>
    "use strict";

    var self = this;
    self.args = self.opts;
    self.debug = true;
    self.param = null;
    if (self.debug) console.log('sel.args: %O', self.args);
    self.race_list = {};
    self.line = [];
    self.cur_race = {};
    self.race_id = '';
    self.day_count = '';
    self.return_url = '';
    self.jyo_list = JSON.parse(self.args.jyo_list);
    self.select_jyo = '';
    self.is_select_race_chack = true;
    self.check_btn = false;
    self.cookie_name = 'select_race_modal';
    self.is_render_comp = false;
    self.kaisai_list = self.args.kaisai_list ? JSON.parse(self.args.kaisai_list) : {};
    self.cur_kaisai = {};
    self.is_show = false;
    self.tab_flag = {'vote':true, 'jyo':false};
    self.vote_list = [];//発売中リスト
    self.ls_key = 'vote_tab';
    self.vote_mode = self.args.vote_mode;
    self.campaign_badge_race_id_list = [];
    self.campaign_badge_jyo_cd_list = [];

    edit_class(syaban)
    {
        if(syaban <= 0){
            return 'WakuSeparat';
        }else{
            return sprintf('Waku%s Shaban_Num', syaban);
        }
    }

    edit_race_num(race_id)
    {
        return sprintf('%sR', race_id.substr(-2).replace(/^0/, ''));
    }

    edit_make_day_count(race)
    {
        var day_count ='';
        if(race['last_day_flg'] == 0){
            if(race['nichiji'] == 1){
                day_count = '初日';
            }else{
                day_count = sprintf('%s日目' , race['nichiji']);
            }
        }else{
            day_count = '最終日';
        }
        return day_count;
    }
    act_race_choice()
    {
        console.log('act_race_choice');
        self.is_select_race_chack = false;
        self.update();
        self.make_slide_modal();
    }

    act_select_jyo(jyo_cd)
    {
        console.log('act_select_jyo:', jyo_cd);
        var tmp_kaisai = self.kaisai_list.find(function(val){
            if(val['jyo_cd'] == jyo_cd){
                return val;
            }
        });
        if(tmp_kaisai['is_kaisai_end'] == 0){
            //開催終了
            //return false;
        }
        self.cur_kaisai = tmp_kaisai
        self.select_jyo = jyo_cd;
        self.update();
    }

    act_chenge_race(race_id)
    {
        console.log('act_chenge_race:', race_id);
        if(self.check_btn){
            const now = new Date();
            now.setDate(now.getFullYear() + 1);
            document.cookie = self.cookie_name + "=1" + "; path=/; expires=" + now.toUTCString();
        }
        var race_date =  race_id.substr(0, 8);
        var url = sprintf("editor.html?date=%s&race_id=%s", race_date, race_id);
        if(self.param['rf']){
            url += sprintf('&rf=%s', self.param['rf']);
        }
        if(self.args.is_appli && self.args.device == '2'){
            //iOSアプリ
            var eventParams = sprintf("%sbet/%s", self.args.keirin_url, url);
            if(typeof webkit !== 'undefined' && typeof webkit.messageHandlers !== 'undefined' && typeof webkit.messageHandlers.raceFooterEvent !== 'undefined'){
                webkit.messageHandlers.raceFooterEvent.postMessage('change_raceid_seat_tab' + "+" + eventParams);
            }
        }else if(self.args.is_appli && self.args.device == '3'){
            //Androidアプリ
            var eventParams = sprintf("%sbet/%s", self.args.keirin_url, url);
            if(typeof NetkeirinWebView !== 'undefined' && typeof NetkeirinWebView.raceFooterEvent !== 'undefined'){
                NetkeirinWebView.raceFooterEvent('change_raceid_seat_tab', eventParams);
            }
        }
        var race_date =  race_id.substr(0, 8);
        var route_url = sprintf("?date=%s&race_id=%s&m=mark_sheet", race_date, race_id);
        if(self.param['rf']){
            route_url += sprintf('&rf=%s', self.param['rf']);
        }

        self.args.obs.trigger('race_api_get_event', 'false');
        route(route_url);
        self.modal_slide_out();
    }

    act_check_btn()
    {
        console.log('act_check_btn');
        self.check_btn = self.check_btn ? false : true;
        console.log(self.check_btn);
    }

    make_race_name(race)
    {
        var ryakusyou = race.ryakusyo3.replace(/\s+/g, "").substr(0, 2);
        var kyu = race.jyoken.substr(0, 1);
        return sprintf("%s%s", kyu, ryakusyou);
    }

    changeTab(tab)
    {
        localStorage.setItem(self.ls_key, tab);
        if(tab == 'jyo'){
            self.tab_flag = {'vote':false, 'jyo':true}
        }else{
            self.tab_flag = {'vote':true, 'jyo':false}
        }
    }

    changeBetMode(vote_mode)
    {
        if(vote_mode == 'netkeirin' || vote_mode == 'TIPSTAR'){
            const now = new Date();
            now.setDate(now.getFullYear() + 1);
            document.cookie = "vote_mode=" + vote_mode + "; path=/; expires=" + now.toUTCString() + "; domain=" + self.args.cookie_domain;
            self.vote_mode = vote_mode;
            self.args.obs.trigger('change_vote_mode_event', vote_mode);
            self.update();
        }
    }

    self.on('update', function() {
        //	     console.error('self.update()');
    });
    self.on('updated', function() {
        //	     console.error('self.updated()');
    });

    /*
     * 画面初期化(mount)
     */
    self.on('mount', function() {
        if (self.debug)  console.log('mount %s', self.args.tag_name);
        self.args.obs.trigger('tag_mounted', {tag: self.args.tag_name});
    });

    shared_obs.on('narabi_show', function(e) {
        console.log('narabi_show : ', e);
        if(e == 'show'){
            self.is_narabi_show = true;
        }else if(e == 'hide'){
            self.is_narabi_show = false;
        }
        self.update();
    });

    shared_obs.on('change_vote_mode', function(e) {
        console.log('change_vote_mode : ', e);
        self.vote_mode = e;
        self.update();
    });

    /*
     * 画面表示(parent -> trigger -> render_xxxx)
     */
    self.args.obs.on('render_' + self.args.tag_name, function(p) {
        if (self.debug) console.log('render_%s start p: %O', self.args.tag_name, p);
        self.kaisai_date = '';
        self.kaisai_mode = 'race';
        //self.select_jyo = '';
        self.race_id = '';
        self.line = [];
        self.cur_race = {};
        self.is_render_comp = false;
        self.is_show = false;
        self.param = p;
        self.tab_flag = {'vote':true, 'jyo':false};
        //self.update();
        self.show_data(p);
    });


     /*
      * データ取得、編集
      */
     self.show_data = function(p) {
        if (self.debug) console.log('self.show_data');

        var api = new AplApiRace(self.args.api_url, true, 'json'/*, true*/);

        if(p['date']){
            self.kaisai_date = p['date'];
        }else{
            var now = new Date();
            var year = now.getFullYear();
            var month = now.getMonth()+1;
            var day = now.getDate();
            self.kaisai_date = sprintf("%s%02d%02d", year, month, day);
        }

        var cookies = document.cookie;
        var cookiesArray = cookies.split(';');
        for (var c of cookiesArray) {
            var cArray = c.split('=')
            if (cArray[0].trim() == self.cookie_name) {
                self.is_select_race_chack = false;
                break;
            }
        }
        self.is_narabi_show = false;

        // レース一覧を取得
        api.get('AplRace', {'kaisai_date': self.kaisai_date, 'syusai': 'all'}, function(ary_race) {
            var selected_race = {};
            if (undefined !== p['race_id']) {
                self.race_id = p['race_id'];
            }else{
                self.select_default_race(ary_race);
            }

            if(!self.race_id){
                //投票可能なレースない
                self.is_show = true;
                self.update();
                return false;
            }

            for (var i = 0; i < ary_race.length; i++) {
                self.race_list[ary_race[i].jyo_cd] = ary_race[i].list;
                for (var idx in ary_race[i].list) {
                    var row = ary_race[i].list[idx];
                    if (row['race_id'] == self.race_id) {
                         self.cur_race = row;
                         break;
                    }
                }
            }

            if(!self.select_jyo){
                //self.select_jyo = self.cur_race['jyo_cd'];
                self.select_jyo = self.cur_race['jyo_cd'];
                self.cur_kaisai = self.kaisai_list.find(function(val){
                    if(val['jyo_cd'] == self.select_jyo){
                        return val;
                    }
                });
            }

/*
            self.vote_list = [];
            for(var jyo_cd in self.race_list){
                for(var i = 0; i < self.race_list[jyo_cd].length; i++){
                    var tmp_race = self.race_list[jyo_cd][i];
                    if(self.check_vote_race(tmp_race['race_id'], tmp_race['sale_status'], tmp_race['close'], false)){
                        tmp_race['kaisai'] = self.kaisai_list.find(function(val){
                            if(val['is_kaisai_end'] != '0' && tmp_race['jyo_cd'] == val['jyo_cd']){
                                return val;
                            }
                        });
                        tmp_race['dead_line'] = false;
                        var now = new Date();
                        var year = tmp_race['race_id'].substr(0, 4);
                        var month = tmp_race['race_id'].substr(4, 2);
                        var day = tmp_race['race_id'].substr(6, 2);
                        if(tmp_race['close']){
                            var time = tmp_race['close'].split(':');
                            var endtime = new Date(year,month - 1,day,time[0],time[1]);
                            //30分前の判定
                            var endtime_timeatamp = endtime.getTime() - (30 * 60 * 1000);
                            if(now.getTime() >= endtime_timeatamp){
                                tmp_race['dead_line'] = true;
                            }
                        }
                        self.vote_list.push(tmp_race);
                        break;
                    }
                }
            }
*/
            var sheet_mode = localStorage.getItem(self.ls_key);
            if(sheet_mode == 'jyo'){
                self.tab_flag = {'vote':false, 'jyo':true}
            }else{
                self.tab_flag = {'vote':true, 'jyo':false}
            }

            if(Object.keys(self.cur_race).leght >= 1){
                var cur_kaisai_date = new Date(self.cur_race['kaisai_date'].substr(0,4) ,self.cur_race['kaisai_date'].substr(4,2) - 1 ,self.cur_race['kaisai_date'].substr(6,2));
                var cur_kaisai_date_1st = new Date(self.cur_race['kaisai_date_1st'].substr(0,4) ,self.cur_race['kaisai_date_1st'].substr(4,2) - 1 ,self.cur_race['kaisai_date_1st'].substr(6,2));
                var day_diff = (cur_kaisai_date - cur_kaisai_date_1st) / 86400000 + 1;
            }

            if(self.cur_race['last_day_flg'] == 0){
                if(self.cur_race['nichiji'] == 1){
                    self.day_count = '初日';
                }else{
                    self.day_count = sprintf('%s日目' , self.cur_race['nichiji']);
                }
            }else{
                self.day_count = '最終日';
            }

            if(self.race_id !== undefined && self.race_id.substr(8, 2) == '91'){
                //pist6の時は場名を上書き
                self.cur_race['jyo'] = 'PIST6';
                self.kaisai_mode = 'pist6';
                self.day_count = '';
            }

            if (self.debug) console.log('self.kaisai_list: %O', self.kaisai_list);
            if (self.debug) console.log('self.race_list: %O', self.race_list);
            if (self.debug) console.log('self.cur_race: %O', self.cur_race);

            // 開催スケジュールを取得
            api.get('AplNarabiYoso',{'race_id': self.race_id}, function(line) {
                self.line = line['lineForecast'] ? line['lineForecast'] : [];
                self.return_url = document.referrer;
                var referrer_domain = self.return_url.replace(/^(http|https):\/\//, '').split('/')[0];
                var keirin_domain = self.args.keirin_url.replace(/^(http|https):\/\//, '').split('/')[0];
                var check_url = /editor\.html/;
                if(keirin_domain != referrer_domain || check_url.test(self.return_url)){
                    self.return_url = sprintf("%srace/entry/?race_id=%s", self.args.keirin_url, self.race_id);
                }
                var query = {race_id: self.race_id, date: self.kaisai_date};

                if(p['rf'] !== undefined){
                    query['rf'] = p['rf'];
                }
                if(p['m'] !== undefined){
                    query['m'] = p['m'];
                }
                //TODO アプリの戻るボタンで正常に戻れないので暫定対応(正規の対応はroute()でURLを書き換える)
                //self.args.obs.trigger('narabi_yoso_comp', query);
                // 買い目取得(local)
                var ndisam = new NDIsam();
                var isam_domain = sprintf("bet_%s", self.race_id);
                var list = ndisam.list(isam_domain);
                if(self.line.length > 0 && Object.keys(list).length <= 0 && self.param['m'] == 'mark_sheet'){
                    self.is_narabi_show = true;
                }

                //発売中のレース
                self.get_vote_list(function(vote_list){
                    self.vote_list = vote_list;
                    //開催が終わったら発売中タブ
                    if(self.vote_list.length <= 0){
                        self.tab_flag = {'jyo':true};
                        //delete self.tab_flag['vote'];
                    }else if(!self.select_jyo){
                        self.select_jyo = self.vote_list[0]['jyo_cd'];
                    }
                    if (self.debug) console.log('self.vote_list: %O', self.vote_list);
                    self.is_show = true;
                    self.get_campaign_badge(function(response){
                        console.log('responseresponseresponseresponseresponse : %O', response);
                        self.campaign_badge_race_id_list = Array.isArray(response['race_id_list']) ? response['race_id_list'] : [];
                        self.campaign_badge_jyo_cd_list = Array.isArray(response['jyo_list']) ? response['jyo_list'] : [];
                        console.log('self.campaign_badge_race_id_list : %O', self.campaign_badge_race_id_list);
                        console.log('self.campaign_badge_jyo_cd_list : %O', self.campaign_badge_jyo_cd_list);
                        self.update();
                    });
                    self.args.obs.trigger('narabi_yoso_comp', query);
                    if (undefined === p['race_id'] && self.is_select_race_chack) {
                        self.make_slide_modal();
                        //$("#RaceChoiceBtn").off("click");
                    }
                });
            });
        });

        self.get_vote_list = function(fn){
            var now = new Date();
            var year = now.getFullYear();
            var month = now.getMonth()+1;
            var day = now.getDate();
            var today = sprintf("%s%02d%02d", year, month, day);
            api.get('AplRace', {'kaisai_date': today, 'syusai': 'all'}, function(ary_race) {
                var vote_list = [];
                //当日のレース一覧に上書き
                for (var i = 0; i < ary_race.length; i++) {
                    self.race_list[ary_race[i].jyo_cd] = ary_race[i].list;
                }
                console.log('race_list : %O', self.race_list);
                console.log('kaisai_list : %O', self.kaisai_list);
                for(var jyo_cd in self.race_list){
                    for(var i = 0; i < self.race_list[jyo_cd].length; i++){
                        var tmp_race = self.race_list[jyo_cd][i];
                        tmp_race['close_text'] = '';
                        if(self.check_vote_race(tmp_race['race_id'], tmp_race['sale_status'], tmp_race['close'], false)){
                            tmp_race['kaisai'] = self.kaisai_list.find(function(val){
                                if(val['is_kaisai_end'] != '0' && tmp_race['jyo_cd'] == val['jyo_cd']){
                                    return val;
                                }
                            });
                            tmp_race['dead_line'] = false;
                            var now = new Date();
                            var year = tmp_race['race_id'].substr(0, 4);
                            var month = tmp_race['race_id'].substr(4, 2);
                            var day = tmp_race['race_id'].substr(6, 2);
                            if(tmp_race['close']){
                                var time = tmp_race['close'].split(':');
                                var endtime = new Date(year,month - 1,day,time[0],time[1]);
                                //30分前の判定
                                var endtime_timeatamp = endtime.getTime() - (30 * 60 * 1000);
                                // 現在時刻と締切時刻の差を計算
                                var timeDifference = Math.ceil((endtime.getTime() - now.getTime()) / (60 * 1000)); // 分単位で計算
                                if(now.getTime() >= endtime_timeatamp){
                                    tmp_race['dead_line'] = true;
                                    tmp_race['close_text'] = `締切${timeDifference}分前`;
                                }else{
                                    tmp_race['close_text'] = `${tmp_race['close']}締切`;
                                }
                            }
                            if(tmp_race['kaisai'] !== undefined){
                                vote_list.push(tmp_race);
                                break;
                            }

                        }else{
                            tmp_race['kaisai'] = self.kaisai_list.find(function(val){
                                if(val['is_kaisai_end'] == '0' && tmp_race['jyo_cd'] == val['jyo_cd']){
                                    return val;
                                }
                            });
                            if(tmp_race['kaisai'] !== undefined && tmp_race['kaisai']['is_kaisai_end'] == '0'){
                                var max_index = self.race_list[tmp_race['jyo_cd']].length -1;
                                var last_race = self.race_list[tmp_race['jyo_cd']][max_index];
                                last_race['kaisai'] = tmp_race['kaisai'];
                                vote_list.push(last_race);
                                break;
                            }
                        }
                    }
                }
                var sort = vote_list.sort(function(a, b) {
                    if (a.kaisai.is_kaisai_end !== b.kaisai.is_kaisai_end) {
                        return a.kaisai.is_kaisai_end == '0' ? 1 : -1; // 終了しているものを後ろに
                    }
                    if(a.jyo_cd >= '90'){
                        return 1; //pist6は末尾
                    }else{
                        return (a.start < b.start) ? -1 : 1
                    }
                });
                vote_list = sort;
                console.log('vote_list : %O', vote_list);
                fn(vote_list);
            });
        }

        self.get_campaign_badge = function(fn){
            // キャンペーンバッジ対応
            var campaignCommon = createCampaignCommon({
                apiURL: self.args.campaign_badge_api_url,
            });

            campaignCommon.api.getCampaign({
                method: 'GET',
            }).then(function(response) {
                if(response.status === 'ok') {
                    fn(response);
                }
            });
        }

        self.select_default_race = function(ary_race){
            var vote_race_list = {};
            var now = new Date();
            var tmp_kaisai = {};
            var start_list = [];
            //最終レースの発送時間抽出
            for (var c = 0; c < ary_race.length; c++) {
                var race_list = ary_race[c].list;
                var tmp_start = race_list.map(function(a) {
                    return a.start.replace(':', '');
                });
                start_list.push(Math.max.apply(null, tmp_start));
            }
            var last_start_time = Math.max.apply(null, start_list);

            for (var c = 0; c < ary_race.length; c++) {
                var race_list = ary_race[c].list;
                for(var idx in race_list){
                    var tmp_race = race_list[idx];
                    var close = tmp_race['close'];
                    var race_id = tmp_race['race_id'];
                    tmp_kaisai[race_id] = tmp_race;
                    //中止対応
                    if(tmp_race['race_status'] >= 90){
                        continue;
                    }
                    var default_flg = true;
                    //最終レースは締切時間まで表示させる
                    if(last_start_time == tmp_race['start'].replace(':', '')){
                        default_flg = false;
                    }
                    if(!self.check_vote_race(race_id, tmp_race['sale_status'], close, default_flg)){
                        continue;
                    }
                    vote_race_list[close] = race_id;
                }
            }

            var keys = Object.keys(vote_race_list);
            keys.sort();
            if(keys.length >= 1){
                self.race_id = vote_race_list[keys[0]];
                self.cur_race = tmp_kaisai[self.race_id];
                var url = sprintf("editor.html?date=%s&race_id=%s", self.kaisai_date, self.race_id);
                //route(url);
            }
        }

        self.check_vote_race = function(race_id, sale_status, close_time, default_race){
            var now = new Date();
            var year = race_id.substr(0, 4);
            var month = race_id.substr(4, 2);
            var day = race_id.substr(6, 2);
            if(!sale_status || sale_status <= 0){
                //発売時間外
                return false;
            }
            if(close_time){
                var time = close_time.split(':');
                var endtime = new Date(year,month - 1,day,time[0],time[1]);
                if(default_race){
                    //デフォルトレースの対象のレースは投票5分前
                    var endtime_timeatamp = endtime.getTime() - 300000;
                }else{
                    var endtime_timeatamp = endtime.getTime();
                }
                if(now.getTime() >= endtime_timeatamp){
                    //締め切り時間
                    return false;
                }
            }else{
                return false;
            }
            return true;
        }

        //制作
        self.event_regist = function(){
            $("#RaceChoiceBtn").off("click");
            $("#RaceChoiceBtn").on("click", function(){
                self.make_slide_modal();
            });
        }

        self.make_slide_modal = function(){
            var current_scrollY = $(window).scrollTop();
            $(".HalfModal").addClass("OpenDraw");
            $(".Wrap").addClass("HalfModalViewOut");
            $(".Wrap.HalfModalViewOut").css({
                top: -1 * current_scrollY,
                height:'auto'
            });
            $("footer.SpFooter,footer.PcFooter").css({visibility: 'hidden',});
            $(".Wrap").append("<div class='ModalOverlay HalfModalOver'></div>");
            $(document).on("touchend click", ".HalfModal_CloseBtn,.Disagree button,.ModalOverlay", function() {
                self.modal_slide_out();
            });
        }

        self.modal_slide_out = function(){
            var current_scrollY = $(window).scrollTop();
            $(".HalfModal").addClass("SlideOut");
            setTimeout(function () {
                $(".HalfModal").removeClass("OpenDraw");
                $(".HalfModal").removeClass("SlideOut");
            }, 200);
            $(".Wrap.HalfModalViewOut").attr({ style: ''}).removeClass("HalfModalViewOut");
            $(".HalfModalOver").remove();
            $('body').css({'position':'static'});
            $("footer.SpFooter,footer.PcFooter").css({visibility: 'visible'});
            $( 'html, body' ).prop( { scrollTop: current_scrollY } );
            event.preventDefault();
        };

        // 初期表示時は0番目のタブ表示
//        self.tabs.index = 0;
//        changeTab(event) {
//            self.tabs.index = event.item.i;
//            if(self.tabs.index = 1){
//                $('.sale_list').removeClass('active');
//                $('.place_list').addClass('active');
//            } else {
//                return false;
//            }
//            $('.RaceChoice_tab').click(function () {
//                $('.RaceChoice_tab,.RaceChoice_list').removeClass('active');
//                let tab_index = $('.RaceChoice_tab').index(this);
//                $(this).addClass('active');
//                $('.RaceChoice_list').eq(tab_index).addClass('active');
//            });
//        }

     }

     // 投票方法選択
     $(document).ready(function () {
      // ボタンをクリックしてサブメニューを表示/非表示
      $('.jsVoteBtn').on('click', function () {
        $('.jsMenuType').toggle();
      });

      // サブメニュー内の項目をクリックしたときの処理
      $('.jsMenuType').on('click', 'li', function () {
          // ボタンのテキストを選択項目に変更
        $('.jsMenuType').hide();  // サブメニューを閉じる
      });

      // メニュー外をクリックするとサブメニューを閉じる
      $(document).on('click', function (e) {
        if (!$(e.target).closest('.jsVoteBtn').length && !$(e.target).closest('.jsMenuType').length) {
          $('.jsMenuType').hide();
        }
      });
    });


    </script>

</narabi_yoso>
