fillAirBattleData = function(typeName, koukuApiData, ignoreStage3){
			const tables = $("<div></div>");
			const table = template.clone().appendTo(tables);
			const planeFrom = koukuApiData.api_plane_from;
			const stage1 = koukuApiData.api_stage1 || {
					api_f_count:0,api_f_lostcount:0,
					api_e_count:0,api_e_lostcount:0
				},
				stage2 = koukuApiData.api_stage2,
				stage3 = koukuApiData.api_stage3,
				stage3cf = koukuApiData.api_stage3_combined;
			$(".type", table).html(typeName + "&nbsp;");
			if(stage1.api_touch_plane){
				$(".ally_contact", table).text(stage1.api_touch_plane[0] <= 0 ? KC3Meta.term("BattleContactNo") : "[{0}]".format(stage1.api_touch_plane[0]));
				$(".enemy_contact", table).text(stage1.api_touch_plane[1] <= 0 ? KC3Meta.term("BattleContactNo") : "[{0}]".format(stage1.api_touch_plane[1]));
			} else {
				$(".ally_contact", table).text("---");
				$(".enemy_contact", table).text("---");
				$(".contact_row", table).hide();
			}
			if(stage1.api_disp_seiku !== undefined){
				$(".airbattle", table).text(KC3Meta.airbattle(stage1.api_disp_seiku)[2]);
			} else {
				$(".airbattle", table).text("---");
				$(".airbattle_row", table).hide();
			}
			$(".ally_fighter", table).text(stage1.api_f_count + (stage1.api_f_lostcount > 0 ? " -" + stage1.api_f_lostcount : ""));
			$(".enemy_fighter", table).text(stage1.api_e_count + (stage1.api_e_lostcount > 0 ? " -" + stage1.api_e_lostcount : ""));
			if(stage2){
				$(".ally_bomber", table).text(stage2.api_f_count + (stage2.api_f_lostcount > 0 ? " -" + stage2.api_f_lostcount : ""));
				$(".enemy_bomber", table).text(stage2.api_e_count + (stage2.api_e_lostcount > 0 ? " -" + stage2.api_e_lostcount : ""));
				if(stage2.api_air_fire){
					const airfire = stage2.api_air_fire;
					$(".aaci .kind", table).text("[{0}]".format(airfire.api_kind));
					$(".aaci .info", table).text("#{0} [{1}]".format(
						airfire.api_idx + 1, airfire.api_use_items.join(",")
					));
				} else {
					$(".aaci", table).hide();
				}
			} else {
				$(".ally_bomber", table).text("---");
				$(".enemy_bomber", table).text("---");
				$(".aaci", table).hide();
			}
			const fillAirstrikeData = (stage3Api, table, className, enemyIds) => {
				// planeFrom[0] = ally fleet plane(s) engaged. it's always null for LBAS and support fleet
				if(planeFrom && (!planeFrom[0] || planeFrom[0].length) && Array.isArray(stage3Api.api_edam)){
					stage3Api.api_edam.forEach((dmg, i) => {
						const sid = enemyIds[i];
						if(sid > 0){
							const shipIcon = $("<img/>").width(14).height(14)
								.css("margin-top", "-3px").css("margin-right", "3px")
								.addClass("shipiconimg")
								// can be regular ship icon for PvP battle
								.attr("src", KC3Meta.abyssIcon(sid));
							$(`.enemy_${className} .s_${i+1}`, table).append(shipIcon);
							// targeted by dive bomber squadron(s)
							if(stage3Api.api_ebak_flag[i]){
								const diveBomber = $("<img/>").width(8).height(8)
									.css({"float": "left", "margin-left": "-5px", "margin-top": "0px"})
									.attr("src", KC3Meta.itemIcon(7));
								$(`.enemy_${className} .f_${i+1}`, table).append(diveBomber);
							}
							// targeted by torpedo bomber squadron(s)
							if(stage3Api.api_erai_flag[i]){
								const torpedoBomber = $("<img/>").width(8).height(8)
									.css({"float": "left", "margin-left": stage3Api.api_ebak_flag[i] ? "-8px" : "-5px", "margin-top": "7px"})
									.attr("src", KC3Meta.itemIcon(8));
								$(`.enemy_${className} .f_${i+1}`, table).append(torpedoBomber);
							}
							// 0.1 exists as flagship protection
							$(`.enemy_${className} .dmg_${i+1}`, table).text("-" + Math.floor(dmg)).css("padding-right", "5px");
							// purple = critical hit, golden = sunk (not implemented)
							if(stage3Api.api_ecl_flag[i]) $(`.enemy_${className} .dmg_${i+1}`, table).css("color", "mediumpurple");
						}
					});
				}
				// planeFrom[1] = enemy fleet plane(s) engaged
				if(planeFrom && planeFrom[1] && planeFrom[1].length && Array.isArray(stage3Api.api_fdam)){
					stage3Api.api_fdam.forEach((dmg, i) => {
						// Cannot get player's ship ID from single battle api or this node data, so only #number
						$(`.ally_${className} .s_${i+1}`, table)
							.text("#" + (i + (className === "escort" ? 7 : 1)))
							.css("color", "silver")
							.css("margin-right", "3px");
						// sp_list: [1] = bouncing torpedo (skip bombs) since 2022-05-27, treat it as dive bombing because bak_flag: 1 at the same time
						// see `main.js#AirWarStage3Model.SP_ATTACK_TYPE.BOUNCE_BOM`
						if(stage3Api.api_fbak_flag[i]){
							const diveBomber = $("<img/>").width(8).height(8)
								.css({"float": "left", "margin-left": "-5px", "margin-top": "0px"})
								.attr("src", KC3Meta.itemIcon(7));
							const isBounce = ((stage3Api.api_f_sp_list || [])[i] || []).includes(1);
							if(isBounce) {
								diveBomber.css("filter", "drop-shadow(0px 0px 2px #911)")
									.css("-webkit-filter", "drop-shadow(0px 0px 2px #911)");
							}
							$(`.ally_${className} .f_${i+1}`, table).append(diveBomber);
						}
						if(stage3Api.api_frai_flag[i]){
							const torpedoBomber = $("<img/>").width(8).height(8)
								.css({"float": "left", "margin-left": stage3Api.api_fbak_flag[i] ? "-8px" : "-5px", "margin-top": "7px"})
								.attr("src", KC3Meta.itemIcon(8));
							$(`.ally_${className} .f_${i+1}`, table).append(torpedoBomber);
						}
						$(`.ally_${className} .dmg_${i+1}`, table).text("-" + Math.floor(dmg)).css("padding-right", "5px");
						if(stage3Api.api_fcl_flag[i]) $(`.ally_${className} .dmg_${i+1}`, table).css("color", "mediumpurple");
					});
				}
			};
			// Ignore stage3 for LBAS because might be too many items, and summary report already showed
			if(!ignoreStage3 && (stage3 || stage3cf)){
				const stage3Table = stage3Template.clone().appendTo(tables);
				if(stage3) fillAirstrikeData(stage3, stage3Table, "main", enemyMainShipIds);
				if(stage3cf) fillAirstrikeData(stage3cf, stage3Table, "escort", enemyEscortShipIds);
			}
			$("table", tables).css("font-size", "11px");
			return tables.children();
		}
Build HTML tooltip for details of air battle losses