2 lines
18 KiB
JavaScript
2 lines
18 KiB
JavaScript
"use strict";(self.webpackChunkant_design_pro=self.webpackChunkant_design_pro||[]).push([[583],{96642:function(oe,w,r){var P=r(75782),T=r(58733),K=r(50959),u=r(72961),B=r(11527),j=["fieldProps","min","proFieldProps","max"],W=function(S,$){var G=S.fieldProps,o=S.min,O=S.proFieldProps,d=S.max,L=(0,T.Z)(S,j);return(0,B.jsx)(u.Z,(0,P.Z)({valueType:"digit",fieldProps:(0,P.Z)({min:o,max:d},G),ref:$,filedConfig:{defaultProps:{width:"100%"}},proFieldProps:O},L))},A=K.forwardRef(W);w.Z=A},59419:function(oe,w,r){var P=r(75782),T=r(58733),K=r(18518),u=r(50959),B=r(60061),j=r(72961),W=r(11527),A=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","showSearch","options"],z=["fieldProps","children","params","proFieldProps","mode","valueEnum","request","options"],S=u.forwardRef(function(d,L){var Y=d.fieldProps,ne=d.children,_=d.params,q=d.proFieldProps,R=d.mode,x=d.valueEnum,V=d.request,e=d.showSearch,c=d.options,l=(0,T.Z)(d,A),n=(0,u.useContext)(B.Z);return(0,W.jsx)(j.Z,(0,P.Z)((0,P.Z)({valueEnum:(0,K.h)(x),request:V,params:_,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,P.Z)({options:c,mode:R,showSearch:e,getPopupContainer:n.getPopupContainer},Y),ref:L,proFieldProps:q},l),{},{children:ne}))}),$=u.forwardRef(function(d,L){var Y=d.fieldProps,ne=d.children,_=d.params,q=d.proFieldProps,R=d.mode,x=d.valueEnum,V=d.request,e=d.options,c=(0,T.Z)(d,z),l=(0,P.Z)({options:e,mode:R||"multiple",labelInValue:!0,showSearch:!0,showArrow:!1,autoClearSearchValue:!0,optionLabelProp:"label"},Y),n=(0,u.useContext)(B.Z);return(0,W.jsx)(j.Z,(0,P.Z)((0,P.Z)({valueEnum:(0,K.h)(x),request:V,params:_,valueType:"select",filedConfig:{customLightMode:!0},fieldProps:(0,P.Z)({getPopupContainer:n.getPopupContainer},l),ref:L,proFieldProps:q},c),{},{children:ne}))}),G=S,o=$,O=G;O.SearchSelect=o,O.displayName="ProFormComponent",w.Z=O},40792:function(oe,w,r){var P=r(75782),T=r(58733),K=r(50959),u=r(72961),B=r(11527),j=["fieldProps","unCheckedChildren","checkedChildren","proFieldProps"],W=K.forwardRef(function(A,z){var S=A.fieldProps,$=A.unCheckedChildren,G=A.checkedChildren,o=A.proFieldProps,O=(0,T.Z)(A,j);return(0,B.jsx)(u.Z,(0,P.Z)({valueType:"switch",fieldProps:(0,P.Z)({unCheckedChildren:$,checkedChildren:G},S),ref:z,valuePropName:"checked",proFieldProps:o,filedConfig:{valuePropName:"checked",ignoreWidth:!0}},O))});w.Z=W},66732:function(oe,w,r){var P=r(75782),T=r(58733),K=r(50959),u=r(72961),B=r(11527),j=["fieldProps","proFieldProps"],W=["fieldProps","proFieldProps"],A="text",z=function(o){var O=o.fieldProps,d=o.proFieldProps,L=(0,T.Z)(o,j);return(0,B.jsx)(u.Z,(0,P.Z)({valueType:A,fieldProps:O,filedConfig:{valueType:A},proFieldProps:d},L))},S=function(o){var O=o.fieldProps,d=o.proFieldProps,L=(0,T.Z)(o,W);return(0,B.jsx)(u.Z,(0,P.Z)({valueType:"password",fieldProps:O,proFieldProps:d,filedConfig:{valueType:A}},L))},$=z;$.Password=S,$.displayName="ProFormComponent",w.Z=$},82730:function(oe,w,r){r.r(w),r.d(w,{default:function(){return le}});var P=r(25359),T=r.n(P),K=r(49811),u=r.n(K),B=r(54306),j=r.n(B),W=r(27693),z={randomUUID:typeof crypto!="undefined"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};let S;const $=new Uint8Array(16);function G(){if(!S&&(S=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!S))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return S($)}const o=[];for(let a=0;a<256;++a)o.push((a+256).toString(16).slice(1));function O(a,s=0){return(o[a[s+0]]+o[a[s+1]]+o[a[s+2]]+o[a[s+3]]+"-"+o[a[s+4]]+o[a[s+5]]+"-"+o[a[s+6]]+o[a[s+7]]+"-"+o[a[s+8]]+o[a[s+9]]+"-"+o[a[s+10]]+o[a[s+11]]+o[a[s+12]]+o[a[s+13]]+o[a[s+14]]+o[a[s+15]]).toLowerCase()}function d(a,s=0){const b=O(a,s);if(!validate(b))throw TypeError("Stringified UUID is invalid");return b}var L=null;function Y(a,s,b){if(z.randomUUID&&!s&&!a)return z.randomUUID();a=a||{};const F=a.random||(a.rng||G)();if(F[6]=F[6]&15|64,F[8]=F[8]&63|128,s){b=b||0;for(let p=0;p<16;++p)s[b+p]=F[p];return s}return O(F)}var ne=Y,_=r(12472),q=r(61643),R=r(81308),x=r(66732),V=r(59419),e=r(24176),c=r(96642),l=r(40792),n=r(86195),i=r(4050),M=r(833),h=r(21362),ee=r(68243),N=r(26572),H=r(79112),g=r(50959),t=r(11527),le=function(){var a=(0,g.useRef)(),s=(0,g.useState)(ie),b=j()(s,2),F=b[0],p=b[1],te=[{title:"\u7F16\u53F7",dataIndex:"index",key:"index"},{title:"\u540D\u79F0",dataIndex:"name",key:"name"},{title:"\u7C7B\u578B",dataIndex:"type",key:"type",render:function(Z,m){return(0,t.jsx)(i.Z,{color:"purple",children:Z})}},{title:"\u670D\u52A1\u5668",dataIndex:"server",key:"server"},{title:"\u7AEF\u53E3",dataIndex:"port",key:"port"},{title:"\u5907\u6CE8",dataIndex:"remark",key:"remark"},{title:"\u521B\u5EFA\u65E5\u671F",dataIndex:"created_at",key:"created_at",render:function(Z,m){return(0,t.jsx)("span",{children:new Date(Z*1e3).toLocaleDateString()})}},{title:"\u542F\u7528",dataIndex:"enable",key:"enable",renderFormItem:function(){return(0,t.jsx)(M.Z,{disabled:!0,defaultChecked:!1})},render:function(Z,m){return(0,t.jsx)(M.Z,{onChange:function(U){m.enable=U;var v={};v[m.id]=m,(0,n.request)("/api/storage",{method:"put",data:v}).then(function(C){var E,y,X=!1;for(var J in C.errors)X=!0,h.ZP.warning(C.errors[J],10);var f=!0;for(var re in C.messages)f=!0,h.ZP.info(C.messages[re],10);!X&&!f&&h.ZP.success("\u63D0\u4EA4\u6210\u529F\uFF01",1),(E=a.current)===null||E===void 0||(y=E.reloadAndRest)===null||y===void 0||y.call(E)})},defaultChecked:m==null?void 0:m.enable})}},{title:"\u64CD\u4F5C",valueType:"option",width:"10%",render:function(Z,m){return[(0,t.jsx)("a",{onClick:function(){return p(m)},children:"\u7F16\u8F91"},"more"),(0,t.jsx)("a",{onClick:function(){var U={};U[m.id]="",(0,n.request)("/api/storage",{method:"put",data:U}).then(function(v){var C,E,y=!1;for(var X in v.errors)y=!0,h.ZP.warning(v.errors[X],10);var J=!0;for(var f in v.messages)J=!0,h.ZP.info(v.messages[f],10);!y&&!J&&h.ZP.success("\u63D0\u4EA4\u6210\u529F\uFF01",1),(C=a.current)===null||C===void 0||(E=C.reloadAndRest)===null||E===void 0||E.call(C)})},children:"\u5220\u9664"},"delete")]}}];return(0,t.jsxs)(_._z,{content:"\u4EE3\u7406\u5217\u8868",children:[(0,t.jsx)(ee.Z,{style:{marginBottom:10},children:(0,t.jsx)(N.ZP,{type:"primary",onClick:function(){p(de)},icon:(0,t.jsx)(W.Z,{}),children:"\u65B0\u5EFA\u4E00\u884C"})}),(0,t.jsx)(q.Z,{search:!1,actionRef:a,rowKey:function(Z){return Z.id},columns:te,request:u()(T()().mark(function D(){var Z,m=arguments;return T()().wrap(function(U){for(;;)switch(U.prev=U.next){case 0:return Z=m.length>0&&m[0]!==void 0?m[0]:{},U.abrupt("return",(0,n.request)("/api/storage?keys=proxies",{params:Z}).then(function(v){var C=[],E=0;for(var y in v.data)E++,v.data[y].id=y,v.data[y].index=E,C.push(v.data[y]);return v.data=C,v}));case 2:case"end":return U.stop()}},D)}))}),F.id!="-1"&&(0,t.jsx)(Q,{open:F.id!="-1",data:F,onCancel:function(){return p(ie)},onFinish:function(){var D=u()(T()().mark(function Z(m){var k;return T()().wrap(function(v){for(;;)switch(v.prev=v.next){case 0:k={},F.id==""&&(F.id="proxies."+ne()),m.created_at=Math.floor(Date.now()/1e3),k[F.id]=m,(0,n.request)("/api/storage",{method:"put",data:k}).then(function(C){var E=!1;for(var y in C.errors)E=!0,h.ZP.warning(C.errors[y],4);var X=!1;for(var J in C.messages)X=!0,h.ZP.info(C.messages[J],4);if(console.log(E,X),!E&&!X){var f,re;h.ZP.success("\u63D0\u4EA4\u6210\u529F\uFF01",1),p(ie),(f=a.current)===null||f===void 0||(re=f.reloadAndRest)===null||re===void 0||re.call(f)}});case 5:case"end":return v.stop()}},Z)}));return function(Z){return D.apply(this,arguments)}}()})]})};function Q(a){var s,b,F,p,te,D,Z=(0,g.useState)({}),m=j()(Z,2),k=m[0],U=m[1],v=(0,g.useState)({}),C=j()(v,2),E=C[0],y=C[1],X=(0,g.useState)(a.data.type),J=j()(X,2),f=J[0],re=J[1],se=(0,g.useRef)(),fe=(0,g.useState)((s=(b=a.data)===null||b===void 0?void 0:b.plugin)!==null&&s!==void 0?s:""),he=j()(fe,2),Pe=he[0],Ee=he[1],xe=(0,g.useState)((F=a.data["plugin-opts"])===null||F===void 0?void 0:F.mode),ve=j()(xe,2),ge=ve[0],Ce=ve[1];return(0,g.useEffect)(function(){return(0,n.request)("/api/proxy/scripts").then(function(ue){ue.data&&U(ue.data)}),function(){}},[]),(0,t.jsx)(H.Z,{title:a.data.id==0?"\u521B\u5EFA":"\u7F16\u8F91",open:!0,onCancel:a.onCancel,onOk:function(){var I;a.onFinish(se==null||(I=se.current)===null||I===void 0?void 0:I.getFieldsValue())},children:(0,t.jsxs)(R.A,{formRef:se,onValuesChange:function(I){if("type"in I&&re(I.type),"plugin"in I){var ae,ce,Fe=(ae=I==null?void 0:I.plugin)!==null&&ae!==void 0?ae:"";Ee(Fe),(ce=se.current)===null||ce===void 0||ce.setFieldValue("plugin-opts",{}),Ce("")}if(console.log(I),"plugin-opts"in I&&"mode"in I["plugin-opts"]){var me,pe,ye=(me=(pe=I["plugin-opts"])===null||pe===void 0?void 0:pe.mode)!==null&&me!==void 0?me:"";Ce(ye)}},onFinish:a.onFinish,submitter:!1,children:[(0,t.jsxs)(R.A.Group,{title:"\u63CF\u8FF0",children:[(0,t.jsx)(x.Z,{tooltip:"\u7CFB\u7EDF\u552F\u4E00\u4E0D\u53EF\u66F4\u6539\uFF0C\u53EA\u80FD\u5220\u9664\u3002",name:"id",initialValue:a.data.id,label:"\u7FA4\u7EC4ID",hidden:!0}),(0,t.jsx)(x.Z,{name:"name",initialValue:a.data.name,label:"\u540D\u79F0",required:!0}),(0,t.jsx)(x.Z,{name:"remark",initialValue:a.data.remark,label:"\u5907\u6CE8",rules:[{message:"\u8BF7\u586B\u5199\u7FA4\u5907\u6CE8"}]})]}),(0,t.jsx)(R.A.Group,{children:(0,t.jsx)(V.Z,{tooltip:"\u5E73\u53F0\u63A5\u5165\u7CFB\u7EDF\u540E\u5C06\u81EA\u52A8\u51FA\u73B0\u5728\u5217\u8868\u4E2D\u3002",initialValue:a.data.type,valueEnum:{http:"Http",socks5:"Socks5",trojan:"Trojan",vmess:"Vmess",ss:"Shadowsocks",ssr:"ShadowSocksR",snell:"Snell"},width:"md",name:"type",label:"\u7C7B\u578B",required:!0})}),(0,t.jsxs)(e.UW,{title:"\u4EE3\u7406\u53C2\u6570",children:[(0,t.jsx)(x.Z,{name:"server",initialValue:a.data.server,label:"\u5730\u5740",required:!0}),(0,t.jsx)(c.Z,{name:"port",initialValue:a.data.port,label:"\u7AEF\u53E3",required:!0}),["http","socks5"].includes(f)&&(0,t.jsx)(x.Z,{name:"username",initialValue:a.data.username,label:"\u7528\u6237"}),["snell"].includes(f)&&(0,t.jsx)(x.Z,{name:"psk",initialValue:a.data.psk,label:"\u9884\u5171\u4EAB\u5BC6\u94A5"}),["http","ss","socks5","trojan"].includes(f)&&(0,t.jsx)(x.Z,{name:"password",initialValue:a.data.password,label:"\u5BC6\u7801"}),["vmess"].includes(f)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(x.Z,{name:"uuid",initialValue:a.data.uuid,label:"UUID"}),(0,t.jsx)(c.Z,{name:"alterId",initialValue:a.data.alterId,label:"AlterId"})]}),["vmess","trojan"].includes(f)&&(0,t.jsx)(l.Z,{name:"skip-cert-verify",initialValue:a.data["skip-cert-verify"],label:"\u8DF3\u8FC7\u8BC1\u4E66\u9A8C\u8BC1"}),["http","ss","vmess","socks5"].includes(f)&&(0,t.jsx)(l.Z,{name:"tls",initialValue:a.data.tls,label:"TLS"}),["vmess","trojan"].includes(f)&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(V.Z,{name:"network",initialValue:a.data.network,label:"\u4F20\u8F93\u65B9\u5F0F",width:"sm",valueEnum:Object.assign({ws:"WebSocket"},f=="vmess"?{h2:"HTTP/2"}:{http:"Http"})})}),["ss","vmess","ssr"].includes(f)&&(0,t.jsx)(V.Z,{name:"cipher",initialValue:a.data.tls?a.data.tls:"none",label:"\u52A0\u5BC6\u65B9\u5F0F",width:"md",valueEnum:f=="vmess"?{none:"none",auto:"Auto","chacha20-poly1305":"ChaCha20-Poly1305","aes-128-gcm":"AES-128-GCM"}:{"aes-128-gcm":"AES-128-GCM","aes-192-gcm":"AES-192-GCM","aes-256-gcm":"AES-256-GCM","aes-128-cfb":"AES-128-CFB","aes-192-cfb":"AES-192-CFB","aes-256-cfb":"AES-256-CFB","aes-128-ctr":"AES-128-CTR","aes-192-ctr":"AES-192-CTR","aes-256-ctr":"AES-256-CTR","rc4-md5":"RC4-MD5","chacha20-ietf":"ChaCha20-IETF",xchacha20:"XChaCha20","chacha20-ietf-poly1305":"ChaCha20-IETF-Poly1305","xchacha20-ietf-poly1305":"XChaCha20-IETF-Poly1305"}}),["ss"].includes(f)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(V.Z,{name:"plugin",initialValue:(p=a.data.plugin)!==null&&p!==void 0?p:"",label:"\u63D2\u4EF6",width:"md",valueEnum:{"":"none",obfs:"obfs","v2ray-plugin":"v2ray-plugin"}}),Pe!=""&&(0,t.jsxs)(e.UW,{title:"\u63D2\u4EF6\u53C2\u6570",children:[(0,t.jsx)(R.A.Group,{children:(0,t.jsx)(V.Z,{name:["plugin-opts","mode"],label:"\u6A21\u5F0F",width:"md",valueEnum:{"":"none",tls:"TLS",http:"Http",websocket:"Websocket"}})}),["websocket"].includes(ge)&&(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)(R.A.Group,{children:[(0,t.jsx)(l.Z,{label:"TLS",name:["plugin-opts","tls"]}),(0,t.jsx)(l.Z,{label:"\u8DF3\u8FC7\u8BC1\u4E66\u9A8C\u8BC1",name:["plugin-opts","skip-cert-verify"]})]}),(0,t.jsxs)(R.A.Group,{children:[(0,t.jsx)(l.Z,{label:"WebSocket",name:["plugin-opts","wss"]}),(0,t.jsx)(x.Z,{label:"\u4E3B\u673A(Host)",name:["plugin-opts","host"]}),(0,t.jsx)(x.Z,{label:"\u8DEF\u5F84(Path)",name:["plugin-opts","path"]}),(0,t.jsx)(l.Z,{label:"\u591A\u8DEF\u590D\u7528(Mux)",name:["plugin-opts","mux"]})]}),(0,t.jsx)(R.A.Group,{children:(0,t.jsx)(x.Z,{label:"\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934(Headers)",name:["plugin-opts","headers","custom"]})})]}),["http","tls"].includes(ge)&&(0,t.jsx)(t.Fragment,{children:(0,t.jsx)(R.A.Group,{children:(0,t.jsx)(x.Z,{label:"\u4E3B\u673A(Host)",name:["plugin-opts","host"]})})})]})]})]}),(0,t.jsxs)(e.UW,{title:"\u652F\u63F4\u65B9\u5F0F",children:[(0,t.jsx)(V.Z,{initialValue:(te=a.data.rules)!==null&&te!==void 0?te:[],tooltip:"\u8F93\u5165\uFF0C\u56DE\u8F66\u6216\u70B9\u51FB\u9009\u62E9\u4EE5\u6DFB\u52A0\u6570\u636E",name:"rules",label:"\u57DF\u540D&IP",fieldProps:{mode:"multiple",showSearch:!0,onSearch:function(I){(0,n.request)("/api/proxy/rules?keyword="+I).then(function(ae){ae&&ae.data&&y(ae.data)})}},width:"lg",valueEnum:E}),(0,t.jsx)(V.Z,{initialValue:(D=a.data.plugins)!==null&&D!==void 0?D:[],name:"plugins",label:"\u811A\u672C",width:"lg",fieldProps:{mode:"multiple"},valueEnum:k})]})]})},a.data.chat_id)}var ie={id:"-1",index:0,type:"",server:"",port:0,name:""},de={id:"",index:0,type:"",server:"",port:0,name:"",enable:!0}},4050:function(oe,w,r){r.d(w,{Z:function(){return V}});var P=r(96157),T=r(84875),K=r.n(T),u=r(50959),B=r(85548),j=r(78862),W=r(70458);function A(e){return typeof e!="string"?e:e.charAt(0).toUpperCase()+e.slice(1)}var z=r(49272),S=r(42498),$=r(97624),G=r(74074);const o=(e,c,l)=>{const n=A(l);return{[`${e.componentCls}-${c}`]:{color:e[`color${l}`],background:e[`color${n}Bg`],borderColor:e[`color${n}Border`]}}},O=e=>(0,S.Z)(e,(c,l)=>{let{textColor:n,lightBorderColor:i,lightColor:M,darkColor:h}=l;return{[`${e.componentCls}-${c}`]:{color:n,background:M,borderColor:i,"&-inverse":{color:e.colorTextLightSolid,background:h,borderColor:h},[`&${e.componentCls}-borderless`]:{borderColor:"transparent"}}}}),d=e=>{const{paddingXXS:c,lineWidth:l,tagPaddingHorizontal:n,componentCls:i}=e,M=n-l,h=c-l;return{[i]:Object.assign(Object.assign({},(0,z.Wf)(e)),{display:"inline-block",height:"auto",marginInlineEnd:e.marginXS,paddingInline:M,fontSize:e.tagFontSize,lineHeight:`${e.tagLineHeight}px`,whiteSpace:"nowrap",background:e.tagDefaultBg,border:`${e.lineWidth}px ${e.lineType} ${e.colorBorder}`,borderRadius:e.borderRadiusSM,opacity:1,transition:`all ${e.motionDurationMid}`,textAlign:"start",[`&${i}-rtl`]:{direction:"rtl"},"&, a, a:hover":{color:e.tagDefaultColor},[`${i}-close-icon`]:{marginInlineStart:h,color:e.colorTextDescription,fontSize:e.tagIconSize,cursor:"pointer",transition:`all ${e.motionDurationMid}`,"&:hover":{color:e.colorTextHeading}},[`&${i}-has-color`]:{borderColor:"transparent",[`&, a, a:hover, ${e.iconCls}-close, ${e.iconCls}-close:hover`]:{color:e.colorTextLightSolid}},["&-checkable"]:{backgroundColor:"transparent",borderColor:"transparent",cursor:"pointer",[`&:not(${i}-checkable-checked):hover`]:{color:e.colorPrimary,backgroundColor:e.colorFillSecondary},"&:active, &-checked":{color:e.colorTextLightSolid},"&-checked":{backgroundColor:e.colorPrimary,"&:hover":{backgroundColor:e.colorPrimaryHover}},"&:active":{backgroundColor:e.colorPrimaryActive}},["&-hidden"]:{display:"none"},[`> ${e.iconCls} + span, > span + ${e.iconCls}`]:{marginInlineStart:M}}),[`${i}-borderless`]:{borderColor:"transparent",background:e.tagBorderlessBg}}};var L=(0,$.Z)("Tag",e=>{const{fontSize:c,lineHeight:l,lineWidth:n,fontSizeIcon:i}=e,M=Math.round(c*l),h=e.fontSizeSM,ee=M-n*2,N=e.colorFillQuaternary,H=e.colorText,g=(0,G.TS)(e,{tagFontSize:h,tagLineHeight:ee,tagDefaultBg:N,tagDefaultColor:H,tagIconSize:i-2*n,tagPaddingHorizontal:8,tagBorderlessBg:e.colorFillTertiary});return[d(g),O(g),o(g,"success","Success"),o(g,"processing","Info"),o(g,"error","Error"),o(g,"warning","Warning")]}),Y=function(e,c){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&c.indexOf(n)<0&&(l[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)c.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(l[n[i]]=e[n[i]]);return l},_=e=>{const{prefixCls:c,className:l,checked:n,onChange:i,onClick:M}=e,h=Y(e,["prefixCls","className","checked","onChange","onClick"]),{getPrefixCls:ee}=u.useContext(W.E_),N=Q=>{i==null||i(!n),M==null||M(Q)},H=ee("tag",c),[g,t]=L(H),le=K()(H,{[`${H}-checkable`]:!0,[`${H}-checkable-checked`]:n},l,t);return g(u.createElement("span",Object.assign({},h,{className:le,onClick:N})))},q=function(e,c){var l={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&c.indexOf(n)<0&&(l[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)c.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(l[n[i]]=e[n[i]]);return l};const R=(e,c)=>{const{prefixCls:l,className:n,rootClassName:i,style:M,children:h,icon:ee,color:N,onClose:H,closeIcon:g,closable:t=!1,bordered:le=!0}=e,Q=q(e,["prefixCls","className","rootClassName","style","children","icon","color","onClose","closeIcon","closable","bordered"]),{getPrefixCls:ie,direction:de}=u.useContext(W.E_),[a,s]=u.useState(!0);u.useEffect(()=>{"visible"in Q&&s(Q.visible)},[Q.visible]);const b=(0,B.o2)(N)||(0,B.yT)(N),F=Object.assign({backgroundColor:N&&!b?N:void 0},M),p=ie("tag",l),[te,D]=L(p),Z=K()(p,{[`${p}-${N}`]:b,[`${p}-has-color`]:N&&!b,[`${p}-hidden`]:!a,[`${p}-rtl`]:de==="rtl",[`${p}-borderless`]:!le},n,i,D),m=y=>{y.stopPropagation(),H==null||H(y),!y.defaultPrevented&&s(!1)},k=u.useMemo(()=>t?g?u.createElement("span",{className:`${p}-close-icon`,onClick:m},g):u.createElement(P.Z,{className:`${p}-close-icon`,onClick:m}):null,[t,g,p,m]),U=typeof Q.onClick=="function"||h&&h.type==="a",v=ee||null,C=v?u.createElement(u.Fragment,null,v,u.createElement("span",null,h)):h,E=u.createElement("span",Object.assign({},Q,{ref:c,className:Z,style:F}),C,k);return te(U?u.createElement(j.Z,null,E):E)},x=u.forwardRef(R);x.CheckableTag=_;var V=x}}]);
|