(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[720],{88280:function(l,e,i){Promise.resolve().then(i.bind(i,38366))},38366:function(l,e,i){"use strict";i.r(e);var n=i(57437),o=i(2265),t=i(76301),d=i(62146),u=i(97500),s=i(9707),r=i(36699),c=i(65582),a=i(99376),p=i(85323),_=i(21659);let v=()=>{var l;let{Paragraph:e}=t.Typography,i=(0,a.useSearchParams)(),{trigger:v}=(0,c.Z)("/v1/upload/streamers",u.wG),{data:m,error:h,isLoading:y,mutate:f}=(0,p.ZP)(()=>i.get("id")?"/v1/upload/streamers/".concat(i.get("id")):null,u._i),g=(0,a.useRouter)(),{typeTree:x,isError:j}=(0,_.JB)(),b=(0,o.useRef)(),[w,k]=(0,o.useState)("inset");if((0,o.useEffect)(()=>{let l=(0,r.ql)(r.f.lg,{match:()=>{k("left")},unmatch:()=>{k("top")}});return()=>l()},[]),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===(l=x.find(l=>l.children.some(l=>l.id===(null==m?void 0:m.tid))))||void 0===l?void 0:l.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,is_only_self:1===m.is_only_self,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 l,i,o,d,u,s,r,c,a,p;let _=await (null===(l=b.current)||void 0===l?void 0:l.validate());try{let l={template_name:null==_?void 0:_.template_name,user_cookie:null==_?void 0:_.user_cookie,copyright:null==_?void 0:_.copyright,id:null==_?void 0:_.id,copyright_source:null!==(i=null==_?void 0:_.copyright_source)&&void 0!==i?i:"",tid:null==_?void 0:_.tid[1],cover_path:null!==(o=null==_?void 0:_.cover_path)&&void 0!==o?o:"",title:null!==(d=null==_?void 0:_.title)&&void 0!==d?d:"",description:null!==(u=null==_?void 0:_.description)&&void 0!==u?u:"",dynamic:null!==(s=null==_?void 0:_.dynamic)&&void 0!==s?s:"",tags:null!==(r=null==_?void 0:_.tags)&&void 0!==r?r:[],dolby:(null==_?void 0:_.sound.includes("dolby"))?1:0,hires:(null==_?void 0:_.sound.includes("hires"))?1:0,up_selection_reply:(null==_?void 0:_.interaction.includes("up_selection_reply"))?1:0,up_close_reply:(null==_?void 0:_.interaction.includes("up_close_reply"))?1:0,up_close_danmu:(null==_?void 0:_.interaction.includes("up_close_danmu"))?1:0,open_elec:(null==_?void 0:_.open_elec)?1:0,no_reprint:(null==_?void 0:_.no_reprint)?1:0,is_only_self:(null==_?void 0:_.is_only_self)?1:0,mission_id:null==_?void 0:_.mission_id,dtime:(null==_?void 0:_.isDtime)?null==_?void 0:_.dtime:null,credits:null!==(c=null==_?void 0:_.credits)&&void 0!==c?c:null,uploader:null!==(a=null==_?void 0:_.uploader)&&void 0!==a?a:null,extra_fields:null!==(p=null==_?void 0:_.extra_fields)&&void 0!==p?p:""},e=await v(l);await f(e),t.FN.success("更新成功"),g.push("/upload-manager")}catch(l){t.P_.error({title:"创建失败",content:(0,n.jsx)(e,{style:{maxWidth:450},children:l.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:l=>b.current=l,autoScrollToError:!0,component:s.Z,labelWidth:"180px",labelPosition:w})]})};e.default=()=>(0,n.jsx)(o.Suspense,{children:(0,n.jsx)(v,{})})}},function(l){l.O(0,[308,385,251,283,191,147,429,301,323,515,971,117,744],function(){return l(l.s=88280)}),_N_E=l.O()}]);