(self["webpackJsonp@lyrio/ui"]=self["webpackJsonp@lyrio/ui"]||[]).push([[104],{1081:function(e,t,n){"use strict";var c=n(80),a=n(179),r=n(19),i=n(1),o=n(0),s=n(1792),l=n(601),u=n(614),j=n(1725),b=n(1790),f=n(618),O=n(55),d=n(758),m=n.n(d),x=n(1799),g=n(1658),h=n.n(g),p=n(22),v=n(701),I=n(816),_=function(e){var t=Object(p.i)("problem_judge_settings"),n=Object(o.useState)(Object.fromEntries(Object.values(v.a).map((function(t){return e.judgeInfo.extraSourceFiles?[t,Object.entries(e.judgeInfo.extraSourceFiles[t]||{}).map((function(e){return[Object(x.a)()].concat(Object(a.a)(e))}))]:[t,[]]})))),O=Object(r.a)(n,2),d=O[0],g=O[1];function _(t,n){e.onUpdateJudgeInfo({extraSourceFiles:Object.fromEntries(Object.values(v.a).map((function(e){return t[e].length>0?[e,Object.fromEntries(t[e].map((function(e){return e.slice(1)})))]:null})).filter((function(e){return e})))})}function S(e){g(e),_(e)}function F(e,t,n,a){if("ADD"===t)S(m()(d,Object(c.a)({},e,{$push:[[Object(x.a)(),"",""]]})));else if("DEL"===t)S(m()(d,Object(c.a)({},e,{$splice:[[n,1]]})));else{var r=d[e][n],i=null==a.dst?r[1]:a.dst,o=null==a.src?r[2]:a.src;S(m()(d,Object(c.a)({},e,Object(c.a)({},n,{$set:[r[0],i,o]}))))}}return Object(i.jsx)("div",{children:Object(i.jsxs)(s.a,{children:[Object(i.jsx)(s.a.Checkbox,{checked:!!e.judgeInfo.extraSourceFiles,label:t(".extra_source_files.option"),onChange:function(){e.pending||(e.judgeInfo.extraSourceFiles?e.onUpdateJudgeInfo({extraSourceFiles:null}):_(d))}}),e.judgeInfo.extraSourceFiles&&Object(i.jsxs)(i.Fragment,{children:[Object(i.jsxs)(l.a,{className:h.a.menu+" "+h.a.menuHeader+" "+h.a.color_6,attached:"top",children:[Object(i.jsx)(l.a.Item,{className:h.a.itemTitle,children:Object(i.jsx)("strong",{children:t(".extra_source_files.title")})}),Object(i.jsx)(l.a.Menu,{position:"right",children:Object(i.jsx)(u.a,{item:!0,icon:"plus",className:"icon ".concat(h.a.itemWithIcon),children:Object(i.jsx)(u.a.Menu,{children:Object.values(v.a).map((function(e){return Object(i.jsx)(u.a.Item,{text:t("code_language.".concat(e,".name")),onClick:function(){return F(e,"ADD")}},e)}))})})})]}),d&&Object.entries(d).map((function(n,c,a){var o=Object(r.a)(n,2),s=o[0],u=o[1],O=a.length;return u.map((function(n,a){var o=Object(r.a)(n,3),d=o[0],m=o[1],x=o[2];return Object(i.jsxs)(l.a,{className:h.a.extraSourceFilesItem,attached:a!=u.length-1||c!==O-1||"bottom",children:[Object(i.jsx)(l.a.Item,{className:h.a.itemTitle+" "+h.a.language,style:0==a?{height:41*u.length-1}:{visibility:"hidden"},children:t("code_language.".concat(s,".name"))}),Object(i.jsx)(I.a,{type:"ItemSearchDropdown",className:h.a.dropdown,testData:e.testData,placeholder:t(".extra_source_files.src"),value:x,onChange:function(e){return F(s,"UPDATE",a,{src:e})}}),Object(i.jsx)(l.a.Item,{className:h.a.input,children:Object(i.jsx)(j.a,{icon:"long arrow alternate right",iconPosition:"left",transparent:!0,placeholder:t(".extra_source_files.dst"),value:m,onChange:function(e,t){var n=t.value;return F(s,"UPDATE",a,{dst:n})}})}),Object(i.jsx)(l.a.Menu,{position:"right",children:Object(i.jsx)(b.a,{trigger:Object(i.jsx)(l.a.Item,{className:"icon ".concat(h.a.itemWithIcon),icon:"delete",title:t(".extra_source_files.delete")}),content:Object(i.jsx)(f.a,{negative:!0,content:t(".extra_source_files.confirm_delete"),onClick:function(){return F(s,"DEL",a)}}),on:"click",position:"top center"})})]},d)}))}))]})]})})};_=Object(O.a)(_);var S={parseJudgeInfo:function(e){return{extraSourceFiles:e.extraSourceFiles&&"object"===typeof e.extraSourceFiles?Object.fromEntries(Object.entries(e.extraSourceFiles).filter((function(e){var t=Object(r.a)(e,2),n=t[0],c=t[1];return Object.values(v.a).includes(n)&&c&&"object"===typeof c})).map((function(e){var t=Object(r.a)(e,2),n=t[0],c=t[1];return[n,Object.fromEntries(Object.entries(c).filter((function(e){var t=Object(r.a)(e,2);t[0];return"string"===typeof t[1]})))]})).filter((function(e){var t=Object(r.a)(e,2),n=(t[0],t[1]);return Object.keys(n).length>0}))):null}},normalizeJudgeInfo:function(e){e.extraSourceFiles||delete e.extraSourceFiles}};t.a=Object.assign(_,S)}}]);
//# sourceMappingURL=104.61cbd457.chunk.js.map