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