2 lines
17 KiB
JavaScript
2 lines
17 KiB
JavaScript
(this["webpackJsonpnew-item-finder-website"]=this["webpackJsonpnew-item-finder-website"]||[]).push([[0],{126:function(e,t,r){"use strict";r.r(t);var n,a=r(0),c=r.n(a),o=r(37),i=r.n(o),s=r(9),l=r(207),u=r(198),d=r(199),f=r(191),h=r(2),p=Object(f.a)((function(e){return{footerHolder:{display:"flex",flex:"0 1 3vh",flexDirection:"row",alignItems:"center",justifyContent:"center",padding:"0 10vw 0 10vw"}}})),m=function(){var e=p();return Object(h.jsx)(u.a,{className:e.footerHolder,children:Object(h.jsx)(d.a,{children:"SPT-Aki \xa92021 Created by Rev and Shirito"})})},b=r(205),j=r(200),x=r(31),O=r(96),v=r.n(O),g=r(95),E=r.n(g);!function(e){e.LIGHT_MODE="light",e.DARK_MODE="dark"}(n||(n={}));var w,_=r(15),k=r.n(_),y=r(23),S=r(94),C=r.n(S),D=function(){var e=Object(y.a)(k.a.mark((function e(t,r){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat("http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/","/api/search"),{mode:"cors",method:"post",headers:{"Content-Type":"application/json"},body:JSON.stringify(r?{query:t,locale:r}:{query:t})});case 2:if(200!==(n=e.sent).status){e.next=9;break}return e.next=6,n.json();case 6:return e.abrupt("return",e.sent.items);case 9:n.status>=400&&console.error(n);case 10:return e.abrupt("return",[]);case 11:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),I=function(){var e=Object(y.a)(k.a.mark((function e(t,r){var n,a;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="".concat("http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/","/api/item?id=").concat(t),r&&(n="".concat(n,"&locale=").concat(r)),e.next=4,fetch(n,{mode:"cors"});case 4:if(200!==(a=e.sent).status){e.next=11;break}return e.next=8,a.json();case 8:return e.abrupt("return",e.sent);case 11:a.status>=400&&console.error(a);case 12:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),R=function(){var e=Object(y.a)(k.a.mark((function e(t,r){var n,a;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n="".concat("http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/","/api/item/hierarchy?id=").concat(t),r&&(n="".concat(n,"&locale=").concat(r)),e.next=4,fetch(n,{mode:"cors"});case 4:if(200!==(a=e.sent).status){e.next=11;break}return e.next=8,a.json();case 8:return e.abrupt("return",e.sent);case 11:a.status>=400&&console.error(a);case 12:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),N=function(){var e=Object(y.a)(k.a.mark((function e(){var t;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch("".concat("http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/","/api/locales"),{mode:"cors"});case 2:if(200!==(t=e.sent).status){e.next=9;break}return e.next=6,t.json();case 6:return e.abrupt("return",e.sent);case 9:t.status>=400&&console.error(t);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();!function(e){e.PREFERED_COLOR_SCHEME="items.sp-tarkov.com-prefered-color-scheme",e.PREFERED_JSON_THEME="items.sp-tarkov.com-prefered-json-theme",e.PREFERED_LOCALE="items.sp-tarkov.com-prefered-locale"}(w||(w={}));var T=["apathy","apathy:inverted","ashes","bespin","brewer","bright:inverted","bright","chalk","codeschool","colors","eighties","embers","flat","google","grayscale","grayscale:inverted","greenscreen","harmonic","hopscotch","isotope","marrakesh","mocha","monokai","ocean","paraiso","pop","railscasts","rjv-default","shapeshifter","shapeshifter:inverted","solarized","summerfruit","summerfruit:inverted","threezerotwofour","tomorrow","tube","twilight"],H=localStorage.getItem(w.PREFERED_LOCALE),L=localStorage.getItem(w.PREFERED_JSON_THEME),P=localStorage.getItem(w.PREFERED_COLOR_SCHEME),A=C()((function(e){return{preferedLocale:H||"en",setPreferedLocale:function(t){localStorage.setItem(w.PREFERED_LOCALE,t),e((function(e){return{preferedLocale:t}}))},localesList:[],refreshLocalesList:function(){var t=Object(y.a)(k.a.mark((function t(){var r;return k.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N();case 2:r=t.sent,e((function(e){return{localesList:r||[]}}));case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),preferedJsonViewerTheme:L&&T.includes(L)?L:T[0],setPreferedJsonViewerTheme:function(t){localStorage.setItem(w.PREFERED_JSON_THEME,t),e((function(e){return{preferedJsonViewerTheme:t}}))},preferedColorScheme:P||n.DARK_MODE,setPreferedColorScheme:function(t){localStorage.setItem(w.PREFERED_COLOR_SCHEME,t),e((function(e){return{preferedColorScheme:t}}))},searchInput:"",setSearchInput:function(t){return e((function(e){return{searchInput:t}}))},desiredSearchInput:"",setDesiredSearchInput:function(t){return e((function(e){return{desiredSearchInput:t}}))},itemHierarchy:{},setHierarchy:function(t){return e((function(e){return{itemHierarchy:t}}))},selectedItem:Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BACKEND_URL:"http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/"}).REACT_APP_SEARCH_FAKE_DATA?JSON.parse(Object({NODE_ENV:"production",PUBLIC_URL:"",WDS_SOCKET_HOST:void 0,WDS_SOCKET_PATH:void 0,WDS_SOCKET_PORT:void 0,FAST_REFRESH:!0,REACT_APP_BACKEND_URL:"http://ec2-54-95-229-197.ap-northeast-1.compute.amazonaws.com/"}).REACT_APP_SEARCH_FAKE_DATA):void 0,setSelectedItem:function(t){return e((function(e){return{selectedItem:t}}))}}})),F=Object(f.a)((function(e){return{buttonHolder:{display:"flex",alignItems:"center",justifyContent:"center",color:"primary",flexGrow:1},iconButton:{ml:1}}})),M=function(){var e=Object(x.a)(),t=F(),r=A(Object(a.useCallback)((function(e){return[e.preferedColorScheme,e.setPreferedColorScheme]}),[])),c=Object(s.a)(r,2),o=c[0],i=c[1];return Object(h.jsxs)(u.a,{className:t.buttonHolder,children:[e.palette.mode," mode",Object(h.jsx)(j.a,{className:t.iconButton,sx:{ml:1},onClick:function(){var e=o===n.LIGHT_MODE?n.DARK_MODE:n.LIGHT_MODE;i(e)},color:"inherit",children:"dark"===e.palette.mode?Object(h.jsx)(E.a,{}):Object(h.jsx)(v.a,{})})]})},G=r(201),J=r(194),K=r(190),B=r(193),z=Object(f.a)((function(e){return{localeHolder:{display:"flex",flexGrow:1,padding:"0.5vh 0 0.5vh 0"},select:{display:"flex",flexGrow:1}}})),V=function(){var e=z(),t=A(Object(a.useCallback)((function(e){return[e.preferedLocale,e.setPreferedLocale]}),[])),r=Object(s.a)(t,2),n=r[0],c=r[1],o=A(Object(a.useCallback)((function(e){return[e.localesList,e.refreshLocalesList]}),[])),i=Object(s.a)(o,2),l=i[0],d=i[1];return Object(a.useEffect)((function(){return d()}),[d]),Object(h.jsx)(h.Fragment,{children:Object(h.jsx)(u.a,{className:e.localeHolder,children:Object(h.jsxs)(G.a,{fullWidth:!0,children:[Object(h.jsx)(J.a,{id:"locale-select",children:"Language"}),Object(h.jsx)(K.a,{className:e.select,labelId:"prefered-locale",value:l.length>0?n:"",onChange:function(e){e.target.value&&c(e.target.value)},children:l.map((function(e,t){return Object(h.jsx)(B.a,{value:e,children:e},t)}))})]})})})},W=Object(f.a)((function(e){return{jsonHolder:{display:"flex",flexGrow:1,padding:"0.5vh 0 0.5vh 0"},configContainer:{display:"flex",flexGrow:0,flexDirection:"column",alignItems:"center",marginLeft:"1vw",width:"20vw",padding:"2vh 1vw 2vh 1vw",backgroundColor:e.palette.background.paper},jsonThemeSelect:{display:"flex",alignSelf:"stretch"}}})),U=function(){var e=W(),t=A(Object(a.useCallback)((function(e){return[e.preferedJsonViewerTheme,e.setPreferedJsonViewerTheme]}),[])),r=Object(s.a)(t,2),n=r[0],c=r[1];return Object(h.jsx)(h.Fragment,{children:Object(h.jsx)(u.a,{className:e.jsonHolder,children:Object(h.jsxs)(G.a,{fullWidth:!0,children:[Object(h.jsx)(J.a,{id:"react-json-view-theme",children:"JSON theme"}),Object(h.jsx)(K.a,{labelId:"react-json-view-theme",value:n,label:"JSON theme",onChange:function(e){e.target.value&&(c(e.target.value),localStorage.setItem(w.PREFERED_JSON_THEME,e.target.value))},children:T.map((function(e,t){return Object(h.jsx)(B.a,{value:e,children:e},t)}))})]})})})},q=Object(f.a)((function(e){return{form:{display:"flex",flexDirection:"row",flexGrow:1,justifyContent:"flex-end"}}})),Y=function(){var e=q();return Object(h.jsx)(h.Fragment,{children:Object(h.jsxs)("form",{className:e.form,children:[Object(h.jsx)(M,{}),Object(h.jsx)(V,{}),Object(h.jsx)(U,{})]})})},Q=Object(f.a)((function(e){return{headerContainer:{display:"flex",flex:"0 1 3vh",flexDirection:"row",backgroundColor:e.palette.background.paper,alignItems:"center",padding:"0 10vw 0 10vw"},linksContainer:{display:"flex",flexGrow:2,flexDirection:"row",alignItems:"center",height:"100%"},link:{display:"flex",padding:"0 1vw 0 1vw",height:"100%",alignItems:"center",borderBottom:"1px solid transparent","&:hover":{borderBottom:"1px solid ".concat(e.palette.action.hover)}}}})),X=function(){var e=Q();return Object(h.jsx)(h.Fragment,{children:Object(h.jsxs)(u.a,{className:e.headerContainer,children:[Object(h.jsxs)(u.a,{className:e.linksContainer,children:[Object(h.jsx)(b.a,{underline:"hover",color:"inherit",href:"https://www.sp-tarkov.com/",className:e.link,children:"Website"}),Object(h.jsx)(b.a,{underline:"hover",color:"inherit",href:"https://mods.sp-tarkov.com/",className:e.link,children:"Workshop"}),Object(h.jsx)(b.a,{underline:"hover",color:"inherit",href:"https://docs.sp-tarkov.com/",className:e.link,children:"Documentation"})]}),Object(h.jsx)(u.a,{sx:{display:"flex",flexGrow:1,flexDirection:"row",alignItems:"center",justifyContent:"flex-end"},children:Object(h.jsx)(Y,{})})]})})},Z=r(195),$=Object(f.a)((function(e){return{breadcrumbHolder:{display:"flex",flex:"0 1 3vh",flexDirection:"row",alignItems:"center",padding:"0 10vw 0 10vw",borderBottom:"1px solid ".concat(e.palette.background.paper)},breadcrumb:{display:"flex",flex:"0 1 3vh",flexDirection:"row",flexGrow:1},link:{color:e.palette.text.secondary,display:"flex",padding:"0 1vw 0 1vw",height:"100%",alignItems:"center",borderBottom:"1px solid transparent","&:hover":{color:e.palette.action.hover,cursor:"pointer"}},currentItem:{cursor:"default",borderBottom:"1px solid ".concat(e.palette.action.hover)}}})),ee=function(){var e=$(),t=A((function(e){return e.setSelectedItem})),r=A((function(e){return e.itemHierarchy})),n=A((function(e){return[e.searchInput,e.setSearchInput]})),c=Object(s.a)(n,2),o=c[0],i=c[1],l=A((function(e){return e.selectedItem})),f=Object(a.useState)([]),p=Object(s.a)(f,2),m=p[0],j=p[1];Object(a.useEffect)((function(){for(var e=[],t=null===l||void 0===l?void 0:l._id;t;){var n,a=r[t];e.push(a),t=null===a||void 0===a||null===(n=a.item)||void 0===n?void 0:n._parent}j(e.filter((function(e){return void 0!==e&&null!==e})).reverse())}),[l,r]);return Object(h.jsx)(u.a,{className:e.breadcrumbHolder,children:Object(h.jsxs)(Z.a,{"aria-label":"breadcrumb",className:e.breadcrumb,children:[Object(h.jsx)(b.a,{underline:"hover",color:"inherit",href:"/",className:e.link,children:Object(h.jsx)(d.a,{variant:"body2",children:"Home"})},"home"),m.map((function(r,n){return function(r,n){return o===r.locale.Name||o===r.item._id||o===r.item._name?Object(h.jsx)(d.a,{variant:"body2",className:e.currentItem,children:r.locale.Name?r.locale.Name:r.item._name},r.item._id):Object(h.jsx)(b.a,{underline:"hover",color:"inherit",onClick:function(){i(r.item._id),t(void 0)},className:e.link,children:Object(h.jsx)(d.a,{variant:"body2",children:r.locale.Name?r.locale.Name:r.item._name})},n)}(r,n.toString())}))]})})},te=r(81),re=r(206),ne=r(189),ae=r(196),ce=r(97),oe=r.n(ce),ie=Object(f.a)((function(e){return{searchAreaHolder:{display:"flex",flexGrow:1,flexDirection:"column",background:e.palette.background.paper,padding:"2vh 2vw 2vh 2vw"},jsonHolder:{display:"flex",flexGrow:1,alignItems:"center",flexDirection:"column",background:e.palette.background.paper,maxHeight:"80vh"},autocomplete:{}}})),se=function(){var e=ie(),t=A((function(e){return e.preferedLocale})),r=A(Object(a.useCallback)((function(e){return e.preferedJsonViewerTheme}),[])),n=A((function(e){return[e.searchInput,e.setSearchInput]})),c=Object(s.a)(n,2),o=c[0],i=c[1],l=Object(a.useState)(""),f=Object(s.a)(l,2),p=f[0],m=f[1],b=A((function(e){return e.setHierarchy})),j=A((function(e){return[e.selectedItem,e.setSelectedItem]})),x=Object(s.a)(j,2),O=x[0],v=x[1],g=Object(a.useState)([]),E=Object(s.a)(g,2),w=E[0],_=E[1],S=function(){var e=Object(y.a)(k.a.mark((function e(r){var n,a;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,D(r,t);case 2:n=e.sent,a=null===n||void 0===n?void 0:n.map((function(e){return{id:e.item._id,name:e.locale.Name}})),_(a||[]);case 5:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),C=Object(a.useCallback)(function(){var e=Object(y.a)(k.a.mark((function e(r){var n,a,c,o;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,I(r,t);case 2:if(!(n=e.sent)){e.next=16;break}return a=n.item,v(a),c={id:a._id,name:n.locale.Name},m(c.name),i(c.name),_([c]),e.next=12,R(a._id,t);case 12:o=e.sent,b(o||{}),e.next=19;break;case 16:v(void 0),m(""),i("");case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),[]);Object(a.useEffect)((function(){o&&o.match(/([a-z0-9]{24})/)&&C(o)}),[C,o]);var N=function(){var e=Object(y.a)(k.a.mark((function e(t){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t&&!(t.length<3)){e.next=4;break}return v(void 0),_([]),e.abrupt("return");case 4:if(t!==p&&t!==(null===O||void 0===O?void 0:O._id)){e.next=6;break}return e.abrupt("return");case 6:if(m(t),!t.match(/([a-z0-9]{24})/)){e.next=12;break}return e.next=10,C(t);case 10:e.next=14;break;case 12:return e.next=14,S(t);case 14:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),T=Object(h.jsx)(re.a,{size:100});return T=void 0!==O?Object(h.jsx)(oe.a,{src:O,theme:r,style:{marginTop:"2vh",width:"100%",overflowY:"auto",display:"flex"}}):Object(h.jsx)(d.a,{children:"No data to display"}),Object(h.jsxs)(u.a,{className:e.searchAreaHolder,children:[Object(h.jsx)(ne.a,{disablePortal:!0,options:w.map((function(e){return e.name})),isOptionEqualToValue:function(e,t){return e===t},className:e.autocomplete,getOptionLabel:function(e){return e},inputValue:o,onInputChange:function(){var e=Object(y.a)(k.a.mark((function e(t,r){return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return");case 2:return v(void 0),i(r),e.next=6,N(r.trim());case 6:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),value:o,onChange:function(){var e=Object(y.a)(k.a.mark((function e(t,r){var n;return k.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!r){e.next=5;break}if(!(n=w.find((function(e){return e.name===r})))){e.next=5;break}return e.next=5,C(n.id);case 5:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),renderInput:function(e){return Object(h.jsx)(ae.a,Object(te.a)(Object(te.a)({},e),{},{label:"Search by name or ID"}))}}),Object(h.jsx)(u.a,{className:e.jsonHolder,children:T})]})},le=Object(f.a)((function(e){return{container:{background:"background.default",display:"flex",flexDirection:"column",flexGrow:1,height:"100vh",maxheight:"100vh"},searchContainer:{display:"flex",flexDirection:"row",flexGrow:1,padding:"2vh 2vw 1vh 2vw"}}})),ue=function(){var e=le();return Object(h.jsx)(h.Fragment,{children:Object(h.jsxs)(u.a,{className:e.container,children:[Object(h.jsx)(X,{}),Object(h.jsx)(ee,{}),Object(h.jsx)(u.a,{className:e.searchContainer,children:Object(h.jsx)(se,{})}),Object(h.jsx)(m,{})]})})},de=r(187),fe=r(188),he=r(92),pe=r(52),me=r(44),be=r(186),je=r(48),xe=Object(je.a)({mode:n.DARK_MODE,background:{default:he.a[800],paper:he.a[900]},text:{primary:pe.a.white,secondary:he.a[400],disabled:me.a[100]},action:{hover:be.a[700]}}),Oe=r(43),ve=Object(je.a)({mode:n.LIGHT_MODE,background:{default:he.a[100],paper:he.a[300]},text:{primary:pe.a.black,secondary:Oe.a[500],disabled:he.a[600]},action:{hover:Oe.a[500]}}),ge=r(98),Ee=function(){var e,t=Object(de.a)("(prefers-color-scheme: dark)"),r=A((function(e){return[e.preferedColorScheme,e.setPreferedColorScheme]})),c=Object(s.a)(r,2),o=c[0],i=c[1];return Object(a.useEffect)((function(){var e=localStorage.getItem(w.PREFERED_COLOR_SCHEME);if(e)i(e);else{var r=t?n.DARK_MODE:n.LIGHT_MODE;i(r)}}),[t]),Object(h.jsx)(h.Fragment,{children:Object(h.jsxs)(l.a,{theme:(e=o===n.DARK_MODE?xe:ve,Object(ge.a)({palette:e,components:{MuiLink:{styleOverrides:{root:{"&:hover":{textDecoration:"none"}}}},MuiTextField:{styleOverrides:{root:{"& label.Mui-focused":{color:e.action.hover},"& .MuiFilledInput-underline:after":{borderBottomColor:e.action.hover}}}},MuiInputBase:{styleOverrides:{root:{"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"".concat(e.action.hover," !important")}}}},MuiFormLabel:{styleOverrides:{root:{"&.Mui-focused .MuiInputLabel":{color:e.action.hover}}}}}})),children:[Object(h.jsx)(fe.a,{}),Object(h.jsx)(ue,{})]})})},we=function(e){e&&e instanceof Function&&r.e(3).then(r.bind(null,208)).then((function(t){var r=t.getCLS,n=t.getFID,a=t.getFCP,c=t.getLCP,o=t.getTTFB;r(e),n(e),a(e),c(e),o(e)}))};i.a.render(Object(h.jsx)(c.a.StrictMode,{children:Object(h.jsx)(Ee,{})}),document.getElementById("root")),we()}},[[126,1,2]]]);
|
|
//# sourceMappingURL=main.4f639ccc.chunk.js.map
|