text: function buildEquipSelectOption(){let e=["tw","cn","en","jp"];lan_eq_nation.forEach(e=>{e.name=`equip_nation_${e.id}`}),lan_eq_type.forEach(e=>{e.name=`equip_type_${e.id}`,e.display=!1}),lan_eq_rarity.forEach(t=>{t.name=`equip_rarity_${t.id}`,e.forEach(e=>t[e]=t.en)}),lan_eq_tier.forEach(t=>{t.name=`equip_tier_${t.id}`,e.forEach(e=>t[e]=`${t.id}`)}),setTimeout(()=>window.buildEquipSelectOption=null)}function buildShipSelectOption(){let e=["tw","cn","en","jp"];lan_ship_nation.forEach(t=>{t.name=`ship_nation_${t.id}`,t.tw=t.cn,e.forEach(e=>t[`${e}_code`]=t[e])}),lan_ship_type.forEach(t=>{t.name=`ship_type_${t.id}`,t.display=!1,t.tw=t.cn,e.forEach(e=>t[`${e}_code`]=t[e])}),lan_ship_rarity.forEach(t=>{t.name=`ship_rarity_${t.id}`,e.forEach(e=>t[e]=t.code)}),setTimeout(()=>window.buildShipSelectOption=null)}const lan_target_list=[{id:"show_setting",en:"⮟ Settings",jp:"⮟ 設定",tw:"⮟ 設定"},{id:"allow_dup_btn",en:"Allow Duplicate",jp:"重複を許可する",tw:"允許重複的船"},{id:"display_fleet_border",en:"Fleet Border",jp:"フレーム表示",tw:"顯示外框"},{id:"display_fleet_op",en:"Fleet ID / Edit Button",jp:"編集ボタン表示",tw:"顯示編輯"},{id:"frame_setting",en:"Thick frame",jp:"厚いフレーム",tw:"粗框"},{id:"add_fleet",en:"Save Current",jp:"現在の艦隊をセーブ",tw:"儲存目前艦隊"},{id:"select_fleet",en:"Select Fleet",jp:"艦隊を選択",tw:"選擇艦隊"},{id:"load_fleet",en:"Load Fleet",jp:"ロード",tw:"載入艦隊"},{id:"remove_fleet",en:"Delete",jp:"削除",tw:"刪除"},{id:"fleet_name_label",en:"Fleet Name",jp:"艦隊名",tw:"艦隊名"},{id:"emptyfleet",en:"Empty Current Fleet",jp:"現在の艦隊を空に",tw:"清空目前艦隊"},{id:"fleetdata_text",en:"Fleet data",jp:"艦隊データ",tw:"艦隊資料"},{id:"dumpdata",en:"Dump",jp:"ダンプ",tw:"匯出"},{id:"copyData",en:"Copy",jp:"コピー",tw:"複製"},{id:"emptyData",en:"Clear",jp:"クリア",tw:"清空"},{id:"loadDataByID",en:"Load",jp:"ロード",tw:"載入"},{id:"owned_data_title",en:"⮟ Owned [Ship/Equip] Data",jp:"⮟ 所持して[艦船/装備]データ",tw:"⮟ 已有的[船/裝備]資料"},{id:"dumpOwned",en:"Dump",jp:"ダンプ",tw:"匯出"},{id:"copyOwned",en:"Copy",jp:"コピー",tw:"複製"},{id:"emptyOwned",en:"Clear",jp:"クリア",tw:"清空"},{id:"loadOwned",en:"Load",jp:"ロード",tw:"載入"},{id:"saveOwned",en:"Save",jp:"セーブ",tw:"儲存"},{id:"loadOwnedSetting",en:"Reload Setting",jp:"設定再読み込み",tw:"重新讀取設定"},{id:"tech_data_title",en:"⮟ Fleet Tech (Reload)",jp:"⮟ 艦船技術(装填)",tw:"⮟ 艦隊科技(裝填)"},{id:"rebuild_cache_btn",en:"Rebuild Cache",jp:"キャッシュをクリア&再構築",tw:"重建快取"},{id:"show_ship_filter",en:"⮟ Show Filter",jp:"⮟ フィルター",tw:"⮟ 顯示過濾器"},{id:"show_equip_filter",en:"⮟ Show Filter",jp:"⮟ フィルター",tw:"⮟ 顯示過濾器"},{id:"owned_ship_set",en:"Set Owned Ship",jp:"所持している艦船を設定",tw:"設定已有的船"},{id:"owned_ship_only",en:"Only Show Owned",jp:"所持しているだけを表示",tw:"只顯示已有的船"},{id:"owned_equip_set",en:"Set Owned Equip",jp:"所持している装備を設定",tw:"設定已有的裝備"},{id:"owned_equip_only",en:"Only Show Owned",jp:"所持しているだけを表示",tw:"只顯示已有的裝備"},{id:"item_level_ship",en:"Level",jp:"レベル",tw:"等級"},{id:"item_level_equip",en:"Enhance Level",jp:"強化レベル",tw:"強化等級"},{id:"ship_level_set",en:"Set Level",jp:"レベル設定",tw:"設定等級"},{id:"equip_level_set",en:"Set Level",jp:"強化レベル設定",tw:"設定強化等級"},{id:"affinity_1",en:"Stranger",jp:"知り合い",tw:"陌生"},{id:"affinity_2",en:"Friendly",jp:"友好",tw:"友好"},{id:"affinity_3",en:"Crush",jp:"好き",tw:"喜歡"},{id:"affinity_4",en:"Love",jp:"愛",tw:"愛"},{id:"affinity_5",en:"Oath",jp:"ケッコン",tw:"誓約"},{id:"affinity_6",en:"Oath(200)",jp:"ケッコン(200)",tw:"誓約(200)"},{id:"select_ship",en:"Select Ship",jp:"艦船を選択",tw:"選擇艦船"},{id:"select_equip",en:"Select Equip",jp:"装備を選択",tw:"選擇裝備"},{id:"filter_nation",en:"Nation",jp:"陣営",tw:"國家"},{id:"filter_type",en:"Type",jp:"種類",tw:"種類"},{id:"filter_rarity",en:"Rarity",jp:"レア度",tw:"稀有度"},{id:"sort",en:"Sorting",jp:"並べ替え",tw:"排序"},{id:"sort_nation",en:"Nation",jp:"陣営",tw:"國家"},{id:"sort_type",en:"Type",jp:"種類",tw:"種類"},{id:"sort_rarity",en:"Rarity",jp:"レア度",tw:"稀有度"},{id:"sort_default",en:"Default",jp:"初期設定",tw:"預設"},{id:"sort_retro",en:"Retrofit",jp:"改造",tw:"改造"},{id:"sort_jp",en:"Name(JP)",jp:"名前(JP)",tw:"名稱(JP)"},{id:"sort_en",en:"Name(EN)",jp:"名前(EN)",tw:"名稱(EN)"},{id:"sort_tw",en:"Name(TW)",jp:"名前(TW)",tw:"名稱(TW)"},{id:"sort_cn",en:"Name(CN)",jp:"名前(CN)",tw:"名稱(CN)"},{id:"sort_cd",en:"Reload Speed",jp:"攻速",tw:"射速"},{id:"search_input",en:"Search by name",jp:"検索(艦船名)",tw:"搜尋船名"},{id:"filter_search_result",en:"Result",jp:"結果",tw:"結果"},{id:"filter_retro",en:"Retrofitted Only",jp:"改造された艦船だけ",tw:"只顯示改造後的"}],vue_ui_text={sub_fleet:{en:"Sub",jp:"潜水",tw:"潛艇",cn:"潛艇"},normal_fleet:{en:"Normal",jp:"通常",tw:"一般",cn:"一般"},copy_fleet:{en:"FleetCopy",jp:"艦隊コピー",tw:"艦隊複製",cn:"艦隊複製"},copy_ship:{en:"ShipCopy",jp:"艦船コピー",tw:"艦船複製",cn:"艦船複製"},swap_ship:{en:"Swap",jp:"交換",tw:"交換",cn:"交換"}},parsetype={1:{cn:"驅逐砲",en:"DD Gun",jp:"駆逐砲"},2:{cn:"輕巡砲",en:"CL Gun",jp:"軽巡砲"},3:{cn:"重巡砲",en:"CA Gun",jp:"重巡砲"},4:{cn:"戰艦砲",en:"BB Gun",jp:"戦艦砲"},5:{cn:"魚雷",en:"Torpedoe",jp:"魚雷"},6:{cn:"防空砲",en:"Anti-Air Gun",jp:"対空砲"},7:{cn:"戰鬥機",en:"Fighter",jp:"戦闘機"},8:{cn:"魚雷機",en:"Torpedo Bomber",jp:"攻撃機"},9:{cn:"轟炸機",en:"Dive Bomber",jp:"爆撃機"},10:{cn:"設備",en:"Auxiliary",jp:"設備"},11:{cn:"超巡砲",en:"CB Gun",jp:"超巡砲"},12:{cn:"水上機",en:"Seaplane",jp:"水上機"},13:{cn:"潛艇用魚雷",en:"Submarine Torpedoe",jp:"潜水艦魚雷"},14:{cn:"爆雷",en:"Depth Charge",jp:"爆雷"},15:{cn:"反潛機",en:"ASW Bomber",jp:"対潜機"},17:{cn:"直升機",en:"ASW Helicopter",jp:"ヘリ"},18:{cn:"貨物",en:"Cargo",jp:"積載"}};Object.keys(parsetype).forEach(e=>parsetype[e].tw=parsetype[e].cn);const lan_ship_nation=[{id:1,cn:"白鷹",en:"Eagle Union",jp:"ユニオン",code:"USS"},{id:2,cn:"皇家",en:"Royal Navy",jp:"ロイヤル",code:"HMS"},{id:3,cn:"重櫻",en:"Sakura Empire",jp:"重桜",code:"IJN"},{id:4,cn:"鐵血",en:"Iron Blood",jp:"鉄血",code:"KMS"},{id:5,cn:"東煌",en:"Dragon Empery",jp:"東煌",code:"PRAN/ROC"},{id:6,cn:"撒丁帝國",en:"Sardegna Empire",jp:"サディア",code:"RN"},{id:7,cn:"北方聯合",en:"Northern Parliament",jp:"北連",code:"SN"},{id:8,cn:"自由鳶尾",en:"Iris Libre",jp:"アイリス",code:"FFNF"},{id:9,cn:"維希教廷",en:"Vichya Dominion",jp:"ヴィシア",code:"MNF"},{id:100,cn:"連動",en:"Collab",jp:"コラボ",code:"Collab"},{id:0,cn:"其他",en:"Other",jp:"その他",code:"Other"}],lan_ship_type=[{id:8,cn:"潛艇",en:"Submarine",jp:"潜水艦",code:"SS",pos:"sub"},{id:17,cn:"潛母",en:"Submarine Carrier",jp:"潜水空母",code:"SSV",pos:"sub"},{id:1,cn:"驅逐",en:"Destroyer",jp:"駆逐",code:"DD",pos:"front"},{id:2,cn:"輕巡",en:"Light Cruiser",jp:"軽巡",code:"CL",pos:"front"},{id:3,cn:"重巡",en:"Heavy Cruiser",jp:"重巡",code:"CA",pos:"front"},{id:18,cn:"超巡",en:"Large Cruiser",jp:"超甲巡",code:"CB",pos:"front"},{id:4,cn:"戰巡",en:"Battle Cruiser",jp:"巡洋戦艦",code:"BC",pos:"back"},{id:5,cn:"戰列",en:"Battle Ship",jp:"戦艦",code:"BB",pos:"back"},{id:6,cn:"輕航",en:"Light Carrier",jp:"軽空母",code:"CVL",pos:"back"},{id:7,cn:"航母",en:"Aircraft Carrier",jp:"空母",code:"CV",pos:"back"},{id:13,cn:"重砲",en:"Monitor",jp:"砲艦",code:"BM",pos:"back"},{id:12,cn:"維修",en:"Repair Ship",jp:"工作",code:"AR",pos:"back"},{id:0,cn:"其他",en:"Other",jp:"その他",code:"Other"}],lan_ship_rarity=[{id:6,cn:"海上傳奇",en:"Ultra Rare",jp:"UR",code:"★★★★★★"},{id:5,cn:"超稀有",en:"SuperRare",jp:"SSR",code:"★★★★★"},{id:4,cn:"精銳",en:"Elite",jp:"SR",code:"★★★★"},{id:3,cn:"稀有",en:"Rare",jp:"R",code:"★★★"},{id:2,cn:"普通",en:"Normal",jp:"N",code:"★★"}];buildShipSelectOption();const lan_eq_type=Object.keys(parsetype).map(e=>e=Object.assign({id:e},parsetype[e])),lan_eq_nation=lan_ship_nation.map(e=>Object.assign({},e)),lan_eq_tier=[{id:0},{id:3},{id:2},{id:1}],lan_eq_rarity=[{id:6,en:"★★★★★★"},{id:5,en:"★★★★★"},{id:4,en:"★★★★"},{id:3,en:"★★★"},{id:2,en:"★★"}];buildEquipSelectOption(),Object.defineProperty(Array.prototype,"isAll",{value:function(){return this.every(e=>Boolean(e))}}),Object.defineProperty(Array.prototype,"sameAs",{value:function(e){if(!(e instanceof Array))throw Error(`[${e}] (${typeof e}) is not Array!!`);return JSON.stringify(this)===JSON.stringify(e)}});const settingKey={language:"language",fleetData:"fleetData",allowDup:"allowDup",thickFrame:"thickFrame",layout:"layout",fleetEdit:"fleetEdit",fleetBorder:"fleetBorder",ownedItem:"ownedItem",techData:"techData",resetDB:"resetDB"},util={sleep:(e=0)=>new Promise(t=>setTimeout(t,e)),indexInObj(e,t=!1){let i=[];if(t)for(let t in e)i.push(t,e[t]);else for(let t in e)i.push(t);return i},sorting(e,t,i){function n(e,t){return String(e).localeCompare(String(t),navigator.languages[0]||navigator.language,{numeric:!0})}return i?e.sort((e,i)=>n(i[t],e[t])):e.sort((e,i)=>n(e[t],i[t])),e},stringifyReplacer(e,t){if("string"==typeof t){if(""==t)return 0;{let e=parseInt(t,10);return e||t}}return t},changeButtonStats(e,t=!0){function i(){e.click(),e.classList.add("active"),e.setAttribute("aria-pressed",!0)}function n(){e.click(),e.classList.remove("active"),e.setAttribute("aria-pressed",!1)}t?e.classList.contains("active")||i():e.classList.contains("active")&&n()}},LS={userSetting:{prefix:"user_setting_",set(e,t){if(e.match(/fleet_index_/))throw Error("Invalid Key");AFL_storage.setItem(`${this.prefix}${e}`,t),console.log(`save key:[${e}], value:[${t}]`)},get(e){return AFL_storage.getItem(`${this.prefix}${e}`)},del(e){return AFL_storage.removeItem(`${this.prefix}${e}`)}},fleetManager:{fleetLength(){let e=this.getData("num_of_fleet");return e||0},storageFleetData(e=[]){let t=e.length;if(!(e instanceof Array))throw Error("fleet data is not Array");if(!t)throw Error("no fleet data");for(let i=1;i<=t;i++)this.setData(`fleet_index_${i}`,e[i-1]);return this.setData("num_of_fleet",t),console.log(`storage ${t} fleet data`),!0},clearFleetData(){let e=this.fleetLength();for(let t=1;t<=e;t++)this.remove(`fleet_index_${t}`);return this.remove("num_of_fleet"),console.log(`remove ${e} old fleet data`),!0},getData(e){let t=AFL_storage.getItem(e);return t?JSON.parse(t):null},setData(e,t){let i=JSON.stringify(t);return AFL_storage.setItem(e,i)},remove:e=>AFL_storage.removeItem(e)},updateStorageList(){let e=fleet_info.list();e.innerHTML=fleet_in_storage.length>0?"":'<div class="dropdown-item text-light text-monospace" id="no_fleet">no fleet in storage...</div>',fleet_in_storage.forEach((t,i)=>{let n=decodeURIComponent(t.name),a=document.createElement("div");a.className="dropdown-item text-light text-monospace",a.textContent=`${i}_[${n}]`,a.onclick=function(){let e=fleet_info.select();e.textContent=`${i}_[${n}]`,e.setAttribute("sotrge_id",i),fleet_info.load().disabled=!1,fleet_info.remove().disabled=!1},e.appendChild(a)})},saveStorage(){let e=fleet_in_storage.length;e&&(LS.fleetManager.clearFleetData(),LS.fleetManager.storageFleetData(fleet_in_storage))},add_fleet(){let e=fleet_info.name(),t=e.value.trim(),i=encodeURIComponent(t);if(t&&0!=t.length){let t=app.util.dumpID();fleet_in_storage.push({name:i,fleet:t}),LS.saveStorage(),msg.normal.storage_add_fleet(i),e.value=""}else msg.error.empty_name()},load_fleet(){let e=fleet_info.select().getAttribute("sotrge_id");e&&!isNaN(e)||msg.error.invalid_id();let t=fleet_in_storage[e];t||msg.error.no_data();let i=decodeURIComponent(t.name);msg.normal.storage_load_fleet(e,t.name),fleet_info.name().value=i,LS.clear_select();let n=document.getElementById("fleetdata");n.value=t.fleet,app.util.loadDataByID()},clear_select(){let e=fleet_info.select();e.textContent="Select Fleet",e.removeAttribute("sotrge_id"),fleet_info.load().disabled=!0,fleet_info.remove().disabled=!0},remove_fleet(){let e=fleet_info.select().getAttribute("sotrge_id");e&&!isNaN(e)||msg.error.invalid_id();let t=fleet_in_storage[e];t||msg.error.no_data(),msg.normal.storage_remove_fleet(e,t.name),LS.clear_select(),fleet_in_storage.splice(e,1),LS.saveStorage()}},initialDB=async(e,t)=>{const i=await idb.openDB(e,t,{upgrade(t,i,n){try{i&&t.objectStoreNames.length&&n>i&&(console.log("clear old version"),t.deleteObjectStore(e))}catch(e){console.log(t,i,n,e)}finally{t.createObjectStore(e,{keyPath:"id"})}}}),n={getImgCache:async(t="")=>(await i).get(e,t),setImgCache:async(t="",n="")=>(await i).put(e,n,t),clear:async()=>(await i).clear(e),allKeys:async()=>(await i).getAllKeys(e),getAllCache:async()=>(await i).getAll(e)};return[i,n]},emptyCache=async()=>{const[e,t]=await initialDB(db_name,db_ver),i=Date.now(),n=LS.userSetting.get(settingKey.resetDB);n&&i-n<864e5||(await t.clear(),window.location.reload(),LS.userSetting.set(settingKey.resetDB,i))},msg={error:{_t:(e="")=>fleet_info.msg.red("Error: "+e),delete_last(){return this._t("You can't delete the last Fleet")},maximum_fleet(){return this._t("Exceed maximum Fleet limit")},negative_position(){return this._t("Position must be positive")},unknown_direction(){return this._t("Unknown direction")},empty_name(){return this._t("Fleet name is empty")},invalid_id(){return this._t("Invalid Fleet id")},no_data(){return this._t("Fleet data is empty")},long_url(){return this._t("URL too long. You still can share it by use fleetdata below")},too_high(){return this._t("Can't yeet the Fleet higher than it is")},too_low(){return this._t("Can't yeet the Fleet lower than it is")},unzip_failed(){return this._t("Invalid data")},corrupted_data(e){return this._t("Corrupted data"+(e.length?` (${e})`:""))},unknown_version(e){return this._t("Unknown version"+(e.length?` (${e})`:""))},wrong_data_type(e){return this._t("Wrong data type"+(e.length?` (${e})`:""))}},normal:{_t:(e="")=>fleet_info.msg.green(e),storage_add_fleet(e){return this._t(`Fleet [${decodeURIComponent(e)}] Saved`)},storage_load_fleet(e,t){return this._t(`Fleet ${e} [${decodeURIComponent(t)}] loaded`)},storage_remove_fleet(e,t){return this._t(`Fleet ${e} [${decodeURIComponent(t)}] removed`)},storage_found_fleets(e){return this._t(`Found ${e} Fleet in storage`)},copied(){return this._t("Copied")},fleet_dump(){return this._t("Fleet data dumped")},fleet_copied(e){return this._t(`Fleet ${e+1} copied`)},fleet_removed(e){return this._t(`Fleet ${e+1} removed`)},fleet_added(e){return this._t(`New ${1==e?"Normal":"Submarine"} Fleet added`)},fleet_loaded(){return this._t("Successfully loaded Fleet data")},owned_dump(e,t){return this._t(`Owned data dumped [Ship:${e}, Equip:${t}]`)},owned_load(e,t){return this._t(`Owned data loaded (text) [Ship:${e}, Equip:${t}]`)},owned_load_setting(e,t){return this._t(`Owned data loaded (setting) [Ship:${e}, Equip:${t}]`)},owned_save(e,t){return this._t(`Owned data saved [Ship:${e}, Equip:${t}]`)},ship_copied(e){return this._t(`[${e[0].property[language]}] copied`)}}},fleet_info={name:()=>document.querySelector("#fleet_name"),select:()=>document.querySelector("#select_fleet"),list:()=>document.querySelector("#fleet_list"),load:()=>document.querySelector("#load_fleet"),remove:()=>document.querySelector("#remove_fleet"),msg:{red(e="",t=!0){let i=document.querySelector("#error_message");if(classManager.exchange(i,msg_color.green,msg_color.red),i.textContent=e,i.style.opacity=1,this.clear_queue(),this.queue.push(setTimeout(()=>{i.style.opacity=0},3e3)),t)throw Error(e)},green(e="",t=!0){let i=document.querySelector("#error_message");classManager.exchange(i,msg_color.red,msg_color.green),i.textContent=e,i.style.opacity=1,this.clear_queue(),this.queue.push(setTimeout(()=>{i.style.opacity=0},3e3)),t&&console.log(e)},clear_queue(){this.queue.forEach(e=>clearTimeout(e))},queue:[]}},classManager={exchange(e,t,i){e.classList.contains(t)&&e.classList.remove(t),e.classList.add(i)},batchExchange(e,t,i){(t&&i)instanceof Array&&(t&&i).length>0&&(t.forEach(t=>e.classList.remove(t)),i.forEach(t=>e.classList.add(t)))}},app={option:{setLanguage(e){let t=e.id;language=ALF.lang=shipSelect.lang=equipSelect.lang=t,document.querySelectorAll("[name=name]").forEach(e=>e.textContent=e.getAttribute(t)),document.querySelectorAll("[ui_text='true']").forEach(e=>{e.id.includes("affinity_")?e.parentElement.childNodes[1].textContent=e.getAttribute(`ui_${t}`):"INPUT"==e.tagName?e.placeholder=e.getAttribute(`ui_${t}`):e.textContent=e.getAttribute(`ui_${t}`)}),e instanceof HTMLElement&&LS.userSetting.set(settingKey.language,language),this.adjustEle()},switchLayout(e,t=!1){function i(i,a){n(t?i:a),e.textContent=layout_list[t?i:a]}function n(e=""){for(let t in appClassData)"app_box"==t?document.querySelector(".app_box").className=`${appClassData.app_box[e]} app_box`:ALF.class_data[t]=appClassData[t][e]}switch(e.textContent){case layout_list.h:i("h","v");break;case layout_list.v:i("v","v2");break;case layout_list.v2:i("v2","h");break;default:throw Error("unknown layout")}LS.userSetting.set(settingKey.layout,layout_list[e.textContent])},frameSize(e){function t(e=""){if(e!=n)return 0,i?e.match(a)?e.replace(a,".png"):e.replace(".png","b.png"):e.replace(a,".png");0}$(e).button("toggle");let i="true"==e.getAttribute("aria-pressed"),n=window.location.href,a=/b+\.png/;[sortedEquip,sortedShip].forEach(e=>{e.forEach(e=>{""!=e.frame&&(e.frame=t(e.frame))})}),document.querySelectorAll("img.frame").forEach(e=>{""!=e.currentSrc&&(e.src=t(e.currentSrc))}),LS.userSetting.set(settingKey.thickFrame,i?1:0)},displayOP(e){$(e).button("toggle");let t=!!e.classList.contains("active");ALF.show_op=t,LS.userSetting.set(settingKey.fleetEdit,t?1:0)},displayBorder(e){$(e).button("toggle");let t=layout_list[document.querySelector("#layout_setting").textContent],i=e.classList.contains("active");if(i){const e={fleet_box_o:{h:"fleet_box_o d-grid justify-content-center",v:"fleet_box_o d-grid border border-secondary",v2:"fleet_box_o flex-row"},fleet_box_i:{h:"fleet_box_i row m-2 border border-secondary",v:"fleet_box_i col p-0",v2:"fleet_box_i col p-0 border border-secondary"}};for(let i in e)appClassData[i]=e[i],ALF.class_data[i]=appClassData[i][t]}else{const e={fleet_box_o:{h:"fleet_box_o d-grid justify-content-center",v:"fleet_box_o d-grid",v2:"fleet_box_o flex-row"},fleet_box_i:{h:"fleet_box_i row m-2",v:"fleet_box_i col p-0",v2:"fleet_box_i col p-0"}};for(let i in e)appClassData[i]=e[i],ALF.class_data[i]=appClassData[i][t]}LS.userSetting.set(settingKey.fleetBorder,i?1:0)},adjustEle(){const e=$(window).width(),t=1300,i={exchange:"exchange",batch:"batchExchange",w25:"w-25",w50:"w-50",w75:"w-75",w100:"w-100",mw75:"mw-75",mw100:"mw-100",no_effect:"adjustEle_placeholder",df:"d-flex",fw:"flex-wrap"},n=(e,t,i,n)=>({mode:t,n:i,s:n,ele:document.getElementById(e)}),a=[["fleet_storage",i.exchange,i.w50,i.w75],["dialog_shipselect",i.exchange,i.no_effect,i.mw75],["dialog_select_equip",i.exchange,i.no_effect,i.mw75]];e<t?a.forEach(e=>{e=n(...e),classManager[e.mode](e.ele,e.n,e.s)}):a.forEach(e=>{e=n(...e),classManager[e.mode](e.ele,e.s,e.n)})},ship:{allow_dup(e){$(e).button("toggle"),LS.userSetting.set(settingKey.allowDup,e.classList.contains("active")?1:0)},setCode(e){$(e).button("toggle");let t=["tw","cn","en","jp"];[lan_ship_nation,lan_ship_type].forEach(e=>{e.forEach(e=>{t.forEach(t=>{let i=e[t],n=e.code;e[t]=i==n?e[`${t}_code`]:e.code})})})},setRetro(e){$(e).button("toggle"),retrofit_only=e.classList.contains("active"),app.shipDisplay()},sort_order(e){e.value=1==e.value?0:1,e.textContent=1==e.value?"⮟":"⮝",document.querySelector('[onclick*="app.option.ship.sort"]').parentElement.querySelector('[aria-labelledby="sort_menu"]>.active').click()},isDescend(){return this._sort_order||(this._sort_order=document.querySelector("#ship_sort_order")),1==this._sort_order.value},last_sort:{},sort(e,t=!1){let i=document.querySelector("#shiplist"),n="000000",a=sortedShip[0],l=(this.last_sort.list?this.last_sort.list:sortedShip).filter(e=>e.id!=n),o=e.getAttribute("value"),r=this.isDescend();console.log(`sort by:${o}, descend:${r}`),t?(l=r?sortedShip:sortedShip.slice().reverse(),r||l.unshift(l.pop())):(l=util.sorting(l,o,r),l.unshift(a)),l.forEach(e=>i.appendChild(i.querySelector(`[id="${e.id}"]`))),this.last_sort={key:o,descend:r,list:l},[...e.parentElement.children].forEach(e=>e.classList.remove("active")),e.classList.add("active")}},equip:{resetFilter(e=!1){const t=new Set(e?[6,5,4,3]:[]),i=new Set(e?[0,3]:[]);document.querySelectorAll("#eq_tier button").forEach(e=>util.changeButtonStats(e,!!i.has(parseInt(e.value,10)))),document.querySelectorAll("#eq_rarity button").forEach(e=>util.changeButtonStats(e,!!t.has(parseInt(e.value,10)))),document.querySelectorAll("#eq_nation button,#eq_type button").forEach(e=>util.changeButtonStats(e,!1)),filter_setting.eq_type=new Set,filter_setting.eq_nation=new Set,filter_setting.eq_rarity=t,filter_setting.eq_tier=i},setCode(e){$(e).button("toggle");let t=["tw","cn","en","jp"];[lan_eq_nation].forEach(e=>{e.forEach(e=>{t.forEach(t=>{let i=e[t],n=e.code;e[t]=i==n?e[`${t}_code`]:e.code})})})},autoUseDefault(e){$(e).button("toggle"),e.classList.contains("active")?this.resetFilter(!0):this.resetFilter(!1)},sort_order(e){e.value=1==e.value?0:1,e.textContent=1==e.value?"⮟":"⮝",document.querySelector('[onclick*="app.option.equip.sort"]').parentElement.querySelector('[aria-labelledby="sort_menu"]>.active').click()},isDescend(){return this._sort_order||(this._sort_order=document.querySelector("#equip_sort_order")),1==this._sort_order.value},last_sort:{},sort(e,t=!1){let i=document.querySelector("#equiplist"),n="666666",a=sortedEquip[0],l=(this.last_sort.list?this.last_sort.list:sortedEquip).filter(e=>e.id!=n),o=e.getAttribute("value"),r=this.isDescend();console.log(`sort by:${o}, descend:${r}`),t?(l=r?sortedEquip:sortedEquip.slice().reverse(),r||l.unshift(l.pop())):("cd"!=o?l=util.sorting(l,o,r):(l.some(e=>e.max_cd)||l.forEach(e=>e.max_cd=e.cd.pop()),l=util.sorting(l,"max_cd",r)),l.unshift(a)),l.forEach(e=>i.appendChild(i.querySelector(`[id="${e.id}"]`))),this.last_sort={key:o,descend:r,list:l},[...e.parentElement.children].forEach(e=>e.classList.remove("active")),e.classList.add("active")}}},fleet:{buildFleet(e=[],t=!1){if(!e.length)throw Error("formation data is empty!!");let i=[];const n={1:e=>this.newNormalFleet(e),2:e=>this.newSubFleet(e)};if(e.forEach((e,t)=>i.push(n[e](t))),c_formation=e,!t)return i;ALF.fleets=fleetData=i},emptyEquip(){let e={id:"",type:[],star:"",rarity:"",tw:"",en:"",cn:"",jp:"",icon:ui_table.empty_disable,bg:"",frame:"",target:"",fb:[],type_tw:"",type_cn:"",type_en:"",type_jp:"",limit:"",quantity:"",equip_level:app._level_default.equip,tech:"",proficiency:"",nationality:"",eq_type:"",style:"",cd:[]};return e},emptyShip(){let e={id:"",type:"",star:"",rarity:"",tw:"",en:"",cn:"",jp:"",icon:ui_table.empty_item,bg:"",frame:"",target:"#shipselect",base:[],equip_p:[],quantity:"",ship_level:app._level_default.ship,nationality:"",eq_p:"",reload:[]};return e},creatEmptyShip(){let e=[];for(let t=0;t<6;t++){let i;i=0!=t?this.emptyEquip():this.emptyShip(),e.push({id:t,property:i})}return e},newNormalFleet(e){if(isNaN(e)||e<0)throw Error("no fleet_id");let t=[],i=[],n=this.creatEmptyShip(),a=n.length;for(let l=0;l<6;l++)if(l<3){let i=[];for(let t=0;t<a;t++){let a=Object.assign({},n[t].property);0==t&&(a.ship_pos=posTable.F[l]),a.pos="front",i.push({id:`${e}_0_${l}_${t}`,property:a})}t.push({id:`fleet_${e}_front_${l}`,item:i})}else{let t=[];for(let i=0;i<a;i++){let a=Object.assign({},n[i].property);0==i&&(a.ship_pos=posTable.BS[l-3]),a.pos="back",t.push({id:`${e}_1_${l-3}_${i}`,property:a})}i.push({id:`fleet_${e}_back_${l-3}`,item:t})}return{id:` ${e+1} `,front:t,back:i}},newSubFleet(e){if(isNaN(e)||e<0)throw Error("no fleet_id");let t=[],i=this.creatEmptyShip();for(let n=0;n<3;n++){let a=[],l=i.length;for(let t=0;t<l;t++){let l=Object.assign({},i[t].property);0==t&&(l.ship_pos=posTable.BS[n]),l.pos="sub",a.push({id:`${e}_2_${n}_${t}`,property:l})}t.push({id:`fleet_${e}_sub_${n}`,item:a})}return{id:` ${e+1} `,sub:t}}},util:{_owned:{ship:new Set([]),equip:new Set([]),ship_on:0,equip_on:0},saveOwned(){let e=JSON.stringify({ship:[...this._owned.ship],equip:[...this._owned.equip],ship_on:this._owned.ship_on,equip_on:this._owned.equip_on});e=LZString.compress(e),LS.userSetting.set(settingKey.ownedItem,e),msg.normal.owned_save(this._owned.ship.size,this._owned.equip.size)},setOwned(e,t){let i=e.classList.contains("active");this._owned[`${t}_on`]=i?0:1,i?e.classList.remove("active"):e.classList.add("active"),"ship"==t&&app.shipDisplay(),"equip"==t&&app.equipDisplay()},_editing_owned:{ship:!1,equip:!1},editOwned(e,t=""){function i(){function e(e){let t=parseInt(e.id,10);a.has(t)?a.delete(t):a.add(t),i(e)}function i(e){e||n.forEach(e=>e.style.opacity=a.has(parseInt(e.id,10))?1:.2),e&&(e.style.opacity=a.has(parseInt(e.id,10))?1:.2)}let n=[...document.querySelectorAll(`#${t}list button`)],l=n.shift();n.forEach(t=>{t.setAttribute("data-dismiss",""),t.onclick=function(){e(this)}}),l.setAttribute("data-dismiss",""),l.disabled=!0,l.onclick="",i()}function n(){let e=[...document.querySelectorAll(`#${t}list button`)],i=e.shift();e.forEach(e=>{e.setAttribute("data-dismiss","modal"),e.onclick=o[t],e.style.opacity=1}),l.disabled=!1,i.disabled=!1,i.setAttribute("data-dismiss","modal"),i.onclick=o[t]}let a=this._owned[t],l=document.querySelector(`#owned_${t}_only`),o={ship:function(){app.setShipAndEquip(this)},equip:function(){app.setEquip(this)}};e.classList.contains("active")?(e.classList.remove("active"),n(),this._editing_owned[t]=!1):(e.classList.add("active"),l.classList.contains("active")&&l.click(),l.disabled=!0,i(),this._editing_owned[t]=!0),"ship"==t&&app.shipDisplay(),"equip"==t&&app.equipDisplay()},removeAllCookie(){function e(e,t="",i=-1){let n=new Date,a=new Date;a.setTime(n.getTime()+1e3*i*60*60*24),document.cookie=`${e}=${t};expires=${a.toUTCString()};SameSite=Strict;`}let t=document.cookie,i={},n=new Set(["expires","SameSite"]);t=t.split(";").map(e=>e.trim()),t.forEach(e=>{let[t,a]=e.split("=");n.has(t)||(i[t]=a)});for(let t in i)e(t)},isCorrectShipType:e=>!("0"===c_side&&!type_front.has(e))&&(!("1"===c_side&&!type_back.has(e))&&!("2"===c_side&&!type_sub.has(e))),async updateFilter(e,t,i){let n=filter_setting[e].has(t),a=(e,t)=>filter_setting[e].add(t),l=(e,t)=>filter_setting[e].delete(t),o=(e,t)=>(n?l:a)(e,t);if(0==t)if("type"==i){let e=["front","back","sub"];n?e.forEach(e=>l(e,0)):e.forEach(e=>a(e,0))}else o(e,0);else o(e,t);return!0},async updateFilterSetting(e){$(e).button("toggle");let t=e.name.split("_"),i=t[0],n=t[1],a=parseInt(t[2],10);if("ship"==i){switch(n){case"nation":await this.updateFilter("nation",a,n);break;case"type":switch(c_side){case"0":await this.updateFilter("front",a,n);break;case"1":await this.updateFilter("back",a,n);break;case"2":await this.updateFilter("sub",a,n);break;default:throw Error(`unknown ship type ${n}`)}break;case"rarity":await this.updateFilter("rarity",a,n),e.style.color=e.style.color.length>0?"":"gold"}app.shipDisplay()}else if("equip"==i){switch(n){case"nation":await this.updateFilter("eq_nation",a,n);break;case"type":await this.updateFilter("eq_type",a,n);break;case"rarity":await this.updateFilter("eq_rarity",a,n),e.style.color=e.style.color.length>0?"":"gold";break;case"tier":await this.updateFilter("eq_tier",a,n);break;default:throw Error(`unknown equip type ${n}`)}app.equipDisplay()}},countShipDisplayed(){document.querySelector("#ship_count").textContent=document.querySelectorAll("#shiplist button[displayed='true']").length},countEquipDisplayed(){document.querySelector("#equip_count").textContent=document.querySelectorAll("#equiplist button[displayed='true']").length},equipCheck(e){function t(){i(a,"src","4.","3."),i(l,"src","ame_4","ame_3"),n(s,"bg","4.","3."),n(s,"frame","ame_4","ame_3"),p?(d="boolean"==typeof s.icon_cache?d:s.icon_cache,o.setAttribute("src",d),s.icon=d):(i(o,"src",u,d),n(s,"icon",u,d)),h.forEach(e=>{r.setAttribute(e,f[`${e}_name`]),s[e]=f[`${e}_name`]}),r.textContent=f[`${language}_name`]}function i(e,t,i,n){e.setAttribute(t,e.getAttribute(t).replace(i,n))}function n(e,t,i,n){e[t]=e[t].replace(i,n)}let a,l,o,r,s,p,c,d,u,_=parseInt(atob("MjgzNDA="),10),f=document.getElementById(String(_)),h=["tw","cn","en","jp"];f&&(a=f.querySelector(".bg"),l=f.querySelector(".frame"),o=f.querySelector(".icon"),r=f.querySelector("[name=name]"),c=parseInt(atob("MTA4MDIw"),10),s=sortedEquip.find(e=>e.id==_),_-=40,p=!!s.icon_cache,c=p?sortedShip.find(e=>e.id==c):window[atob("c2hpcF9kYXRh")][c],f=equip_data[_],eqck=!(!filter_setting.sub.has(8)||!filter_setting.sub.has(17)),d=p?s.icon:`${atob("ZXF1aXBzLw==")}${_}`,u=p?c.icon:`${atob("c2hpcGljb24v")}${c.painting}`,(e===atob("MjA3MDUw")||e===atob("MzA3MDcw"))&&eqck?(i(a,"src","3.","4."),i(l,"src","ame_3","ame_4"),n(s,"bg","3.","4."),n(s,"frame","ame_3","ame_4"),p?(o.setAttribute("src",u),s.icon=u,"boolean"==typeof s.icon_cache&&(s.icon_cache=d)):(i(o,"src",d,u),n(s,"icon",d,u)),h.forEach(e=>{r.setAttribute(e,c[p?e:`${e}_name`]),s[e]=c[p?e:`${e}_name`]}),r.textContent=c[p?language:`${language}_name`]):t())},dumpID(e=!1,t=[],i){let n=[];return(t.length?t:fleetData).forEach(e=>n.push(app.util.dumpFleet(e))),e?n:(n=JSON.stringify(n),n=app.util.updateFleetDataBox(n),i&&msg.normal.fleet_dump(),n)},dumpFleet(e=[]){let t=[];for(let i in e){if("id"==i)continue;let n=[];e[i].forEach(e=>{let t=!e.item[0].property.id;if(t)n.push([0]);else{let t,i=[],a=[];e.item.forEach((e,n)=>{let l=parseInt(e.property.id),o=0==n?e.property.ship_level:e.property.equip_level;l?(i.push(l),0==n?(e.property.affinity&&(t=e.property.affinity),a.push(app.shipLevelLimit(o).toString(16).padStart(2,0))):a.push(app.equipLevelLimit(e.property.rarity,o,e.property.tech).toString(16))):(i.push(0),a.push(app._level_default.equip.toString(16)))}),i.push(a.join("")),t&&i.push(t),n.push(i)}}),t.push(n)}return t.push(e.sub?2:1),t},updateFleetDataBox(e=""){let t,i=document.getElementById("fleetdata");if(e.length)return t=`${e}!0.06!${CryptoJS.MD5(e).toString().slice(0,7)}`,t=LZString.compressToEncodedURIComponent(t),i.value=t,t},async loadDataByID(e=!1,t){function i(e=""){n.value="Error: Corrupted data!!!",console.log(l),msg.error.corrupted_data()}let n=document.getElementById("fleetdata"),a=n.value;a.length||msg.error.no_data(),"["!==a[0]&&(a=LZString.decompressFromEncodedURIComponent(a)),a||(a=LZString.decompressFromEncodedURIComponent(decodeURIComponent(n.value))),a||msg.error.unzip_failed();let[l,o,r]=a.split("!"),s=!1;switch(o){case"0.04":if(s=CryptoJS.SHA3(l,{outputLength:256}).toString(),s!==r)return i(s);l=JSON.parse(l),c_formation.sameAs(formation.v4)||app.fleet.buildFleet(formation.v4,!0);break;case"0.05":if(s=CryptoJS.MD5(l).toString(),s!==r)return i(s);l=JSON.parse(l),c_formation=this.extractFormation(l),app.fleet.buildFleet(c_formation,!0);break;case"0.06":if(s=CryptoJS.MD5(l).toString().slice(0,7),s!==r)return i(s);l=JSON.parse(l),c_formation=this.extractFormation(l),app.fleet.buildFleet(c_formation,!0);break;default:msg.error.unknown_version()}n.value="",await this.parseID(l,e,o),dynamicFleet.disableInvalidMoveButton(),t&&msg.normal.fleet_loaded()},async parseID(e,t=!1,i=""){if(!e.length)throw Error("no data");let n=[app._level_default.ship].concat(Array(5).fill(app._level_default.equip));return i=parseFloat(i),e.forEach((e,t)=>{let a=e[e.length-1],l=!isNaN(a)&&a;e.forEach((e,a)=>{e instanceof Array&&e.forEach((e,o)=>{if(i>.05){let i,r,s=e.length,p=1==s;if(p)return;7==s&&(i=e.pop()),8==s&&(r=e.pop(),i=e.pop()),i&&(i=i.match(/(.{2})(.{5})/).filter((e,t)=>t>0).map((e,t)=>0==t?e:e.split("")).flat()),i instanceof Array||(i=n),e.forEach((e,n)=>{if(0==e&&(e="666666"),p)return;let s=1==l?`${t}_${a}_${o}_${n}`:`${t}_2_${o}_${n}`,c={name:s,id:e},d=parseInt(i[n],16),[u,_,f,h]=this.setCurrent(c,!0),m=fleetData[u][_][f].item[h].property;0==n?(app.setShipAndEquip(c,!1,!0)||(p=!0),m.affinity=r||4,m.affinity_value=this._affinity_bonus[m.affinity],m.ship_level=app.shipLevelLimit(d)):(app.setEquip(c,!1,!0),m.equip_level=app.equipLevelLimit(m.rarity,d,m.tech))})}else{let i=!1;e.forEach((e,n)=>{if(""!==e&&0!==e||(e=0==n?"000000":"666666"),i)return;let r;r=l?1==l?`${t}_${a}_${o}_${n}`:`${t}_2_${o}_${n}`:t<4?`${t}_${a}_${o}_${n}`:`${t}_2_${o}_${n}`;let s={name:r,id:e},[p,c,d,u]=this.setCurrent(s,!0),_=fleetData[p][c][d].item[u].property;0===n?(app.setShipAndEquip(s,!1,!0)||(i=!0),_.ship_level=app.shipLevelLimit(app._level_default.ship)):(app.setEquip(s,!1,!0),_.equip_level=app.equipLevelLimit(_.rarity,app._level_default.equip,_.tech)),"000000"===e&&(i=!0)})}})}),app.checkFleetShipSkill(t)}),t||LS.userSetting.set(settingKey.fleetData,app.util.dumpID()),!0},extractFormation(e=[]){if(!(e instanceof Array))throw Error("Invalid data");let t=[];return e.forEach(e=>{isNaN(e[e.length-1])||t.push(e[e.length-1])}),t},setCurrent(e,t=!1){[c_fleet,c_side,c_pos,c_item]=e.name.split("_");let i=dynamicFleet._swap;if(!i.on){
  if("0"===c_item){let e={0:type_front,1:type_back,2:type_sub};if(e=e[c_side],!e)throw Error("unknown type");t||(lan_ship_type.forEach(t=>t.display=!!e.has(t.id)||0==t.id),app.shipDisplay())}else if(!t){let e=sideTable[c_side],t=fleetData[c_fleet][e][c_pos].item[c_item].property.type,i=new Set(t);lan_eq_type.forEach(e=>e.display=!!i.has(parseInt(e.id))),"true"==document.getElementById("always_reset_equip_filter").getAttribute("aria-pressed")&&app.option.equip.resetFilter(!0),app.equipDisplay()}return[c_fleet,sideTable[c_side],c_pos,c_item]}if(1!=i.state)if(2!=i.state){if(0!=i.state)throw Error("unknown state")}else i.b=[c_fleet,c_side,c_pos,c_item];else i.a=[c_fleet,c_side,c_pos,c_item]},dumpTechData(){document.querySelectorAll("#tech_data_area_expand input").forEach(e=>{let t=parseInt(e.getAttribute("ship_type")),i=this._tech_reload[t]||0;e.value=i})},saveTechData(){let e={};document.querySelectorAll("#tech_data_area_expand input").forEach(t=>{let i=parseInt(t.getAttribute("ship_type")),n=parseInt(t.value,10)||0;isNaN(n)&&(n=0),this._tech_reload[i]=e[i]=n}),console.log(e),LS.userSetting.set(settingKey.techData,JSON.stringify(e)),app.util.updateAllCD()},loadTechData(){let e=LS.userSetting.get(settingKey.techData);if(e&&(e=JSON.parse(e),e))for(let[t,i]of Object.entries(e))this._tech_reload[t]=i},_tech_reload:{1:0,2:0,3:0,4:0,5:0,6:0,7:0,10:0,13:0,18:0},_affinity_bonus:{1:1,2:1.01,3:1.03,4:1.06,5:1.09,6:1.12},getShipReload({reload:[e,t,i,n,a],ship_level:l=125,affinity:o=4,nationality:r=0,type:s,tw:p}){let c,d=this._affinity_bonus[o]||1,u=this._tech_reload[s]||0;return 97!=r&&(n=Math.floor(n*(Math.min(l,100)/100*.7+.3))),c=Math.floor((e+t*(l-1)/1e3+i*(Math.max(l,100)-100)/1e3+n)*d+a+u),c},_airstrike:new Set([7,8,9,12]),getEquipCD({equip_data:e={},ship_reload:t=100,pos:[i,n,a,l]}){function o(e){let l=fleetData[i][n][a].item,o=0,c=0,d=[],u=[];l.forEach((i,n)=>{if(n>0){let n=i.property,{equip_level:a,cd:l,quantity:r,eq_type:_,type:f,id:h}=n,m=e.has(_);if(!l.length)return;if(p=l[a]||l[l.length-1]||0,!p)return;r=parseInt(`0${r}`),m&&(c+=r,p=s(p,t),o+=p*r,d.push(n),u.push({name:n.tw,cd:p,q:r,sum:p*r}))}}),o=r(2.2*o/c),d.forEach(e=>{let t=e.equip_level;e.cd_cache=o,e.equip_level="",e.equip_level=t})}function r(e){return Math.round(100*e)/100}function s(e,t){return e/bc[k1].c1/Math.sqrt((100+t)*(parseInt(bc[k2].c2,16)/100))}let p,{equip_level:c=1,cd:d=[],eq_type:u,type:_}=e,f=this._airstrike.has(u),h=_.some(e=>this._airstrike.has(e));return d.length?(p=d[c]||d[d.length-1]||!1,p?f||h?(o(this._airstrike),r(s(p,t))):r(s(p,t)):0):0},updateAllCD(){fleetData.forEach((e,t)=>{Object.keys(e).forEach((i,n)=>{let a;"id"!=i&&(a=e[i],a.forEach((e,n)=>{let a=!e.item[0].property.id;a||this.updateCD({type:"ship",data:[t,i,n,0]})}))})})},updateCD({type:e="",data:[t,i,n,a]}){let l,o=fleetData[t][i][n].item,r=o[0].property;if(r.id)if(r.reload_cache=this.getShipReload(r),l=r.reload_cache,"ship"==e)o.forEach((e,o)=>{o>0&&setTimeout(async()=>{let o,r=e.property;this._airstrike.has(r.eq_type)?this.getEquipCD({equip_data:r,ship_reload:l,pos:[t,i,n,a]}):(await Vue.nextTick(),r.cd_cache=this.getEquipCD({equip_data:r,ship_reload:l,pos:[t,i,n,a]}),o=r.equip_level,r.equip_level="",r.equip_level=o)})});else{let e=fleetData[t][i][n].item[a].property;this._airstrike.has(e.eq_type)?this.getEquipCD({equip_data:e,ship_reload:l,pos:[t,i,n,a]}):e.cd_cache=this.getEquipCD({equip_data:e,ship_reload:l,pos:[t,i,n,a]})}}},action:{emptyfleet(){let e="No4BgGk6qhdC5Y2gpLlze5nEZTQMwQEYsg";e=LZString.decompressFromEncodedURIComponent(e),app.util.updateFleetDataBox(e),app.util.loadDataByID(),dynamicFleet.disableInvalidMoveButton()},ship_name_search(e){let t=e.target.value.toLowerCase();if(!t)return app.shipDisplay();console.log("search:",t);let i=document.querySelectorAll("#shiplist button");i.forEach(e=>{if("000000"==e.id)return;let i=ship_data[e.id],n=[i.tw_name.toLowerCase(),i.cn_name,i.en_name.toLowerCase(),i.jp_name,i.english_name.toLowerCase()].some(e=>e.match(t));if(n){if(i){let t=app.util.isCorrectShipType(i.type);e.style.display=t?"":"none",e.setAttribute("displayed",!!t)}}else e.style.display="none",e.setAttribute("displayed",!1)}),app.util.countShipDisplayed()},generateURL(){let e=app.util.dumpID(),t=LZString.decompressFromEncodedURIComponent("BYFxAcGcC4HpYB4E4AsAzArgKwPYDYAncAcwDpiBLEYDAI1Ip1gEEAvDAgGQEMA7AUwBiAG378QsIA");t=new URL(t);let i=document.getElementById("url_box");t.searchParams.append("AFLD",e),t=t.href,t.length>=2e3?(i.value="URL too long. You still can share it by use fleetdata below",msg.error.long_url()):(i.value=t,this.copyURL())},copyURL(){let e=document.getElementById("url_box");e.select(),e.setSelectionRange(0,99999),document.execCommand("copy"),msg.normal.copied()},copyData(e){let t=document.getElementById(e);t.select(),t.setSelectionRange(0,99999),document.execCommand("copy"),msg.normal.copied()},emptyData(e){document.getElementById(e).value=""},dumpOwned(){let{ship:e,equip:t}=app.util._owned,i=JSON.stringify({ship:[...e],equip:[...t]}),n=.1,a=CryptoJS.MD5(i).toString();i=`${i}!${n}!${a}`,i=LZString.compressToEncodedURIComponent(i),document.getElementById("owned_data_dump").value=i,msg.normal.owned_dump(e.size,t.size)},loadOwned(){let e=LZString.decompressFromEncodedURIComponent(decodeURIComponent(document.getElementById("owned_data_dump").value));if(e||msg.error.unzip_failed(),e=e.split("!"),3==e.length){let[t,i,n]=e,a=CryptoJS.MD5(t).toString();if(n==a)switch(i){case"0.1":let{ship:e,equip:n}=JSON.parse(t);(e&&n)instanceof Array||msg.error.wrong_data_type(),Object.assign(app.util._owned,{ship:new Set(e),equip:new Set(n)}),msg.normal.owned_load(e.length,n.length);break;default:msg.error.unknown_version(i)}else msg.error.corrupted_data()}else msg.error.corrupted_data(`Incorrect data length:${e.length}`)},loadOwnedSetting(e=!1){let t=JSON.parse(LZString.decompress(LS.userSetting.get(settingKey.ownedItem)));if(t){let{ship:i,equip:n,ship_on:a,equip_on:l}=t;i=new Set(i),n=new Set(n),app.util._owned={ship:i,equip:n,ship_on:a,equip_on:l},a&&document.querySelector("#owned_ship_only").click(),l&&document.querySelector("#owned_equip_only").click(),e&&msg.normal.owned_load_setting(i.size,n.size),console.log("load owned item data",app.util._owned)}else console.log(`unable to load [${settingKey.ownedItem}], removed it`)}},shipDisplay(){function e(e,t,i,n){if(!app.util.isCorrectShipType(t))return!1;let a=!1,l=!1,o=!1;switch(c_side){case"0":filter_setting.front.has(t)||0===filter_setting.front.size?l=!0:filter_setting.front.has(0)&&other_front.has(t)&&(l=!0);break;case"1":filter_setting.back.has(t)||0===filter_setting.back.size?l=!0:filter_setting.back.has(0)&&other_back.has(t)&&(l=!0);break;case"2":filter_setting.sub.has(t)||0===filter_setting.sub.size?l=!0:filter_setting.sub.has(0)&&other_sub.has(t)&&(l=!0);break;default:console.log("unknown type")}if(!l)return!1;if(filter_setting.nation.has(e)||0===filter_setting.nation.size)a=!0;else if(filter_setting.nation.has(100)&&collab_nation.has(e))a=!0;else{if(!filter_setting.nation.has(0)||!other_nation.has(e))return!1;a=!0}return!(!filter_setting.rarity.has(i)&&0!==filter_setting.rarity.size)&&(o=!0,!![a,l,o].isAll()&&(!retrofit_only||1!==n))}function t(){for(let e in fleetData[c_fleet])"id"!=e&&fleetData[c_fleet][e].forEach(e=>{let t=e.item[0].property.id;if(""!=t){let e=document.getElementById(t);e.style.display="none",e.setAttribute("displayed",!1)}})}function i(){let e=app.util._owned.ship;n.forEach(t=>{e.has(parseInt(t.id,10))||(t.style.display="none",t.setAttribute("displayed",!1))})}let n=document.querySelectorAll("#shiplist button");n=[...n],n.shift(),n.forEach(t=>{let i=parseInt(t.id,10),n=e(ship_data[i].nationality,ship_data[i].type,ship_data[i].rarity,ship_data[i].retro);t.style.display=n?"":"none",t.setAttribute("displayed",!!n)}),document.getElementById("allow_dup_btn").classList.contains("active")||app.util._editing_owned.ship||t(),document.querySelector("#owned_ship_only").classList.contains("active")&&i(),app.util.countShipDisplayed(),app.getLevel("ship")},_level_default:{ship:120,equip:10},shipLevelLimit:(e=1)=>(e=parseInt(e,10),isNaN(e)?app._level_default.ship:e<=0?1:e>125?125:e),equipLevelLimit(e=5,t=13,i=0){let n=13;if([e,t,i].forEach(e=>e=parseInt(e,10)),(isNaN(e)||e<1||e>6)&&(e=5),(isNaN(i)||i<0||i>3)&&(i=0),isNaN(t)&&(t=app._level_default.equip),t<0)return 0;switch(e){case 6:case 5:n=3==i||0==i?13:10;break;case 4:n=3==i||0==i?11:10;break;case 3:n=3==i||0==i?7:6;break;case 2:case 1:n=3}return t>n?n:t},getUiAffinity:()=>parseInt(document.querySelector("#affinity_area .active").getAttribute("value")),updateAffinity({value:e=!1,ship_pos:[t,i,n,a],setShip:l=!1,setUI:o=!1}){if(l){let a=fleetData[t][i][n].item[0].property;if(!a)throw Error("updateAffinity: ship not found");{let t=a.ship_level;e?(a.affinity=e,a.affinity_value=app.util._affinity_bonus[e]):(a.affinity=this.getUiAffinity(),a.affinity_value=app.util._affinity_bonus[a.affinity]),a.ship_level="",a.ship_level=t}}if(o&&e){let t=document.querySelector(`#affinity_area [value='${e}']`);t&&t.click()}},getLevel(e="",t=!1){if(!t){let t=sideTable[c_side],i=fleetData[c_fleet][t][c_pos].item[c_item].property,n=i[`${e}_level`],a=document.getElementById(`${e}_level_input`),l=document.getElementById(`${e}_level_slider`);if("ship"==e){i[`${e}_level`]=this.shipLevelLimit(n);let a=i.affinity;a||(a=4),this.updateAffinity({setShip:!0,setUI:!0,ship_pos:[c_fleet,t,c_pos,c_item],value:a})}"equip"==e&&(i[`${e}_level`]=this.equipLevelLimit(i.rarity,n,i.tech)),l.value=a.value=i[`${e}_level`]}},setLevel(e="",t=!1,i=!0){if(!t){let t=sideTable[c_side],n=fleetData[c_fleet][t][c_pos].item[c_item].property,a=parseInt(document.getElementById(`${e}_level_input`).value,10);"ship"==e&&(a=this.shipLevelLimit(a),this.updateAffinity({setShip:!0,ship_pos:[c_fleet,t,c_pos,c_item]})),"equip"==e&&(a=this.equipLevelLimit(n.rarity,a,n.tech)),n[`${e}_level`]=a,app.util.updateCD({type:e,data:[c_fleet,t,c_pos,c_item]}),i&&LS.userSetting.set(settingKey.fleetData,app.util.dumpID())}},setShipAndEquip(e,t=!1,i=!1){let n=sideTable[c_side],a=fleetData[c_fleet][n][c_pos],l=sortedShip.find(t=>{if(t.id===`${e.id}`||t.id===e.id)return Object.assign({},t)}),o=`fleet:${c_fleet}, ${n}, pos:${c_pos}, item:${c_item}`;if(!l){let t=cn_wiki_to_alf_id[e.id];t&&([e.id,t]=[t,e.id],l=sortedShip.find(t=>{if(t.id===`${e.id}`||t.id===e.id)return Object.assign({},t)}),l&&console.log(`%cfound [${e.id}] match cn wiki [${t}]`,"color:orange"))}if(!l)return console.log(`%cship id[${e.id}] at [${o}] not found, abort`,"color:red;"),!1;for(let t in a.item){let n=a.item[t].property;if("000000"===e.id)"0"===t?(ui_table.copy_ship.forEach(e=>n[e]=""),n.icon=l.icon,n.equip_p=n.base=[],delete n.slot_skill,n.reload=[],delete n.reload_cache,delete n.affinity,delete n.affinity_value):(Object.keys(n).filter(e=>"equip_level"!=e).forEach(e=>n[e]=""),n.icon=ui_table.empty_disable,n.fb=n.type=[],n.style=n.eq_type="",n.cd=[],delete n.cd_cache);else{let o=l.equip_p.map(e=>Math.round(100*e));if("0"===t)ui_table.copy_ship.forEach(e=>n[e]=l[e]),n.equip_p=o,app.setLevel("ship",i,!1),skill_ship_slot[e.id]&&(n.slot_skill=Object.assign({},skill_ship_slot[e.id]));else{let e=l[`e${t}`],i=parseInt(t,10)-1,r=a.item[0].property.base[i];Object.keys(n).filter(e=>"equip_level"!=e).forEach(e=>n[e]=""),n.type=e,n.icon=ui_table.empty_item,n.eq_type="",n.cd=[],delete n.cd_cache,t<=3&&(n.proficiency=o[t-1]),null!=r&&e.some(e=>addQuantityList.has(e))&&(n.quantity=`x${r}`);let s=[[],[],[],[]];e.forEach(e=>{ui_table.langs.forEach((t,i)=>{s[i].push(parsetype[e][t])})}),ui_table.langs.forEach((e,t)=>{n[e]=n[`type_${e}`]=s[t].join("/")}),n.target="#equipselect"}}}return app.checkFleetShipSkill(c_fleet),i||app.util.updateCD({type:"ship",data:[c_fleet,n,c_pos,c_item]}),t&&LS.userSetting.set(settingKey.fleetData,app.util.dumpID()),!0},async equipDisplay(){function e(e,t,i,n){[e,t,i,n].forEach(e=>parseInt(e));let a=!1,l=!1,o=!1,r=!1;if(filter_setting.eq_nation.has(e)||0===filter_setting.eq_nation.size)a=!0;else if(filter_setting.eq_nation.has(100)&&eq_collab_nation.has(e))a=!0;else{if(!filter_setting.eq_nation.has(0)||!eq_other_nation.has(e))return!1;a=!0}return!(!filter_setting.eq_type.has(t)&&0!==filter_setting.eq_type.size)&&(l=!0,!(!filter_setting.eq_rarity.has(i)&&0!==filter_setting.eq_rarity.size)&&(o=!0,!(!filter_setting.eq_tier.has(n)&&0!==filter_setting.eq_tier.size)&&(r=!0,!0)))}async function t(e){let t=sideTable[c_side],i=fleetData[c_fleet][t][c_pos],n=[];i.item.forEach((e,t)=>{let i=e.property.id;0!=t&&""!=i&&n.push(i)});let a=[];n.forEach(e=>{let t=parseInt(equip_data[e].equip_limit,10);isNaN(t)||t>0&&!a.includes(t)&&a.push(t)});let l=i.item[c_item].property.limit;return e.forEach(e=>{let t=parseInt(equip_data[e].equip_limit,10);if(t!=l&&a.includes(t)){let t=document.getElementById(e);t.style.display="none",t.setAttribute("displayed",!1)}}),!0}function i(){let e=app.util._owned.equip;o.forEach(t=>{e.has(parseInt(t.id,10))||(t.style.display="none",t.setAttribute("displayed",!1))})}let n=sideTable[c_side],a=fleetData[c_fleet][n][c_pos].item[c_item].property,l=a.type,o=document.querySelectorAll("#equiplist button"),r=fleetData[c_fleet][n][c_pos].item[0].property,s=r.type,p=r.id,c=[];o=[...o],o.shift(),app.util.equipCheck(p),o.forEach(t=>{let i=parseInt(t.id,10),n=equip_data[i],a=l.includes(n.type)&&!n.ship_type_forbidden.includes(s)&&e(n.nationality,n.type,n.rarity,n.tech);a&&(t.style.display="",c.push(i)),a||(t.style.display="none"),t.setAttribute("displayed",""==t.style.display)}),app.util._editing_owned.equip||await t(c),document.querySelector("#owned_equip_only").classList.contains("active")&&i(),app.util.countEquipDisplayed(),app.getLevel("equip")},setEquip(e,t=!1,i=!1){let n=sideTable[c_side],a=fleetData[c_fleet][n][c_pos],l=a.item[c_item].property,o=parseInt(e.id,10),r=`fleet:${c_fleet}, ${n}, pos:${c_pos}, item:${c_item}`;if(!o)return console.log(`%cinvalid equip id[${e.id}] at [${r}], abort`,"color:red;"),!1;if(666666===o)ui_table.copy_equip.forEach(e=>l[e]=""),l.tw=l.type_tw,l.cn=l.type_cn,l.en=l.type_en,l.jp=l.type_jp,l.icon=ui_table.empty_item,l.style=l.eq_type="",l.cd=[],delete l.cd_cache,a.item[0].property.slot_skill&&app.setProficiencyBySkill({c_data:[c_fleet,n,c_pos,c_item]});else{let e=sortedEquip.find(e=>{if(e.id===o)return Object.assign({},e)});if(!e)return console.log(`%cequip id[${o}] at [${r}] not found, abort`,"color:red;"),!1;ui_table.copy_equip.forEach(t=>l[t]=e[t]),app.setLevel("equip",!1,!1),l.eq_type=e.type,a.item[0].property.slot_skill&&app.setProficiencyBySkill({c_data:[c_fleet,n,c_pos,c_item]})}return app.util.updateCD({type:"equip",data:[c_fleet,n,c_pos,c_item]}),t&&LS.userSetting.set(settingKey.fleetData,app.util.dumpID()),!0},checkFleetShipSkill(e){let t=[],i=fleetData[e];Object.keys(i).forEach(n=>{"id"!=n&&i[n].forEach((i,a)=>{let l=i.item[0].property.slot_skill;l&&2==l.type&&t.push({c_data:[e,n,a,0]})})}),t.length>0&&t.forEach(e=>app.setProficiencyBySkill(e))},setProficiencyBySkill({c_data:e=[],condition:t=!1}){function i(){let{type:e,slot:t,check:i,list:n,p_diff:a}=_,o=a instanceof Array,r=!1;for(let e of t){let t=f[e-1];if(n.some(e=>e==t[i])){if(o){f.forEach((e,t)=>{e.proficiency+=a[t],e.style=l(a[t])}),r=!0;break}t.proficiency+=a,t.style=l(a),r=!0}}return r}function n(){let e,t,{type:i,slot:n,check:a,list:s,p_diff:c}=_,[d,u]=n[0].split("_");return u=o(d,u),("id"!=a||u==p)&&(e=fleetData[r][d][u].item[0].property,t=e.tw,!!s.some(t=>t==e[a])&&(f.forEach((e,t)=>{e.proficiency+=c[t],e.style=l(c[t])}),!0))}function a(){let t=!1;for(let i of _.cons)if(t=app.setProficiencyBySkill({c_data:e,condition:i}),t)break;return t}function l(e){return e>0?"color: lime;":e<0?"color: orangered;":0==e?"":void 0}function o(e,t){return"front"==e?posTable_r.F[t]:posTable_r.BS[t]}let[r,s,p,c]=e,d=fleetData[r][s][p],u=d.item[0].property.equip_p,_=t||d.item[0].property.slot_skill,f=[d.item[1].property,d.item[2].property,d.item[3].property];d.item[0].property.tw;switch(f.forEach((e,t)=>{e.proficiency=u[t],e.style=""}),_.type){case 1:return i();case 2:return n();case 3:return a();default:return}},async initialize(){function e(){function e(e){let t;if(t=10!=e?lan_ship_type.find(t=>t.id==e):{tw:"航戰",cn:"航戰",jp:"航戦",en:"Aviation Battleship"},t){let{tw:e,cn:i,en:n,jp:a}=t;return{tw:e,cn:i,en:n,jp:a}}}let t=document.getElementById("tech_data_area_expand"),i=[1,2,3,4,5,6,7,10,13,18],n=[];i.forEach(t=>{let i=e(t),a=Object.keys(i).map(e=>`ui_${e}="${i[e]}"`).join(" ");a+=' ui_text="true"',n.push(`\n                    <div class="d-flex my-3 justify-content-center">\n                        <label class="my-auto w-50 border-left border-bottom" for="tech_${t}" ${a}>${i[language]}</label>\n                        <div class="ml-0">\n                            <input class="m-auto text-center" type="text" size="2" id="tech_${t}" ship_type="${t}">\n                        </div>\n                    </div>\n                    `)}),n.push('<button class="btn" id="tech_data_save" onclick="app.util.saveTechData()">Save</button>'),t.innerHTML=n.join("\n")}async function t(e){let t,i=e=>parseInt((parseInt(e)%1e3).toString().repeat(4).slice(0,10)),n=e=>{let t,i;return i=3*(2<<e-1),i=(e>>1)*(t=1<<e),!(e<<5!=(e>>1)*t||!e)&&e},a=e=>!!n(e<<1)&&"0x"+parseInt(`${(e<<7)-(9<<e)+(e>>1<<1)}`).toString(16),l={},o=9,r=0;for(let s=0;s<o;s++)e=parseInt(`${e+i(e)}`.slice(0,10)),`${e}`.split("").forEach((i,o)=>{let s=parseInt(`${o}${i.toString(16)}${e}`.slice(0,6),10).toString(16).padStart(8,0);l[s]||(t=n(o),l[s]=Object.assign({},{c1:0}),t?(r++,l.c1=s,l[s].c1=parseInt(t)):l[s].c1=parseInt(i),t=a(o),t?(r++,l.c2=s,l[s].c2=t):l[s].c2="0x"+parseInt(`${i}${o}0`).toString(16).slice(0,3).padStart(3,0))}),(r<4||!l.c1||!l.c2)&&s--;return k1=l.c1,delete l.c1,k2=l.c2,delete l.c2,Object.assign(bc,l),!0}function i(e,t){let i=setInterval(()=>{Object.keys(e).every(t=>e[t])&&(t(),clearInterval(i))})}function n(e="",t=1){let i=document.createElement("div");i.textContent=e,i.className="text-center text-monospace",document.getElementById("loading_box").appendChild(i),t&&$(i).fadeOut("slow"),t||(i.style.display="none")}async function a(e="",t="",i=100,n={}){let a=document.querySelector("#loading_box"),l=document.createElement("div");return l.className="row justify-content-center mb-2",l.innerHTML=`\n                    <div class="text-center w-100">${t}</div>\n                    <div class="progress w-50 mx-auto position-relative">\n                        <div class="p-bar progress-bar bg-info" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="${i}">\n                            <div class="p-lable justify-content-center d-flex position-absolute w-100 text-dark">[0/${i}]</div>\n                        </div>\n                    </div>\n                `,a.appendChild(l),Object.assign(n,{bar:l.querySelector(".p-bar"),lable:l.querySelector(".p-lable"),value:0,max:i,update(){let e=++this.value,t=this.max,i=`${Math.round(e/t*100)}%`;this.bar.style.width=i,this.bar.setAttribute("aria-valuenow",e),this.lable.textContent=`[${e}/${t}] ${i}`}}),!0}function l(){let e=document.getElementById("ship_level_input"),t=document.getElementById("ship_level_slider"),i=document.getElementById("equip_level_input"),n=document.getElementById("equip_level_slider"),a=(a="")=>{"ship"==a&&(e.value=t.value),"equip"==a&&(i.value=n.value)},l=(a="")=>{"ship"==a&&(t.value=e.value=app.shipLevelLimit(e.value)),"equip"==a&&(n.value=i.value=app.equipLevelLimit(5,i.value)),app.setLevel(a,!1,!1)};e.addEventListener("change",()=>l("ship")),i.addEventListener("change",()=>l("equip")),t.addEventListener("input",()=>a("ship")),n.addEventListener("input",()=>a("equip")),t.addEventListener("change",()=>app.setLevel("ship",!1,!1)),n.addEventListener("change",()=>app.setLevel("equip",!1,!1)),$("#shipselect").on("hide.bs.modal",()=>app.setLevel("ship")),$("#equipselect").on("hide.bs.modal",()=>app.setLevel("equip"))}async function o(){let e=({uni_id:e,tw_name:t,cn_name:i,en_name:n,jp_name:a,type:l,nationality:o,rarity:r,star:s,retro:p,base_list:c,equip_1:d,equip_2:u,equip_3:_,equip_4:f,equip_5:h,painting:m,bg:y="",frame:g="",eq_p:b,reload:w,reload_cache:v=""})=>(m=`shipicon/${m.toLowerCase()}.png`,y=`ui/bg${r-1}.png`,g=`ui/frame_${r-1}.png`,{id:e,tw:t,cn:i,en:n,jp:a,type:l,nationality:o,rarity:r,star:s,retro:p,base:c,e1:d,e2:u,e3:_,e4:f,e5:h,icon:m,bg:y,frame:g,equip_p:b,reload:w,reload_cache:v}),t=[],i={};for(let i in ship_data)t.push(e(ship_data[i]));t=util.sorting(t,"nationality",!1),t=util.sorting(t,"type",!0),t=util.sorting(t,"id",!1),t=util.sorting(t,"rarity",!0),Object.assign(i,t[0]);for(let e in i)i[e]="";return t.unshift(Object.assign(i,{id:"000000",en:"remove",tw:"移除",cn:"移除",jp:"除隊",icon:ui_table.empty_item})),sortedShip=t,!0}async function r(){let e=({id:e,tw_name:t,cn_name:i,en_name:n,jp_name:a,type:l,nationality:o,rarity:r,ship_type_forbidden:s,equip_limit:p,icon:c,bg:d="",frame:u="",tech:_,cd:f})=>(c=`equips/${c}.png`,1!=r?(d=`ui/bg${r-1}.png`,u=`ui/frame_${r-1}.png`):(d=`ui/bg${r}.png`,u=`ui/frame_${r}.png`),{id:e,tw:t,cn:i,en:n,jp:a,type:l,nationality:o,rarity:r,fb:s,limit:p,icon:c,bg:d,frame:u,tech:_,cd:f}),t=[],i={};for(let i in equip_data)t.push(e(equip_data[i]));t=util.sorting(t,"id",!0),t=util.sorting(t,"type",!0),t=util.sorting(t,"nationality",!1),t=util.sorting(t,"rarity",!0),Object.assign(i,t[0]);for(let e in i)i[e]="";return t.unshift(Object.assign(i,{id:"666666",en:"remove",tw:"移除",cn:"移除",jp:"外す",icon:ui_table.empty_item})),sortedEquip=t,!0}async function s(){function e(e,t,i,n,a,l){return setTimeout(()=>{let o=document.getElementById(e.id),r=o.querySelector(".icon");l?(r.setAttribute("img_data",`${n}_${a}`),l.observe(r)):r.src=e.icon,o.onclick=function(){i(this)},t.update()})}function t(e,t){e.forEach(e=>{e.intersectionRatio>0&&(i(e.target),t.unobserve(e.target))})}function i(e){let[t,i]=e.getAttribute("img_data").split("_");e.src=("ship"==t?sortedShip:sortedEquip)[i].icon}console.time("addClickEventAndImg");let n=[{type:"ship",list:sortedShip,onclick:app.setShipAndEquip},{type:"equip",list:sortedEquip,onclick:app.setEquip}],l=sortedShip.length+sortedEquip.length,o=_loading_.add_img,r=(()=>"IntersectionObserver"in window&&"IntersectionObserverEntry"in window&&"intersectionRatio"in window.IntersectionObserverEntry.prototype)(),s=["MTA4MDIw","MjgzNDA="].reduce((e,t)=>(e.push(parseInt(atob(t))),e),[]);await a("add_img","add event & image",l,o);for(let i of n){let a=!!r&&new IntersectionObserver(t,{root:document.getElementById(`${i.type}select`),threshold:.5}),l=n.findIndex(e=>e==i);i.list.forEach((t,n)=>{e(t,o,i.onclick,i.type,n,t.id!=s[l]&&a)})}console.timeEnd("addClickEventAndImg")}function p(e,t){let i=`\n                    <button class="p-1 item_container" data-dismiss="modal" displayed="true" style="opacity: 1;" id="${e.id}">\n                        <div class="container-fluid p-0 box">\n                            <div class="container-fluid icon_box">\n                                <img class="img-fluid bg" src="${e.bg}">\n                                <img class="img-fluid frame" src="${e.frame}">\n                                <img class="img-fluid icon" src="${ui_table.empty_disable}">\n                            </div>\n                            <span class="item_name" name="name" tw="${e.tw}" cn="${e.cn}" en="${e.en}" jp="${e.jp}">\n                                ${e[language]}\n                            </span>\n                        </div>\n                    </button>\n                `;return t.update(),i}async function c(){console.time("createAllShip"),await a("create_ship","Generate Ships",sortedShip.length,_loading_.ship);let e=document.querySelector("#shiplist"),t=sortedShip.map(e=>p(e,_loading_.ship));return setTimeout(()=>{e.innerHTML=t.join(""),q.ship_done=!0}),console.timeEnd("createAllShip"),!0}async function d(){console.time("createAllEquip"),await a("create_equip","Generate Equips",sortedEquip.length,_loading_.equip);let e=document.querySelector("#equiplist"),t=sortedEquip.map(e=>p(e,_loading_.equip));return setTimeout(()=>{e.innerHTML=t.join(""),q.equip_done=!0}),console.timeEnd("createAllEquip"),!0}function u(e="",t="ship",i=""){return`${"ship"==t?"shipicon":"equips"}_${e.replace(i,"$1")}`}async function _(e){let t="getMissingCache",i=[],n=_loading_.missing_cache;console.time(t),await a("fetch_missing","Found some icons have no cache, download it now...",e.length,n);for(let t of e)i.length>=E&&(await Promise.all(i),i=[]),i.push(h(t.src).then(e=>{t.data_url=e,n.update()}));return await Promise.all(i),console.timeEnd(t),e}async function f(){let e="imgToDataURI";console.time(e);let t=/.*(?:equips|shipicon)\/([^\.]+).*/,i=0,n={};[sortedShip,sortedEquip].forEach((e,a)=>{e.forEach(e=>{let l=u(e.icon,0==a?"ship":"equip",t);n[l]||(n[l]={src:e.icon,id:l,data_url:""},i++)})});let l=[],o=[],r=_loading_.cache_image;await a("fetch_img","Downloading images... This will take a while.",i,r);for(let e in n){let t=n[e];o.length>=E&&(await Promise.all(o),o=[]),o.push(h(t.src).then(e=>{t.data_url=e,r.update()})),l.push(t)}return await Promise.all(o),console.log(`fetch ${i} images`),console.timeEnd(e),l}async function h(e="",t=!1){function i(e){return new Promise((t,i)=>{var n=new FileReader;n.onload=(()=>{t(n.result)}),n.onerror=i,n.readAsDataURL(e)})}let n="file:"==window.location.protocol;return t||n?e:fetch(e).then(e=>e.blob()).then(e=>i(e))}async function m(e){let t="loadImgCache";console.time(t);let i=/.*(?:equips|shipicon)\/([^\.]+).*/,n=sortedShip.length+sortedEquip.length-2,l=_loading_.load_cache,o=[],r=[{type:"ship",list:sortedShip},{type:"equip",list:sortedEquip}],s=await e.getAllCache(),p=0;return s=s.reduce((e,t)=>(e[t.src]=t.data_url,e),{}),await a("load_cache","Loading Cache",n,l),r.forEach(e=>{let t=new Set([]);e.list.forEach((n,a)=>{if(0==a)return;let r=s[n.icon];r?(n.icon_cache=!0,n.icon=r,p++):(n.icon_cache=!1,t.has(n.icon)||(console.log("cache not found",n),t.add(n.icon),o.push({src:n.icon,id:u(n.icon,e.type,i),data_url:""}))),l.update()})}),console.log(`set ${p} src to image cache`),console.timeEnd(t),o}async function y(e,t,i){const n=e.transaction(t,"readwrite"),a=i.map(e=>n.store.add(e));return await Promise.all([...a,n.done]),!0}function g(){let e=["en","jp","tw"];lan_target_list.forEach(t=>{let i=document.querySelectorAll(`#${t.id},[ui_id=${t.id}]`);i.length>0?i.forEach(i=>{i.setAttribute("ui_text","true"),i.setAttribute("ui_cn",t.tw),e.forEach(e=>i.setAttribute(`ui_${e}`,t[e]))}):console.log(`id[${t.id}] not found`)})}function b(){let e=document.querySelector("#search_input");if(!e)return console.log("search_input not found");e.addEventListener("input",app.action.ship_name_search);let t=$("#shipselect");t.on("hide.bs.modal",()=>e.value=""),console.log("add search event")}function w(){window.addEventListener("resize",app.option.adjustEle),$(window).width()<1300&&app.option.adjustEle()}async function v(){let e={};for(let t in settingKey){let i=LS.userSetting.get(t);e[t]=i||!1}e[settingKey.techData]&&app.util.loadTechData();let t=new URL(window.location.href),i=t.searchParams.get("AFLD"),n=document.querySelector("#fleetdata");if(e[settingKey.language]?document.getElementById(e[settingKey.language]).click():(app.option.setLanguage({id:language}),LS.userSetting.set(settingKey.language,language)),i?(n.value=i,app.util.loadDataByID(!0)):e[settingKey.fleetData]&&(n.value=e.fleetData,app.util.loadDataByID(!0)),1==e[settingKey.allowDup]&&app.option.ship.allow_dup(document.getElementById("allow_dup_btn")),1==e[settingKey.thickFrame]){let e=document.getElementById("frame_setting");setTimeout(()=>app.option.frameSize(e),500)}if(e[settingKey.layout]){let t=document.querySelector("#layout_setting");t.textContent=layout_list[e[settingKey.layout]],app.option.switchLayout(t,!0)}return 1!=e[settingKey.fleetEdit]&&e[settingKey.fleetEdit]||document.querySelector("#display_fleet_op").click(),1!=e[settingKey.fleetBorder]&&e[settingKey.fleetEdit]||document.querySelector("#display_fleet_border").click(),e[settingKey.ownedItem]&&app.action.loadOwnedSetting(),!0}async function S(){let e=LS.fleetManager.fleetLength();if(!(e<=0)){fleet_in_storage=[];for(let t=1;t<=e;t++){let e=LS.fleetManager.getData(`fleet_index_${t}`);e&&(e.name&&e.fleet&&fleet_in_storage.push({name:e.name,fleet:e.fleet}))}return msg.normal.storage_found_fleets(fleet_in_storage.length),!0}}console.time(app.initialize.name);let q={ship_done:!1,equip_done:!1};const E=5;if(await t(Date.now(),!1),n("sort Ship",0),await o(),n("sort Equip",0),await r(),n("access indexedDB",0),!indexedDB||!window.idb){let e=document.querySelector("#loading_box");return e.innerHTML="\n                    <div>Unable to access indexedDB.</div>\n                    <div>This browser doesn't support it or it's in incognito mode.</div>\n                ",e.className="h5 text-danger text-center text-monospace mx-auto my-5",setTimeout(()=>delete app.initialize,500)}{const[e,t]=await initialDB(db_name,db_ver);let i,n=await t.allKeys();if(!n.length){let t=await f();t.length>0&&(await y(e,db_name,t),console.log(`cached ${t.length} icons`))}i=await m(t),i.length>0&&(i=await _(i),i.length>0&&(await y(e,db_name,i),console.log(`cached ${i.length} icons that is missing form db`),console.log(i)))}await c(),await d(),await s(),e(),n("add text to ele",0),g(),n("add search",0),b(),n("add resize event",0),w(),n("load user setting",0),await v(),n("load fleet storage",0),await S(),n("set slider",0),l(),$("#loading_box").delay(500).slideUp(750),$(".lds-dual-ring").fadeOut(500,()=>$("#app_area").slideDown(1e3)),dynamicFleet.disableInvalidMoveButton(),i(q,()=>{app.option.setLanguage({id:language}),setTimeout(()=>delete app.initialize),setTimeout(()=>window.scrollTo({top:0})),console.timeEnd(app.initialize.name)})}},dynamicFleet={getPos(e){let t=e.getAttribute("pos");return parseInt(t.split(" ")[1],10)-1},moveFleet(e){let t=this.getPos(e),i=parseInt(e.getAttribute("data"),10),n=app.util.dumpID(!0),a=[];i<0?t-1<0&&msg.error.too_high():t+1>fleetData.length-1&&msg.error.too_low(),i=i<0?t-1:t+1,a=n.splice(t,1).flat(),n.splice(i,0,a),n=JSON.stringify(n),n=app.util.updateFleetDataBox(n),app.util.loadDataByID(!0),LS.userSetting.set(settingKey.fleetData,n),this.disableInvalidMoveButton()},copyFleet(e){fleetData.length>=maximumFleet&&msg.error.maximum_fleet();let t=this.getPos(e),i=app.util.dumpID(!0),n=[];i.forEach((e,i)=>{i==t&&n.push(Object.assign([],e)),n.push(e)}),n=JSON.stringify(n),n=app.util.updateFleetDataBox(n),app.util.loadDataByID(!0),LS.userSetting.set(settingKey.fleetData,n),msg.normal.fleet_copied(t)},deleteFleet(e){let t=this.getPos(e),i=app.util.dumpID(!0),n=[];i.forEach((e,i)=>{i!=t&&n.push(e)}),n.length||msg.error.delete_last(),n=JSON.stringify(n),n=app.util.updateFleetDataBox(n),app.util.loadDataByID(!0),LS.userSetting.set(settingKey.fleetData,n),msg.normal.fleet_removed(t),this.disableInvalidMoveButton()},insertFleet(e){fleetData.length>=maximumFleet&&msg.error.maximum_fleet();let t=e.getAttribute("data").split(",").map(e=>parseInt(e,10)),i=t[0],n=this.getPos(e),a=t[1];n<0&&msg.error.negative_position(),[0,1].includes(a)||msg.error.unknown_direction();let l=app.util.dumpID(!0),o={},r=[];switch(i){case 1:o=app.fleet.newNormalFleet(0);break;case 2:o=app.fleet.newSubFleet(0);break;default:throw Error("unknown formation")}o=app.util.dumpFleet(o),l.forEach((e,t)=>{0==a&&n==t&&r.push(o),r.push(e),1==a&&n==t&&r.push(o)}),r=JSON.stringify(r),r=app.util.updateFleetDataBox(r),app.util.loadDataByID(!0),LS.userSetting.set(settingKey.fleetData,r),msg.normal.fleet_added(i)},disableInvalidMoveButton(){function e(e=[]){e.forEach(e=>{e.setAttribute("disabled",!0),e.style.opacity=0})}function t(e=[]){e.forEach(e=>{e.removeAttribute("disabled"),e.removeAttribute("style")})}
  let i=document.querySelectorAll('[onclick^="dynamicFleet.moveFleet"],[onclick^="dynamicFleet.deleteFleet"]'),n=document.querySelectorAll('[pos=" 1 "][onclick^="dynamicFleet.moveFleet"][data="-1"],'+`[pos=" ${fleetData.length} "][onclick^="dynamicFleet.moveFleet"][data="1"]`);i.length&&(1!==fleetData.length?t(i):e(i)),n.length&&e(n),i=document.querySelectorAll('[onclick^="dynamicFleet.copyFleet"],[onclick^="dynamicFleet.insertFleet"]'),fleetData.length<maximumFleet?i.length&&t(i):fleetData.length>=maximumFleet&&i.length&&e(i)},_swap:{on:!1,state:0,a:!1,b:!1,is_ship:!1},async swapPos(e,t=!1){function i(){r(u),o(u),dynamicFleet._swap={on:!1,state:0,a:!1,b:!1,is_ship:!1}}async function n(){let e=fleetData[m.a[0]][sideTable[m.a[1]]][m.a[2]].item,t=fleetData[m.b[0]][sideTable[m.b[1]]][m.b[2]].item,i=t[0].property.ship_pos;return e.forEach((i,n)=>{t[n].property={},t[n].property=JSON.parse(JSON.stringify(e[n].property))}),t[0].property.ship_pos=i,msg.normal.ship_copied(e),!0}async function a(){let e=fleetData[m.a[0]][sideTable[m.a[1]]][m.a[2]].item,t=fleetData[m.b[0]][sideTable[m.b[1]]][m.b[2]].item,i=e[0].property.ship_pos,n=t[0].property.ship_pos;return e.forEach((i,n)=>{[e[n].property,t[n].property]=[t[n].property,e[n].property]}),e[0].property.ship_pos=i,t[0].property.ship_pos=n,!0}function l(e,t){0==t&&e.name.split("_")[1]!=m.a[1]&&d(e)}function o(e){_.forEach(t=>e(t))}function r(e){f.forEach(t=>{[...t.children].forEach((t,i)=>e(t,i))})}function s(e){e.getAttribute("data-toggle")&&e.setAttribute("data-toggle","false")}function p(e){e.getAttribute("data-toggle")&&e.setAttribute("data-toggle","modal")}function c(e,t){t>0&&d(e),s(e)}function d(e){e.classList.add(h)}function u(e){e.classList.remove(h),p(e)}let _=document.querySelectorAll(["#options",".fleet_op_box","#empty_fleet","#url_area","#data_area","#reset_cache"].join(",")),f=document.querySelectorAll(".ship_container"),h="disable_ele",m=this._swap,y=(e,t=100,i=0,n=!0)=>(n&&(i=0),i>0&&n&&(n=!1),document.addEventListener("click",g),new Promise((a,l)=>{let o=setInterval(()=>{if(e())return clearInterval(o),document.removeEventListener("click",g),a(!0);if(i<0||!m.is_ship){clearInterval(o),document.removeEventListener("click",g);let e=[];return i<0&&e.push("swap timeout"),m.is_ship||e.push("target is not ship"),l(e.join(", "))}i>=0&&!n&&(i-=t)},t)})),g=t=>{function i({_attr:e="data-target",_value:t="#shipselect",_elem:i=document,_max_rase:n=3}){if(i.ELEMENT_NODE){let a=!1,l=i,o=0;if(!l.getAttribute)return!1;for(;o<=n&&!a&&l;){if(l.getAttribute(e)==t)a=l;else{let i=[...l.children].find(i=>i.getAttribute(e)==t);i&&"ship_container"!=l.className&&(a=i)}if(a||!l.parentElement)break;l=l.parentElement,o++}return a||!1}return!1}t.target==e?m.is_ship=!0:m.is_ship=!!i({_elem:t.target})};o(d),r(c),m.on=!0,m.state=1,m.is_ship=!0;try{if(await y(()=>Boolean(m.a)),m.state++,!(m.a instanceof Array))throw Error("unknown position");if(r(l),await y(()=>Boolean(m.b)),!(m.b instanceof Array))throw Error("unknown position");t||await a(),t&&await n(),LS.userSetting.set(settingKey.fleetData,app.util.dumpID()),app.checkFleetShipSkill(m.a[0]),app.checkFleetShipSkill(m.b[0])}catch(e){console.log(e)}finally{i()}}},maximumFleet=30,appClassData={app_box:{h:"app_box d-flex flex-column w-100 m-auto",v:"app_box row justify-content-center py-1 px-5 m-0",v2:"app_box d-table justify-content-center m-auto"},fleet_box_o:{h:"fleet_box_o d-grid justify-content-center",v:"fleet_box_o d-grid",v2:"fleet_box_o flex-row"},fleet_box_i:{h:"fleet_box_i row m-2",v:"fleet_box_i col p-0",v2:"fleet_box_i col p-0"}},layout_list={h:"Horizontal",v:"Vertical 1",v2:"Vertical 2",Horizontal:"h","Vertical 1":"v","Vertical 2":"v2"},formation={v4:[1,1,1,1,2],v5:[1]},sideTable={0:"front",1:"back",2:"sub"},ui_table={empty_item:"ui/empty.png",empty_disable:"ui/icon_back.png",langs:["tw","cn","en","jp"],copy_ship:["tw","cn","en","jp","icon","frame","bg","id","type","rarity","star","base","equip_p","nationality","reload"],copy_equip:["tw","cn","en","jp","icon","frame","bg","id","limit","rarity","tech","nationality","cd"]},AFL_storage=window.localStorage,filter_setting={nation:new Set,front:new Set,back:new Set,sub:new Set,rarity:new Set,eq_nation:new Set,eq_rarity:new Set,eq_type:new Set,eq_tier:new Set},msg_color={red:"text-danger",green:"text-success"},_loading_={ship:{},equip:{},cache_image:{},load_cache:{},add_img:{},missing_cache:{}},bc={},posTable={BS:{0:"2",1:"1",2:"3"},F:{0:"3",1:"2",2:"1"}},posTable_r={BS:{2:"0",1:"1",3:"2"},F:{3:"0",2:"1",1:"2"}},type_front=new Set([1,2,3,18,19]),type_back=new Set([4,5,6,7,10,12,13]),type_sub=new Set([8,17]),other_nation=new Set([97,98]),collab_nation=new Set([101,103,104,105,106,107,108,109,110]),other_front=new Set([19]),other_back=new Set([10]),other_sub=new Set([0]),addQuantityList=new Set([1,2,3,4,5,6,7,8,9,11,12,13]),eq_other_nation=other_nation,eq_collab_nation=collab_nation,eq_nation=new Set(lan_eq_nation.map(e=>parseInt(e.id,10))),eq_type=new Set(lan_eq_type.map(e=>parseInt(e.id,10))),eq_rarity=new Set(lan_eq_rarity.map(e=>parseInt(e,10))),eq_tier=new Set(lan_eq_tier.map(e=>parseInt(e.id,10))),db_name="image_cache",db_ver=14,ALF_version=.05;let k1,k2,c_fleet="",c_side="",c_pos="",c_item="",c_ships=[],c_formation=[],retrofit_only=!0,fleetData=app.fleet.buildFleet(formation.v5),sortedShip=[],sortedEquip=[],fleet_in_storage=[],eqck=!1,language="en";Vue.component("item-container",{props:["item","lang"],template:'\n        <button class="p-1 item_container" onclick="app.util.setCurrent(this)" data-toggle="modal"\n          v-bind:name="item.id"\n          v-bind:pos="item.property.pos"\n          v-bind:data-target="item.property.target"\n          >\n            <div class="container-fluid p-0 box">\n              <div class="icon_box">\n                <img class="img-fluid bg" v-bind:src="item.property.bg">\n                <img class="img-fluid frame" v-bind:src="item.property.frame">\n                <img class="img-fluid icon" v-bind:src="item.property.icon">\n                <span class="itemq text_shadow" v-text="item.property.quantity" v-if="item.property.quantity"></span>\n                <span class="ship_pos2" v-text="item.property.ship_pos" v-if="item.property.ship_pos"></span>\n                <span class="ship_level" v-text="item.property.ship_level" v-if="item.property.bg && (item.property.ship_level > 0)"></span>\n                <span class="ship_affinity text_shadow" v-text="item.property.affinity_value" v-if="item.property.bg && (item.property.affinity_value > 1)"></span>\n                <span class="equip_level" v-text="\'+\'+item.property.equip_level" v-if="item.property.bg && (item.property.equip_level > 0)"></span>\n                <span class="equip_proficiency text_shadow" v-text="item.property.proficiency+\'%\'" v-if="item.property.quantity && item.property.proficiency" v-bind:style="item.property.style"></span>\n                <span class="equip_cd text_shadow" v-text="item.property.cd_cache+\'s\'" v-if="item.property.bg && (item.property.cd_cache > 0)"></span>\n              </div>\n              <span class="item_name" v-text="item.property[lang]"></span>\n            </div>\n        </button>\n    '}),Vue.component("ship-container",{props:["ship","lang"],template:'\n        <div class="ship_container">\n            <item-container\n                v-for="item in ship.item"\n                v-bind:key="item.id"\n                v-bind:item="item"\n                v-bind:lang="lang"\n            ></item-container>\n        </div>\n    '});const fleet_btn_style={normal:"btn btn-outline-secondary btn-sm fleet_op_btn p-0",yellow:"btn btn-outline-warning btn-sm fleet_op_btn p-0 w-50",text:"text-monospace text-center w-100 d-flex align-items-center justify-content-center border",copy:"btn btn-outline-success btn-sm w-75 mx-1 my-auto text-truncate text-monospace p-1 text-nowrap",del:"btn btn-outline-danger btn-sm mr-0 ml-auto my-auto fleet_op_btn px-2 py-0"},path=(e="")=>`dynamicFleet.${e}(this)`,action={insert:path(dynamicFleet.insertFleet.name),move:path(dynamicFleet.moveFleet.name),copy:path(dynamicFleet.copyFleet.name),delete:path(dynamicFleet.deleteFleet.name),swap:path(dynamicFleet.swapPos.name),swap_copy:path(dynamicFleet.swapPos.name)};Vue.component("fleet-container",{props:["fleet","lang","show_op","class_data","ui_text"],template:`\n        <div v-bind:class="class_data.fleet_box_o">\n            <div class="fleet_op_box" v-if="show_op">\n                <div class="d-flex line-5-item">\n                    <div class="w-25 text-monospace text-center m-auto fleet_name" v-text="fleet.id">Fleet_ID</div>\n                    <button class="${fleet_btn_style.copy}" v-bind:pos="fleet.id" onclick="${action.copy}" v-text="ui_text.copy_fleet[lang]">CopyFleet</button>\n                </div>\n                <div class="d-flex line-5-item">\n                    <div class="d-flex btn-group w-100 m-auto">\n                        <button class="${fleet_btn_style.yellow}" v-bind:pos="fleet.id" data="1,0" onclick="${action.insert}">⮝</button>\n                        <div class="${fleet_btn_style.text} border-warning" v-text="ui_text.normal_fleet[lang]">Normal</div>\n                        <button class="${fleet_btn_style.yellow}" v-bind:pos="fleet.id" data="1,1" onclick="${action.insert}">⮟</button>\n                    </div>\n                </div>\n                <div class="d-flex line-5-item">\n                    <div class="d-flex btn-group w-100 mx-1 my-auto">\n                        <button class="${fleet_btn_style.normal} w-50 w-border-right" v-bind:pos="fleet.id" onclick="${action.move}" data="-1">⮝</button>\n                        <div class="${fleet_btn_style.normal} w-75" onclick="${action.swap}" v-text="ui_text.swap_ship[lang]">Swap</div>\n                        <button class="${fleet_btn_style.normal} w-50 border-left" v-bind:pos="fleet.id" onclick="${action.move}" data="1">⮟</button>\n                    </div>\n                </div>\n                <div class="d-flex line-5-item">\n                    <div class="d-flex btn-group w-100 m-auto">\n                        <button class="${fleet_btn_style.yellow}" v-bind:pos="fleet.id" data="2,0" onclick="${action.insert}">⮝</button>\n                        <div class="${fleet_btn_style.text} border-warning" v-text="ui_text.sub_fleet[lang]">Sub</div>\n                        <button class="${fleet_btn_style.yellow}" v-bind:pos="fleet.id" data="2,1" onclick="${action.insert}">⮟</button>\n                    </div>\n                </div>\n                <div class="d-flex line-5-item">\n                    <button class="${fleet_btn_style.copy}" v-bind:pos="fleet.id" onclick="${action.swap_copy.replace("this","this, true")}" v-text="ui_text.copy_ship[lang]">CopyShip</button>\n                    <button class="${fleet_btn_style.del}" v-bind:pos="fleet.id" onclick="${action.delete}">✖</button>\n                </div>\n            </div>\n            <div v-bind:class="class_data.fleet_box_i">\n                <div class="flex-col fleet_side_box" v-if="fleet.back">\n                    <ship-container\n                        v-for="back in fleet.back"\n                        v-bind:key="back.id"\n                        v-bind:ship="back"\n                        v-bind:name="back.id"\n                        v-bind:lang="lang"\n                    ></ship-container>\n                </div>\n                <div class="flex-col fleet_side_box" v-if="fleet.front">\n                    <ship-container\n                        v-for="front in fleet.front"\n                        v-bind:key="front.id"\n                        v-bind:ship="front"\n                        v-bind:name="front.id"\n                        v-bind:lang="lang"\n                    ></ship-container>\n                </div>\n                <div class="flex-col fleet_side_box" v-if="fleet.sub">\n                    <ship-container\n                        v-for="sub in fleet.sub"\n                        v-bind:key="sub.id"\n                        v-bind:ship="sub"\n                        v-bind:name="sub.id"\n                        v-bind:lang="lang"\n                    ></ship-container>\n                </div>\n            </div>\n        </div>\n    `});const filter_btn_class="btn btn-outline-secondary line-5-item py-2 ml-0 font-weight-bold text-truncate filter-btn",filter_btn_template=`<button type="button" onclick="app.util.updateFilterSetting(this)" class="${filter_btn_class}"></button>`,filter_btn_template_4item=filter_btn_template.replace("line-5-item","line-4-item"),filter_btn_template_6item=filter_btn_template.replace("line-5-item","line-6-item");Vue.component("ship-nation-button",{props:["nation","lang"],template:filter_btn_template_6item}),Vue.component("ship-type-button",{props:["type","lang"],template:filter_btn_template}),Vue.component("ship-rarity-button",{props:["rarity","lang"],template:filter_btn_template}),Vue.component("equip-nation-button",{props:["nation","lang"],template:filter_btn_template_6item}),Vue.component("equip-type-button",{props:["type","lang"],template:filter_btn_template}),Vue.component("equip-rarity-button",{props:["rarity","lang"],template:filter_btn_template}),Vue.component("equip-tier-button",{props:["tier","lang"],template:filter_btn_template_4item}),app.initialize();const ALF=new Vue({el:"#AzurLaneFleetApp",data:{fleets:fleetData,lang:language,show_op:!1,class_data:{app_box:appClassData.app_box.h,fleet_box_o:appClassData.fleet_box_o.h,fleet_box_i:appClassData.fleet_box_i.h},ui_text:vue_ui_text}}),shipSelect=new Vue({el:"#shipselect",data:{nation:lan_ship_nation,type:lan_ship_type,rarity:lan_ship_rarity,lang:language}}),equipSelect=new Vue({el:"#equipselect",data:{nation:lan_eq_nation,type:lan_eq_type,rarity:lan_eq_rarity,tier:lan_eq_tier,lang:language}});