(window.webpackJsonp=window.webpackJsonp||[]).push([[14],{499:function(e,t,n){"use strict";n.d(t,"a",(function(){return l}));var s=n(138),i=n(17),o=(n(500),n(32)),r=n(2);class l extends s.a{constructor(e,t,n,s,i){super(i),this.element=Object(r.s)({className:`${t} core_Input`}),this._value=new o.a(this,e,this.set_value),this.value=this._value,this.input_element=Object(r.m)({className:`${s} core_Input_inner`}),this.input_element.type=n,this.input_element.addEventListener("change",()=>{this._value.set_val(this.get_value(),{silent:!1})}),this.input_element.addEventListener("keydown",e=>{"Enter"===e.key&&this._value.set_val(this.get_value(),{silent:!1})}),i&&i.readonly&&this.set_attr("readOnly",!0),this.element.append(this.input_element)}set_enabled(e){super.set_enabled(e),this.input_element.disabled=!e}set_attr(e,t,n){if(null==t)return;const s=this.input_element,o=n||(e=>e);Object(i.a)(t)?(s[e]=o(t.val),this.disposable(t.observe(({value:t})=>s[e]=o(t)))):s[e]=o(t)}}},500:function(e,t,n){},639:function(e,t,n){"use strict";n.d(t,"a",(function(){return l})),n.d(t,"b",(function(){return c}));var s=n(42),i=n(2),o=n(15);n(640);const r=n(23).a.get("core/gui/Table");var l;!function(e){e[e.Asc=0]="Asc",e[e.Desc=1]="Desc"}(l||(l={}));class c extends s.a{constructor(e){super(e),this.tbody_element=Object(i.u)(),this.element=Object(i.t)({className:"core_Table"}),this.children=[],this.create_row=(e,t)=>{const n=new o.a;let s=0;return[Object(i.A)(...this.columns.map((o,l)=>{const c=o.fixed?Object(i.y)():Object(i.v)();try{const t=o.render_cell(e,n);c.append(t),o.input&&c.classList.add("input"),o.fixed&&(c.classList.add("fixed"),c.style.left=`${s}px`,s+=o.width||0),c.style.width=`${o.width}px`,o.text_align&&(c.style.textAlign=o.text_align),o.tooltip&&(c.title=o.tooltip(e))}catch(e){r.warn(`Error while rendering cell for index ${t}, column ${l}.`,e)}return c})),n]},this.update_footer=()=>{if(!this.footer_row_element)return;const e=this.columns.length;for(let t=0;t{const n=Object(i.y)({data:{index:t.toString()}},Object(i.s)(e.title));return e.fixed&&(n.style.position="sticky",n.style.left=`${c}px`,c+=e.width),n.style.width=`${e.width}px`,e.footer&&(a=!0),n}));const u=e.sort;u&&(s.onmousedown=e=>{if(e.target instanceof HTMLElement){let n=e.target;for(let e=0;e<5&&!n.dataset.index;e++){if(!n.parentElement)return;n=n.parentElement}if(!n.dataset.index)return;const s=parseInt(n.dataset.index,10),i=this.columns[s];if(!i.sortable)return;const o=t.findIndex(e=>e.column===i);if(0===o){const e=t[0];e.direction=e.direction===l.Asc?l.Desc:l.Asc}else-1!==o&&t.splice(o,1),t.unshift({column:i,direction:l.Asc});u(t)}}),n.append(s),this.tbody_element=Object(i.u)(),this.element.append(n,this.tbody_element),a&&(this.footer_row_element=Object(i.A)(),this.element.append(Object(i.x)({},this.footer_row_element)),this.create_footer()),this.disposables(Object(i.d)(this.tbody_element,this.values,this.create_row),this.values.observe(this.update_footer)),this.finalize_construction()}create_footer(){const e=[];let t=0;for(let n=0;nObject(o.d)(e).episode===this.episode);const n=Object(u.c)(),s=this.add(new a.b({class:"hunt_optimizer_MethodsForEpisodeView_table",values:n,sort:e=>{n.sort((t,n)=>{for(const{column:s,direction:i}of e){let e=0;switch(s.key){case"method":e=t.name.localeCompare(n.name);break;case"time":e=t.time.val.as("minutes")-n.time.val.as("minutes");break;default:{const i=o.c[s.key];i&&(e=(t.enemy_counts.get(i)||0)-(n.enemy_counts.get(i)||0))}}if(0!==e)return i===a.a.Asc?e:-e}return 0})},columns:[{key:"method",title:"Method",fixed:!0,width:250,sortable:!0,render_cell:e=>e.name},{key:"time",title:"Time",fixed:!0,width:60,input:!0,sortable:!0,render_cell(e,t){const n=t.add(new c(e.time.val));return t.add(n.value.observe(({value:t})=>e.set_user_time(t))),n.element}},...this.enemy_types.map(e=>({key:o.c[e],title:Object(o.d)(e).simple_name,width:90,text_align:"right",sortable:!0,render_cell(t){const n=t.enemy_counts.get(e);return null==n?"":n.toString()}}))]}));this.element.append(s.element),this.disposables(e.current.observe(({value:e})=>_(this,void 0,void 0,(function*(){try{const t=yield e;this.hunt_methods_observer&&this.hunt_methods_observer.dispose(),this.hunt_methods_observer=t.methods.observe(({value:e})=>{n.val=e.filter(e=>e.episode===this.episode)},{call_now:!0})}catch(e){m.error("Couldn't load hunt optimizer store.",e)}})),{call_now:!0})),this.finalize_construction()}dispose(){super.dispose(),this.hunt_methods_observer&&this.hunt_methods_observer.dispose()}}var v=function(e,t,n,s){return new(n||(n=Promise))((function(i,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function l(e){try{c(s.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,l)}c((s=s.apply(e,t||[])).next())}))};class b extends s.a{constructor(e,t){super(e,{class:"hunt_optimizer_MethodsView",tabs:[{title:"Episode I",key:"episode_1",path:"/methods/episode_1",create_view:()=>v(this,void 0,void 0,(function*(){return new f(t,i.b.I)}))},{title:"Episode II",key:"episode_2",path:"/methods/episode_2",create_view:()=>v(this,void 0,void 0,(function*(){return new f(t,i.b.II)}))},{title:"Episode IV",key:"episode_4",path:"/methods/episode_4",create_view:()=>v(this,void 0,void 0,(function*(){return new f(t,i.b.IV)}))}]}),this.finalize_construction()}}}}]);