import*as mc from"@minecraft/server";import*as ui from"@minecraft/server-ui";const entries={start:{category:void 0,linksTo:["entities","items","structures","discord","credits"]},entities:{category:"start",linksTo:["wroughtnaut","umvuthi","umvuthana","frostmaw","sculptor","bluff","naga","foliaath","grottol","lantern"]},frostmaw:{category:"entities",linksTo:["ice_crystal"]},wroughtnaut:{category:"entities",linksTo:["wroughtnaut_helmet","wroughtnaut_axe"]},umvuthi:{category:"entities",linksTo:["umvuthana","sol_visage","suns_blessing"]},umvuthana:{category:"entities",linksTo:["umvuthi","umvuthana_masks"]},naga:{category:"entities",linksTo:["naga_fang","naga_fang_dagger"]},foliaath:{category:"entities",linksTo:["foliaath_seed"]},grottol:{category:"entities",linksTo:[]},lantern:{category:"entities",linksTo:[]},sculptor:{category:"entities",linksTo:["earthrend_gauntlet","sculptor_staff","bluff"]},bluff:{category:"entities",linksTo:["sculptor","geomancy_armor"]},travellers:{category:"entities",linksTo:["umvuthi","sculptor","wroughtnaut","frostmaw"]},items:{category:"start",linksTo:["ice_crystal","wroughtnaut_helmet","wroughtnaut_axe","umvuthana_masks","sol_visage","suns_blessing","naga_fang","naga_fang_dagger","blowgun","foliaath_seed","spear","earthrend_gauntlet","sculptor_staff","geomancy_armor","rake"]},ice_crystal:{category:"items",linksTo:["frostmaw"]},wroughtnaut_helmet:{category:"items",linksTo:["wroughtnaut"]},wroughtnaut_axe:{category:"items",linksTo:["wroughtnaut"]},umvuthana_masks:{category:"items",linksTo:["umvuthana"]},sol_visage:{category:"items",linksTo:["umvuthi","umvuthana"]},suns_blessing:{category:"items",linksTo:["umvuthi"]},naga_fang:{category:"items",linksTo:["naga_fang_dagger","blowgun","naga"]},naga_fang_dagger:{category:"items",linksTo:["naga_fang"]},blowgun:{category:"items",linksTo:["naga_fang"]},foliaath_seed:{category:"items",linksTo:["foliaath"]},spear:{category:"items",linksTo:["spear"]},earthrend_gauntlet:{category:"items",linksTo:["sculptor"]},sculptor_staff:{category:"items",linksTo:["sculptor"]},geomancy_armor:{category:"items",linksTo:["bluff"]},rake:{category:"items",linksTo:[]},structures:{category:"start",linksTo:["wroughtnaut_chamber","umvuthana_grove","monastery"]},wroughtnaut_chamber:{category:"structures",linksTo:["wroughtnaut"]},umvuthana_grove:{category:"structures",linksTo:["umvuthi","umvuthana"]},monastery:{category:"structures",linksTo:["bluff","sculptor"]},discord:{category:"start",linksTo:[]},credits:{category:"start",linksTo:[]}};export function openGuidebook(t){openPage(t,"start")}function openPage(t,e){const n=new Date,o=3===n.getMonth()&&n.getDate()>=1&&n.getDate()<=7;t.source.setDynamicProperty("hf_mzs:current_page",e);const a=`guidebook.hf_mzs.title_${e}`,s=`guidebook.hf_mzs.body_${e}${"wroughtnaut"===e&&o?"_april_fools":""}`,r=entries[e],i=(new ui.ActionFormData).title({translate:a}).body({translate:s,with:["\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n","\n"]});for(let t=0;t<r.linksTo.length;t++)"start"===r.linksTo[t]?i.button({translate:`guidebook.hf_mzs.button_${r.linksTo[t]}`}):"wroughtnaut"===r.linksTo[t]?i.button({translate:`guidebook.hf_mzs.button_${r.linksTo[t]}`},`textures/hf/mzs/guidebook/${r.linksTo[t]}${o?"_april_fools":""}`):i.button({translate:`guidebook.hf_mzs.button_${r.linksTo[t]}`},"textures/hf/mzs/guidebook/"+r.linksTo[t]);"start"===r.category?i.button({translate:`guidebook.hf_mzs.button_${r.category}`}):void 0!==r.category&&("wroughtnaut"===r.category?i.button({translate:`guidebook.hf_mzs.button_${r.category}`},`textures/hf/mzs/guidebook/${r.category}${o?"_april_fools":""}`):i.button({translate:`guidebook.hf_mzs.button_${r.category}`},"textures/hf/mzs/guidebook/"+r.category)),i.show(t.source).then((e=>{void 0===r.category||e.selection!==r.linksTo.length?e.selection>=0&&openPage(t,r.linksTo[e.selection]):openPage(t,r.category)}))}function disableCamera(t){t.source.runCommand("/inputpermission set @s camera disabled"),mc.system.runTimeout((()=>{t.source.runCommand("/inputpermission set @s camera enabled")}),20)}