You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
27 KiB
2 lines
27 KiB
"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[4498],{33712:function(He,oe,u){u.r(oe),u.d(oe,{default:function(){return B}});var e=u(59301),K=u(76560),F=u(28284),ge=u(62957),re=u(6767),L=u(37568),W=u(77019),N=u(5269),U=u(99571),D=u(47889),M=u(82326),H=u(2978),Q=u(67135),R={flex_box_center:"flex_box_center___GIMe1",flex_space_between:"flex_space_between___gMzN8",flex_box_vertical_center:"flex_box_vertical_center___SgaNa",flex_box_center_end:"flex_box_center_end___N1Baa",flex_box_column:"flex_box_column___hIyfb",bg:"bg___Y4VEx",formWrap:"formWrap___JY9de",taskSty:"taskSty___tTZ5e",zhishidian:"zhishidian___dkMpP",tags_list:"tags_list___jEpNy",tag_item:"tag_item___y0LQk",tag_icon:"tag_icon___RAquA"},_=u(89392),Y=u(84236),le=u(74543),we=u(74424),se=u(21693),he=u(88390),Ce=Object.defineProperty,Ie=Object.defineProperties,De=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,je=Object.prototype.hasOwnProperty,Fe=Object.prototype.propertyIsEnumerable,ve=(a,n,s)=>n in a?Ce(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s,_e=(a,n)=>{for(var s in n||(n={}))je.call(n,s)&&ve(a,s,n[s]);if(ie)for(var s of ie(n))Fe.call(n,s)&&ve(a,s,n[s]);return a},ke=(a,n)=>Ie(a,De(n)),Ae=(a,n)=>{var s={};for(var c in a)je.call(a,c)&&n.indexOf(c)<0&&(s[c]=a[c]);if(a!=null&&ie)for(var c of ie(a))n.indexOf(c)<0&&Fe.call(a,c)&&(s[c]=a[c]);return s},Ue=a=>{var n=a,{InputRight:s,value:c=[],onChange:P=()=>{}}=n,p=Ae(n,["InputRight","value","onChange"]);const[w,A]=(0,e.useState)(),j=E=>{const x=c.filter((J,ne)=>ne!==E);P(x)},f=E=>{E.preventDefault(),w&&(P([...c,w]),A(null))};return e.createElement("div",null,e.createElement(L.default,ke(_e({},p),{value:w,onChange:E=>A(E.target.value),onPressEnter:f,onBlur:f})),s,e.createElement("div",{className:"mt20"},c==null?void 0:c.map((E,x)=>e.createElement(he.Z,{className:"ml10 mr10",count:"x",onClick:()=>j(x)},e.createElement(U.ZP,{type:"primary",ghost:!0},E)))))},Te=u(46383),Ze=u(74914),Qe=u(34055),Be=u(49661),Re=u(42586),t=Object.defineProperty,o=Object.defineProperties,v=Object.getOwnPropertyDescriptors,l=Object.getOwnPropertySymbols,r=Object.prototype.hasOwnProperty,C=Object.prototype.propertyIsEnumerable,g=(a,n,s)=>n in a?t(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s,h=(a,n)=>{for(var s in n||(n={}))r.call(n,s)&&g(a,s,n[s]);if(l)for(var s of l(n))C.call(n,s)&&g(a,s,n[s]);return a},I=(a,n)=>o(a,v(n)),O=(a,n,s)=>new Promise((c,P)=>{var p=j=>{try{A(s.next(j))}catch(f){P(f)}},w=j=>{try{A(s.throw(j))}catch(f){P(f)}},A=j=>j.done?c(j.value):Promise.resolve(j.value).then(p,w);A((s=s.apply(a,n)).next())});const y={1:[100,200],2:[300,400,500,600],3:[700,800,900,1e3]},b=({shixunsDetail:a,dispatch:n,practiceSetting:s})=>{var c,P,p,w,A,j;const f=(0,K.useParams)(),[E]=F.default.useForm(),[x,J]=(0,e.useState)({}),[ne,ue]=(0,e.useState)([100,200]),{challengesNew:m}=a,[$,Ne]=(0,e.useState)(),[ce,Se]=(0,e.useState)(),[be,X]=(0,e.useState)(!0),[ze,xe]=(0,e.useState)(1),z=(0,e.useRef)({subject:"",difficulty:1,hide_task_pass:!1,score:100,hide_width_rate:40,task_pass:(0,se.S)(m.task_pass_default),has_relation:!1}),k=(0,e.useRef)(null),{selectQuestionParams:ae,id:pe,newQuestion:q}=s,[$e,de]=(0,e.useState)(!1),[T,ee]=(0,e.useState)([]);(0,e.useEffect)(()=>{f.challengesId?(Se(!0),Ve()):(X(!0),Se(!1),n({type:"shixunsDetail/getChallengesNew",payload:h({},f)}),X(!1)),setTimeout(()=>{var i;(i=document.getElementById("practice-scroll"))==null||i.scrollTo(0,0)},300)},[f]),(0,e.useEffect)(()=>(Pe(),()=>{clearTimeout(k.current)}),[x]);const Ve=()=>O(void 0,null,function*(){X(!0);const i=yield(0,Q.ii)({id:f.id,challengeId:f.challengesId,tab:0});if(i){const d=I(h({},i),{task_pass:(0,se.S)(i.task_pass)});Ne(d),Le(d),X(!1),z.current={subject:d.subject,difficulty:d.difficulty,score:d.score,task_pass:d.task_pass,hide_task_pass:d.hide_task_pass,hide_width_rate:d.hide_width_rate,has_relation:d==null?void 0:d.has_relation},ee(d==null?void 0:d.tag_disciplines)}}),Le=i=>{const d={subject:i.name,difficulty:i.difficulty,score:i.score,challenge_tag:i.tags,task_pass:i.task_pass,hide_task_pass:i.hide_task_pass,hide_width_rate:i.hide_width_rate,has_relation:i==null?void 0:i.has_relation},S=y[i.difficulty];ue(S),E.setFieldsValue(h({},d)),J(h({},d))},We=i=>{const d=y[i],S=d==null?void 0:d[0];ue(d),E.setFieldsValue({score:S}),J(h(h({},E.getFieldsValue()),{score:S}))},me=(i,d)=>{J(h({},E.getFieldsValue())),"difficulty"in i&&We(i.difficulty)},Oe=(...i)=>O(void 0,[...i],function*(d={},S=!1,V=1){var te,G;const fe=(0,Be.TG)();if(ce){(yield(0,Q.Rs)(I(h({},f),{tab:0,challenge:h({},d),challenge_tag:d.challenge_tag,sync_origin_shixun:S,homework_common_id:fe||void 0,tag_discipline_ids:(T==null?void 0:T.length)>0?T==null?void 0:T.map(Ge=>Ge==null?void 0:Ge.id):[]})))&&(n({type:"practiceSetting/setUpdateIndex"}),(te=a==null?void 0:a.detail)!=null&&te.copy_for_exercise&&(0,se.m)(n,a,f.id,V),K.history.replace(`/shixuns/${f.id}/edit/${f.challengesId}/tab=2`));return}const ye=h({},x);ye.identifier=f.id,ye.st=0,ye.sync_origin_shixun=S,ye.homework_common_id=fe||void 0;const Xe=yield(0,Q.al)(h({},ye));Xe.status===1&&((G=a==null?void 0:a.detail)!=null&&G.copy_for_exercise&&(0,se.m)(n,a,f.id,V),K.history.replace(`/shixuns/${f.id}/edit/${Xe.challenge_id}/tab=2`),setTimeout(()=>{n({type:"practiceSetting/setParams",payload:{newQuestion:null}}),n({type:"practiceSetting/setUpdateIndex"})},200))}),Ee=()=>{Me()},Pe=()=>{clearTimeout(k.current),k.current=setTimeout(Z,500)},Z=()=>{"subject"in x&&q&&n({type:"practiceSetting/setParams",payload:{newQuestion:{st:0,name:x==null?void 0:x.subject}}});const d=["subject","difficulty","score","task_pass"].some(S=>{const V=(0,_.isNumber)(x[S])?String(x[S]):x[S],te=(0,_.isNumber)(z.current[S])?String(z.current[S]):z.current[S];return!(0,_.isEqual)(V,te)});n(d?{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!0}}:{type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})},Me=()=>{var i;const d=()=>{K.history.push(`/shixuns/${pe}/challenges`),n({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};(i=s==null?void 0:s.sideBar)!=null&&i.confirmLeave?ge.default.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:()=>{d()}}):d()};return e.createElement(e.Fragment,null,e.createElement("section",{key:1,className:R.bg,id:"practice-scroll"},e.createElement(F.default,{key:ze,form:E,className:R.formWrap,scrollToFirstError:!0,layout:"vertical",onValuesChange:me,onFinish:i=>{var d,S,V;if(!ce&&((d=a.detail)==null?void 0:d.shixun_status)===2){re.ZP.info("\u8BE5\u5B9E\u8BAD\u5DF2\u7ECF\u53D1\u5E03\u4E0D\u80FD\u65B0\u5EFA");return}(S=a==null?void 0:a.detail)!=null&&S.is_fork_from_creator&&((V=a==null?void 0:a.detail)!=null&&V.copy_for_exercise)&&z.current.has_relation?n({type:"classroomList/setActionTabs",payload:{key:"\u540C\u6B65\u4FEE\u6539",value:i,type:"taskLevel",fn:(te,G,fe)=>{Oe(te,G,fe)}}}):Oe(i)}},e.createElement(we.Z,{activeIndex:0,isEdit:ce}),e.createElement(F.default.Item,{initialValue:"",name:"subject",label:"\u4EFB\u52A1\u540D\u79F0:",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4EFB\u52A1\u540D\u79F0"}]},e.createElement(L.default,{bordered:!1,maxLength:200,suffix:`${((c=x.subject)==null?void 0:c.length)||0}/200`,placeholder:"\u4F8B\u5982\uFF1A\u4ECEPython\u7A0B\u5E8F\u8BBE\u8BA1-\u5165\u95E8\u7CBE\u901A"})),e.createElement(F.default.Item,{className:R.taskSty,name:"task_pass",label:e.createElement(W.Z,{align:"middle",style:{width:"100%"}},e.createElement(N.Z,{className:"mr10"},"\u4EFB\u52A1\u8981\u6C42:"),e.createElement(N.Z,null,((P=a==null?void 0:a.detail)==null?void 0:P.id)&&(0,Qe.$O)()&&e.createElement(Te.Z,{title:"AI\u751F\u6210",fetchUrl:"/api/stream/intelligent_imports/ai_generate.json",fetchData:{type:4,shixun_id:pe},promptPropName:"query",headNode:e.createElement(e.Fragment,null,e.createElement("div",{className:"c-grey-333 font22"},e.createElement("span",{className:"mr5"},"\u{1F44B}"),"\u55E8\uFF0C\u6211\u662F\u60A8\u7684\u667A\u80FD\u52A9\u6559\uFF0C\u60A8\u7684\u6559\u5B66\u597D\u5E2E\u624B"),e.createElement("div",{className:"font16 mt20",style:{color:"#434D6C"}},"\u6211\u53EF\u4EE5\u9605\u8BFB\u60A8\u4E0A\u4F20\u7684\u6559\u6848\uFF0C\u4E66\u7C4D\u7B49\u6559\u5B66\u8D44\u6599\uFF0C\u5E76\u6839\u636E\u60A8\u7684\u8981\u6C42\u4E3A\u60A8\u81EA\u52A8\u751F\u6210\u4EFB\u52A1\u8981\u6C42\u3002"),e.createElement("div",{className:"font16 mt20",style:{color:"#434d6c"}},"\u5FEB\u6765\u8BD5\u4E00\u4E0B\u5427\uFF5E"))},e.createElement(U.ZP,{type:"primary"},"AI\u751F\u6210"))),e.createElement(N.Z,{style:{marginLeft:"auto"}},e.createElement(U.ZP,{style:{marginRight:"-10px"},onClick:()=>{de(!0)}},"\u7248\u672C\u7BA1\u7406"))),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u4F5C\u4E1A\u7684\u7B80\u4ECB"},{max:35e3,message:"\u8FC7\u5173\u4EFB\u52A1\u7B80\u4ECB\u6700\u5927\u9650\u523635000\u4E2A\u5B57\u7B26"}]},e.createElement(H.Z,{key:f.challengesId||"3",watch:!0,defaultValue:ce?$==null?void 0:$.task_pass:m.task_pass_default})),e.createElement(F.default.Item,{initialValue:40,name:"hide_width_rate",label:"\u4EFB\u52A1\u8981\u6C42\u9ED8\u8BA4\u5C55\u793A\u5BBD\u5EA6:"},e.createElement(D.ZP.Group,null,e.createElement(D.ZP,{value:0},"0%"),e.createElement(D.ZP,{style:{marginLeft:70},value:30},"30%"),e.createElement(D.ZP,{style:{marginLeft:70},value:40},"40%"),e.createElement(D.ZP,{style:{marginLeft:70},value:50},"50%"))),x.unity_3d&&((p=a.detail)==null?void 0:p.identity)<3&&e.createElement(F.default.Item,{name:"unity_3d_routes",label:"\u8DEF\u5F84:",rules:[{required:!0,message:"\u5FC5\u586B\u9879\uFF1A\u4E0D\u80FD\u4E3A\u7A7A"}]},e.createElement(L.default,{bordered:!1,disabled:((w=a.detail)==null?void 0:w.shixun_status)===2,placeholder:"\u8BF7\u9009\u62E9\u7248\u672C\u5E93\u4E2D\u7684\u4EE3\u7801\u6587\u4EF6\u3002\u4F8B\uFF1A src/step1/HelloWorld.java"})),e.createElement(F.default.Item,{initialValue:1,name:"difficulty",label:"\u96BE\u5EA6\u7CFB\u6570:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u96BE\u5EA6\u7CFB\u6570"}]},e.createElement(D.ZP.Group,{disabled:((A=a.detail)==null?void 0:A.shixun_status)===2},e.createElement(D.ZP,{value:1},"\u7B80\u5355"),e.createElement(D.ZP,{style:{marginLeft:70},value:2},"\u4E2D\u7B49"),e.createElement(D.ZP,{style:{marginLeft:70},value:3},"\u56F0\u96BE"))),e.createElement(F.default.Item,{name:"challenge_tag",label:e.createElement("div",null,"\u6280\u80FD\u6807\u7B7E ",e.createElement("span",{className:"pl20 font12 c-light-black"},"\u5B66\u5458\u7B54\u9898\u6B63\u786E\u5C06\u83B7\u5F97\u6280\u80FD\uFF0C\u5426\u5219\u4E0D\u80FD\u83B7\u5F97\u6280\u80FD\uFF08\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E\uFF09")),rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u6280\u80FD\u6807\u7B7E"}]},e.createElement(Ue,{placeholder:"\u6DFB\u52A0\u6807\u7B7E",style:{width:"260px"},InputRight:e.createElement("span",{className:"ml5"},"(\u56DE\u8F66\u6DFB\u52A0\u6807\u7B7E)")})),e.createElement(F.default.Item,{name:"tag_discipline_ids",label:"\u77E5\u8BC6\u70B9:"},e.createElement("div",{className:R.zhishidian,onClick:()=>{n({type:"account/setActionTabs",payload:{key:"\u5173\u8054\u8BFE\u7A0B\u77E5\u8BC6\u70B9"}})}},"\u9009\u62E9\u77E5\u8BC6\u70B9")),(T==null?void 0:T.length)>0&&e.createElement("div",{className:R.tags_list},T==null?void 0:T.map((i,d)=>e.createElement("div",{key:d,className:R.tag_item},e.createElement("div",null,i==null?void 0:i.name),e.createElement("i",{className:`iconfont icon-guanbi11 ml10 ${R.tag_icon}`,onClick:()=>{ee([...T.filter(S=>(S==null?void 0:S.id)!=(i==null?void 0:i.id))])}})))),e.createElement(W.Z,{className:"customItemSelect"},e.createElement(N.Z,null,e.createElement(F.default.Item,{name:"score",initialValue:100,label:"\u5956\u52B1\u91D1\u5E01:",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u5956\u52B1\u7ECF\u9A8C\u503C"}]},e.createElement(M.default,{disabled:((j=a.detail)==null?void 0:j.shixun_status)===2,bordered:!1,getPopupContainer:i=>i.parentNode,style:{width:260}},ne==null?void 0:ne.map((i,d)=>e.createElement(M.default.Option,{key:d,value:i},i))))),e.createElement(N.Z,{flex:1},e.createElement("div",{style:{marginTop:88},className:"font12 c-light-black ml10"}," \u5B66\u5458\u6B63\u786E\u7B54\u9898\u65F6\u83B7\u5F97\u91D1\u5E01\uFF0C\u5E76\u4E14\u83B7\u5F97\u7B49\u91CF\u7684\u7ECF\u9A8C\u503C\u3002\u5982\uFF1A+100\u91D1\u5E01\u3001+100\u7ECF\u9A8C\u503C"))))),e.createElement(Y.t,{key:2,onOk:()=>E.submit(),className:"customFixedButton",onCancel:Ee}),e.createElement(Ze.Z,{visible:$e,identifier:f==null?void 0:f.id,challenge_id:f==null?void 0:f.challengesId,onCancle:()=>{de(!1)},onOK:i=>O(void 0,null,function*(){E.setFieldValue("task_pass",i),x.task_pass=i,J(x),yield E.submit()})}),e.createElement(le.Z,{loading:be}),e.createElement(Re.Z,{knowledgeList:T,setKnowledgeList:ee}))};var B=(0,K.connect)(({shixunsDetail:a,newCourse:n,globalSetting:s,practiceSetting:c})=>({shixunsDetail:a,newCourse:n,globalSetting:s,practiceSetting:c}))(b)},74424:function(He,oe,u){u.d(oe,{Z:function(){return re}});var e=u(59301),K=u(62957),F=u(76560);const ge=({activeIndex:L,isEdit:W=!0,dispatch:N,practiceSetting:U})=>{const D=(0,F.useParams)(),{id:M,challengesId:H}=D,Q=(0,e.useMemo)(()=>[{name:"\u672C\u5173\u4EFB\u52A1",url:`/shixuns/${M}/edit/${H}/editcheckpoint`},{name:"\u8BC4\u6D4B\u8BBE\u7F6E",url:`/shixuns/${M}/edit/${H}/tab=2`},{name:"\u53C2\u8003\u7B54\u6848",url:`/shixuns/${M}/edit/${H}/tab=3`},{name:"\u5173\u5361\u6392\u884C\u699C",url:`/shixuns/${M}/edit/${H}/tab=4`}],[M,H]),R=_=>{var Y;const le=()=>{F.history.push(_),N({type:"practiceSetting/setSideBarTabs",payload:{confirmLeave:!1}})};(Y=U==null?void 0:U.sideBar)!=null&&Y.confirmLeave?K.default.confirm({title:"\u79BB\u5F00\u6B64\u9875\u63D0\u793A",content:"\u7CFB\u7EDF\u53EF\u80FD\u4E0D\u4F1A\u4FDD\u5B58\u60A8\u6240\u505A\u7684\u66F4\u6539\u3002",okText:"\u79BB\u5F00",cancelText:"\u53D6\u6D88",onOk:()=>{le()}}):le()};return e.createElement("ul",{className:"challenge-nav"},W?Q.map((_,Y)=>L===Y?e.createElement("li",{key:_.url}," ",e.createElement("a",{className:"active"},_.name)," "):e.createElement("li",{key:_.url}," ",e.createElement("a",{onClick:()=>R(_.url)},_.name)," ")):e.createElement("li",{key:Q[0].url}," ",e.createElement("a",{className:"active"},Q[0].name)," "))};var re=(0,F.connect)(({globalSetting:L,practiceSetting:W})=>({globalSetting:L,practiceSetting:W}))(ge)},88390:function(He,oe,u){u.d(oe,{Z:function(){return Re}});var e=u(59301),K=u(92310),F=u.n(K),ge=u(77900),re=u(29509),L=u(22703),W=u(48755),N=u(36237),U=u(63356),D=u(93427),M=u(51636),H=u(16931);const Q=new N.Keyframes("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),R=new N.Keyframes("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),_=new N.Keyframes("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),Y=new N.Keyframes("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),le=new N.Keyframes("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),we=new N.Keyframes("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),se=t=>{const{componentCls:o,iconCls:v,antCls:l,badgeShadowSize:r,textFontSize:C,textFontSizeSM:g,statusSize:h,dotSize:I,textFontWeight:O,indicatorHeight:y,indicatorHeightSM:b,marginXS:B,calc:a}=t,n=`${l}-scroll-number`,s=(0,D.Z)(t,(c,P)=>{let{darkColor:p}=P;return{[`&${o} ${o}-color-${c}`]:{background:p,[`&:not(${o}-count)`]:{color:p},"a:hover &":{background:p}}}});return{[o]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,U.Wf)(t)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${o}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:t.indicatorZIndex,minWidth:y,height:y,color:t.badgeTextColor,fontWeight:O,fontSize:C,lineHeight:(0,N.unit)(y),whiteSpace:"nowrap",textAlign:"center",background:t.badgeColor,borderRadius:a(y).div(2).equal(),boxShadow:`0 0 0 ${(0,N.unit)(r)} ${t.badgeShadowColor}`,transition:`background ${t.motionDurationMid}`,a:{color:t.badgeTextColor},"a:hover":{color:t.badgeTextColor},"a:hover &":{background:t.badgeColorHover}},[`${o}-count-sm`]:{minWidth:b,height:b,fontSize:g,lineHeight:(0,N.unit)(b),borderRadius:a(b).div(2).equal()},[`${o}-multiple-words`]:{padding:`0 ${(0,N.unit)(t.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${o}-dot`]:{zIndex:t.indicatorZIndex,width:I,minWidth:I,height:I,background:t.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${(0,N.unit)(r)} ${t.badgeShadowColor}`},[`${o}-count, ${o}-dot, ${n}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${v}-spin`]:{animationName:we,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${o}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${o}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:h,height:h,verticalAlign:"middle",borderRadius:"50%"},[`${o}-status-success`]:{backgroundColor:t.colorSuccess},[`${o}-status-processing`]:{overflow:"visible",color:t.colorInfo,backgroundColor:t.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:r,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:Q,animationDuration:t.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${o}-status-default`]:{backgroundColor:t.colorTextPlaceholder},[`${o}-status-error`]:{backgroundColor:t.colorError},[`${o}-status-warning`]:{backgroundColor:t.colorWarning},[`${o}-status-text`]:{marginInlineStart:B,color:t.colorText,fontSize:t.fontSize}}}),s),{[`${o}-zoom-appear, ${o}-zoom-enter`]:{animationName:R,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`${o}-zoom-leave`]:{animationName:_,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack,animationFillMode:"both"},[`&${o}-not-a-wrapper`]:{[`${o}-zoom-appear, ${o}-zoom-enter`]:{animationName:Y,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`${o}-zoom-leave`]:{animationName:le,animationDuration:t.motionDurationSlow,animationTimingFunction:t.motionEaseOutBack},[`&:not(${o}-status)`]:{verticalAlign:"middle"},[`${n}-custom-component, ${o}-count`]:{transform:"none"},[`${n}-custom-component, ${n}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[n]:{overflow:"hidden",transition:`all ${t.motionDurationMid} ${t.motionEaseOutBack}`,[`${n}-only`]:{position:"relative",display:"inline-block",height:y,transition:`all ${t.motionDurationSlow} ${t.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${n}-only-unit`]:{height:y,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${n}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${o}-count, ${o}-dot, ${n}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},he=t=>{const{fontHeight:o,lineWidth:v,marginXS:l,colorBorderBg:r}=t,C=o,g=v,h=t.colorTextLightSolid,I=t.colorError,O=t.colorErrorHover;return(0,M.mergeToken)(t,{badgeFontHeight:C,badgeShadowSize:g,badgeTextColor:h,badgeColor:I,badgeColorHover:O,badgeShadowColor:r,badgeProcessingDuration:"1.2s",badgeRibbonOffset:l,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},Ce=t=>{const{fontSize:o,lineHeight:v,fontSizeSM:l,lineWidth:r}=t;return{indicatorZIndex:"auto",indicatorHeight:Math.round(o*v)-2*r,indicatorHeightSM:o,dotSize:l/2,textFontSize:l,textFontSizeSM:l,textFontWeight:"normal",statusSize:l/2}};var Ie=(0,H.I$)("Badge",t=>{const o=he(t);return se(o)},Ce);const De=t=>{const{antCls:o,badgeFontHeight:v,marginXS:l,badgeRibbonOffset:r,calc:C}=t,g=`${o}-ribbon`,h=`${o}-ribbon-wrapper`,I=(0,D.Z)(t,(O,y)=>{let{darkColor:b}=y;return{[`&${g}-color-${O}`]:{background:b,color:b}}});return{[h]:{position:"relative"},[g]:Object.assign(Object.assign(Object.assign(Object.assign({},(0,U.Wf)(t)),{position:"absolute",top:l,padding:`0 ${(0,N.unit)(t.paddingXS)}`,color:t.colorPrimary,lineHeight:(0,N.unit)(v),whiteSpace:"nowrap",backgroundColor:t.colorPrimary,borderRadius:t.borderRadiusSM,[`${g}-text`]:{color:t.badgeTextColor},[`${g}-corner`]:{position:"absolute",top:"100%",width:r,height:r,color:"currentcolor",border:`${(0,N.unit)(C(r).div(2).equal())} solid`,transform:t.badgeRibbonCornerTransform,transformOrigin:"top",filter:t.badgeRibbonCornerFilter}}),I),{[`&${g}-placement-end`]:{insetInlineEnd:C(r).mul(-1).equal(),borderEndEndRadius:0,[`${g}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${g}-placement-start`]:{insetInlineStart:C(r).mul(-1).equal(),borderEndStartRadius:0,[`${g}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}};var ie=(0,H.I$)(["Badge","Ribbon"],t=>{const o=he(t);return De(o)},Ce),Fe=t=>{const{className:o,prefixCls:v,style:l,color:r,children:C,text:g,placement:h="end",rootClassName:I}=t,{getPrefixCls:O,direction:y}=e.useContext(W.E_),b=O("ribbon",v),B=`${b}-wrapper`,[a,n,s]=ie(b,B),c=(0,re.o2)(r,!1),P=F()(b,`${b}-placement-${h}`,{[`${b}-rtl`]:y==="rtl",[`${b}-color-${r}`]:c},o),p={},w={};return r&&!c&&(p.background=r,w.color=r),a(e.createElement("div",{className:F()(B,I,n,s)},C,e.createElement("div",{className:F()(P,n),style:Object.assign(Object.assign({},p),l)},e.createElement("span",{className:`${b}-text`},g),e.createElement("div",{className:`${b}-corner`,style:w}))))};const ve=t=>{const{prefixCls:o,value:v,current:l,offset:r=0}=t;let C;return r&&(C={position:"absolute",top:`${r}00%`,left:0}),e.createElement("span",{style:C,className:F()(`${o}-only-unit`,{current:l})},v)};function _e(t,o,v){let l=t,r=0;for(;(l+10)%10!==o;)l+=v,r+=v;return r}var Ae=t=>{const{prefixCls:o,count:v,value:l}=t,r=Number(l),C=Math.abs(v),[g,h]=e.useState(r),[I,O]=e.useState(C),y=()=>{h(r),O(C)};e.useEffect(()=>{const a=setTimeout(y,1e3);return()=>clearTimeout(a)},[r]);let b,B;if(g===r||Number.isNaN(r)||Number.isNaN(g))b=[e.createElement(ve,Object.assign({},t,{key:r,current:!0}))],B={transition:"none"};else{b=[];const a=r+10,n=[];for(let p=r;p<=a;p+=1)n.push(p);const s=I<C?1:-1,c=n.findIndex(p=>p%10===g);b=(s<0?n.slice(0,c+1):n.slice(c)).map((p,w)=>{const A=p%10;return e.createElement(ve,Object.assign({},t,{key:p,value:A,offset:s<0?w-c:w,current:w===c}))}),B={transform:`translateY(${-_e(g,r,s)}00%)`}}return e.createElement("span",{className:`${o}-only`,style:B,onTransitionEnd:y},b)},Ke=function(t,o){var v={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&o.indexOf(l)<0&&(v[l]=t[l]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,l=Object.getOwnPropertySymbols(t);r<l.length;r++)o.indexOf(l[r])<0&&Object.prototype.propertyIsEnumerable.call(t,l[r])&&(v[l[r]]=t[l[r]]);return v},Te=e.forwardRef((t,o)=>{const{prefixCls:v,count:l,className:r,motionClassName:C,style:g,title:h,show:I,component:O="sup",children:y}=t,b=Ke(t,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:B}=e.useContext(W.E_),a=B("scroll-number",v),n=Object.assign(Object.assign({},b),{"data-show":I,style:g,className:F()(a,r,C),title:h});let s=l;if(l&&Number(l)%1===0){const c=String(l).split("");s=e.createElement("bdi",null,c.map((P,p)=>e.createElement(Ae,{prefixCls:a,count:Number(l),value:P,key:c.length-p})))}return g!=null&&g.borderColor&&(n.style=Object.assign(Object.assign({},g),{boxShadow:`0 0 0 1px ${g.borderColor} inset`})),y?(0,L.Tm)(y,c=>({className:F()(`${a}-custom-component`,c==null?void 0:c.className,C)})):e.createElement(O,Object.assign({},n,{ref:o}),s)}),Ze=function(t,o){var v={};for(var l in t)Object.prototype.hasOwnProperty.call(t,l)&&o.indexOf(l)<0&&(v[l]=t[l]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,l=Object.getOwnPropertySymbols(t);r<l.length;r++)o.indexOf(l[r])<0&&Object.prototype.propertyIsEnumerable.call(t,l[r])&&(v[l[r]]=t[l[r]]);return v};const Be=e.forwardRef((t,o)=>{var v,l,r,C,g;const{prefixCls:h,scrollNumberPrefixCls:I,children:O,status:y,text:b,color:B,count:a=null,overflowCount:n=99,dot:s=!1,size:c="default",title:P,offset:p,style:w,className:A,rootClassName:j,classNames:f,styles:E,showZero:x=!1}=t,J=Ze(t,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:ne,direction:ue,badge:m}=e.useContext(W.E_),$=ne("badge",h),[Ne,ce,Se]=Ie($),be=a>n?`${n}+`:a,X=be==="0"||be===0,ze=a===null||X&&!x,xe=(y!=null||B!=null)&&ze,z=s&&!X,k=z?"":be,ae=(0,e.useMemo)(()=>(k==null||k===""||X&&!x)&&!z,[k,X,x,z]),pe=(0,e.useRef)(a);ae||(pe.current=a);const q=pe.current,$e=(0,e.useRef)(k);ae||($e.current=k);const de=$e.current,T=(0,e.useRef)(z);ae||(T.current=z);const ee=(0,e.useMemo)(()=>{if(!p)return Object.assign(Object.assign({},m==null?void 0:m.style),w);const Z={marginTop:p[1]};return ue==="rtl"?Z.left=parseInt(p[0],10):Z.right=-parseInt(p[0],10),Object.assign(Object.assign(Object.assign({},Z),m==null?void 0:m.style),w)},[ue,p,w,m==null?void 0:m.style]),Ve=P!=null?P:typeof q=="string"||typeof q=="number"?q:void 0,Le=ae||!b?null:e.createElement("span",{className:`${$}-status-text`},b),We=!q||typeof q!="object"?void 0:(0,L.Tm)(q,Z=>({style:Object.assign(Object.assign({},ee),Z.style)})),me=(0,re.o2)(B,!1),Oe=F()(f==null?void 0:f.indicator,(v=m==null?void 0:m.classNames)===null||v===void 0?void 0:v.indicator,{[`${$}-status-dot`]:xe,[`${$}-status-${y}`]:!!y,[`${$}-color-${B}`]:me}),Ee={};B&&!me&&(Ee.color=B,Ee.background=B);const Pe=F()($,{[`${$}-status`]:xe,[`${$}-not-a-wrapper`]:!O,[`${$}-rtl`]:ue==="rtl"},A,j,m==null?void 0:m.className,(l=m==null?void 0:m.classNames)===null||l===void 0?void 0:l.root,f==null?void 0:f.root,ce,Se);if(!O&&xe){const Z=ee.color;return Ne(e.createElement("span",Object.assign({},J,{className:Pe,style:Object.assign(Object.assign(Object.assign({},E==null?void 0:E.root),(r=m==null?void 0:m.styles)===null||r===void 0?void 0:r.root),ee)}),e.createElement("span",{className:Oe,style:Object.assign(Object.assign(Object.assign({},E==null?void 0:E.indicator),(C=m==null?void 0:m.styles)===null||C===void 0?void 0:C.indicator),Ee)}),b&&e.createElement("span",{style:{color:Z},className:`${$}-status-text`},b)))}return Ne(e.createElement("span",Object.assign({ref:o},J,{className:Pe,style:Object.assign(Object.assign({},(g=m==null?void 0:m.styles)===null||g===void 0?void 0:g.root),E==null?void 0:E.root)}),O,e.createElement(ge.default,{visible:!ae,motionName:`${$}-zoom`,motionAppear:!1,motionDeadline:1e3},Z=>{let{className:Me}=Z;var i,d;const S=ne("scroll-number",I),V=T.current,te=F()(f==null?void 0:f.indicator,(i=m==null?void 0:m.classNames)===null||i===void 0?void 0:i.indicator,{[`${$}-dot`]:V,[`${$}-count`]:!V,[`${$}-count-sm`]:c==="small",[`${$}-multiple-words`]:!V&&de&&de.toString().length>1,[`${$}-status-${y}`]:!!y,[`${$}-color-${B}`]:me});let G=Object.assign(Object.assign(Object.assign({},E==null?void 0:E.indicator),(d=m==null?void 0:m.styles)===null||d===void 0?void 0:d.indicator),ee);return B&&!me&&(G=G||{},G.background=B),e.createElement(Te,{prefixCls:S,show:!ae,motionClassName:Me,className:te,count:de,title:Ve,style:G,key:"scrollNumber"},We)}),Le))});Be.Ribbon=Fe;var Re=Be}}]);
|