(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[720],{88280:function(e,l,i){Promise.resolve().then(i.bind(i,53320))},53320:function(e,l,i){"use strict";i.r(l);var n=i(57437),o=i(2265),t=i(48936),d=i(98964),u=i(30695),r=i(54935),s=i(44623),c=i(77634),a=i(16463),p=i(91617),v=i(12951);let _=()=>{var e;let{Paragraph:l}=t.Typography,i=(0,a.useSearchParams)(),{trigger:_}=(0,c.Z)("/v1/upload/streamers",u.wG),{data:m,error:h,isLoading:y,mutate:g}=(0,p.ZP)(()=>i.get("id")?"/v1/upload/streamers/".concat(i.get("id")):null,u._i),f=(0,a.useRouter)(),{typeTree:x,isError:j}=(0,v.JB)(),b=(0,o.useRef)(),[w,k]=(0,o.useState)("inset");if((0,o.useEffect)(()=>{let e=(0,s.ql)(s.f.lg,{match:()=>{k("left")},unmatch:()=>{k("top")}});return()=>e()},[]),h||j)return(0,n.jsx)("div",{children:null==h?void 0:h.message});if(y)return(0,n.jsx)("div",{children:"Loading..."});if(!m||!x)return null;let E={...m,tid:[null===(e=x.find(e=>e.children.some(e=>e.id===(null==m?void 0:m.tid))))||void 0===e?void 0:e.value,m.tid],sound:(1===m.dolby?["dolby"]:[]).concat(1===m.hires?["hires"]:[]),interaction:(1===m.up_close_danmu?["up_close_danmu"]:[]).concat(1===m.up_close_reply?["up_close_reply"]:[]).concat(1===m.up_selection_reply?["up_selection_reply"]:[]),open_elec:1===m.open_elec,no_reprint:1===m.no_reprint,isDtime:!!m.dtime};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("div",{style:{display:"flex",flexDirection:"row-reverse",paddingRight:12},children:(0,n.jsx)(t.zx,{onClick:async()=>{var e,i,o,d,u,r,s,c,a;let p=await (null===(e=b.current)||void 0===e?void 0:e.validate());try{let e={template_name:null==p?void 0:p.template_name,user_cookie:null==p?void 0:p.user_cookie,copyright:null==p?void 0:p.copyright,id:null==p?void 0:p.id,copyright_source:null!==(i=null==p?void 0:p.copyright_source)&&void 0!==i?i:"",tid:null==p?void 0:p.tid[1],cover_path:null!==(o=null==p?void 0:p.cover_path)&&void 0!==o?o:"",title:null!==(d=null==p?void 0:p.title)&&void 0!==d?d:"",description:null!==(u=null==p?void 0:p.description)&&void 0!==u?u:"",dynamic:null!==(r=null==p?void 0:p.dynamic)&&void 0!==r?r:"",tags:null!==(s=null==p?void 0:p.tags)&&void 0!==s?s:[],dolby:(null==p?void 0:p.sound.includes("dolby"))?1:0,hires:(null==p?void 0:p.sound.includes("hires"))?1:0,up_selection_reply:(null==p?void 0:p.interaction.includes("up_selection_reply"))?1:0,up_close_reply:(null==p?void 0:p.interaction.includes("up_close_reply"))?1:0,up_close_danmu:(null==p?void 0:p.interaction.includes("up_close_danmu"))?1:0,open_elec:(null==p?void 0:p.open_elec)?1:0,no_reprint:(null==p?void 0:p.no_reprint)?1:0,mission_id:null==p?void 0:p.mission_id,dtime:(null==p?void 0:p.isDtime)?null==p?void 0:p.dtime:null,credits:null!==(c=null==p?void 0:p.credits)&&void 0!==c?c:null,uploader:null!==(a=null==p?void 0:p.uploader)&&void 0!==a?a:null},l=await _(e);await g(l),t.FN.success("更新成功"),f.push("/upload-manager")}catch(e){t.P_.error({title:"创建失败",content:(0,n.jsx)(l,{style:{maxWidth:450},children:e.message}),style:{width:"min-content"}})}},type:"primary",icon:(0,n.jsx)(d.Z,{size:"large"}),theme:"solid",style:{marginTop:12,marginRight:4},children:"保存模板"})}),(0,n.jsx)(t.Form,{initValues:E,style:{paddingLeft:30,paddingBottom:40},getFormApi:e=>b.current=e,autoScrollToError:!0,component:r.Z,labelWidth:"180px",labelPosition:w})]})};l.default=()=>(0,n.jsx)(o.Suspense,{children:(0,n.jsx)(_,{})})}},function(e){e.O(0,[798,674,86,949,753,293,406,862,936,617,781,411,971,23,744],function(){return e(e.s=88280)}),_N_E=e.O()}]);